Stability Analysis of Sharpness-Aware Minimization

Hoki Kim, Jinseong Park, Yujin Choi, Jaewook Lee

TL;DR

Sharpness-Aware Minimization (SAM) is a powerful technique for improving deep learning generalization by finding "flat" minima. However, this paper reveals that SAM can get stuck at saddle points, a common feature in deep learning loss landscapes, leading to convergence instability. The authors demonstrate that SAM's diffusion is worse than standard gradient descent for escaping these saddle points, but surprisingly, common training tricks like momentum and batch size can significantly mitigate this issue.

What Problem Does This Paper Address?

Deep learning models, despite achieving low training error, often struggle with generalization to unseen data. This phenomenon is linked to the "flatness" of the loss landscape: flatter minima tend to generalize better. Sharpness-Aware Minimization (SAM) was proposed to address this by optimizing for the worst-case loss within a small neighborhood of the current parameters, effectively encouraging flatter minima. While SAM has shown impressive performance gains, its behavior near saddle points – critical points where the gradient is zero but the loss is not a minimum in all directions – has remained unclear. Saddle points are ubiquitous in high-dimensional deep learning landscapes, and if SAM gets trapped in them, its generalization benefits could be undermined. This paper investigates this potential failure mode, aiming to understand why and how SAM can become unstable near saddle points.

Methods

The authors employ a multi-pronged approach:

  • Dynamical Systems Theory: They analyze SAM's behavior near saddle points using the qualitative theory of dynamical systems. This involves treating the optimization process as a continuous-time gradient flow and examining the stability of equilibrium points and the structure of their stable and unstable manifolds.
  • Theoretical Analysis: They derive conditions under which saddle points can become attractors for SAM dynamics, meaning SAM might converge to them instead of escaping. They also extend this analysis to stochastic settings, modeling SAM's diffusion and proving it's worse than vanilla gradient descent for escaping saddle points.
  • Empirical Validation: The theoretical findings are tested on various optimization problems, including the Beale function and a toy neural network with a known saddle point. They also conduct experiments on CIFAR-10 and CIFAR-100 datasets using ResNet-18 to evaluate the impact of training tricks.

Datasets

  • Beale function: A standard 2D optimization problem used to illustrate SAM's behavior near a saddle point.
  • Double-well potential function: Another 1D optimization problem used to demonstrate SAM's tendency to get stuck at saddle points.
  • Toy neural network: A custom-built two-layer neural network with a non-linear activation function, designed to have a specific saddle point for controlled experiments.
  • CIFAR-10 and CIFAR-100: Standard image classification datasets used to evaluate SAM's performance on benchmark tasks with a ResNet-18 architecture.

Key Insights and Ideas

  • Saddle points as attractors: SAM's mechanism of minimizing worst-case loss can, counter-intuitively, make saddle points act as attractors, preventing escape. This is a direct consequence of how SAM perturbs the weights.
  • Worse diffusion than SGD: In stochastic settings, SAM exhibits greater diffusion than standard SGD, meaning it's less effective at escaping saddle points. This is a critical finding that challenges the assumption that SAM always improves optimization dynamics.
  • Momentum and batch size are crucial: The paper reveals that seemingly "overlooked" training tricks like momentum and batch size play a vital role in mitigating SAM's saddle point instability. Larger momentum and smaller batch sizes can help SAM escape these problematic regions.
  • Trade-off between sharpness and escape: SAM's pursuit of flatness (sharpness-awareness) inherently makes it harder to escape saddle points, creating a trade-off that needs to be managed.

Key Results

  • Theoretical proof: The paper provides theoretical conditions under which a saddle point becomes an attractor for SAM dynamics (Theorem 1).
  • Stochastic analysis: SAM's diffusion is shown to be worse than SGD's, leading to slower escape from saddle points (Theorem 2 and Corollary 1).
  • Empirical demonstration: Experiments on the Beale function and a toy neural network visually confirm SAM getting stuck at saddle points, while SGD escapes.
  • Impact of training tricks: Experiments on CIFAR datasets show that increasing momentum significantly improves SAM's performance and generalization, especially when combined with larger perturbation radii. For instance, a higher momentum (γ=0.95) can improve SAM's accuracy by over 20% compared to SGD.

Limitations and Future Work

  • Generalization to complex networks: While the theoretical framework is established for general dynamical systems, its direct applicability to the highly complex and non-convex loss landscapes of very deep neural networks requires further investigation.
  • Understanding SAM's success: The paper acknowledges that SAM generally improves performance despite its saddle point issues. Further work is needed to reconcile this observed success with the theoretical findings on convergence instability.
  • Optimizing training tricks: The paper highlights the importance of momentum and batch size. Future research could explore how to optimally tune these hyperparameters for SAM in various scenarios.
  • Transient attraction vs. permanent trapping: The paper's findings suggest that SAM might permanently trap at saddle points, contrasting with some theories that attribute SAM's success to transient attraction to saddle regions. Further investigation into this distinction is warranted.

Summary updated

BibTeX
@inproceedings{kim2026stability,
  author = {Hoki Kim and Jinseong Park and Yujin Choi and Jaewook Lee},
  title = {{Stability Analysis of Sharpness-Aware Minimization}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=tNvmMTsRqh},
}
Figure