Title: SCALEABLE INPUT GRADIENT REGULARIZATION FOR ADVERSARIAL ROBUSTNESS

Abstract: In this work we revisit gradient regularization for adversarial robustness with some new ingredients. First, we derive new per-image theoretical robustness bounds based on local gradient information. These bounds strongly motivate input gradient regularization. Second, we implement a scaleable version of input gradient regularization which avoids double backpropagation: adversarially robust ImageNet models are trained in 33 hours on four consumer grade GPUs. Finally, we show experimentally and through theoretical certification that input gradient regularization is competitive with adversarial training. Moreover we demonstrate that gradient regularization does not lead to gradient obfuscation or gradient masking. * However, (1) is a difficult and costly non-smooth, non-convex optimization problem. Instead, Goodfellow et al. (2014) proposed solving a surrogate problem: find a perturbation v of a clean image x that maximizes the loss, subject to the condition that the perturbation be inside a norm-ball

1. INTRODUCTION:

Neural networks are vulnerable to adversarial attacks. These are small (imperceptible to the human eye) perturbations of an image which cause a network to misclassify the image (Biggio et al., 2013; Szegedy et al., 2013; Goodfellow et al., 2014) . The threat posed by adversarial attacks must be addressed before these methods can be deployed in error-sensitive and security-based applications (Potember, 2017) .

Building adversarially robust models is an optimization problem with two objectives: (i) maintain test accuracy on clean unperturbed images, and (ii) be robust to large adversarial perturbations. The present state-of-the-art method for adversarial defence, adversarial training (Szegedy et al., 2013; Goodfellow et al., 2014; Tramèr et al., 2018; Madry et al., 2017; Miyato et al., 2018) , in which models are trained on perturbed images, offers robustness at the expense of test accuracy (Tsipras et al., 2018) . Up until the recent method of Shafahi et al. (2019b) , multi-step adversarial training had taken many days to train on large datasets (Kannan et al., 2018; Xie et al., 2018) .

Assessing the empirical effectiveness of an adversarial defence requires careful testing with multiple attacks (Goodfellow et al., 2018) . Furthermore, existing defences are vulnerable to new, stronger attacks: Carlini & Wagner (2017a) and Athalye et al. (2018) advocate designing specialized attacks to circumvent prior defences, while Uesato et al. (2018) warn against using weak attacks to evaluate robustness. This has led the community to develop theoretical tools to certify adversarial robustness. Several certification approaches have been proposed: through linear programming (Wong & Kolter, 2018; Wong et al., 2018) or mixed-integer linear-programming (Xiao et al., 2018) ; semi-definite relaxation (Raghunathan et al., 2018b; a) ; randomized smoothing (Li et al., 2018; Cohen et al., 2019) ; or estimates of the local Lipschitz constant (Hein & Andriushchenko, 2017; Weng et al., 2018; Tsuzuku et al., 2018) . The latter two approaches have scaled well to ImageNet-1k. Notably, randomized smoothing with adversarial training has shown great promise for rigorous certification against attacks in the 2 norm (Salman et al., 2019) , although it is not yet clear how randomized smoothing may be adapted to other norms.

In practice, certifiably robust networks often perform worse than adversarially trained models, which in general lack theoretical guarantees. In this article, we work towards bridging the gap between theoretically robust networks and empirically effective training methods. Our approach relies on minimizing a loss regularized against large input gradients E (x,y)∼P L(f (x; w), y) + λ 2 ∇ x L(f (x; w), y)

2

where • * is dual to the one measuring adversarial attacks (for example the 1 norm for attacks measured in the ∞ norm). Heuristically, making loss gradients small should make gradient based attacks more challenging. Drucker & LeCun (1991) implemented gradient regularization using 'double backpropagation', which has been shown to improve model generalization (Novak et al., 2018) . It has been used to improve the stability of GANs (Roth et al., 2017; Nagarajan & Kolter, 2017) and to promote learning robust features with contractive auto-encoders (Rifai et al., 2011) . While it has been proposed for adversarial attacks robustness (Lyu et al., 2015; Ross & Doshi-Velez, 2018; Roth et al., 2018; Ororbia II et al., 2017; Hein & Andriushchenko, 2017; Jakubovitz & Giryes, 2018; Simon-Gabriel et al., 2018) , experimental evidence has been mixed, in particular, input gradient regularization has so far not been competitive with multi-step adversarial training.

In particular, the heuristic that "gradients should be small" has motivated several other approaches to adversarial robustness which were later shown to suffer from problems of gradient obfuscation (Athalye et al., 2018) . This is the phenomenon whereby gradients are in some sense hidden or minimized, so that gradient-based attacks fail to produce adversarial examples. Due to this phenomenon, the community now greets adversarial robustness methods based on notions of small gradients with a healthy dose of skepticism. It is therefore necessary to demonstrate new methods do not suffer from gradient obfuscation (Carlini et al., 2019) , both empirically and theoretically: empirically, by attacking models with gradient-free methods or non-local attacks; and theoretically using tight certification techniques.

