Skip to main content
QUICK REVIEW

[Paper Review] Towards Understanding Sharpness-Aware Minimization

Maksym Andriushchenko, Nicolas Flammarion|arXiv (Cornell University)|Jun 13, 2022
Domain Adaptation and Few-Shot LearningComputer Science11 citations
TL;DR

This paper provides a theoretical and empirical analysis of Sharpness-Aware Minimization (SAM), showing that SAM's implicit bias favors flatter minima and better generalization than standard SGD, especially when using m-sharpness. It proves convergence for non-convex objectives and demonstrates that SAM significantly improves generalization, particularly on intermediate-width models and under noisy labels.

ABSTRACT

Sharpness-Aware Minimization (SAM) is a recent training method that relies on worst-case weight perturbations which significantly improves generalization in various settings. We argue that the existing justifications for the success of SAM which are based on a PAC-Bayes generalization bound and the idea of convergence to flat minima are incomplete. Moreover, there are no explanations for the success of using $m$-sharpness in SAM which has been shown as essential for generalization. To better understand this aspect of SAM, we theoretically analyze its implicit bias for diagonal linear networks. We prove that SAM always chooses a solution that enjoys better generalization properties than standard gradient descent for a certain class of problems, and this effect is amplified by using $m$-sharpness. We further study the properties of the implicit bias on non-linear networks empirically, where we show that fine-tuning a standard model with SAM can lead to significant generalization improvements. Finally, we provide convergence results of SAM for non-convex objectives when used with stochastic gradients. We illustrate these results empirically for deep networks and discuss their relation to the generalization behavior of SAM. The code of our experiments is available at https://github.com/tml-epfl/understanding-sam.

Motivation & Objective

  • To address the incompleteness of existing justifications for SAM’s success based on PAC-Bayes bounds and flat minima convergence.
  • To investigate why m-sharpness in SAM is essential for generalization, especially in the context of worst-case weight perturbations.
  • To theoretically analyze SAM’s implicit bias in diagonal linear networks and empirically validate it in non-linear networks.
  • To establish convergence guarantees for SAM under stochastic gradients in non-convex optimization.
  • To relate SAM’s convergence behavior to its generalization performance through empirical evaluation on deep networks.

Proposed method

  • Theoretical analysis of SAM’s implicit bias in diagonal linear networks using m-sharpness as a key component.
  • Empirical study of SAM’s implicit bias in non-linear networks via fine-tuning standard models with SAM.
  • Derivation and proof of convergence for SAM in stochastic non-convex optimization settings.
  • Use of m-SAM with varying m (number of examples in worst-case perturbation) to assess impact on generalization.
  • Empirical evaluation using ResNet-18 and ResNet-34 on CIFAR-10 and CIFAR-100 with varying batch sizes, model widths, and perturbation radii.
  • Comparison of SAM with and without gradient normalization, and with decreasing perturbation radius ρ over time.

Experimental results

Research questions

  • RQ1Why is m-sharpness critical for SAM’s generalization performance, and how does it differ from average-case robustness?
  • RQ2Does SAM’s implicit bias consistently favor flatter, better-generalizing minima compared to standard SGD in linear and non-linear settings?
  • RQ3How does SAM’s convergence behavior relate to its generalization performance in non-convex deep learning objectives?
  • RQ4What is the impact of varying m (number of examples used in worst-case perturbation) on generalization and training stability?
  • RQ5How does SAM perform under label noise, and does gradient normalization or decreasing perturbation radius ρ affect its performance?

Key findings

  • SAM consistently selects solutions with better generalization than standard SGD in diagonal linear networks, and this effect is amplified by using m-sharpness.
  • Empirical results show that fine-tuning a standard model with SAM leads to significant generalization improvements, especially on intermediate-width models (e.g., width factor 16 shows largest gains).
  • SAM with m equal to the batch size achieves marginal improvements over standard SGD, but cannot fully close the generalization gap between large-batch and small-batch SGD.
  • Decreasing the perturbation radius ρ over time is detrimental to generalization, suggesting that a constant ρ is preferable for convergence and performance.
  • SAM with and without gradient normalization achieve nearly identical test error under 60% label noise, indicating robustness to gradient normalization in noisy settings.
  • The training objective for SAM shows a consistent decreasing trend, confirming that increasing training error is not due to optimization failure but rather a property of the objective landscape.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.