Bag of Tricks for FGSM Adversarial Training

Zichao Li, Li Liu, Zeyu Wang, Yuyin Zhou, Cihang Xie · DOI

Abstract

Adversarial training (AT) is the primary defense against malicious attacks on neural networks, yet its high computational cost remains a significant barrier. While the Fast Gradient Sign Method (FGSM) offers a single-step alternative to iterative methods like PGD, it frequently suffers from Catastrophic Overfitting (CO)—a sudden collapse in model robustness. This paper identifies a "bag of tricks" across data initialization, network architecture, and optimization that stabilizes FGSM training. By employing techniques such as pixel masking and architectural adjustments, the authors achieve state-of-the-art robustness (46.4% on AutoAttack) without sacrificing the speed of fast adversarial training.

Introduction

Adversarial training typically involves generating adversarial examples to augment the training set. The most robust approach, PGD-AT, is iterative and slow. FGSM-AT is a faster, single-step alternative but is notoriously unstable. During training, models often experience CO, where robust accuracy against strong attackers (e.g., PGD) abruptly drops to zero, even as performance against the weak FGSM attacker remains high. Previous attempts to stabilize FGSM-AT, such as adding random noise or complex gradient regularization, often compromise final robustness or introduce significant computational overhead.

Methodology: A Bag of Tricks

The researchers propose several low-cost "tricks" to prevent CO, categorized into three main perspectives:

1. Data Initialization: FGSM-Mask

Instead of the standard practice of adding random noise to images before an attack (F+FGSM), the authors introduce FGSM-Mask. This technique involves masking (zeroing out) a subset of pixels. Interestingly, the study found that a fixed masking pattern—using the same mask for every instance of an image throughout training—is as effective as random masking.

Comparison of FGSM-Mask and F+FGSM (random noise) initialization techniques.

2. Network Architecture

  • FGSM-Str2: Inspired by the inherent robustness of Vision Transformers (ViTs), the authors increased the stride of the first convolutional layer in CNNs. This mimics the "patchify" operation in ViTs, which seems to naturally resist CO.
  • FGSM-Smooth: Replacing standard ReLU activations with smoother functions like SiLU or SoftPlus significantly stabilizes the training process by providing more informative gradients.

3. Optimization: WeightNorm

The authors introduce a lightweight regularization term, WeightNorm, which constrains the weights of the first convolutional layer. This ensures that features extracted from clean and adversarial images remain similar, preventing the gradient "explosion" typically associated with the onset of CO.

Results and Discussion

The proposed methods were evaluated on CIFAR-10 and CIFAR-100 using architectures like PreActResNet-18 and WideResNet-34-10. Robustness was verified against PGD-50 and the rigorous AutoAttack (AA) suite.

Stability and Robustness

The "tricks" effectively prevent the sudden drop in robust accuracy. For instance, a PreActResNet-18 on CIFAR-10 using a combination of Str2 and Smooth achieved 49.8% PGD-50 accuracy and 46.4% AA accuracy, rivaling much slower iterative methods.

Robust accuracy over training epochs for FGSM-Mask with varying masking ratios, showing stability against catastrophic overfitting.

Efficiency and Scalability

WeightNorm optimization is approximately 25% faster than previous state-of-the-art stabilizers like GradAlign because it avoids expensive second-order gradient calculations. Furthermore, while previous fast methods often fail on larger models like WideResNet-34-10, these tricks remain stable and effective across scales.

Conclusion

This work challenges the belief that random initialization is the only way to prevent catastrophic overfitting in FGSM training. By focusing on the first layer of the network—through masking, stride adjustments, or weight normalization—researchers can achieve high levels of robustness with minimal computational overhead. While a performance gap still exists compared to the most intensive PGD-based methods, these "tricks" provide a practical path toward efficient and robust deep learning.

Summary updated

BibTeX
@inproceedings{li2023bag,
  author = {Zichao Li and Li Liu and Zeyu Wang and Yuyin Zhou and Cihang Xie},
  title = {{Bag of Tricks for FGSM Adversarial Training}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=X2Dbqvfx-NI},
}
Figure