Introduction
Sharpness-Aware Minimization (SAM) has emerged as a highly effective optimization technique in deep learning. By seeking out "flat" minima—regions in the loss landscape where the loss remains consistently low despite small perturbations—SAM helps models generalize better to unseen data. However, the standard implementation of SAM introduces a subtle practical mismatch. While theory dictates following the gradient of a surrogate loss, the algorithm actually uses a shifted gradient: it calculates the gradient at a point perturbed by a distance $\rho$ and applies that update to the original point.
This paper reveals a critical flaw stemming from this shifted gradient approach: SAM can stall at "hallucinated minimizers." These are deceptive points in the loss landscape where the shifted gradient vanishes, tricking the optimizer into halting, even though the original loss gradient remains significantly large.
The Mechanics of Hallucinated Minimizers
To understand why SAM gets trapped, the authors combine dynamical systems analysis with geometric proofs. They identify an "alignment trap" that occurs when the gradient at a point $x$ points directly toward a true minimizer located exactly at the perturbation distance $\rho$. Because the gradient at that distant point is zero, the SAM update evaluates to zero, and the optimizer stalls.
Key theoretical insights regarding these hallucinated points include:
- Non-convexity is a Prerequisite: The authors mathematically prove that hallucinated minimizers cannot exist in strictly convex landscapes. They are a unique byproduct of the complex, non-convex terrain inherent to neural networks (e.g., landscapes containing both local minimizers and local maximizers).
- The Large-$\rho$ Problem: The emergence of these traps is heavily tied to the size of the perturbation radius. As $\rho$ increases, the optimizer reaches further across the landscape, increasing the likelihood of getting snagged on a distant minimizer's zero gradient. This explains the long-observed phenomenon of SAM's performance degrading or destabilizing at large $\rho$ values.
- Manifold Inheritance: If the original loss landscape features a continuous "valley" (manifold) of minima, the hallucinated minimizers will often form a corresponding smooth manifold of the same dimension.
Empirical Evidence and the SGD Warm-Start Solution
The researchers validated their theoretical claims through experiments on standard computer vision benchmarks, including MNIST, CIFAR-10, and CIFAR-100.
In full-batch MNIST experiments using a 2-layer Tanh network (providing a smooth, "real-analytic" landscape that matches their theoretical assumptions), the authors directly verified the existence of these traps. At a radius of $\rho=1.8$, they observed points where the SAM shifted gradient was nearly zero ($4.8 \times 10^{-9}$), while the original gradient was still substantial ($6.27 \times 10^{-2}$).
To combat this failure mode, the authors propose a practical safeguard: an SGD warm-start. Early in training, model iterates reside in high-loss regions where they are highly susceptible to falling into hallucinated basins. By running standard Stochastic Gradient Descent (SGD) for the first 10% of training, the model is moved into safer, lower-loss geometries before SAM is enabled.
Tests on CIFAR-100 using a ResNet-18 architecture demonstrated the efficacy of this approach. While SAM-only training became increasingly unstable and frequently failed to converge as $\rho$ grew, the SGD $\to$ SAM switching strategy remained stable. It not only achieved higher peak accuracy (77.49% vs. 77.05%) but also significantly reduced the model's sensitivity to the choice of $\rho$, making the optimizer much easier to tune.
Limitations and Future Directions
While this paper provides a robust explanation for SAM's large-$\rho$ degradation, several open questions remain:
- Smoothness Assumptions: The formal proofs rely on "real-analytic" (highly smooth) functions. Although empirical results confirm the same failure modes in non-smooth ReLU networks, extending the mathematical proofs to these architectures remains an open challenge.
- Stochasticity: The core theory is built around deterministic (full-batch) SAM. A rigorous theoretical framework for hallucinated minimizers in stochastic (mini-batch) settings is still needed.
- Alternative SAM Variants: Future work must explore whether variants like Adaptive SAM (ASAM) or Surrogate Gap Minimization (GSAM) are equally susceptible to these optimization ghosts.
Summary updated