Enhancing Sharpness-Aware Optimization Through Variance Suppression

Bingcong Li, Georgios B. Giannakis

Abstract

Sharpness-Aware Minimization (SAM) has emerged as a powerful technique for improving the generalization of deep neural networks by seeking parameters in "flat" regions of the loss landscape. However, SAM's effectiveness is often limited by the stochastic noise inherent in minibatch gradients, which can lead to "friendly adversaries" that fail to reflect global sharpness. This paper introduces Variance-Suppressed Sharpness-Aware Optimization (VaSSO), a novel approach that stabilizes the adversarial perturbation using an exponentially moving average of gradients. Our results demonstrate that VaSSO consistently outperforms standard SAM and its variants across multiple benchmarks, showing particular resilience to label noise and converging to significantly flatter minima.

Introduction

Deep neural networks are prone to overfitting, often converging to sharp minima that generalize poorly to unseen data. Sharpness-Aware Minimization (SAM) addresses this by optimizing for both low training loss and low curvature. It achieves this by identifying an adversarial perturbation—a small change in parameters that maximizes local loss—and then updating the model based on the gradient at this perturbed location.

While effective, SAM relies on minibatch-based stochastic gradients to calculate these perturbations. This reliance introduces a significant bottleneck: the "friendly adversary" problem. Because a single minibatch does not represent the entire dataset, a perturbation that appears adversarial for one batch may inadvertently decrease the loss for others. This misalignment prevents SAM from accurately identifying truly flat regions of the global loss landscape.

The "Friendly Adversary" Problem

The core of the SAM algorithm is the search for a perturbation $\epsilon$ that maximizes the loss $L(w + \epsilon)$. In practice, this $\epsilon$ is calculated using the gradient of the current minibatch. If the variance between minibatches is high, the resulting perturbation becomes a "friendly adversary"—it increases the loss for the current batch but aligns with the descent direction of the global loss, failing to impose the intended sharpness penalty. The authors demonstrate that when perturbations are intentionally aligned with the gradients of different batches, the generalization benefits of SAM vanish, highlighting the critical need for stable, variance-reduced adversaries.

Variance-Suppressed Sharpness-Aware Optimization (VaSSO)

To mitigate the noise in perturbation calculation, we propose VaSSO (Variance-Suppressed Sharpness-Aware Optimization). Instead of using the instantaneous minibatch gradient to determine the perturbation, VaSSO utilizes a slope vector ($d_t$), which is maintained as an Exponentially Moving Average (EMA) of previous stochastic gradients:

$$d_t = (1 - \theta)d_{t-1} + \theta g_t(x_t)$$

By smoothing the gradient signal, VaSSO suppresses high-frequency noise and ensures that the adversarial perturbation reflects the broader geometry of the loss landscape. This approach provides several key advantages:

  1. Stability: Theoretical analysis shows that VaSSO is qualitatively $\sqrt{\theta}$ times more stable than standard SAM.
  2. Efficiency: VaSSO can be implemented with no additional memory overhead compared to standard SAM, as the slope vector replaces or augments existing momentum buffers.
  3. Theoretical Rigor: The paper provides convergence proofs for VaSSO that do not rely on the restrictive "bounded gradient" assumptions common in previous optimization literature.

Experimental Evaluation

Generalization Performance

VaSSO was evaluated across a variety of architectures (ResNet, WideResNet, PyramidNet, and ViT) and datasets (CIFAR-10, CIFAR-100, ImageNet, and IWSLT-14). On CIFAR benchmarks, VaSSO consistently outperformed SAM and other advanced variants like ASAM and FisherSAM by margins of 0.2% to 0.3%. On ImageNet, combining VaSSO with GSAM achieved a top-1 accuracy of 77.48% on ResNet-50, a notable improvement over the 77.16% achieved by vanilla SAM.

Robustness to Label Noise

One of the most significant strengths of VaSSO is its performance in the presence of label noise. Label noise typically increases gradient variance, which severely degrades the performance of standard SAM. In experiments on CIFAR-10 with 75% synthetic label noise, VaSSO (with $\theta=0.2$) achieved an accuracy of 85.02%, representing a nearly 10% improvement over standard SAM's 75.36%. The EMA-based smoothing effectively filters out the erratic signals produced by mislabeled samples.

Landscape Analysis

To verify that VaSSO indeed finds flatter solutions, the authors performed Hessian spectrum analysis. The results confirmed that models trained with VaSSO converge to solutions with significantly smaller top eigenvalues ($\lambda_1$) compared to those trained with SGD or standard SAM. This empirical evidence supports the claim that variance suppression allows the optimizer to locate more stable, flatter valleys in the loss landscape.

Conclusion

VaSSO addresses a fundamental limitation of sharpness-aware optimization by stabilizing the adversarial search process. By suppressing the variance of minibatch gradients through an exponentially moving average, VaSSO prevents the formation of "friendly adversaries" and enables the discovery of truly flat minima. While the method maintains the 2x computational overhead characteristic of SAM-family optimizers, its superior generalization and remarkable robustness to label noise make it a compelling choice for training high-performance deep learning models. Future work may focus on integrating VaSSO with lightweight SAM variants to reduce computational costs while preserving its stability benefits.

Summary updated

BibTeX
@inproceedings{li2023enhancing,
  author = {Bingcong Li and Georgios B. Giannakis},
  title = {{Enhancing Sharpness-Aware Optimization Through Variance Suppression}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2023},
  url = {https://openreview.net/forum?id=Sf3t6Bth4P},
}
Figure