Our main contributions in this work are the following. First, we motivate using input gradient regularization of the loss by deriving new theoretical robustness bounds. These bounds use the gradient of the loss, and an estimate of the error of the linear approximation of the loss, called the modulus of continuity. These theoretical bounds show that small loss gradient and a small modulus of continuity are sufficient conditions for adversarial robustness. Second, we empirically show that input gradient regularization is competitive with standard adversarial training (Madry et al., 2017) , at a fraction of the training time. We verify that training with gradient regularization does not lead to gradient obfuscation, by attacking our trained models with gradient-free methods, and through certification bounds. Finally, we scale input gradient regularization to ImageNet-1k (Deng et al., 2009) by using finite differences to estimate the gradient regularization term, rather than double backpropagation (which does not scale). This allows us to train adversarially robust networks on ImageNet-1k with only 50% more training time than that of standard (non robust) training.

2. ADVERSARIAL ROBUSTNESS BOUNDS FROM THE LOSS:



2.1. BACKGROUND:

Much effort has been directed towards determining theoretical lower bounds on the minimum sized perturbation necessary to perturb an image so that it is misclassified by a model. One promising approach, proposed by Hein & Andriushchenko (2017) and Weng et al. (2018) , and which has scaled well to ImageNet-1k, is to use the Lipschitz constant of the model. In this section, we build upon these ideas: we propose using the Lipschitz constant of a suitable loss, designed to measure classification errors. Additionally, we propose a tighter lower bound which uses the local gradient information of the loss, and an error bound on the first-order approximation of the loss.

Our notation is as follows. Write y = f (x; w) for a model which takes input vectors x to label probabilities, with parameters w. Let L(y 1 , y 2 ) be the loss and write (x) := L(f (x, w), y), for the loss of a model f .

Finding an adversarial perturbation is interpreted as a global minimization problem: find the closest image to a clean image, in some specified norm, that is is also misclassified by the model

min v v subject to f (x + v) misclassified (1)

of radius δ around the clean image. The surrogate problem is written

max v (x + v) -c(v); where c(v) = 0 if v ≤ δ ∞ otherwise (2)

The hard constraint c(v) forces perturbations to be inside the norm-ball centred at the clean image x. Ideally, solutions of this surrogate problem (2) will closely align with solutions of the original more difficult global minimization problem. However, the hard constraint in (2) forces a particular scale: it may miss attacks which would succeed with only a slightly bigger norm. Additionally, the maximization problem (2) does not force misclassification, it only asks that the loss be increased.

The advantage of ( 2) is that it may be solved with gradient-based methods: present best-practice is to use variants of projected gradient descent (PGD), such as the iterative fast-signed gradient method (Kurakin et al., 2016; Madry et al., 2017) when attacks are measured in the ∞ norm. However, gradient-based methods are not always effective: on non-smooth networks, such as those built of ReLU activation functions, a small gradient does not guarantee that the loss remains small locally. That is, ReLU networks may increase rapidly with a very small perturbation, even when local gradients are small. This deficiency was identified in (Papernot et al., 2016) and expanded on by Athalye et al. (2018) . In this scenario, PGD methods will fail to locate these worst-case perturbations, and give a false impression of robustness. Carlini & Wagner (2017b) avoid this scenario by incorporating decision boundary information into the loss; others solve (1) directly (Brendel et al., 2018; Chen & Jordan, 2019; Finlay et al., 2019) using gradient-free methods or non-local attacks.

2.2. DERIVATION OF THEORETICAL LOWER BOUNDS:

This leads us to consider the following compromise between ( 1) and ( 2). Consider the following modification of the Carlini & Wagner (2017b) 

loss (x) = max i =c f i (x) -f c (x)

, where c is the index of the correct label, and f i (x) is the model output for the i-th label. This loss has the appealing property the sign of the loss determines if the classification is correct. Adversarial attacks are found by minimizing

EQUATION

The constant 0 determines when classification is incorrect; for the modified Carlini-Wagner loss, 0 = 0. Problem (3) is closer to the true problem (1), and will always find an adversarial image. We use (3) to derive theoretical lower bounds on the minimum size perturbation necessary to misclassify an image. Suppose the loss is L-Lipschitz with respect to model input. Then we have the estimate

(x + v) ≤ (x) + L v (4)

Now suppose v is adversarial, with minimum adversarial loss (x + v) = 0 . Then rearranging (4), we obtain the lower bound v ≥ 1 L ( 0 -(x)) . Unfortunately, the Lipschitz constant is a global quantity, and ignores local gradient information; see for example Huster et al. (2018) . Thus this bound can be quite poor, even when networks have small Lipschitz constant. A tighter theoretical bound may instead be achieved by using (i) the local gradient, and (ii) a bound on the error of a first order approximation of the loss. At image x and perturbations up to size ε, the error of a first order approximation of the loss is bounded above by the modulus of continuity

EQUATION

Intuitively, this measures the maximum amount the gradient can change over perturbations of size ε.

