How do SGD hyperparameters in natural training affect adversarial robustness?

Sandesh Kamath, Amit Deshpande, K. V. SubrahmanyamarXiv 2020

Introduction

The efficiency of large-batch Stochastic Gradient Descent (SGD) is a cornerstone of modern deep learning, yet it often introduces a "generalization gap" and increased vulnerability to adversarial attacks. Conventional wisdom suggests that models trained with large batches settle into "sharp" minima in the loss landscape, which are inherently more sensitive to the small input perturbations characteristic of adversarial examples. This study investigates how standard SGD hyperparameters—learning rate (LR), batch size (BS), and momentum—influence the intrinsic adversarial robustness of models trained solely on clean data.

Methodology

The researchers evaluated the impact of hyperparameter tuning across three distinct regimes:

  1. Fixed Learning Rate: Varying the batch size while keeping the learning rate constant.
  2. Constant LR/BS Ratio: Scaling the learning rate linearly with the batch size to maintain a consistent ratio.
  3. Standard Benchmark: Utilizing a decaying learning rate schedule with a fixed momentum of 0.9.

Robustness was assessed using the Fast Gradient Sign Method (FGSM) and Projected Gradient Descent (PGD) attacks. To analyze the geometry of the loss landscape, the authors calculated the top eigenvalue of the Hessian matrix as a proxy for local curvature (sharpness). Experiments were conducted on MNIST, Fashion MNIST, and CIFAR-10 datasets using several architectures, including ResNet18 and the custom convolutional models detailed below.

Architectural specifications for the convolutional neural networks used in the study, including StdCNN and M1.

Key Insights: The LR/BS Ratio and the Sharpness Myth

A primary finding of this research is the stabilizing effect of the LR/BS ratio. While increasing batch size typically degrades robustness in standard setups, maintaining a constant ratio between the learning rate and batch size acts as a "robustness anchor," keeping adversarial accuracy remarkably stable across a wide range of batch sizes.

Furthermore, the study challenges the prevailing theory that loss landscape sharpness (measured by the Hessian spectrum) is a definitive predictor of adversarial vulnerability. In a notable counter-example using the StdCNN architecture on Fashion MNIST, the authors observed that models trained with larger batches exhibited both higher Hessian eigenvalues (sharper minima) and increased FGSM accuracy. This suggests that the relationship between curvature and robustness is more nuanced than previously assumed.

Results and Observations

  • Stability through Scaling: In the constant LR/BS regime, both natural and adversarial accuracy showed minimal variation across different batch sizes, providing a reliable method for scaling training without sacrificing baseline robustness.
  • Momentum Effects: Momentum was found to be a potent "smoothing agent." Higher momentum values generally led to flatter minima and improved robustness, particularly in fixed-LR training scenarios.
  • Curvature vs. Robustness: The identification of cases where sharpness and robustness increase simultaneously indicates that local curvature is not the sole determinant of a model's sensitivity to perturbations.

Conclusion

This work demonstrates that the inherent adversarial robustness of naturally trained models is significantly influenced by SGD hyperparameter choices. By adhering to specific scaling rules, such as maintaining a constant LR/BS ratio, researchers can preserve robustness even when utilizing large-batch training for efficiency. While these naturally trained models do not reach the robustness levels of those specifically trained with adversarial examples, these insights provide a crucial foundation for optimizing hyperparameters in more advanced robust training frameworks.

Summary updated

BibTeX
@misc{kamath2020how,
  author = {Sandesh Kamath and Amit Deshpande and K. V. Subrahmanyam},
  title = {{How do SGD hyperparameters in natural training affect adversarial robustness?}},
  year = {2020},
  eprint = {2006.11604},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2006.11604},
}
Figure