[Paper Review] Surrogate Gap Minimization Improves Sharpness-Aware Training
This paper proposes GSAM, a novel training method that improves Sharpness-Aware Minimization (SAM) by introducing a surrogate gap—a computationally efficient proxy for Hessian-based sharpness—enabling direct minimization of sharpness alongside loss. GSAM performs two steps per update: minimizing the perturbed loss (as in SAM) and ascending in the orthogonal direction to reduce the surrogate gap, resulting in flatter minima and improved generalization, with a 5.4% top-1 accuracy gain over AdamW on ViT-B/32 for ImageNet.
The recently proposed Sharpness-Aware Minimization (SAM) improves generalization by minimizing a extit{perturbed loss} defined as the maximum loss within a neighborhood in the parameter space. However, we show that both sharp and flat minima can have a low perturbed loss, implying that SAM does not always prefer flat minima. Instead, we define a extit{surrogate gap}, a measure equivalent to the dominant eigenvalue of Hessian at a local minimum when the radius of the neighborhood (to derive the perturbed loss) is small. The surrogate gap is easy to compute and feasible for direct minimization during training. Based on the above observations, we propose Surrogate extbf{G}ap Guided extbf{S}harpness- extbf{A}ware extbf{M}inimization (GSAM), a novel improvement over SAM with negligible computation overhead. Conceptually, GSAM consists of two steps: 1) a gradient descent like SAM to minimize the perturbed loss, and 2) an extit{ascent} step in the extit{orthogonal} direction (after gradient decomposition) to minimize the surrogate gap and yet not affect the perturbed loss. GSAM seeks a region with both small loss (by step 1) and low sharpness (by step 2), giving rise to a model with high generalization capabilities. Theoretically, we show the convergence of GSAM and provably better generalization than SAM. Empirically, GSAM consistently improves generalization (e.g., +3.2\% over SAM and +5.4\% over AdamW on ImageNet top-1 accuracy for ViT-B/32). Code is released at \url{ https://sites.google.com/view/gsam-iclr22/home}.
Motivation & Objective
- To address the limitation of SAM, which can yield low perturbed loss in both sharp and flat minima, by identifying a more reliable measure of sharpness.
- To define a computationally tractable surrogate gap that approximates the dominant Hessian eigenvalue at local minima, especially for small neighborhood radii.
- To develop a training method that jointly minimizes perturbed loss and surrogate gap to achieve flatter minima and better generalization.
- To prove convergence of the proposed GSAM algorithm and establish its theoretical superiority over SAM in generalization performance.
- To empirically validate GSAM across diverse architectures (ResNets, Vision Transformers, MLP-Mixer) with consistent improvements over SAM and baseline optimizers.
Proposed method
- Define the surrogate gap as $ h(w) = f_p(w) - f(w) $, where $ f_p(w) $ is the perturbed loss and $ f(w) $ is the standard loss, which approximates the dominant Hessian eigenvalue at local minima.
- Decompose the gradient $ \nabla f(w) $ into components parallel and orthogonal to $ \nabla f_p(w) $, enabling targeted optimization in the orthogonal direction.
- Perform a gradient descent step on $ f_p(w) $ to minimize the perturbed loss, preserving the SAM update rule.
- Apply an ascent step along the orthogonal component $ \nabla_\perp f(w) $ to minimize the surrogate gap $ h(w) $, without altering $ f_p(w) $ due to orthogonality.
- Introduce a hyperparameter $ \alpha $ to control the magnitude of the ascent step, allowing flexible trade-off between loss and sharpness minimization.
- Ensure theoretical convergence by assuming a decaying neighborhood radius $ \rho_t $, which supports the convergence analysis of GSAM.
Experimental results
Research questions
- RQ1Can the perturbed loss in SAM reliably distinguish between sharp and flat minima, or can it be low in both?
- RQ2Is there a computationally efficient alternative to Hessian-based sharpness measures that can be used during training?
- RQ3Can minimizing a surrogate gap—defined as the difference between perturbed and standard loss—effectively guide optimization toward flatter minima?
- RQ4Does a two-step update strategy, combining perturbed loss descent and orthogonal ascent to reduce the surrogate gap, lead to better generalization than SAM?
- RQ5Can GSAM be theoretically shown to converge and provably generalize better than SAM under standard assumptions?
Key findings
- The surrogate gap $ h(w) = f_p(w) - f(w) $ is theoretically equivalent to the dominant Hessian eigenvalue at a local minimum when the neighborhood radius $ \rho $ is small, making it a valid and efficient sharpness proxy.
- GSAM achieves a 3.2% improvement in top-1 accuracy over SAM and a 5.4% improvement over AdamW on ImageNet using ViT-B/32, demonstrating consistent generalization gains.
- The ascent step in GSAM, which minimizes the surrogate gap, is the primary driver of performance improvement, as shown by ablation studies with both constant and decayed $ \rho_t $ schedules.
- Empirical validation shows that $ \cos\theta_t $, the cosine of the angle between $ \nabla f(w) $ and $ \nabla f_p(w) $, remains above 0.9 throughout training, supporting the theoretical assumption that the gradients are nearly aligned in high-dimensional parameter space.
- The surrogate gap decreases with increasing $ \alpha $, and increases with training steps, indicating that GSAM successfully drives the model toward flatter minima over time.
- GSAM is widely applicable and incurs negligible computational overhead compared to SAM, making it practical for large-scale training.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.