Bag of Tricks for FGSM Adversarial Training

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

TL;DR

Adversarial training with the single-step Fast Gradient Sign Method (FGSM-AT) is dramatically faster than multi-step methods, but it frequently collapses due to "catastrophic overfitting," where robust accuracy suddenly plunges to zero. This paper systematically explores a "bag of tricks" across data initialization, network architecture, and loss regularization that stabilize FGSM-AT without heavy computation, achieving up to 49.8% PGD-50 accuracy on CIFAR-10.

What Problem Does This Paper Address?

Standard adversarial training (such as PGD-AT) relies on multi-step gradient ascent to craft adversarial examples during training. While effective, it is computationally expensive. Vanilla single-step training (FGSM-AT) is fast, but suffers from catastrophic overfitting: after a few training epochs, the network suddenly loses all robustness against multi-step attacks, its robust accuracy crashing to 0%.

Existing mitigations either sacrifice robustness (such as adding per-step uniform random noise in Fast-AT, which fails on larger networks or bigger perturbation budgets) or introduce heavy computational overhead (such as GradAlign, which demands an extra forward-backward propagation pass per step). This paper investigates simple, computationally light modifications to make FGSM-AT stable and robust.

Methods

The authors investigate solutions across three distinct dimensions:

  1. Data Initialization (Masking):
  2. FGSM-Mask: Instead of perturbing images with random noise, randomly zero-out a subset of image pixels (e.g., 30%) before computing the FGSM gradient perturbation.
  3. FGSM-Mask-Fixed: Pre-defines a fixed, deterministic pixel mask per image across the entire training process.
  4. Network Structure:
  5. Larger First-Layer Stride (FGSM-Str2): Inspired by Vision Transformers (ViTs), which downsample aggressively via patch projection and do not suffer from catastrophic overfitting, the authors increase the stride of the first convolutional layer in CNNs from 1 to 2 (adjusting a later stride to maintain output resolution).
  6. Smooth Activations (FGSM-Smooth): Replacing standard ReLU with smooth activations like Parametric SoftPlus ($\alpha=2$), GELU, ELU, or SiLU.
  7. Optimization Regularizers:
  8. GradNorm: Penalizes the $L_2$ norm of input gradients ($\mathbb{E}[\|\nabla_x \mathcal{L}\|_2]$), which abruptly spikes when overfitting occurs. (Effective, but computationally heavy due to second-order derivatives).
  9. WeightNorm: Enforces intermediate feature consistency between clean and perturbed samples at the first convolutional layer ($\omega_1 \delta$). By treating $\delta$ as a constant and only optimizing layer weights $\omega_1$, it bypasses expensive second-order backpropagation.
       Input Image x
             │
     ┌───────┴───────┐
     ▼               ▼
[Masking/Fixed Mask] [Increased Stride / Smooth Activation]
     │               │
     └───────┬───────┘
             ▼
      FGSM Generation
             │
             ▼
    [WeightNorm Loss] ──► Stable Adversarial Training

Datasets

The authors evaluate their methods on standard benchmark vision datasets without any external data:

  • CIFAR-10: Used for the primary experiments with PreActResNet-18 and WideResNet-34-10 under perturbation budgets $\epsilon \in [2/255, 16/255]$ ($l_\infty$-norm).
  • CIFAR-100: Used to verify scalability across more complex label distributions.

No new datasets or benchmarks are introduced.

Key Insights and Ideas

  • Randomness is not required for stability: Prior consensus assumed dynamic, per-iteration random noise initialization was necessary to break alignment and stop catastrophic overfitting. The authors overturn this: deterministic, offline fixed masking patterns (or even fixed noise per image) completely stabilize training.
  • Architectural inductive biases matter: Standard Vision Transformers (like Compact Vision Transformer, CVT) naturally avoid catastrophic overfitting even under large perturbation bounds ($\epsilon = 16/255$). Importing ViT characteristics—non-overlapping patch extraction (larger first-layer stride) and smooth non-linearities—prevents collapse in conventional CNNs.
  • First-layer feature alignment is sufficient: Instead of calculating expensive gradient-alignment penalties across the entire computational graph, regularizing the first layer’s weights against perturbation shift (WeightNorm) stabilizes training at virtually zero extra compute cost (42s/epoch vs. 40s/epoch for vanilla FGSM-AT, compared to 56s for GradAlign).

Key Results

  • PreActResNet-18 on CIFAR-10 ($\epsilon = 8/255$):
  • FGSM-Mask (30% ratio): Achieves 48.5% PGD-50-10 and 44.2% AutoAttack (AA) accuracy, beating Fast-AT (F+FGSM: 45.4% / 41.0%).
  • FGSM-Str2: Achieves 47.2% PGD-50-10 and 44.4% AA.
  • Synergistic Combinations: Combining Str2 + Smooth yields 49.8% PGD-50-10 and 46.4% AA—closing in on expensive PGD-10 multi-step training (51.9% / 48.2%) while remaining significantly faster.
  • Scalability to Large Models (WideResNet-34-10):
  • Fast-AT (F+FGSM) catastrophically collapses to 0.0% robust accuracy on WideResNet-34-10.
  • In contrast, architectural modifications like FGSM-Str2 retain 46.0% AA accuracy, and combining Str2 + Smooth reaches 50.4% PGD-50-10 and 47.3% AA.
  • Higher Perturbation & CIFAR-100:
  • When $\epsilon$ is pushed up to $16/255$, proposed methods preserve meaningful robustness where vanilla and Fast-AT break down.
  • On CIFAR-100, methods achieve $\approx 25\%$ PGD-50-10 accuracy, whereas vanilla FGSM-AT collapses to 0%.

Limitations and Future Work

  • Performance variation across model scales: Input masking alone degrades in efficacy on larger architectures (WideResNet-34-10 required high mask ratios of 70% and only reached 21–31% AA accuracy).
  • Sub-additive combinations: Combining certain tricks (e.g., Masking + Str2 or Masking + WeightNorm) yields diminishing or flat returns rather than additive gains.
  • Theoretical foundations: While the paper provides empirical insights linking first-layer strides and activation smoothness to loss surface geometry, a unified theoretical proof explaining why single-step training destabilizes in standard CNNs remains an open question for future work.

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