A toolkit of adversarial training tricksBag of Tricks for Adversarial Training
The authors systematically evaluate overlooked training techniques in CIFAR-10 adversarial training, stating that basic settings such as weight decay can change robust accuracy by about 7%, and that retrained TRADES reaches 54.39% on the AutoAttack leaderboard.
- Recent benchmarks have found that most adversarial training (AT) improvements are no better than simple early stopping, and the authors suspect that inconsistent basic training settings across methods (weight decay, learning rate schedule, etc.) interfere with fair comparison between methods.
- On CIFAR-10 under l∞ ε=8/255, using PGD-AT as the default framework, early stopping, warmup, batch size, label smoothing, optimizer, weight decay, activation function, BN mode, etc. were ablated one by one, and TRADES, FastAT and FreeAT were retrained to verify the generality of the conclusions.
- The authors state that robust accuracy is far more sensitive to basic settings than clean accuracy: weight decay 1e-4 and 5e-4 differ by about 7%; merely changing TRADES's weight decay to 5e-4 raises AA accuracy by about 4%, and the retrained model reaches 54.39% on the AutoAttack leaderboard (without additional data) (WRN-34-20).
- The authors explicitly write that the empirical observations and conclusions may not generalize to other datasets, tasks or AT frameworks; experiments were conducted only on CIFAR-10, and apart from Table 16 (5 random seeds), the main results do not report the number of repetitions or variance.
- Evaluated models
- ResNet-18WRN-34-10WRN-34-20SENet-18DenseNet-121DenseNet-201GoogleNetDPN26DPN92RegNetX (200MF)RegNetX (400MF)ResNet-50ResNeXt-29
- Benchmarks
- CIFAR-10AutoAttack benchmark
- Metrics
- Clean accuracyPGD-10 accuracyAutoAttack (AA) accuracyRayS accuracy
Researchers at Tsinghua University systematically evaluated commonly overlooked training techniques and hyperparameters in adversarial training on CIFAR-10 (ℓ∞ threat model, ϵ=8/255), finding that robustness is far more sensitive to basic settings than expected, with subtle differences in weight decay able to reduce robust accuracy by more than 7%. The paper points out that differences between TRADES and the implementation by Rice et al. in weight decay (2×10−4 vs. 5×10−4), PGD initialization, and BN mode can produce a robust accuracy gap of about 5%; mild label smoothing and linear learning rate scaling are beneficial, while early stopping of adversarial steps may harm worst-case robustness. Based on this, the authors provide a PGD-AT baseline training setting and use it to retrain TRADES, achieving new SOTA results on the AutoAttack benchmark, with code open-sourced on GitHub.
Why it was selectedThe paper's ablation experiments show that adversarial training robustness is highly sensitive to basic settings such as weight decay, and its baseline recipe helps fairly reproduce and compare various defense methods.
Paper analysis
What problem does this paper attempt to solve?
The basic training settings of AT methods are inconsistent, which may drown out the improvements of the methods themselves; the authors systematically evaluate these overlooked training techniques.
Core problem: comparisons between adversarial training (AT) methods are confounded by inconsistent basic training settings (weight decay, learning rate schedule, BN mode, etc.), so improvements from the methods themselves may be overestimated or underestimated.
- Problem scenario: recent benchmarks (Croce & Hein, 2020b; Chen & Gu, 2020) found that simply applying early stopping to PGD-AT (Rice et al., 2020) yields the gains of almost all proposed improvements (including TRADES); the authors consider this phenomenon counterintuitive.
- Core observation: the authors' investigation found that TRADES uses weight decay 2×10⁻⁴, Gaussian PGD initialization, and eval-mode BN, whereas Rice et al. (2020) use 5×10⁻⁴, uniform initialization, and train-mode BN; in their CIFAR-10 experiments, these two sets of settings can differ in robust accuracy by about 5% (e.g., Table 8).
- Shortcomings of existing methods: the authors surveyed dozens of AT papers (Table 1 summarizes 21), finding that even with the same model architecture, basic hyperparameter settings are highly inconsistent and individually customized; directly using their released code or checkpoints as a benchmark would underestimate some actually effective improvements.
- What the paper proposes: systematically evaluate on CIFAR-10 the impact of a series of often-overlooked training techniques (warmup, early stopping, weight decay, batch size, BN mode, etc.), provide a baseline training configuration for PGD-AT, and retrain frameworks such as TRADES to verify generality.
- Positioning: the authors state this is not a new defense method, but rather reveals overlooked confounding factors, and call for unifying implementation details in benchmarking.
What related research exists?
Related work falls into three categories: AT improvement methods, fast AT, and robustness benchmarks; the authors position this as a systematic evaluation of implementation details rather than a new defense.
Adversarial Training and Its Improvements
- PGD-AT and TRADES: PGD-AT of Madry et al. (2018) and TRADES of Zhang et al. (2019b) are the main AT frameworks and have won adversarial competitions (Kurakin et al., 2018; Brendel et al., 2020); the ablations in this paper are mainly based on these two frameworks.
- Mechanism improvements: The authors list improvement lines grouped by source, including ensemble learning (Tramèr et al., 2018; Pang et al., 2019), metric learning (Mao et al., 2019, etc.), generative modeling, semi-supervised learning (Carmon et al., 2019; Alayrac et al., 2019) and self-supervised learning (Hendrycks et al., 2019, etc.), for description only.
- Theoretical lines: Provable robust training (Dvijotham et al., 2018a;b; Wong & Kolter, 2018) and randomized smoothing (Cohen et al., 2019); the authors note that these methods currently fall short of the best empirical robustness under empirical evaluation.
Fast Adversarial Training
- Acceleration methods: Computation reuse (Shafahi et al., 2019b; Zhang et al., 2019a), adaptive adversarial steps (Wang et al., 2019; Zhang et al., 2020), single-step training (Wong et al., 2020, etc.); this paper verifies the generality of the conclusions on FastAT and FreeAT.
- Side-effect fixes: Andriushchenko & Flammarion (2020) and Li et al. (2020) address catastrophic overfitting in fast AT.
Robustness Benchmarks
- AutoAttack and RayS: Croce & Hein (2020b) propose AutoAttack, an ensemble of four attacks, and maintain a leaderboard; Chen & Gu (2020) propose the black-box RayS attack; Dong et al. (2020) conduct large-scale robustness curve evaluation. This paper mainly evaluates with PGD-10 and AutoAttack, and uses RayS in some experiments.
- Corruption robustness datasets: MNIST-C (Mu & Gilmer, 2019), ImageNet-C/P (Hendrycks & Dietterich, 2019), used to evaluate generalization to general perturbations.
Comparison Baselines and Positioning
- Direct comparison targets: The early stopping setting of Rice et al. (2020) is the source of this paper's default configuration; Table 16 compares on the AutoAttack leaderboard with Pang et al. (2020c), Zhang et al. (2020), Rice et al. (2020), Qin et al. (2019), Huang et al. (2020) and the original TRADES.
- Concurrent work: Gowal et al. (2020) likewise systematically study AT training techniques, covering batch size, label smoothing, weight decay, etc., and additionally analyze weight averaging and data quality; the authors state that the two works are complementary.
- Authors' positioning: This paper does not propose a new defense but reveals the impact of training details on AT evaluation, promoting fairer comparison of AT methods.
How does the paper address this problem?
Using the PGD-AT default configuration as the baseline, training tricks were ablated one by one on CIFAR-10, then a baseline configuration was assembled and validated on TRADES, FastAT and FreeAT.
Overall approach: fix one default training setting, change only one training technique at a time for ablation, observe changes in Clean / PGD-10 / AA accuracy, then combine useful techniques into a baseline configuration, and do a sanity check on other AT frameworks.
Experimental setup and default configuration
- Threat model: CIFAR-10, l∞ threat model, maximum perturbation ε=8/255, no additional data used.
- Evaluation attacks: PGD-10 (untargeted, step size 2/255, 5 restarts at evaluation, no restart during training) and the standard version of AutoAttack (AutoPGD and FAB without restart).
- Default configuration (following Rice et al., 2020): PGD-AT framework; batch size 128; SGD momentum optimizer, initial learning rate 0.1; weight decay 5×10⁻⁴; ReLU, no label smoothing; BN in train mode when constructing adversarial examples; train for 110 epochs, learning rate decayed by 0.1× at epochs 100 and 105; report the checkpoint with the best PGD-10 accuracy.
Techniques ablated one by one
- Early stopping: at two levels—early stopping of training epochs (which the authors treat as the default choice) and early stopping of adversarial strength (evaluating the mechanism of Zhang et al., 2020 that increases the tolerance steps per epoch).
- Warmup: linearly increase the learning rate and the maximum perturbation ε from zero to preset values over the first 10/15/20 epochs, respectively.
- Training hyperparameters: batch size (64/128/256/512, and testing the linear scaling rule of Goyal et al. 2017), label smoothing (0–0.4), optimizer (Momentum, Nesterov, Adam, AdamW, SGD-GC/GCC), weight decay (swept over the range 1×10⁻⁴ to 9×10⁻⁴), activation function (eight kinds including ReLU, Softplus, ELU), model architecture (12 kinds including DenseNet, ResNet, WRN), BN mode (train vs. eval when constructing adversarial examples).
Combinations and baseline configuration
- Combination experiments: combine label smoothing, weight decay, activation function, and BN mode on WRN-34-10 and WRN-34-20 (Table 8).
- Resulting baseline configuration: batch size 128; SGD momentum; weight decay 5×10⁻⁴; eval-mode BN for generating adversarial examples; warmup not necessary; moderate label smoothing (0.1∼0.2) and smooth activation functions may be beneficial; architectures with residual connections.
Validation on other frameworks
- TRADES retraining: change only the weight decay of the original implementation from 2×10⁻⁴ to 5×10⁻⁴, leaving the rest unchanged, to test whether the conclusions on PGD-AT transfer (Table 9).
- FastAT / FreeAT: implemented based on the FastAT code; FastAT trained for 15 epochs with cyclic learning rate (lmin=0, lmax=0.2); FreeAT trained for 24 epochs with cyclic learning rate (lmin=0, lmax=0.04) and mini-batch replay of 4 (Table 10).
What experiments did the paper conduct?
Training tricks were ablated one by one on CIFAR-10: weight decay has the largest impact (about 7 percentage points), and retrained TRADES reaches 54.39% on the AutoAttack leaderboard.
Experimental setup
- Architectures tested: mainly ResNet-18, WRN-34-10, WRN-34-20; the BN mode and architecture experiments additionally include SENet-18, DenseNet-121, GoogleNet, DPN26, etc. (Table 7, Figure 2).
- Dataset and threat model: CIFAR-10, l∞, ε=8/255 (Table 9 additionally has ε=0.031), no additional data.
- AT frameworks: PGD-AT (default), TRADES, FastAT, FreeAT.
- Metrics and evaluation: Clean, PGD-10 (5 restarts), standard AutoAttack accuracy; the label smoothing experiments additionally test RayS, PGD-1000 (CE and C&W objectives), SPSA-10000 (Table 4, Table 17).
- Number of repetitions: only Table 16 reports the mean and standard deviation over 5 random seeds; the other tables do not report the number of repetitions.
Main results
According to Table 8 (PGD-AT, CIFAR-10, changing settings row by row):
Swipe horizontally to read the table
Architecture Setting Clean PGD-10 AA WRN-34-10 wd 1×10⁻⁴, ReLU, train BN 85.87 49.45 46.43 WRN-34-10 wd 2×10⁻⁴, ReLU, train BN 86.14 52.08 48.72 WRN-34-10 wd 5×10⁻⁴, ReLU, train BN 86.07 56.60 52.19 WRN-34-10 wd 5×10⁻⁴, ReLU, eval BN 87.38 56.04 51.93 WRN-34-10 wd 5×10⁻⁴, Softplus, LS 0.1, train BN 86.42 57.22 53.01 WRN-34-20 wd 5×10⁻⁴, ReLU, train BN 86.97 57.57 53.26 WRN-34-20 wd 5×10⁻⁴, Softplus, LS 0.1, train BN 85.69 57.86 53.66 WRN-34-20 wd 5×10⁻⁴, Softplus, LS 0.1, eval BN 87.86 57.33 53.23 - Weight decay has the largest impact: the authors state that the robust accuracy difference between 1×10⁻⁴ and 5×10⁻⁴ can reach about 7% (Figure 1(a)); Figure 1(b) shows that smaller weight decay learns faster but overfits earlier.
- Technique gains are not additive: the authors state that the improvements from combining techniques do not add up as ideally expected; label smoothing and smooth activations are beneficial but not pronounced, especially on large-capacity models.
- Interpretation of Rice et al.: the authors believe that part of the high performance of the Rice et al. (2020) models comes from their reasonable training settings.
TRADES retraining and AutoAttack ranking
- What was tested: change only the weight decay of TRADES (2×10⁻⁴→5×10⁻⁴), retrain under ε=8/255 and ε=0.031 (Table 9).
- Results: the authors report clean accuracy increases by about 1% and AA accuracy by about 4%; in Table 16, the retrained TRADES (WRN-34-20) reaches 54.39% AA, higher than 53.74% of Pang et al. (2020c) and 53.42% of Rice et al. (2020); under ε=0.031, WRN-34-10 reaches 54.28±0.24% (5 seeds), higher than the original TRADES's 53.08%. The authors state this returns TRADES to the top of the AutoAttack leaderboard (without additional data).
Other frameworks and architecture analysis
- FastAT / FreeAT (Table 10): both weight decay 5×10⁻⁴ and LS 0.1 improve AA: FastAT from 42.99% (wd 2×10⁻⁴) to 44.50%, FreeAT from 44.24% to 45.91%; the authors state the observations generalize to these frameworks.
- Architectures (Figure 2): among 12 architectures with comparable parameter counts, the authors state that DenseNet achieves both the best clean and PGD-10 accuracy while saving memory; the figure shows the architecture points distributed along clean accuracy 82–86% and PGD-10 accuracy 52–57%.
- Decision boundary visualization (Figure 3): the authors state that an appropriate weight decay (5×10⁻⁴) can increase the decision boundary margin; the figure shows the correct/incorrect prediction regions of WRN-34-10 on cross-sections along the PGD-10 direction and a random direction.
Other ablations and analyses
- Early stopping of adversarial strength (Table 2/14): clean accuracy increases (ResNet-18 82.52→86.52), but AA decreases (48.51→45.96–46.6); the authors believe this may harm worst-case robustness.
- Warmup (Table 2/14): warmup of either the learning rate or the perturbation has limited effect.
- Batch size (Table 3): 128 performs well; large batch with linearly scaled learning rate can benefit (e.g., WRN-34-10 batch 512: 50.69→53.36 PGD-10).
- Label smoothing (Table 4/17): moderate LS (0.1–0.3) improves robust accuracy by 0.5∼1% under AA, PGD-1000, and SPSA; LS 0.4 drops back on ResNet-18.
- Optimizer (Table 5/15): SGD variants (Mom, Nesterov, SGD-GC/GCC) are similar; Adam/AdamW have lower AA under the step learning rate schedule (ResNet-18: 44.04/42.39 vs. 48.51).
- BN mode (Table 7): constructing adversarial examples in eval mode improves clean accuracy (+0.89∼+1.91), with robust accuracy essentially unchanged (slightly lower for individual architectures).
What are some points that can be further explored?
The authors explicitly acknowledge that the conclusions may not generalize to other datasets or frameworks; the experiments cover only CIFAR-10, and most results do not report the number of repetitions.
Limitations and future directions noted by the authors
- Generality in doubt (Sec. 3 and Conclusion): The authors explicitly write that the empirical observations and conclusions may not generalize to other datasets, tasks or AT frameworks.
- Recommend unified settings (Sec. 3): The authors emphasize that fair comparison of AT methods requires unifying implementation details (not just model architecture).
- Recommend careful tuning (Conclusion): When building AT methods, training settings should be tuned more carefully on the validation set, or configurations that have been validated over the long term under adversarial settings should be used.
- Call to retrain old methods (Sec. 1): The authors encourage the community to reimplement previously proposed defenses with well-tuned training settings to better tap their potential.
- Evaluation warning for LS (Sec. 3.2): Label smoothing has a potential gradient masking effect, and the authors recommend careful evaluation per Carlini et al. (2019) when using it.
Scope of experiments
- The experimental dataset is CIFAR-10, the threat model is l∞, ε=8/255 (part of Table 9 uses ε=0.031), and no additional training data is used.
- The AT frameworks covered are PGD-AT, TRADES, FastAT and FreeAT, 4 in total; the architectures tested are mainly ResNet-18, WRN-34-10 and WRN-34-20, and the BN and architecture experiments additionally include 9 architectures.
- The evaluation attacks are PGD-10 and the standard version of AutoAttack; the label smoothing experiments additionally test RayS, PGD-1000 (CE/C&W) and SPSA-10000.
- Apart from Table 16, which reports the mean and standard deviation over 5 random seeds, the other tables in the paper do not report the number of repetitions or variance.
- The paper does not report the training cost or time comparison of each ablation experiment.
Summarize the main content of the paper
Systematically evaluates overlooked training tricks in CIFAR-10 adversarial training, provides a baseline configuration, and retrained TRADES reaches 54.39% on the AutoAttack leaderboard.
An empirical study on implementation details of adversarial training (AT) that, in response to the benchmark phenomenon that "most AT improvements are no better than early stopping," examines and systematically evaluates overlooked training techniques.
- Problem: The authors survey 21 AT papers (Table 1) and find that basic settings such as weight decay, learning rate schedule and BN mode are highly inconsistent; the difference between the settings of TRADES and Rice et al. (2020) can cause about a 5% difference in robust accuracy on CIFAR-10, potentially drowning out the improvements of the methods themselves.
- Method: Using the PGD-AT default configuration (batch 128, SGD momentum, wd 5×10⁻⁴, 110 epochs) as the baseline, on CIFAR-10 with l∞ ε=8/255, they ablate early stopping, warmup, batch size, label smoothing, optimizer, weight decay, activation function and BN mode one by one, evaluating with PGD-10 and AutoAttack.
- Key results: The robust accuracy difference between weight decay 1×10⁻⁴ and 5×10⁻⁴ can reach about 7% (Figure 1(a)), while clean accuracy is insensitive; moderate label smoothing improves robust accuracy by 0.5∼1%; eval-mode BN improves clean accuracy with robustness unchanged; early stopping increases clean accuracy with stronger attacks but lowers AA accuracy.
- Retraining validation: Merely changing TRADES's weight decay to 5×10⁻⁴ raises AA accuracy by about 4%; retrained TRADES (WRN-34-20) reaches 54.39% on the AutoAttack leaderboard (without additional data), surpassing previous methods on the leaderboard (Table 16); the conclusions also hold on FastAT and FreeAT.
- Authors' conclusion: Robustness is more sensitive to training settings than clean accuracy; the authors call for unifying implementation details, carefully tuning on the validation set, and retraining old defenses with tuned settings; the authors explicitly acknowledge that the conclusions may not generalize to other datasets or frameworks.