A Universal Class of Sharpness-Aware Minimization Algorithms

Behrooz Tahmasebi, Ashkan Soleymani, Dara Bahri, Stefanie Jegelka, Patrick Jaillet

Introduction

In deep learning, achieving zero training loss is rarely the final goal; the true objective is generalization to unseen data. A long-standing hypothesis in the field suggests that "flat" minima—regions of the loss landscape where the loss changes slowly with respect to parameter perturbations—generalize better than "sharp" ones. Sharpness-Aware Minimization (SAM) has emerged as a leading technique to explicitly seek these flat regions. However, standard SAM and its variants often rely on specific, sometimes limited, definitions of sharpness.

The Challenges of Non-Convexity and Scale

Existing sharpness measures face two significant hurdles. First, many measures, such as the trace or the maximum eigenvalue of the Hessian, are most intuitive in convex settings. In the highly non-convex landscapes of modern neural networks, these measures can be misleading. For instance, a saddle point might have a zero trace despite being "sharp" in certain directions.

A non-convex loss landscape illustrating the complexity of identifying true flatness in neural networks.

Second, neural networks often exhibit parameter invariance. In architectures like ReLU networks, weights can be rescaled across layers without changing the model's output. Standard sharpness measures are typically sensitive to such scaling, meaning the "sharpness" value can change drastically even when the underlying function remains identical.

A Universal Framework for Sharpness

To address these limitations, researchers have proposed a unified mathematical framework that can represent any continuous function of the Hessian. This framework defines sharpness through a triplet $(\phi, \psi, \mu)$:

  • $\mu$ (The Measure): Determines how directions are sampled around a point.
  • $\psi$ and $\phi$ (The Functions): Define the transformation and aggregation of curvature information along those directions.

By varying these hyperparameters, the framework can recover existing measures or generate entirely new ones tailored to specific needs.

Table of hyperparameters $(\phi, \psi, m, \mu)$ and the resulting sharpness measures $S(x; \phi, \psi, \mu)$ derived from the universal framework.

New Algorithms: Frob-SAM and Det-SAM

Leveraging this universality, two novel algorithms were introduced:

  1. Frob-SAM: This algorithm targets the Frobenius norm of the Hessian. Unlike measures that only look at the average or maximum curvature, the Frobenius norm considers the magnitude of all curvatures simultaneously, making it significantly more robust in non-convex regions.
  2. Det-SAM: This algorithm minimizes the determinant of the Hessian. Its primary advantage is scale-invariance, ensuring that the optimization process isn't biased by arbitrary weight rescaling.

Experimental Results and Insights

The effectiveness of these new "flavors" of sharpness was tested across standard benchmarks including CIFAR-10, CIFAR-100, and SVHN. The results highlight several key advantages:

  • Superior Generalization: Frob-SAM and Det-SAM consistently outperformed standard SGD and often surpassed standard SAM.
  • Robustness in Data-Scarce Regimes: On sub-sampled datasets (e.g., CIFAR10-S with only 10% of data), Frob-SAM achieved a 1.5% improvement in test accuracy over standard SAM, suggesting that more sophisticated sharpness measures provide stronger regularization when data is limited.
  • Noisy Label Resilience: In experiments with corrupted labels (CIFAR10-C), Frob-SAM outperformed SAM by over 2%. This indicates that minimizing the Frobenius norm helps prevent the model from overfitting to label noise.

Conclusion

The introduction of a universal class of sharpness measures moves the field beyond a "one-size-fits-all" approach to flatness. By providing a mathematical construction kit for sharpness, this research allows practitioners to choose or even design measures that are robust to non-convexity and scale. While the computational cost remains higher than standard SGD, the significant gains in generalization and robustness—especially in challenging data environments—make these advanced SAM variants a powerful tool for modern machine learning.

Summary updated

BibTeX
@inproceedings{tahmasebi2024universal,
  author = {Behrooz Tahmasebi and Ashkan Soleymani and Dara Bahri and Stefanie Jegelka and Patrick Jaillet},
  title = {{A Universal Class of Sharpness-Aware Minimization Algorithms}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=9Ub6nLqdMo},
}
Figure