Note that the quantity is defined for any norm. Using this quantity, for perturbations of size ε we have the estimate

EQUATION

As before, assume v is adversarial, with minimum adversarial loss (x + v) = 0 . Rearranging (6), we obtain the lower bound v ≥

1 ∇ (x) * ( 0 -(x) -ω(ε)).

Remark 2.1. If the model and the loss are twice continuously differentiable, the modulus of continuity can be derived from the maximum curvature. However ω(ε) is defined even when the model and the loss are not twice differentiable.

We have proved the following. Proposition 2.2. Suppose the loss (x) is Lipschitz continuous with respect to model input x, with Lipschitz constant L. Let 0 be such that if (x) < 0 , the model is always correct. Then a lower bound on the minimum magnitude of perturbation v necessary to adversarially perturb an image x is

v ≥ max{ 0 -(x), 0} L (L-bound)

Suppose in addition the modulus of continuity ω(ε) is defined as in (5). Then the minimum adversarial distance is bounded below by ε provided the following inequality holds

0 -(x) -ω(ε) ∇ (x) * ≥ ε (ω-bound)

Proposition 2.2 motivates the need for input gradient regularization. The Lipschitz constant L is the maximum gradient norm of the loss over all inputs. Therefore (L-bound) says that a regularization term encouraging small gradients (and so reducing L) should increase the minimum adversarial distance. This aligns with (Hein & Andriushchenko, 2017) , who proposed the cross-Lipschitz regularizer, penalizing networks with large Jacobians in order to shrink the Lipschitz constant of the network.

However, this is not enough: the gap 0 -(x) must be large as well. Together (L-bound) explains one form of 'gradient masking' (Papernot et al., 2017) . Shrinking the magnitude of gradients while also closing the gap 0 -(x) effectively does nothing to improve adversarial robustness. For example, in one form of defense distillation, the magnitude of the model Jacobian is reduced by increasing the temperature of the final softmax layer of the network. However, this has the detrimental side-effect of sending the model output to

( 1 N , • • • , 1 N ),

where N is the number of classes, which effectively shrinks the loss gap to zero. An alternative form sends the temperature of the final softmax layer to zero, which pushes the model output to a one-hot vector; however this sends the Lipschitz constant to ∞. In either form, the lower bound provided by Proposition 2.2 approaches zero.

Moreover, (ω-bound) states that even supposing the loss's gradient is small, and the gap 0 -(x) is large, there may still be adversarially vulnerable images nearby due to errors in the first order approximation. Taken together, Proposition 2.2 provides three sufficient conditions for training robust networks: (i) the loss gap 0 -(x) should be large; (ii) the gradients of the loss should be small; and (iii) the error of the first-order approximation, measured by ω(ε), should also be small. The first point will be satisfied by default when the loss is minimized. The second point will be satisfied by training with a loss regularized to penalize large input gradients. In Section 4 we provide experimental evidence that the third point is satisfied with input gradient regularization implemented using finite differences.

These robustness bounds are most similar in spirit to Weng et al. (2018) , who derive bounds using an estimate of the local Lipschitz constant of the model by sampling the model gradient norm locally. Indeed, in practice, L and ω(ε) can only be estimated and are not exactly computable on all but the simplest networks. We estimate L and ω(ε) using the Extreme Value Theory approach outlined by Weng et al. (2018) . To estimate L, we sample the maximum gradient norm over batches from the data distribution, and estimate an upper bound by fitting a generalized extreme value (GEV) distribution to these samples through maximum likelihood estimation (MLE). Similarly, we estimate ω(ε) by sampling the maximum of (5) over batches of the data distribution and v ≤ ε, and then fitting a GEV using MLE. The values of L and ω(ε) used in our bounds are estimated from the fitted GEV distribution with threshold p = 0.001. Because these quantities are estimates, in practice the theoretical bounds of Proposition 2.2 can only be implemented approximately, providing a heuristic measure of adversarial robustness. Notably however, these bounds are valid in any norm with corresponding dual. Furthemore, upon estimating L and ω(ε), we emphasize that these quantities only require one gradient evaluation and one model evaluation to provide an estimate on the robustness of an image.

To date, the theoretical bounds in the Euclidean norm that show the greatest promise have arguably been those obtained through randomized smoothing (Li et al., 2018; Cohen et al., 2019; Salman et al., 2019) . In randomized smoothing, models are trained with inputs perturbed through Gaussian noise; robust prediction is achieved by averaging model predictions over inputs again perturbed with Gaussian noise, which requires many tens of thousands of model evaluations. It is well known that training with Gaussian noise is equivalent to squared 2 norm gradient regularization (Bishop, 1995) . Therefore we expect that models trained with squared norm gradient regularization, should have similar adversarial robustness as those trained through randomized smoothing.

3 SQUARED NORM GRADIENT REGULARIZATION Proposition 2.2 provides strong motivation for input gradient regularization as a method for promoting adversarial robustness. However, it does not tell us what form the gradient regularization term should take. In this section, we show how norm squared gradient regularization arises from a quadratic cost.

