Sharpness-Aware Minimization Can Hallucinate Minimizers

Chanwoong Park, Uijeong Jang, Ernest K. Ryu, Insoon Yang

TL;DR

Sharpness-Aware Minimization (SAM) is a highly popular optimization technique designed to find flat minima for better generalization. This paper reveals a critical flaw: due to a subtle mismatch between SAM's theoretical loss formulation and its practical implementation, the algorithm can permanently stall at non-optimal points where the gradient appears to vanish but is actually non-zero. The authors formalize these points as "hallucinated minimizers" and demonstrate that a simple initial SGD warm-start effectively mitigates this failure mode.

What Problem Does This Paper Address?

SAM works by solving a min-max problem: it finds a perturbation within a radius $\rho$ that maximizes the loss (finding the sharpest nearby point), and then updates the weights to minimize this worst-case loss. Theoretically, this minimizes a smooth surrogate loss $f^{\text{SAM}}(x)$.

However, computing the exact gradient of this surrogate loss is computationally expensive. To save time, standard implementations use a shortcut: they compute the gradient at the perturbed point ($x^+$) and use that directly to update the original weights.

This paper addresses the mathematical gap created by this implementation shortcut. Because the update rule relies entirely on the gradient at the perturbed point ($\nabla f(x^+)$), the optimization process can completely stall whenever $\nabla f(x^+) = 0$, even if the true gradient at the current point ($\nabla f(x)$) is large. This means SAM can converge to completely arbitrary, non-optimal points of the original loss function, a phenomenon that becomes particularly severe when using larger perturbation radii ($\rho$).

Illustrative example of hallucinated minimizers showing how the practical SAM gradient field creates attractors that do not correspond to actual minimizers of the loss.

Methods

The authors tackle this problem through a combination of geometric proofs, dynamical systems analysis, and empirical validation:

  • Theoretical Formalization: They define "hallucinated minimizers" as points where the shifted gradient vanishes ($\nabla f(x^+) = 0$) while the original gradient does not ($\nabla f(x) \neq 0$), and show that these points act as local minimizers of the surrogate loss.
  • Geometric Existence Proofs: They prove that these points are guaranteed to exist in nonconvex landscapes where local minimizers and maximizers coexist. For complex landscapes with non-isolated maximizers (like plateaus), they use the Łojasiewicz inequality to prove existence under real-analyticity assumptions.
  • Stability Analysis: They establish sufficient conditions under which these hallucinated minimizers form locally attracting basins (attractors) for discrete-time SAM dynamics, meaning the optimizer will actively get sucked into them and get stuck.
  • Algorithmic Safeguard: They propose a simple, zero-overhead fix: an initial SGD warm-start (running standard SGD for the first 10% of training) before enabling SAM. This pushes the optimization trajectory away from high-loss maximizer regions where hallucinated minimizers are likely to trap the model.

Datasets

The authors validate their findings using standard machine learning benchmarks:

  • MNIST: Paired with a 2-layer Tanh network in a smooth, full-batch setting to directly verify the theoretical assumptions and visualize the loss landscapes.
  • CIFAR-10 & CIFAR-100: Evaluated using a ResNet-18 architecture under both full-batch (deterministic) and mini-batch (stochastic) training settings to demonstrate the failure mode in realistic deep learning scenarios.

Key Insights and Ideas

  • The Implementation Mismatch Matters: The core issue isn't SAM's underlying theory, but the mathematical gap between the theoretical surrogate gradient $\nabla f^{\text{SAM}}(x)$ and the practically implemented shifted gradient $\nabla f(x^+)$.
  • Nonconvexity is a Prerequisite: This failure mode cannot happen in purely convex landscapes. It requires local maximizers or plateaus where gradients can align to point directly toward a minimizer from a distance $\rho$.
  • Explaining the Large-$\rho$ Degradation: Practitioners have long noted that SAM's performance degrades drastically if the perturbation radius $\rho$ is set too large. This paper provides the exact mechanism for why: larger radii make it much easier for the algorithm to "hallucinate" minimizers near high-loss regions.
  • Manifold Inheritance: Hallucinated minimizers aren't just isolated freak points; they can form continuous, smooth manifolds that inherit the exact dimensionality of the true underlying minimizer manifolds.

Key Results

  • Direct Verification: In full-batch MNIST training with $\rho = 1.8$, SAM stalled at a point where the shifted gradient norm was nearly zero ($\approx 4.8 \times 10^{-9}$) while the true gradient norm was highly significant ($\approx 6.27 \times 10^{-2}$).
  • Performance Collapse: On MNIST, sweeping larger values of $\rho$ caused a substantial fraction of standard SAM runs to plateau at high training losses and suffer severe test accuracy drops.
  • Warm-Start Mitigation: Introducing a 10% SGD warm-start completely eliminated these plateaus, stabilizing training across all values of $\rho$ and preventing accuracy collapse on both MNIST and CIFAR datasets.

Limitations and Future Work

  • Deterministic vs. Stochastic Theory: The formal mathematical proofs for existence and local attraction are derived for deterministic, full-batch settings. While empirical evidence shows the failure mode persists in stochastic mini-batch training, a rigorous stochastic theory is left for future work.
  • Smoothness Assumptions: The proofs rely heavily on smoothness or real-analyticity (which technically rules out standard ReLU networks from the formal proofs, though empirical signatures were still observed in ReLU-based ResNets).
  • Other SAM Variants: The paper focuses strictly on standard SAM. It remains an open question how other variants (like ASAM or GSAM) amplify or suppress these hallucinated minimizers.

Summary updated

BibTeX
@inproceedings{park2026sharpness,
  author = {Chanwoong Park and Uijeong Jang and Ernest K. Ryu and Insoon Yang},
  title = {{Sharpness-Aware Minimization Can Hallucinate Minimizers}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=7xwOy8C00l},
}
Figure