B ATCH N ORMALIZATION IS A C AUSE OF A DVERSARIAL V ULNERABILITY
Anonymous authors
Paper under double-blind review
A BSTRACT
Batch normalization (BN) is often used in an attempt to stabilize and accelerate training in deep neural networks.
In many cases it indeed decreases the number of parameter updates required to achieve low training error.
However, it also reduces robustness to small adversarial input perturbations and common corruptions by double-digit percentages, as we show on ﬁve standard datasets.
Furthermore, we ﬁnd that substituting weight decay for BN is sufﬁcient to nullify a relationship between adversarial vulnerability and the input dimension.
A recent mean-ﬁeld analysis found that BN induces gradient explosion when used on multiple layers, but this cannot fully explain the vulnerability we observe, given that it occurs already for a single BN layer.
We argue that the actual cause is the tilting of the decision boundary with respect to the nearest-centroid classiﬁer along input dimensions of low variance.
As a result, the constant introduced for numerical stability in the BN step acts as an important hyperparameter that can be tuned to recover some robustness at the cost of standard test accuracy.
We explain this mechanism explicitly on a linear “toy model” and show in experiments that it still holds for nonlinear “real-world” models.
I NTRODUCTION
BN is a standard component of modern deep neural networks, and tends to make the training process less sensitive to the choice of hyperparameters in many cases (Ioffe & Szegedy, 2015).
While ease of training is desirable for model developers, an important concern among stakeholders is that of model robustness during deployment to plausible, previously unseen inputs.
The adversarial examples phenomenon has exposed unstable predictions across state-of-the-art models (Szegedy et al., 2014).
This has led to a variety of methods that aim to improve robustness, but doing so effectively remains a challenge (Athalye et al., 2018;
Schott et al., 2019; Hendrycks & Dietterich, 2019; Jacobsen et al., 2019a).
We believe that a prerequisite to developing methods that increase robustness is an understanding of factors that reduce it.
Approaches for improving robustness often begin with existing neural network architectures—that use
BN—and patch them against speciﬁc attacks, e.g., through inclusion of adversarial examples during training (Szegedy et al., 2014; Goodfellow et al., 2015; Kurakin et al., 2017; Madry et al., 2018).
An implicit assumption is that BN itself does not reduce robustness, however, recent initialization-time analyses have shown that it causes exploding gradients, and increased sensitivity to input perturbations, particularly as the depth of feedforward networks increase (Yang et al., 2019; Labatie, 2019).
In this work, we consider the impact of BN in practical scenarios in terms of robustness to common corruptions (Hendrycks & Dietterich, 2019) and adversarial examples (Szegedy et al., 2014), ﬁnding that BN induced sensitivity remains a concern even in cases where its use appears benign on the basis of clean test accuracy, and when only one BN layer is used.
The frequently made observation that adversarial vulnerability can scale with the input dimension (Goodfellow et al., 2015; Gilmer et al., 2018; Simon-Gabriel et al., 2019) highlights the importance of identifying regularizers as more than merely a way to improve test accuracy.
In particular, BN was a confounding factor in Simon-Gabriel et al.
(2019), making the results of their initialization-time analysis hold after training.
By adding (cid:96) 2 regularization and removing BN, we show that there is no inherent relationship between adversarial vulnerability and the input dimension.
B ATCH N ORMALIZATION
We brieﬂy review how BN modiﬁes the hidden layers’ pre-activations h of a neural network.
We use the notation of Yang et al.
(2019), where α is an index for units in a layer l , and i for a mini-batch of
B samples from the dataset; N l denotes the number of units in layer l , W l is the matrix of weights and b l is the vector of biases that parametrize layer l .
The batch mean is deﬁned as µ α = 1 B (cid:80) i h αi , and the variance is σ 2 α = 1 B (cid:80) i ( h αi − µ α ) 2 .
In the BN procedure, the mean µ α is subtracted from the pre-activation of each unit h lαi (consistent with Ioffe & Szegedy (2015)), the result is divided by the standard deviation σ α plus a small constant c to prevent division by zero, then scaled and shifted by the learned parameters γ α and β α , respectively.
This is described in equation 1, where a per-unit nonlinearity φ , e.g., ReLU, is applied after the normalization.
[Equation]
This procedure introduces complications, however.
Consider two mini-batches that differ by only a single example: due to the induced batch-wise nonlinearity, they will have different representations of all examples.
These differences are ampliﬁed by stacking BN layers, and were shown to cause exploding gradients at initialization (Yang et al., 2019).
Conversely, normalization of intermediate representations for two different training inputs impairs the ability to distinguish deﬁnite examples that ought to be classiﬁed with a large prediction margin (as judged by an “oracle”), from more ambiguous instances.
The last layer of a discriminative neural network, in particular, is typically a linear decoding of class label-homogeneous clusters, and thus makes use of information contained in the mean and variance at this stage for classiﬁcation.
In light of these observations, we begin in our analysis by adding a single BN layer to models trained by gradient descent (GD).
This is the most favorable scenario according to the analysis of Yang et al.
(2019), where more layers and a smaller mini-batch size exacerbate the exploding gradients.
B OUNDARY T ILTING
Tanay & Grifﬁn (2016) relate the adversarial vulnerability of linear classiﬁers to the tilting angle θ of the decision boundary w.r.t.
the nearest-centroid classiﬁer.
Following their setup, we examine how BN affects this angle in a simple linear model, and then show that increasing model complexity cannot “undo” this vulnerability.
[Figure]
[Equation]
[Figure]
[Equation]
[Figure]
Consider the binary classiﬁcation task of identifying two different types of input x subject to
Gaussian noise with a linear classiﬁer w (cid:62) x
+ b .
This can be modeled by the class-conditional distribution p ( x | y = j ) =
N ( ν j , Σ) with label y ∼ Ber(0 .
The Bayes-optimal solution to this problem is given by the weight vector w = Σ − 1 (cid:0) ν 0 − ν 1 (cid:1) , and b = 12 ( ν 1 + ν 0 ) (cid:62) Σ − 1 ( ν 1 − ν 0 )+log p ( y =0) p ( y =1) , where p ( y ) denotes the marginal probability for the label y
(see e.g. (Jordan, 1995)), while the nearest-centroid classiﬁer is deﬁned by w ∗ =
ν 0 − ν 1 .
We analyze the effect of batch-normalizing the input to the classiﬁer for this problem (i.e., h αi = x αi ), ﬁrst in the simplest setting where γ α = 1 ,β α = 0 ∀ α .
We select the class distribution means ν j to be symmetric around zero, so that the batch mean computed by BN is µ α = 0 ∀ α .
The batch-normalized linear classiﬁer is thus deﬁned as: f ( x )=
w (cid:62) x + b √ σ 2 + c .
By construction of our synthetic dataset, the variance of the batch can be deduced from the data parameters: σ 2 α =( ν jα ) 2 +Σ αα .
The tilting angle θ of the batch-normalized
[Table]
decision boundary w.r.t.
the one given by w ∗ (note that the boundary is perpendicular to w ) is approximately equal to the angle between the datasets before and after normalization.
To compute θ , we divide the weights w by √ σ 2 + c
[Table]
and then normalize w/ (cid:107) w (cid:107) 2 , such that θ =cos − 1 ( w (cid:62) w ∗ ) .
From this analysis it follows that the order of magnitude of c is important relative to the data variance: if c>σ 2 α then the effective weight value w α is reduced, and if c<σ 2 α and σ 2 α is small, then w α increases greatly, causing boundary tilting along direction α .
We depict simulations of the toy model in Figure 1.
We use constant learning rate GD, which is known to converge to the max-margin solution—equivalent to the nearest centroid classiﬁer in this case–for linear models on separable data (Soudry et al., 2018).
Batch-normalized GD (BNGD) converges for arbitrary learning rates for linear models (Cai et al., 2019); we use a value of 0.1 for 1000 epochs.
Next, we train linear models on the MNIST 3 vs. 7 dataset with 5000 training samples (drawn uniformly per class) using a learning rate of 0.1 for 50 epochs.
We compute the angle θ w.r.t.
the nearest-centroid classiﬁer, which is obtained by subtracting the “average 3” from the “average 7” of the full training set.
Although this may seem like a crude reference point, the nearest-centroid classiﬁer is much more robust than the linear model of Goodfellow et al.
, achieving 40% accuracy for the fast gradient sign method (FGSM) at (cid:15) = 1 / 4 vs. ≈ 0% .
Results consistent with the boundary tilting theory are shown in Table 1, which not only shows that BN causes tilting, but that this is unaffected by the parameters γ and β .
Post-normalization, there is no signal to γ and β about the variances of the original dataset.
This is consistent with other works that observe γ and β do not inﬂuence the studied effect (van Laarhoven, 2017; Zhang et al., 2019a; Yang et al., 2019)
Increasing the numerical stability constant c increases robustness in terms of absolute test accuracy for additive white Gaussian noise (AWGN) on MNIST and CIFAR-10 datasets by 33% and 41% respectively (at the cost of standard accuracy).
We defer the details of this experiment to Appendix A.
This loss of accuracy, and the effect of c are consistent with Labatie (2019), which remarks that under
BN, directions of high signal variance are dampened, while directions of low signal variance are ampliﬁed.
This preferential exploration of low signal directions reduces the signal-to-noise ratio and increases sensitivity w.r.t.
the input .
Increasing c reduces the sensitivity along “low signal directions”.
E MPIRICAL R ESULTS
For the main practical results, we evaluate the robustness (quantiﬁed as the drop in test accuracy under input perturbations) of convolutional networks, with and without BN.
Although the use of BN affects the range of suitable training hyperparameters, standard procedures from the literature were used that were originally tuned for batch-normalized models.
The datasets – MNIST, SVHN, CIFAR-10, and
ImageNet – were normalized to zero mean and unit variance.
As a white-box adversarial attack we use projected gradient descent (PGD), (cid:96) ∞ - and (cid:96) 2 -norm variants, for its simplicity and ability to degrade performance with little perceptible change to the input (Madry deep et al., 2018).
We run PGD for 20–40 iterations, with (cid:15) ∞ =0 .
03 and a step size of (cid:15) ∞ / 10 for SVHN,
CIFAR-10, and (cid:15) ∞
= 0 .
01 for ImageNet.
For PGD- (cid:96) 2 we set (cid:15) 2 = (cid:15) ∞
√ d , where d is the input dimension.
We report the test accuracy for additive Gaussian noise of zero mean and variance 1 / 4 , denoted as “Noise”, as well as the CIFAR-10-C common corruption benchmark (Hendrycks &
Dietterich, 2019).
We found these methods were sufﬁcient to demonstrate a considerable disparity in robustness due to BN, but this is not intended as a formal security evaluation.
All uncertainties are the standard error of the mean.
[Table]
For SVHN, models were trained by stochastic gradient descent (SGD) with momentum 0.9 forepochs, with a batch size ofand initial learning rate of 0 . 01 , which was dropped by a factor of ten at epochs 25 and 40.
Trials were repeated over ﬁve random seeds.
We show the results of this experiment in Table 2, ﬁnding that BN increased clean test accuracy by 1 . 86 ± 0 .
05% , and reduced test accuracy for additive noise by 5 . 5 ± 0 .
6% , for PGD- (cid:96) ∞ by 17 ± 1% , and for PGD- (cid:96) 2 by 20 ± 1% .
and CIFAR-10.1 ( v6 ) in several variants: clean, noisy, and PGD perturbed.
[Table]
For the CIFAR-10 experiments we trained models with a similar procedure as for SVHN, but with random 32 × 32 crops using four-pixel padding, and horizontal ﬂips.
We evaluate two families of contemporary models: one without skip connections (VGG) and a WideResNets (WRN) using “Fixup” initialization (Zhang et al., 2019b) to reduce the use of BN.
In the ﬁrst experiment, a basic comparison with and without BN shown in Table 3, we evaluate the best model in terms of test accuracy after training for 150 epochs with a ﬁxed learning rate of 0 . 01 .
In this case, inclusion of BN for VGG reduces the clean generalization gap (difference between training and test accuracy) by 1 . 1 ± 0 .
For additive noise, test accuracy drops by 6 ± 1% , and for PGD perturbations by 17 .
3 ± 0 .
7% and 5 .
9 ± 0 .
4% for (cid:96) ∞ and (cid:96) 2 variants, respectively.
Very similar results are obtained on a new test set, CIFAR-10.1 v6 (Recht et al., 2018): BN slightly improves the clean test accuracy (by 2 . 0 ± 0 .
, but leads to a considerable drop in test accuracy of 6 ± 1% for the case with additive noise, and 15 ± 1% and 3 .
4 ± 0 .
6% respectively for (cid:96) ∞ and (cid:96) 2 PGD variants (PGD absolute values omitted for CIFAR-10.1 in Table
It has been suggested that one of the beneﬁts of BN is that it facilitates training with a larger learning rate (Ioffe & Szegedy, 2015; Bjorck et al., 2018).
We test this from a robustness perspective in an experiment summarized in Table 4, where the initial learning rate is increased to 0 .
1 when BN is used.
We prolong training for up to 350 epochs, and drop the learning rate by a factor of ten at epochand 250 in both cases, which increases clean test accuracy relative to results in Table 3.
The deepest model that is trainable using standard “He” initialization (He et al., 2015) without BN is VGG13.
None of the deeper batch-normalized models recover the robustness of the most shallow, or same-depth unnormalized equivalents, nor does the higher learning rate with BN improve robustness compared to baselines trained for the same number of epochs.
Additional results for deeper models on SVHN and
CIFAR-10 can be found in Appendix D.
[Table] [Table]
[Table] [Table]
We also evaluate robustness on the common corruption benchmark comprising 19 types of real-world effects that can be grouped into four categories: “noise”, “blur”, “weather”, and “digital” corruptions (Hendrycks & Dietterich, 2019).
Each corruption has ﬁve “severity” or intensity levels.
We report the mean error on the corrupted test set (mCE) by averaging over all intensity levels and corruptions (Hendrycks & Dietterich, 2019).
We summarize the results for two VGG variants and a WideResNet on CIFAR-10-C, trained from scratch on the default training set for three and ﬁve random seeds, respectively.
Accuracy for the noise corruptions, which caused the largest difference in accuracy with BN, are outlined in Table 5.
The key takeaway is: For all models tested, the batch-normalized variant has a higher error rate for all corruptions of the “noise” category, at every intensity level .
[Table]
VGG (cid:51) 91 .68 .24 .
AlexNet (cid:55)
ResNet (cid:51)
BagNet- (cid:51) 70 .1 .7 .
BagNet- (cid:51) 81 .
BagNet- (cid:51)
Averaging over all 19 corruptions we ﬁnd that
BN increases mCE by 1 . 9 ± 0 .
9% for VGG8, 2 . 0 ± 0 .
3% forVGG13, and 1 .
6 ± 0 .
4% forWRN.
There is a large disparity in accuracy when modulating BN for different corruption categories, therefore we examine these in more detail in Appendix F.
Interestingly, some corruptions that led to a positive gap for VGG8 show a negative gap for the WRN, i.e., BN improved accuracy to:
Contrast— 4 . 9 ± 1 .
1% , Snow— 2 . 8 ± 0 .
Spatter— 2 . 3 ± 0 .
These are the same corruptions for which VGG13 loses, or does not improve its robustness when BN is removed.
We suspect accuracy for these corruptions correlates with standard test accuracy, which is highest for the WRN.
Visually, these corruptions appear to preserve texture information.
Conversely, noise is applied in a spatially global way that disproportionately degrades these textures, emphasizing shapes and edges.
It is now known that modern CNNs trained on standard image datasets
[Figure]
Clean
[Figure]
Noise Acc.
BIM Acc.
[Figure]
B a t c h n o r m
U nn o r m a li ze d 0 .0 .0 .0 .0 .0 .0 .0 .0 . have a to rely heavily in addition to shape and cues for nition (Geirhos et al., 2019) pre
BagNets)
ImageNet with an architecture that spatial information between patches and is thus considered to make extensive use of patterns for classiﬁcation (Brendel & Bethge, 2019) patch sizes { are reduced to just and 14 .
62% for
AWGN, respectively.
Compared with Table 6, where all models obtain over 40% , these ﬁgures suggest that robustness to Gaussian noise is a good proxy for the use of texture for ImageNet classiﬁcation.
Our results support the hypothesis that BN may be exacerbating this tendency to leverage superﬁcial texture-like information for classiﬁcation of image data.
Next, we evaluate the robustness of pre-trained ImageNet models from the torchvision.models repository, which conveniently provides models with and without BN.
4 Results are shown in Table 6, where BN improves top-5 accuracy on noise in some cases, but consistently reduces it by 8 .
54% to 11 .
% (absolute) for PGD.
The trends are the same for top-1 accuracy, only the absolute values are smaller; the degradation varies from 2 .
38% to 4 .
Given the discrepancy between noise and PGD for ImageNet, we include a black-box transfer analysis in the Appendix D.2 that is consistent with the white-box analysis.
Finally, we explore the role of batch size and depth in Figure 2.
We ﬁnd that BN limits the maximum trainable depth, which increases with the batch size, but quickly plateaus as predicted by Theorem 3. of (Yang et al., 2019).
Robustness decreases with the batch size for depths that maintain a reasonable test accuracy, at around 25 or fewer layers.
This tension between clean accuracy and robustness as a function of the batch size is not observed in unnormalized networks.
V ULNERABILITY AND I NPUT D IMENSION
A recent work Simon-Gabriel et al.
(2019) analyzes adversarial vulnerability of batch-normalized networks at initialization time and conjectures based on a scaling analysis that, under the commonly used He et al.
(2015) initialization scheme, adversarial vulnerability scales as ∼ √ d .
[Table]
They also show in experiments that independence between vulnerability and the input dimension can be approximately recovered through adversarial training by projected gradient descent (PGD) (Madry et al., 2018) with a modest trade-off of clean accuracy.
We show that this can be achieved by simpler means and with little to no trade-off through (cid:96) 2 weight decay, where the regularization constant λ corrects the loss scaling as the norm of the input increases with d .
We increase the MNIST image width √ d from 28 to 56, 84, and 112 pixels.
The loss
L is predicted to grow like √ d for (cid:15) -sized
attacks by Thm.
4 of Simon-Gabriel et al.
We conﬁrm that without regularization the loss does scale roughly as predicted (see Table 13 of Appendix E).
Training with (cid:96) 2 weight decay, however, we obtain adversarial test accuracy ratios of 0 .
98 ± 0 .
96 ± 0 . 04 , and 1 . 00 ± 0 .
03 and clean accuracy ratios of 0 .
999 ± 0 .
996 ± 0 .
003 , and 0 .
987 ± 0 .
for √ d of 56, 84, and 112, respectively, relative to the original √ d = 28 dataset.
A more detailed explanation and results are provided in Appendix E.
[Table]
Next, we repeat this experiment with a twohidden-layer ReLU MLP, with the number of hidden units equal to the half the input dimension, andoptionallyuseonehiddenlayerwith batch norm.
5 To evaluate robustness, 100 iterations of BIM- (cid:96) ∞ were used with a step size of 1e-3, and (cid:15) ∞ = 0 .
We also report test accuracy with additive Gaussian noise of zero mean and unit variance, the same ﬁrst two moments as the clean images.
Despite a difference in clean accuracy of only 0 .
08 ± 0 .
05% , Table 7 shows that for the original image resolution, batch norm reduced accuracy for noise by 16 .
4 ± 0 .
4% , and for
BIM- (cid:96) ∞ by 43 .
8 ± 0 .
Robustness keeps decreasing as the image size increases, with the batch-normalized network having ∼ 40% less robustness to BIM and 13 − 16% less to noise at all sizes.
We then apply the (cid:96) 2 regularization constants tuned for the respective input dimensions on the linear model to the ReLU MLP with no further adjustments.
Table 8 shows that by adding sufﬁcient (cid:96)regularization ( λ =0 . 01 ) to recover the original ( √ d =28 , no BN) accuracy for BIM of ≈ 66% when using batch norm, we induce a test error increase of 1 .
69 ± 0 .
01% , which is substantial on MNIST.
Furthermore, using the same regularization constant and no batch norm increases clean test accuracy by 1 . 39 ± 0 .
04% , and for the BIM- (cid:96) ∞ perturbation by 21 .
7 ± 0 .
Finally, following the guidance in the original work on batch norm (Ioffe & Szegedy, 2015) to the extreme ( λ = 0 ): when we reduce weight decay when using batch norm, accuracy for the (cid:15) ∞ =
.perturbation is degraded by 79 . 3 ± 0 .
3% for √ d =56 , and 81 .
2 ± 0 .
2% for √ d =84 .
In all cases, using batch norm greatly reduced test accuracy for noisy and adversarially perturbed inputs, while weight decay increased accuracy for such inputs.
R ELATED W ORK
Our work examines the effect of batch norm on model robustness at test time.
References with an immediateconnectiontoourworkwerediscussedintheprevioussections; herewebrieﬂymentionother works that do not have a direct relationship to our experiments, but are relevant to batch norm in general.
The original work Ioffe & Szegedy (2015) that introduced batch norm as a technique for improving neural network training and test performance motivated it in terms of “internal covariate shift” – referring to the changing distribution of layer outputs, an effect that requires subsequent layers to steadily adapt to the new distribution and thus slows down the training process.
Several follow-up works started from the empirical observation that batch norm usually accelerates and stabilizes training, and attempted to clarify the mechanism behind this effect.
One argument is that batch-normalized networkshaveasmootheroptimizationlandscapeduetosmallergradientsimmediatelybeforethebatchnormalized layer (Santurkar et al., 2018).
However, Yang et al.
(2019) study the effect of stacking many batch-normalized layers and prove that this causes gradient explosion that is exponential in network depth for networks without skip connections and holds for any non-linearity.
In practice, relatively shallow batch-normalized networks seem to beneﬁt from the “helpful smoothing” of the loss surface property Santurkar et al.
(2018), while very deep networks are not trainable (Yang et al., 2019).
In our work, we found that a single batch-normalized layer sufﬁces to induce severe adversarial vulnerability.
A concurrent submission suggests that BN induced vulnerability may be due to a mismatch between the tracked mean and variance values at training versus test time (Anonymous, 2020).
We investigate this hypothesis in Appendix H and ﬁnd that the use of tracked statistics can play a similar role as tuning the numerical stability constant c , thus this does not completely account for the vulnerability.
Weight decay’s loss scaling mechanism is complementary to other mechanisms identiﬁed in the literature, for instance that it increases the effective learning rate (van Laarhoven, 2017; Zhang et al., 2019a).
Our results are consistent with these works in that weight decay reduces the generalization gap (between training and test error), even in batch-normalized networks where it is presumed to have no effect.
Given that batch norm is not typically used on all layers, the loss scaling mechanism persists, although to a lesser degree in this case.
Shafahi et al.
(2019) performed similar input dimension scaling experiments as in this work and came to a similar conclusion that the input dimension is irrelevant to adversarial vulnerability.
However, like Simon-Gabriel et al.
(2019), they use PGD rather than weight decay to prevent vulnerability from increasing with input dimension.
Although it can be shown that robust optimization is equivalent to parameter norm regularization for linear models if we allow the (cid:15) -ball (aka disturbance δ ) to vary with each example (Xu et al., 2009), we maintain that the latter is a more efﬁcient approach.
C ONCLUSION
We found that there is no free lunch with batch norm when model robustness is a concern: the accelerated training properties and occasionally higher clean test accuracy come at the cost of increased vulnerability, both to additive noise and for adversarial perturbations.
We have shown that there is no inherent relationship between the input dimension and vulnerability.
Our results highlight the importance of identifying the disparate mechanisms of regularization techniques.
A T HE N UMERICAL S TABILITY C ONSTANT
The constant c originally added to the mini-batch variance in the denominator for numerical stability (named (cid:15) in Ioffe & Szegedy (2015)) turns out to be an important hyperparameter in terms of robustness.
It acts as a threshold on the variance of all input dimensions or neurons.
When c is much less than the minimum variance over dimensions, it induces boundary tilting along the low-variance dimensions.
In Figure 3 we sweep c for MNIST 3 vs. 7 and CIFAR-10, and compare the corresponding clean test accuracy with FGSM and AWGN accuracy for MNIST, and AWGN for CIFAR-10.
For MNIST, increasing c allows us to trade-off clean accuracy for robustness to FGSM, but is suboptimal compared to L2 weight decay.
For these experiments we ﬁxed γ α =1 and β α =0 .
For CIFAR-10, eight-layer VGG models were trained with a constant learning rate of 0.01 with no drops, momentum of 0.9, a batch size of 128, and 50 epochs (for computational reasons) over four random seeds.
As for BNGD, for this particular experiment we apply BN only to the input layer.
A consistent trend is observed where robustness to noise increases greatly as c is increased, but we note that this occurs for c several orders of magnitude greater than default settings.
B O N AN A CCURACY VS . R OBUSTNESS T RADE -O FF
It is natural to wonder if the degradation in robustness arising from the use of BN is simply due to
BN increasing the standard test accuracy, given a known trade-off between the two (Tanay & Grifﬁn, 2016;
Galloway et al., 2018;
Su et al., 2018;
Tsipras et al., 2019).
Note that if the relationship between input X and label Y is free of noise, e.g., as in Gilmer et al.
(2018), then there is no such trade-off and increasing accuracy corresponds to increasing robustness.
For the toy problem we studied in § 3,
BN actually aligned the decision boundary with the Bayes-optimal solution, so increasing standard accuracy may be intrinsic to the normalization itself in some cases.
Given that BN does typically increase clean test accuracy by some small amount on commonly used datasets, we thought it was most representative to not intentionally limit the performance of
BN.
We did, however, ﬁnd natural cases where BN did not improve clean test accuracy.
We trained
[Figure] [Figure] ResNets{20,32,44,56,110} using Fixup initialization on CIFAR-10: all consistently obtain about 0 .
5% higher clean test accuracy than their batch-normalized equivalent, and are also more robust to noise ( ≈ 15% ) and PGD (cid:96) ∞ and (cid:96) 2 perturbations ( ≈ 30% ), as shown in Figure 4.
For MNIST, the results of Tables 6 & 7 also show compatible clean accuracy irrespective of BN, and yet vastly different robustness.
Thus, the vulnerability induced by BN is not merely a consequence of increasing standard test accuracy.
C PGD T RAINING Y IELDS U NFORTUNATE R OBUSTNESS T RADE -O FFS
We believe that it is most informative to evaluate on corruptions or perturbations that are not presented to models during training, which is why we did not use PGD adversarial training in the main text given that we evaluate on the same. In a practical setting we cannot assume awareness of potential attacks a priori .
For brevity, we opted to report accuracy for an arbitrary small value of (cid:15) in the main text.
In general, however, it is more informative to plot accuracy vs. (cid:15) to ensure the accuracy reaches zero for reasonably large (cid:15) to help rule out gradient masking issues (Papernot et al., 2017; Athalye et al., 2018).
This also shows that (cid:15) was not cherry-picked.
Figure 5(b) shows that PGD- (cid:96) ∞ training recovers much of the [Figure]
[Figure] BN-vulnerability gap when tested on PGD- (cid:96) ∞ perturbations only, although there is a still a non-trivial improvement at (cid:15)
= 8 / 255 from 38 .
84% to 41 .
57% (recall that we only trained with (cid:15) max = 4 / 255 , so absolute accuracy is slightly lower than in Madry et al
Ultimately, adversarial robustness is concerned with robustness to the worst attack in our threat model.
If we consider the contrast corruption from CIFAR-10-C (Hendrycks & Dietterich, 2019), PGD- (cid:96) ∞ training with (cid:15) =4 , 5 iterations, and a step size of 1 (as in Figure 5(b)) , this reduces the absolute test accuracy by 23 .
5% and 28 .
5% for WideResNet 28–10 in Fixup and BN variants, respectively.
We do not believe it is reasonable for a threat model of natural image classiﬁers to exclude natural changes in image contrast (Gilmer & Hendrycks, 2019).
Thus, the recipe of PGD training a high capacity model alone can exacerbate other vulnerabilities (Jacobsen et al., 2019a; Mu & Gilmer, 2019). Similar results are observed on an MNIST-C benchmark (Mu & Gilmer, 2019), to which we add an additional Gaussian noise corruption.
We PGD-train the LeNet-5 variant from the AdverTorch library (Ding et al., 2019) using 20 inner-loop iterations, a step size of 0.3 / 10 , and (cid:15) max = 0 . with a random initial perturbation as in Madry et al. Table 9 shows that BN reduces the mean test accuracy on MNIST-C by 11 ± 2% ; the accuracy is reduced from 87 . 0 ± 0 .
5% (Per-img) to 76 ± 2% (BN). This is compatible with Mu & Gilmer (2019), which reported an 11 . 15% degradation in absolute test accuracy for PGD training, although they did not report the variance over multiple runs. Note that Mu & Gilmer (2019) use a slightly different CNN architecture that obtains 91 .
21% mean test accuracy, slightly higher than our 87 . 0 ± 0 . 5% baseline. In particular, the performance of BN and the PGD variants is decimated by altering the brightness of the images, whereas the baseline shows little performance degradation.
It is known that PGD training yields a highly sparse network that implements a thresholding operation in the ﬁrst layer, see the Appendix C of Madry et al.
(2018), which forces the model to be invariant to perturbations with (cid:96) ∞ -norm <(cid:15) .
This excessive invariance is itself another cause of adversarial vulnerability (Jacobsen et al., 2019a;b).
The PGD trained batch-normalized model (PGD BN) performs worse than the baseline by double digit percentages for each of the: “Brightness”, “Fog”, “Impulse Noise”, “Stripe”, and “Zigzag” corruptions, with 7 ± 2% higher mCE.
D A DDITIONAL E MPIRICAL R ESULTS
This section contains supplementary explanations and results to those of Section 4.
D. A DDITIONAL SVHN AND CIFAR-10 R ESULTS FOR D EEPER M ODELS
Our ﬁrst attempt to train VGG models on SVHN with more than eight layers failed, therefore for a fair comparison we report the robustness of the deeper models that were only trainable by using BN [Table] in Table 10.
None of these models obtained much better robustness in terms of PGD- (cid:96) [Table] although they did better for PGD- (cid:96) ∞ .
[Table]
Fixup initialization was recently proposed to reduce the use of normalization layers in deep residual networks (Zhang et al., 2019b).
As a natural test we compare a WideResNet (28 layers, width factor 10) with Fixup versus the default architecture with BN.
Note that the Fixup variant still contains one
BN layer before the classiﬁcation layer, but the number of BN layers is still greatly reduced.
[Table]
We train WideResNets (WRN) with ﬁve unique seeds and report their test accuracies in Table 11.
Consistent with (Recht et al., 2018), higher clean test accuracy on CIFAR-10, i.e. obtained by the WRN compared to VGG, translated to higher clean accuracy on CIFAR-10.1.
However, these gains were wiped out by moderate Gaussian noise.
VGG8 dramatically outperforms both WideResNet variants subject to noise, achieving 78 .
9 ± 0 .
6 vs. 69 .
1 ± 1 . 1 .
Unlike for VGG8, the WRN showed little generalization gap between noisy CIFAR-10 and 10.1 variants: 69 . 1 ± 1 . 1 is reasonably comparable with 67 .
8 ± 0 . 9 , and 57 .
6 ± 1 . 5 with 58 .
3 ± 1 . 2 .
The Fixup variant improves accuracy by 11 .
6 ± 1 .
9% for noisy CIFAR-10, 9 . 5 ± 1 .
5% for noisy CIFAR-10.1, 5 . 4 ± 0 .
6% for PGD- (cid:96) ∞ , and 1 . 1 ± 0 .
4% for PGD- (cid:96) 2 .
We believe our work serves as a compelling motivation for Fixup and other techniques that aim to reduce usage of BN.
The role of skip-connections should be isolated in future work since absolute values were consistently lower for residual networks.
D. I MAGE N ET B LACK - BOX T RANSFERABILITY A NALYSIS
[Table] [Table] The discrepancy between the results in additive noise and for white-box BIM perturbations for
ImageNet in Section 3 raises a natural question: Is gradient masking a factor inﬂuencing the success of the white-box results on ImageNet?
No, consistent with the white-box results, when the target is unnormalized but the source is, top 1 accuracy is 10 .
5% − 16 .
4% higher, while top 5 accuracy is 5 .
3% − 7 .
5% higher, than vice versa.
This can be observed in Table 12 by comparing the diagonals from lower left to upper right.
When targeting an unnormalized model, we reduce top 1 accuracy by 16 .
5% − 20 .
4% using a source that is also unnormalized, compared to a difference of only 2 . 1% − 4 .
9% by matching batch-normalized networks.
This suggests that the features used by unnormalized networks are more stable than those of batch-normalized networks.
[Figure] Unfortunately [Figure] the pre-trained ImageNet models provided by the PyTorch developers do not include hyperparameter settings or other training details.
However, we believe that this speaks to the generality of the results, i [Figure] e., that they are not sensitive to hyperparameters.
D. B ATCH N ORM L IMITS M AXIMUM T RAINABLE D EPTH AND R OBUSTNESS
In Figure 6 we show that BN not only limits the maximum trainable depth, but robustness decreases with the batch size for depths that maintain test accuracy, at around 25 or fewer layers (in Figure 6(a)).
Both clean accuracy and robustness showed little to no relationship with depth nor batch size in unnormalized networks.
A few outliers are observed for unnormalized networks at large depths and batch size, which could be due to the reduced number of parameter update steps that result from a higher batch size and ﬁxed number of epochs (Hoffer et al., 2017).
Note that in Figure 6(a) the bottom row—without batch norm—appears lighter than the equivalent plot above, with batch norm, indicating that unnormalized networks obtain less absolute peak accuracy than the batch-normalized network.
Given that the unnormalized networks take longer to converge, we prolong training for 40 epochs total.
When they do converge, we see more conﬁgurations that achieve highercleantestaccuracythanbatch-normalizednetworksinFigure6(b).
Furthermore, goodrobustness can be experienced simultaneously with good clean test accuracy in unnormalized networks, whereas the regimes of good clean accuracy and robustness are still mostly non-overlapping in Figure 6(b).
E W EIGHT D ECAY AND I NPUT D IMENSION
Consider a logistic classiﬁcation model represented by a neural network consisting of a single unit, parameterized by weights w ∈ R d and bias b ∈ R , with input denoted by x ∈ R d and true labels y ∈ {± 1 } .
Predictions are deﬁned by s = w (cid:62) x + b , and the model is optimized through empirical risk minimization, i.e., by applying stochastic gradient descent (SGD) to the loss function equation 2, where ζ ( z )
=
log(1+ e − z ) :
[Equation]
We note that w (cid:62) x + b is a scaled , signed distance between x and the classiﬁcation boundary deﬁned by our model.
If we deﬁne d ( x ) as the signed Euclidean distance between x and the boundary, then we have: w (cid:62) x + b = (cid:107) w (cid:107) 2 d ( x ) .
Hence, minimizing equation 2 is equivalent to minimizing
[Equation]
We deﬁne the scaled loss as
[Equation]
and note that adding a (cid:96) 2 regularization term in equation 3, resulting in equation 5, can be understood as a way of controlling the scaling of the loss function:
[Equation]
[Figure]
[Equation]
[Figure]
[Equation]
[Figure]
, the misclassiﬁed data is penalized linearly while the correctly classiﬁed data is not penalized.
(e) A medium regularization parameter (medium (cid:107) w (cid:107) 2 ) corresponds to smoothly blending the margin. (f) For a large regularization parameter (small (cid:107) w (cid:107) 2 ), all data points are penalized almost linearly.
In Figures 7(a)-7(c), we develop intuition for the different quantities contained in equation 2 with respect to a typical binary classiﬁcation problem, while Figures 7(d)-7(f) depict the effect of the regularization parameter λ on the scaling of the loss function.
To test this theory empirically we study a model with a single linear layer (number of units equals input dimension) and cross-entropy loss function on variants of MNIST of increasing input dimension, to approximate the toy model described in the “core idea” from (Simon-Gabriel et al., 2019) as closely as possible, but with a model capable of learning.
Clearly, this model is too simple to obtain competitive test accuracy, but this is a helpful ﬁrst step that will be subsequently extended to ReLU networks.
The model was trained by SGD for 50 epochs with a constant learning rate of 1e-2 and a mini-batch size of 128.
In Table 13 we show that increasing the input dimension by resizing MNIST from 28 ×to various resolutions with PIL.Image.
NEAREST interpolation increases adversarial vulnerability in terms of accuracy and loss.
Furthermore, the “adversarial damage”, deﬁned as the average increase of the loss after attack, which is predicted to grow like √ d by Theorem 4 of (Simon-Gabriel et al., 2019), falls in between that obtained empirically for (cid:15) =0 .
05 and (cid:15) =0 .
1 for all image widths except for 112, which experiences slightly more damage than anticipated.
Simon-Gabriel et al.
(2019) note that independence between vulnerability and the input dimension can be recovered through adversarial-example augmented training by projected gradient descent (PGD), with a small trade-off in terms of standard test accuracy.
We ﬁnd that the same can be achieved through a much simpler approach: (cid:96) 2 weight decay, with parameter λ chosen dependent on d to correct for the loss scaling.
This way we recover input dimension invariant vulnerability with little degradation of test accuracy, e.g., see the result for √ d =112 and (cid:15) =0 .
1 in Table 13: the accuracy ratio is 1 . 00 ±
.with weight decay regularization, compared to 0 .
10 ± 0 .
09 without.
Compared to PGD training, weight decay regularization i) does not have an arbitrary (cid:15) hyperparameter that ignores inter-sample distances, ii) does not prolong training by a multiplicative factor given by the number of steps in the inner loop, and 3) is less attack-speciﬁc.
Thus, we do not use adversarially augmented training because we wish to convey a notion of robustness to unseen attacks and common corruptions.
Furthermore, enforcing robustness to (cid:15) -perturbations may increase vulnerability to invariancebased examples, where semantic changes are made to the input, thus changing the Oracle label, but not the classiﬁer’s prediction (Jacobsen et al., 2019a).
Our models trained with weight decay obtained 12% [Table] [Table] higher accuracy (86% vs. 74% correct) compared to batch norm on a small sample of 100 (cid:96) ∞ invariancebased MNIST examples.
8 We make primary use of traditional (cid:96) p perturbations as they are well studied in the literature and straightforward to compute, but solely defending against these is not the end goal.
A more detailed comparison between adversarial training and weight decay can be found in (Galloway et al., 2018).
The scaling of the loss function mechanism of weight decay is complementary to other mechanisms identiﬁed in the literature recently, for instance that it also increases the effective learning rate (van Laarhoven, 2017; Zhang et al., 2019a).
Our results are consistent with these works in that weight decay reduces the generalization gap, even in batch-normalized networks where it is presumed to have no effect.
Given that batch norm is not typically used on the last layer, the loss scaling mechanism persists in this setting, albeit to a lesser degree. [Figure] Layer Layer
[Figure]
F C OMMON C ORRUPTION R OBUSTNESS
For VGG8, the mean generalization gaps due to batch norm for noise were: Gaussian— 9 . 2 ± 1 . 9% ,
Impulse— 7 . 5 ± 0 .
8% , Shot— 5 . 6 ± 1 .
6% , and Speckle— 4 .
5 ± 1 .
After the “noise” category the next most damaging corruptions (by difference in accuracy due to batch norm) were: Contrast— 4 . 4 ± 1 . 3% , Spatter— 2 . 4 ± 0 .
7% , JPEG— 2 . 0 ± 0 .
4% , and Pixelate— 1 . 3 ± 0 .
Results for the remaining corruptions were a coin toss as to whether batch norm improved or degraded robustness, as the random error was in the same ballpark as the difference being measured.
For VGG13, the batch norm accuracy gap enlarged to 26 − 28% for Gaussian noise at severity levels 3, 4, and 5; and over 17% for Impulse noise at levels 4 and 5.
Averaging over all levels, we have gaps for noise variants of: Gaussian— 20 . 9 ± 1 .
4% , Impulse— 13 .
6 ± 0 .
6% , Shot— 14 . 1 ± 1 . 0% , and
Speckle— 11 .
1 ± 0 .
Robustness to the other corruptions seemed to beneﬁt from the slightly higher clean test accuracy of 1 . 3 ± 0 .
1% for the batch-normalized VGG13.
The remaining generalization gaps varied from (negative) 0 .
2 ± 1 .
3% for Zoom blur, to 2 .
9 ± 0 .
6% for Pixelate.
For the WRN, the mean generalization gaps for noise were: Gaussian— 12 .
1 ± 2 .
8% , Impulse— 10 .
7 ± 2 .
9% , Shot— 8 .
7 ± 2 .
6% , and Speckle— 6 . 9 ± 2 .
Note that the large uncertainty for these measurements is due to high variance for the model with batch norm, on average 2 . 3% versus 0 .
7% for Fixup.
JPEG compression was next at 4 .
6 ± 0 .
G A DVERSARIAL S PHERES
The “Adversarial Spheres” dataset contains points sampled uniformly from the surfaces of two concentric n -dimensional spheres with radii R = 1 and R = 1 . 3 respectively, and the classiﬁcation task is to attribute a given point to the inner or outer sphere.
We consider the case n = 2 , that is, datapoints from two concentric circles.
This simple problem poses a challenge to the conventional wisdom regarding batch norm: not only does batch norm harm robustness, it makes training less stable.
In Figure 9 we show that, using the same architecture as in (Gilmer et al., 2018), the batch-normalized network is highly sensitive to the learning rate η .
We use SGD instead of Adam to avoid introducing unnecessary complexity, and especially since SGD has been shown to converge to the maximum-margin solution for linearly separable data (Soudry et al., 2018).
We use a ﬁnite dataset of 500 samples from N (0 ,I ) projected onto the circles.
The unormalized network achieves zero training error for η up to 0.1 (not shown), whereas the batch-normalized network is already untrainable at η =0 . 01 .
To evaluate robustness, we sample 10,000 test points from the same distribution for each class (20k total), and apply noise drawn from N (0 , 0 .
005 × I ) .
We evaluate only the models that could be trained to 100% training accuracy with the smaller learning rate of η =0 .
The model with batch
[Table]
[Figure] [Figure] [Figure]
H A LTERNATIVE E XPLANATIONS OF THE V ULNERABILITY
In a concurrent submission, it is suggested that the main reason for BN induced vulnerability is a mismatch between the mean and variance statistics at training versus test time (Anonymous, 2020).
We investigate this hypothesis using the well controlled MNIST 3 vs. 7 testbed from §3.
Figure 10 shows that by eliminating tracking, i e. going from plot 10(a) to 10(b), the boundary tilting angle θ w.r.t.
the nearest-centroid classiﬁer is reduced by 13 . 7 ◦ .
Eliminating BN altogether reduces θ by an additional 25 . 2 ◦ , and using per-image normalization (rather than per-pixel as in BN) achieves a further reduction of θ by 31 . 3 ◦ .
In terms of FGSM at (cid:15) = 1 / 10 , model 10(b)
(BN, no tracking) achieves 38 .
7% accuracy whereas the unnormalized baseline 10(c) achieves 66 .
The observation regarding tracking is insightful and contributes to a more reﬁned understanding of BN.
However, this experiment is a counterexample to the claim that the tracking aspect of BN is the main source of vulnerability, compared to boundary tilting arising from the per-dimension normalization procedure itself.
As acknowledged in Anonymous (2020), it is worth re-iterating that using BN without tracked statistics at test-time is restricted to large batch sizes, which may not be practical.
In Figure 11, we show that the reduction in vulnerability achieved by not using tracked statistics at test time can be achieved by increasing the numerical stability constant c .
Here, the c value can be used to interpolate between the conﬁgurations achieved when tracking is used (shown in Figure 10(a)), or not used (shown in Figure 10(b)) for a ﬁxed c .
There remains a distinct qualitative difference between the weight matrices visualized in Figures [10(b)
( c =1e-5, no tracking) – 11(f)
( c =1, with tracking)], which both resemble the hand-drawn digit “3”, compared to the case without BN in Figures [10(c)–(e)] which contain both a “3” as dark pixels and a “7” as bright pixels.
This is a consequence of the BN procedure not being class-aware, i.e., all pixels of a digit “7” are normalized by the variance of both class “3” and class “7”, which more closely resembles a “3” for this dataset as shown in Figure 10(f). I A DVERSARIAL E XAMPLES
To alleviate possible concerns that gradient masking effects (Papernot et al., 2017; Athalye et al., 2018) may explain the apparent difference in robustness between batch-normalized and unnormalized networks, we provide qualitative evidence that BN degrades the visual appearance of adversarial examples for strong unbounded attacks.
In other words, we show that these unbounded adversarial examples remain “adversarial” for batch-normalized networks, while semantically relevant features are introduced for inputs classiﬁed with high conﬁdence by the baselines, such that a human oracle would agree with the predictions.
If the gradients were obfuscated in any way, we would be unable to meaningfully increase the accuracy or prediction conﬁdence of the models beyond random chance, and the examples that we initialize from white noise would remain noisy.
Note: this is not the sole source of evidence we provide that gradient masking is not a factor, the common corruption benchmarks and unbounded attacks reaching 100% success also support this.
I. MNIST
For the MNIST experiments, we train a LetNet-5 CNN variant from the AdverTorch library (Ding et al., 2019).
All models (batch-normalized or not) are trained for 90 epochs of SGD with a constant learning rate of 0.01, and a mini-batch size of 50.
We compare three variants of this model:
L2 :
Uses an L 2 weight decay regularization constant λ =0 .
BN :
The two convolution layers of the LetNet-5 are batch-normalized, with default settings ( γ and β enabled, numerical stability constant set to 1e-5, momentum of 0.1).
Per-img : Subsumes “L2” and additionally uses per-image normalization, i.e., we subtract the global mean of each image to correct the average intensity, then divide by the standard deviation of all features in the image.
The models obtain similar clean test accuracy:
“L2”— 98 . 0% , “BN”— 99 . 2% , “Per
-img”— 98 . 4% .
To construct adversarial examples, two unbounded attack schemes are used: “fooling images” (Nguyen et al., 2015) and the Carlini & Wagner (2017) (CWL2) method.
The fooling images procedure starts with white noise, then minimizes the cross entropy loss wrt a target class until it is predicted with high conﬁdence.
“Conﬁdence” here means the softmax margin, i.e., the difference between the max softmax output and the second from max output.
{+Formally, we sample a starting point x 0 ∼N (0 , 0 . 
+}
) ∈
R 28 × 28 , then update x according to x n = x n − 1 + δ , using n = 1 to 100 iterations of PGD- (cid:96) 2 w.r.t.
each class label.
For “L2” and “BN”, we clip pixel values to [0 , 1] , and for “Per-img” to [ − 1 , 1] .
We use a PGD- (cid:96)step size of 0 . 2 .
Figure 12 shows the fooling images, their predicted class labels, and prediction conﬁdence for the three conﬁgurations.
The procedure bears similarity to “Activation Maximization” techniques for interpreting neural networks, but this usually requires post-hoc regularization of the input images (Simonyan et al., 2014).
This was not required here, owing to the competitive robustness of models 12(a) and 12(b), which makes them somewhat interpretable by default.
The batch-normalized model classiﬁes images that only faintly resemble natural digits with full conﬁdence, while those of the baselines contain more clearly class-relevant features.
In particular, the “Per-img” case in Figure 12(b) makes no fully saturated conﬁdence predictions, and its fooling images resemble matched ﬁlters (Turin, 1960)
w.r.t.
task relevant edges.
The Carlini & Wagner (2017) (CWL2) Adam optimizer-based attack seeks to ﬁnd the smallest perturbation in terms of (cid:96) 2 distance which achieves either an arbitrary, or targeted, misclassiﬁcation.
We use the arbitrary misclassiﬁcation objective, conﬁdence parameter k =4 to encourage reasonably high conﬁdence predictions, a “learning rate” of 1e-2, nine (9) binary search steps, and an initial value for the constant c of 1e-3, which balances the minimization of the (cid:96) 2 -norm of the perturbation δ , and prediction conﬁdence.
We allow up to 10,000 attack iterations, and show the resulting examples in
Figure 13.
For the same conﬁdence threshold, the mean (cid:96) 2 norm of the perturbations required to change
[Figure]
the predictions of the batch-normalized model was (cid:107) δ (cid:107) 2 =0 .
95 , while (cid:107) δ (cid:107) 2 =2 .
was required for the unnormalized model.
This is a three fold improvement in terms of the relevant performance metric for this attack, which always obtains 100% success by virtue of being unbounded.
I. SVHN
For SVHN, we visualize the fooling images in Figure 14, and all combinations of source to targeted misclassiﬁcation crafted using a basic iterative gradient method (BIM- (cid:96) 2 ) for a random sample of each class in Figure 15.
We use a simple CNN architecture described in Table 15.
The model is trained for 50 epochs of SGD on the SVHN dataset (excluding the “extra” split) with a constant learning rate of 0.01, and a mini-batch size of 128 in both cases.
Since SVHN is imbalanced, the loss is weighted by the inverse frequency of each class.
As in §I.1, for the no-BN baseline we use an L 2 weight decay regularization constant λ =0 .
01 , and per-image preprocessing.
Although both models obtain similar a test accuracy of about 90% , the fooling images for the unnormalized model contain task relevant edges, like those of Figure 12(b), whereas the batch-normalized model yields difﬁcult to interpret images.
Similarly, the examples of grid 15(a) resemble the target class in many cases, while those of 15(b) for the batch-normalized model have a subtle textured effect, and preserve the semantic cues of the source image.
[Equation]
L EARNING R ATE
It is known that using a high initial learning rate, which is annealed during training, often achieves higher test accuracy than training with a smaller ﬁxed learning rate, even though the latter approach optimizes the training loss more quickly.
To explain this phenomenon, Li et al.
(2019) introduce the concept of learning order , which is a training time property that was found to be predictive of generalization ability, in contrast with post-training notions of model complexity that are typically believed to govern generalization.
Learning order refers to different examples being learned at different
[Figure]
[Figure]
[Figure]
[Table]
times, according to their intrinsic noise level and complexity.
Li et al.
ﬁnd that using a high initial learning rate prevents the model from ﬁtting high complexity patterns too early, at the expense of easier to ﬁt patterns.
When the learning rate is annealed, the model effectively moves on to the next stage of a “curriculum” in which it can learn more challenging patterns.
To show that the BN vulnerability does not depend on a particular learning rate, we conduct a similar experiment on CIFAR-10 as in Li et al.
(2019) with “small” and “large” initial learning rate (“lr”).
We evaluate several measures of robustness every 10 epochs to better characterize the regimes in which the vulnerability occurs, and its relationship with the annealing of the learning rate.
A shallow VGG variant (VGG8) is trained over 150 epochs using two different initial learning rates (details in caption of Figure 16), and the process is repeated over three random seeds for BN vs. no-BN.
We use standard hyper-parameters, SGD with momentum 0.9, a mini-batch size of 128, weight decay 5e-4, and standard data augmentation.
For preprocessing, we use the commonly used per-channel statistics both with and without BN.
We use “Un” to denote the unnormalized model, and “BN” for batch-normalized.
The ﬁnal test accuracies are: “Un, small lr”: 88 .
7 ± 0 .
1% , “Un, large lr”: 90 . 4 ± 0 .
1% , (difference 1 .
7 ± 0 .
1% ), “BN, small lr”: 90 .
3 ± 0 .
1% , “BN, large lr”: 91 .
3 ± 0 .
1 , (difference 1 . 0 ± 0 .
To evaluate robustness, we evaluate accuracy on several variants of the test set: “Clean”—the original test set, “AWGN”—with additive white Gaussian noise ( σ 2 = 1 / 16 ), “FSGM”—with perturbation crafted by one-step fast gradient sign method (cid:96) ∞ , and “PGD”—a 40-step PGD- (cid:96) ∞ perturbation, with a step size of (cid:15)/ 30 .
We use (cid:15) = 8 / 255 as the (cid:96) ∞ norm budget for both FGSM and PGD perturbations, and clip the pixel values to [ ± 2 ].
For the “high lr” case shown in Figure 16(a), the unnormalized model achieves higher robustness than the batch-normalized model after around 70–80 epochs, shortly after the learning rate is ﬁrst annealed.
This result begets the question: if we are willing to sacriﬁce clean test accuracy and do not anneal the largelearningrate, canwemitigatetheBNvulnerability?
Weinvestigatethisinasubsequentexperiment depicted in Figure 17.
Meanwhile, Figure 16(b) shows that in the “small lr” case, the unnormalized model achieves higher robustness on all tests compared to its batch-normalized equivalent, at all epochs.
Figure 17 shows that if we do not anneal the learning rate, there appears to be little difference in robustness between the batch-normalized and unnormalized models.
We conclude this section with a few remarks:
The “large constant learning rate” is not a particularly
practical setting, as 10% absolute clean test accuracy has been left on the table.
The poor relative performance of this particular baseline does not mean that BN is not increasing adversarial vulnerability in an absolute sense.
Indeed, from Table 3, training the same architecture with a small learning rate yields 52 .
9 ± 0 .
6% for the same magnitude PGD- (cid:96) ∞
[Figure]
perturbation, while the batch-normalized variant achieves less than 40% accuracy at all epochs and learning rates studied here (this can be seen through inspection of Figures 16 and 17).
The accuracy of the unnormalized model on all test sets increases almost monotonically with prolonged training, and appears to be still increasing at the conclusion of the 150 epochs.
For fairness, we did not investigate further training to see how long this trend continues.
Conversely, the batch-normalized model converges quickly then plateaus.
At this point its accuracy tends to oscillate, or even decline monotonically (particularly for PGD in Figure 16(b)), thus careful early stopping is much more relevant to BN.
[Figure]