In adversarial training, solutions of (2) are used to generate images on which the network is trained. In effect, adversarial training seeks a solution of the minimax problem

EQUATION

)

where P is the distribution of images. This is a robust optimization problem (Wald, 1945; Rousseeuw & Leroy, 1987) . The cost function c(v) penalizes perturbed images from being too far from the original. When the cost function is the hard constraint from (2), perturbations must be inside a norm ball of radius δ. This leads to adversarial training with PGD (Kurakin et al., 2016; Madry et al., 2017) . However this forces a particular scale: it is possible that no images are adversarial within radius δ, but that there are adversarial images with only a slightly larger distance. Instead of using a hard constraint, we can relax the cost function to be the quadratic cost c(v) = 1 2δ v 2 . The quadratic cost allows attacks to be of any size, but penalizes larger attacks more than smaller attacks. With a quadratic cost, there is less of a danger that a local attack will be overlooked. Solving (7) directly is expensive: on ImageNet-1k, both Kannan et al. ( 2018) and Xie et al. (2018) required large-scale distributed training with many dozens or hundreds of GPUs, and over a week of training time. Recent research suggests this hurdle may be surmounted (Shafahi et al., 2019b; Zhang et al., 2019) . However we take the view that (7) may be bounded above, and solved approximately. When the loss is smooth, the modulus of continuity is ω(ε) = ε 2 C, where C is the maximum positive Hessian norm over all inputs. By using the bound (6) with the quadratic loss c(v) = 1 2δ v 2 , the optimal value of max

v (x + v) -c(v) is δ 2(1-δC) ∇ x (x) 2

* , provided δ < 1 C . This gives the following proposition. Proposition 3.1. Suppose both the model and the loss are twice continuously differentiable. Suppose attacks are measured with quadratic cost 1 2δ v 2 . Then the optimal value of (7) is bounded above by

EQUATION

)

where λ = δ 1-δC . That is, we may bound the solution of the adversarial training problem (7) by solving the gradient regularization problem (8), when the cost function is quadratic. It is not necessary to know δ or compute C; they are absorbed into λ.

Input gradient regularization using the squared 2 norm was proposed for adversarial robustness in Ross & Doshi-Velez (2018). It was expanded by Roth et al. (2018) to use a Mahalanobis norm with the correlation matrix of adversarial attacks.

When c(v) is the hard constraint forcing attacks inside the δ norm ball and C is small, supposing the curvature term is negligible, we can estimate the maximum in (7) by (x) + 1 δ ∇ x (x) * , using the dual norm for the gradient. This is norm gradient regularization (not squared), and has been used for adversarial robustness on both CIFAR-10 (Simon-Gabriel et al., 2018) , and MNIST (Seck et al., 2019) .

3.1. FINITE DIFFERENCE IMPLEMENTATION:

Norm squared input gradient regularization has long been used as a regularizer in neural networks: Drucker & LeCun (1991) implemented gradient regularization with 'double backpropagation' to compute the derivatives of the penalty term with respect to the model parameters w, which is needed to update the parameters during training. Double backpropagation involves two passes of automatic differentiation: one pass to compute the gradient of the loss with respect to the inputs x, and another pass on the output of the first to compute the gradient of the penalty term with respect to model parameters w. In neural networks, double backpropagation is the standard technique for computing the parameter gradient of a regularized loss. However, it is not currently scaleable to large neural networks. Instead we approximate the gradient regularization term with finite differences. Proposition 3.2 (Finite difference approximation of squared 2 gradient norm). Let d be the normalized input gradient direction: d = ∇ x (x)/ ∇ x (x) 2 when the gradient is nonzero, and set d = 0 otherwise. Let h be the finite difference step size. Then, the squared 2 gradient norm is approximated by

∇ x (x) 2 2 ≈ (x + hd) -(x) h 2 (9)

The vector d is normalized to ensure the accuracy of the finite difference approximation: as can be seen by ( 6), the error of the finite difference is bounded by ω(h)/h. Without normalizing the gradient, this term can be large, which is undesirable in general. However, the finite difference error term does play a role in promoting adversarial robustness. Proposition 2.2 shows it is necessary for ω(ε) to be small. By using finite differences, minimizing (8) also implicitly minimizes ω(h), due to the error term. Therefore the finite difference approximation provide an indirect means for controlling the modulus of continuity ω(ε) necessary for adversarial robustness, through the finite difference error. This would otherwise be unavailable with an exact method computing the gradient norm.

The finite differences approximation (9) allows the computation of the gradient of the regularizer (with respect to model parameters w) to be done with only two regular passes of backpropagation, rather than with double backpropagation. On the first, the input gradient direction d is calculated. The second computes the gradient with respect to model parameters by performing backpropagation on the right-hand-side of (9). Double backpropagation is avoided by detaching d from the computational graph after the first pass. In practice, for large networks, we have found that the finite difference approximation of the regularization term is considerably more efficient than using double backpropagation. On networks sized for MNIST, we have observed roughly a 10% speed improvement by using finite differences; on CIFAR-10 networks finite differences are roughly 50% faster than double backpropagation.

