Smooth Adversarial Training

Cihang Xie, Mingxing Tan, Boqing Gong, Alan L. Yuille, Quoc V. Le

Abstract: It is commonly believed that networks cannot be both accurate and robust, that gaining robustness means losing accuracy. It is also generally believed that, unless making networks larger, network architectural elements would otherwise matter little in improving adversarial robustness. Here we present evidence to challenge these common beliefs by a careful study about adversarial training. Our key observation is that the widely-used ReLU activation function significantly weakens adversarial training due to its non-smooth nature. Hence we propose smooth adversarial training (SAT), in which we replace ReLU with its smooth approximations to strengthen adversarial training. The purpose of smooth activation functions in SAT is to allow it to find harder adversarial examples and compute better gradient updates during adversarial training. Compared to standard adversarial training, SAT improves adversarial robustness for "free", i.e., no drop in accuracy and no increase in computational cost. For example, without introducing additional computations, SAT significantly enhances ResNet-50's robustness from 33.0% to 42.3%, while also improving accuracy by 0.9% on ImageNet. SAT also works well with larger networks: it helps EfficientNet-L1 to achieve 82.2% accuracy and 58.6% robustness on ImageNet, outperforming the previous state-of-the-art defense by 9.5% for accuracy and 11.6% for robustness.

Introduction: The Robustness-Accuracy Trade-off

Adversarial training (AT) is currently the most effective defense against adversarial examples—inputs meticulously designed to deceive neural networks. Despite its effectiveness, AT has long been associated with two significant drawbacks: a persistent trade-off where robustness comes at the cost of clean accuracy, and a "scaling wall" suggesting that substantial robustness gains require massive increases in model size.

This research identifies a fundamental architectural bottleneck: the Rectified Linear Unit (ReLU). While ReLU is standard in deep learning, its first derivative is discontinuous, jumping abruptly from 0 to 1 at the origin. In adversarial training, gradients are used both to generate "hard" adversarial examples (the inner loop) and to update model weights (the outer loop). The non-smooth nature of ReLU gradients introduces noise and instability, hindering both processes.

Comparison of ReLU and Parametric Softplus gradients.

Smooth Adversarial Training (SAT)

To address this, the authors propose Smooth Adversarial Training (SAT). The core idea is to replace ReLU with smooth, $C^1$ continuous activation functions. By ensuring the first derivative is continuous, SAT provides higher-quality gradients that allow the attacker to find more effective adversarial examples and the optimizer to find better weight updates.

The study explores several smooth approximations of ReLU, including:

  • Parametric Softplus: A smooth version of ReLU controlled by a sharpness parameter.
  • SILU (Swish): $x \cdot \sigma(x)$, which is smooth and non-monotonic.
  • GELU: Gaussian Error Linear Unit.
  • ELU: Exponential Linear Unit.
  • SmoothReLU: A custom variant designed to isolate the effect of smoothness from other properties like negative responses.
Smooth activation functions evaluated in SAT.

The authors also conducted ablation studies to confirm that the benefit stems specifically from gradient quality. By using smooth gradients only during the backward pass while maintaining ReLU in the forward pass, they isolated the impact of smoothness on the optimization landscape.

Key Results and Scaling

SAT demonstrates that robustness can be improved without sacrificing accuracy. On the ImageNet benchmark, applying SAT to a standard ResNet-50 using the SILU activation function increased adversarial robustness from 33.0% to 42.3% (+9.3%) while simultaneously improving clean accuracy by 0.9%. This result effectively challenges the notion of an inherent trade-off.

Furthermore, SAT synergizes with model scaling. When applied to the EfficientNet-L1 architecture, SAT achieved 82.2% clean accuracy and 58.6% robustness, outperforming previous state-of-the-art defenses by significant margins (9.5% in accuracy and 11.6% in robustness). Loss landscape visualizations further support these findings, showing that SAT results in a much smoother and more stable optimization surface compared to the "jagged" landscape produced by ReLU-based training.

Discussion and Limitations

While SAT provides a "free" boost in robustness and accuracy on ImageNet, results on smaller datasets like CIFAR-10 were more varied. Some smooth functions performed worse than ReLU on CIFAR-10, suggesting sensitivity to dataset scale or hyperparameters. Additionally, while activation functions were the focus, other non-smooth components like max-pooling remain. Future work could explore fully smooth architectures by replacing max-pooling with average pooling or strided convolutions.

In conclusion, Smooth Adversarial Training reveals that architectural smoothness is a critical, yet previously overlooked, factor in building robust and accurate neural networks. By simply replacing ReLU with smooth alternatives, researchers can significantly enhance model performance in adversarial settings without additional computational overhead.

Summary updated

BibTeX
@misc{xie2020smooth,
  author = {Cihang Xie and Mingxing Tan and Boqing Gong and Alan L. Yuille and Quoc V. Le},
  title = {{Smooth Adversarial Training}},
  year = {2020},
  eprint = {2006.14536},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2006.14536},
}
Figure