Our proposed training algorithm, with squared Euclidean input gradient regularization, is presented in Algorithm 1 of Appendix A. Other gradient penalty terms can be approximated as well. For example, when defending against attacks measured in the ∞ norm, the squared 1 norm penalty can approximated by setting instead d = sign(∇ x (x))/ √ N when the gradient is nonzero. 

4. EXPERIMENTAL RESULTS:

In this section we provide empirical evidence that input gradient regularization is an effective tool for promoting adversarial robustness. We attack networks with gradient-free attacks, and demonstrate gradient regularization does not lead to gradient obfuscation. Moreover our results show that gradient regularization is comparable to adversarial training, both experimentally and through rigorous certification.

We train networks on the CIFAR-10 dataset (Krizhevsky & Hinton, 2009) , and ImageNet-1k (Deng et al., 2009) . On the CIFAR dataset we use the ResNeXt-34 (2x32) architecture; on ImageNet-1k we use a ResNet-50 (He et al., 2016) . The CIFAR networks were trained with standard data augmentation and learning rate schedules on a single GeForce GTI 1080 Ti. On ImageNet-1k, we modified the training code of Shaw et al.'s [44] submission to the DAWNBench competition (Coleman et al., 2018) and train with four GPUs. Training code and trained model weights will be made available.

We train an undefended network as a baseline to compare various types of regularization. On CIFAR-10, networks are trained with squared 2 and squared 1 gradient norm regularization. The former is appropriate for defending against attacks measured in 2 ; the latter for attacks measured in ∞ .

We set the regularization strength to be either λ = 0.1 or 1; and set finite difference discretization h = 0.01 unless otherwise specified. (For a study of the effect of finite difference size h, refer to Table 4 .) We compare each network with the most common form of adversarial training, where models are trained using the hyperparameters in Madry et al. (2017) (7-steps of FGSM, projected onto an ∞ ball of either radius 8 255 or 2 255 ). On CIFAR-10 we also compare against the 'For Free' implementation of Shafahi et al. (2019a) , using the same hyperparameters. On ImageNet-1k we only train adversarially robust models with squared 2 regularization.

On each dataset, we attack 1000 randomly selected images. We perturb each image with attacks in both the Euclidean and ∞ norms, with a suite of current state-of-the-art attacks: the Carlini-Wagner attack (Carlini & Wagner, 2017b) ; the Boundary attack (Brendel et al., 2018) (a gradient-free attack); the LogBarrier attack (Finlay et al., 2019) (a non-local attack); and PGD (Madry et al., 2017) (in both the ∞ norm or the 2 norm). The former three attacks have all been shown effective at evading gradient masking and gradient obfuscation. PGD excels at finding images close to the original when gradients are not close to zero. We report our results using the best adversarial distance on a per image basis, in each norm. On the majority of test images, PGD finds the closest adversarial image. However on a significant portion of inputs, the closest adversarial image is found by one of the three other attacks. Adversarial robustness results for networks attacked in the ∞ norm are presented in Table 1 . These results are for networks built of standard ReLUs. Table 1 and Figure 1 demonstrate a clear trade-off between test accuracy and adversarial robustness, as the strength of the regularization is increased.

On CIFAR-10, the undefended network achieves test error of 4.36%, but is not robust to attacks even at ∞ distance 2 255 . However with a strong regularization parameter (λ = 1), test error increases to 9.02% on clean images. At both adversarial distance ε = 2 255 and 8 255 adversarial training achieves slightly better robustness (by about 5% percent) than our best models, yet comes at over double the training time.

In Table 1 we also report heuristic measures of robustness using (ω-bound). We skip reporting bounds using (L-bound), for this bound returned vacuous results (an upper bound of 100% test error at all distances). On some test images the heuristic bound fails; this is due to the inherent difficulty of estimating ω(ε) accurately.

In Table 2 we report results on models trained for attacks in the 2 norm. On CIFAR-10, the most robust model is trained with regularization strength λ = 1, and outperforms even the adversarially trained model. On ImageNet-1k, we see the same pattern: the model trained with λ = 1 offers the best protection against adversarial attacks. Due to the long training time, we were not able to train ImageNet-1k with standard multi-step adversarial training. In Table 2 we also report our heuristic measure of bounds on the minimum distance required to adversarially perturb, using the Carlini-Wagner loss.1 Further ω-bound results on CIFAR-10 are presented in Table 6 Both (L-bound) and (ω-bound) provide reasonable estimates of the minimum adversarial distance, though (ω-bound) is closer to empirical results. These heuristic measures of robustness are further corroborated by Table 3 of Appendix B, which shows that both adversarial training and gradient regularization significantly decrease model gradients and the modulus of continuity ω(ε). We also use randomized smoothing, a tight and exact bound on robustness, to verify our heuristic measures, see Table 5 .

5. CONCLUSION:

We have provided motivation for training adversarially robust networks through input gradient regularization, by bounding the minimum adversarial distance with gradient statistics of the loss. We have shown that gradient regularization is scaleable to ImageNet-1k, and provides adversarial robustness competitive with adversarial training, both theoretically and empirically. Moreover we have demonstrated that gradient regularization does not lead to gradient obfuscation. Networks may be trained using gradient regularization in fractions of the training time of standard adversarial training.

We gave theoretical per-image bounds on the minimum adversarial distance, for non-smooth models, using the Lipschitz constant of the loss, and its modulus of continuity, which measures the error of a first order approximation of the loss. These bounds were empirically compared against state-of-the-art attacks and other theoretical bounds. Although in practice these bounds give heuristic measures of robustness, they are valid in any norm, and provide per-image robustness measures at the cost of only one model evaluation and one gradient evaluation.

A TRAINING ALGORITHM:

Algorithm 1 Training with squared 2 -norm input gradient regularization, using finite differences 1: Input: Initial model parameters w 0 Hyperparameters: Regularization strength λ; batch size m; finite difference discretization h 2: while w t not converged do 3: sample minibatch of data (x (i) , y (i) ) i=1,...,m from empirical distribution P 4:

for i = 0 to m do 5: i) , y (i) ; w t ) 6:

g (i) = ∇ x (x (

d (i) = g (i) g (i) 2

if g (i) = 0 0 otherwise for 1 -norm use normalized signed gradient 7:

detach d (i) from computational graph 8:

z (i) = x (i) + hd (i) 9:

end for (z (i) , y (i) ; w) -(x (i) , y (i) ; w) 

:

This loss can be modified for Top-5 mis-classification as well.

Figures and Tables:

Figure1: Adversarial attacks on the CIFAR-10 dataset, on networks built with standard ReLUs. Regularized networks attacked in 2 are trained with squared 2 norm gradient regularization; networks attacked in ∞ are trained with squared 1 norm regularization.

Figure 2: Adversarial attacks on ImageNet-1k with the ResNet-50 architecture. Top5 error reported.

Adversarial robustness statistics, measured in the ∞ norm. Top1 error is reported on CIFAR-10; Top5 error on ImageNet-1k. On CIFAR-10 gradient regularization is reported using either double backpropagation (DBP) or finite differences (FD).

Table content: <table><tr><td/><td>% clean</td><td colspan="4">ω-bound % error at empirical % error at</td><td>training</td></tr><tr><td/><td>error</td><td>ε = 2 255</td><td>ε = 8 255</td><td>ε = 2 255</td><td>ε = 8 255</td><td>time (hours)</td></tr><tr><td>CIFAR-10</td><td/><td/><td/><td/><td/><td/></tr><tr><td>Undefended</td><td>4.36</td><td>100</td><td>100</td><td>70.82</td><td>98.94</td><td>2.06</td></tr><tr><td>∞ 7-step AT, ε = 2/255</td><td>6.17</td><td>16.02</td><td>100</td><td>16.80</td><td>53.90</td><td>10.82</td></tr><tr><td>∞ 7-step AT, ε = 8/255</td><td>16.33</td><td>26.59</td><td>58.32</td><td>22.86</td><td>46.02</td><td>12.10</td></tr><tr><td>∞ 'For Free' AT, m = 2</td><td>6.82</td><td>20.08</td><td>100</td><td>22.61</td><td>63.95</td><td>1.91</td></tr><tr><td>∞ 'For Free' AT, m = 8</td><td>19.94</td><td>38.52</td><td>100</td><td>34.09</td><td>61.48</td><td>2.04</td></tr><tr><td>squared 1 norm (DBP), λ = 0.1</td><td>6.50</td><td>25.69</td><td>100</td><td>41.63</td><td>97.31</td><td>9.85</td></tr><tr><td>squared 1 norm (DBP), λ = 1</td><td>12.62</td><td>33.05</td><td>99.43</td><td>33.95</td><td>80.37</td><td>9.89</td></tr><tr><td>squared 1 norm (FD), λ = 0.1</td><td>6.45</td><td>19.40</td><td>100</td><td>24.92</td><td>70.41</td><td>5.22</td></tr><tr><td>squared 1 norm (FD), λ = 1, h = 0.1</td><td>9.02</td><td>20.66</td><td>55.30</td><td>18.47</td><td>58.69</td><td>5.15</td></tr><tr><td>ImageNet-1k</td><td/><td/><td/><td/><td/><td/></tr><tr><td>Undefended</td><td>6.94</td><td>100</td><td>100</td><td>90.21</td><td>98.94</td><td>20.30</td></tr><tr><td>squared 2 norm, λ = 0.1</td><td>7.66</td><td>74.7</td><td>100</td><td>70.56</td><td>97.53</td><td>32.60</td></tr><tr><td>squared 2 norm, λ = 1</td><td>10.26</td><td>63.7</td><td>100</td><td>52.79</td><td>95.93</td><td>33.87</td></tr></table>

Adversarial robustness statistics, measured in 2 . Top1 error is reported on CIFAR-10; Top5 error on ImageNet-1k. On CIFAR-10 gradient regularization is reported using either both double backpropagation (DBP) or finite differences (FD).

Table content: <table><tr><td/><td>% clean</td><td colspan="3">mean adversarial distance</td><td>training</td></tr><tr><td/><td>error</td><td/><td/><td/><td>time</td></tr><tr><td/><td/><td colspan="3">L-bound ω-bound empirical</td><td>(hours)</td></tr><tr><td>CIFAR-10</td><td/><td/><td/><td/><td/></tr><tr><td>Undefended</td><td>4.36</td><td>0.006</td><td>0</td><td>0.12</td><td>2.06</td></tr><tr><td>∞ 7-step AT, ε = 2/255</td><td>6.17</td><td>0.05</td><td>0.36</td><td>0.66</td><td>10.82</td></tr><tr><td>∞ 7-step AT, ε = 8/255</td><td>16.33</td><td>0.18</td><td>0.55</td><td>0.74</td><td>12.10</td></tr><tr><td>∞ 'For Free' AT, m = 2, λ = 0.1</td><td>6.82</td><td>0.06</td><td>0.35</td><td>0.53</td><td>1.91</td></tr><tr><td>∞ 'For Free' AT, m = 8, λ = 1</td><td>19.94</td><td>0.03</td><td>0.29</td><td>0.49</td><td>2.04</td></tr><tr><td>squared 2 norm (DBP), λ = 0.1</td><td>5.91</td><td>0.006</td><td>0</td><td>0.13</td><td>9.60</td></tr><tr><td>squared 2 norm (DBP), λ = 1</td><td>4.35</td><td>0.01</td><td>0</td><td>0.15</td><td>9.74</td></tr><tr><td>squared 2 norm (FD), λ = 0.1</td><td>8.03</td><td>0.14</td><td>0.34</td><td>0.63</td><td>5.18</td></tr><tr><td>squared 2 norm (FD), λ = 1</td><td>20.31</td><td>0.30</td><td>0.50</td><td>0.81</td><td>5.08</td></tr><tr><td>ImageNet-1k</td><td/><td/><td/><td/><td/></tr><tr><td>Undefended</td><td colspan="2">6.94 3.63e-2</td><td>0.5</td><td>0.55</td><td>20.30</td></tr><tr><td>squared 2 norm, λ = 0.1</td><td>7.66</td><td>0.13</td><td>0.96</td><td>1.14</td><td>32.60</td></tr><tr><td>squared 2 norm, λ = 1</td><td>10.26</td><td>0.26</td><td>1.23</td><td>1.75</td><td>33.87</td></tr></table>

Regularity statistics on selected models, measured in the 2 norm. Statistics computed using modified loss max i =c f i (x) -f c (x).

Table content: <table><tr><td/><td colspan="2">∇ (x)</td><td colspan="2">ω(0.5) ω(1.0)</td></tr><tr><td/><td>mean</td><td>max</td><td/><td/></tr><tr><td>CIFAR-10</td><td/><td/><td/><td/></tr><tr><td>Undefended</td><td colspan="2">3.05 122.34</td><td>1.80</td><td>3.13</td></tr><tr><td>∞ 7-step AT, ε = 2/255</td><td>0.63</td><td>11.96</td><td>0.08</td><td>0.32</td></tr><tr><td>∞ 7-step AT, ε = 8/255</td><td>0.40</td><td>2.52</td><td>0.02</td><td>0.06</td></tr><tr><td>∞ 'For Free', m = 2</td><td>0.75</td><td>10.82</td><td>0.13</td><td>0.35</td></tr><tr><td>∞ 'For Free', m = 8</td><td>0.93</td><td>16.08</td><td>0.11</td><td>0.31</td></tr><tr><td>squared 2 norm (DBP), λ = 0.1</td><td colspan="2">3.38 107.13</td><td>1.60</td><td>1.40</td></tr><tr><td>squared 2 norm (DBP), λ = 1</td><td>2.75</td><td>56.09</td><td>1.31</td><td>2.30</td></tr><tr><td>squared 2 norm (FD), λ = 0.1</td><td>0.58</td><td>4.43</td><td>0.08</td><td>0.50</td></tr><tr><td>squared 2 norm (FD), λ = 1</td><td>0.35</td><td>1.33</td><td>0.02</td><td>0.05</td></tr><tr><td>ImageNet-1k</td><td/><td/><td/><td/></tr><tr><td>Undefended</td><td>1.12</td><td colspan="3">17.51 1.7e-2 6.7e-2</td></tr><tr><td>squared 2 norm, λ = 0.1</td><td>0.46</td><td colspan="3">4.85 5.5e-3 2.2e-2</td></tr><tr><td>squared 2 norm, λ = 1</td><td>0.27</td><td colspan="3">2.12 3.4e-3 2.1e-2</td></tr></table>

Study of empirical robustness in the ∞ norm as a function of finite difference size h. All models here trained with squared 1 norm gradient penalty, with regularizer strength λ = 1.

Table content: <table><tr><td/><td>% clean</td><td colspan="2">empirical % error at</td></tr><tr><td/><td>error</td><td>ε = 2 255</td><td>ε = 8 255</td></tr><tr><td>Undefended</td><td>4.36</td><td>70.82</td><td>98.94</td></tr><tr><td>double backpropagation</td><td>12.62</td><td>33.95</td><td>80.37</td></tr><tr><td>h = 1e-4</td><td>39.68</td><td>50.95</td><td>84.20</td></tr><tr><td>h = 1e-3</td><td>25.84</td><td>38.81</td><td>78.65</td></tr><tr><td>h = 1e-2</td><td>14.47</td><td>26.54</td><td>69.91</td></tr><tr><td>h = 0.1</td><td>9.02</td><td>18.47</td><td>58.69</td></tr><tr><td>h = 1</td><td>5.51</td><td>45.93</td><td>83.86</td></tr></table>

Certified test error (%) at various 2 radii on CIFAR-10, using the randomized smoothing certification technique ofCohen et al. (2019).

Table content: <table><tr><td/><td colspan="6">0.25 0.5 0.75 1.0 1.25 1.5 1.75 2.0</td></tr><tr><td>Undefended</td><td>90 92</td><td colspan="5">96 99 100 100 100 100</td></tr><tr><td>squared 2 norm, λ = 1</td><td>47 63</td><td>80 90</td><td>90</td><td>90</td><td>90</td><td>90</td></tr><tr><td>Cohen et al. (2019)</td><td>40 57</td><td>68 77</td><td>83</td><td>86</td><td>88</td><td>90</td></tr><tr><td>Salman et al. (2019)</td><td>26 43</td><td>52 62</td><td>67</td><td>71</td><td>75</td><td>81</td></tr></table>

Certified test error (%) at various 2 radii on CIFAR-10, using (ω-bound).

Table content: <table><tr><td/><td colspan="5">0.25 0.5 0.75 1.0 1.25 1.5</td></tr><tr><td>Undefended</td><td colspan="5">100 100 100 100 100 100</td></tr><tr><td>∞ 7-step AT, ε = 2/255</td><td>19</td><td colspan="4">91 100 100 100 100</td></tr><tr><td>∞ 7-step AT, ε = 8/255</td><td>31</td><td>47</td><td>61</td><td colspan="2">77 100 100</td></tr><tr><td>squared 2 norm (FD), λ = 0.1</td><td>22</td><td colspan="4">99 100 100 100 100</td></tr><tr><td>squared 2 norm (FD), λ = 1</td><td>33</td><td>50</td><td>65</td><td>80</td><td>98 100</td></tr></table>

Peer review (iclr2020):
This paper revisits the method of gradient regularization, which regularizes the loss function by adding the norm of the input gradient, aiming to improve adversarial robustness. The standard gradient regularization is implemented with *double backpropagation*, which could be time consuming for large networks. This paper proposes to replace the exact gradient by its discretization via finite difference, which is computationally more efficient comparing to *double backpropagation*. Experiments are conducted to show the effectiveness of the method in reducing training time. Overall, the paper is well written but the contribution is very limited and I find some of the experimental comparisons unfair. Thus I do not support publication of the paper. Here are my detailed arguments. 1) The gradient regularization is not novel The main contribution of the paper is to use the finite difference in the gradient regularization in order to improve the training time. The method of gradient regularization is not new, hence the contribution is only the computational effectiveness. This would be fine if one could improve the state-of-the-art method*s training time by a lot, but according to the experiments, the performance of adversarial robustness is far from the adversarial training, for example in CIFAR10 epsilon=8/255, there is a 12% drop, which is a huge gap. 2) Unfair comparison in the experiments In table 2, the performance of robustness with respect to the l2 norm is presented. However, in the baseline method of adversarial training, the used attack is in l_{infty} norm. This is unfair since l2 norm and l_{infty} norm has very different characteristics. Moreover, the gradient regularization uses l2 norm instead of l_{1} as in table 1, which makes the comparison unfair. Furthermore, the finite difference improves the training time versus the standard gradient regularization, but it does not imply that the performance will be the same. In particular, it would be better to include the performance of standard gradient regularization in table 1 and 2 as well. 3) Comment on the motivation/theory The theory part is fairly straightforward and it clearly shows that the norm of gradient (w.r.t input) itself is not sufficient to guarantee robustness. As a evidence, even under standard training (for example on MNIST), the gradient norm could be very small, in order of 10^{-4} but still have adversarial example with very small perturbation. Thus, what we also need is to control how fast this gradient changes (Lipschitz constant or w-bound). However, the gradient norm regularization does not take into account how gradient changes. It is claimed that the finite discretization implicitly reduces how the gradient changes, however, I am not convinced by the argument since as long as we take h to be small, it is still a very local measure. An interesting question would be how h affect the performance and it is not discussed in the paper.