Make Sharpness-Aware Minimization Stronger: A Sparsified Perturbation Approach

Peng Mi, Li Shen, Tianhe Ren, Yiyi Zhou, Xiaoshuai Sun, Rongrong Ji, Dacheng Tao

Abstract

Sharpness-Aware Minimization (SAM) has emerged as a powerful technique for improving deep learning generalization by finding "flat" minima in the loss landscape. However, SAM's requirement to perturb every parameter doubles the training cost. This paper proposes Sparse SAM (SSAM), a method that selectively perturbs only the most critical parameters. By leveraging gradient redundancy and identifying "sharp" dimensions, SSAM maintains or exceeds SAM's performance while significantly reducing computational overhead. Our approach is supported by theoretical convergence guarantees and extensive empirical results across multiple benchmarks.

Introduction

Deep neural networks often struggle with generalization because they converge to "sharp" minima—regions in the loss landscape where small weight perturbations lead to massive spikes in error. Sharpness-Aware Minimization (SAM) addresses this by seeking out "flat" minima through a min-max optimization: first finding a perturbation that maximizes the loss, and then updating the weights to minimize that "worst-case" loss.

Despite its success, SAM is computationally expensive, requiring two forward-backward passes per update and effectively doubling training time compared to standard Stochastic Gradient Descent (SGD). A key observation motivating this work is that SAM's perturbations are often redundant. As shown in Figure 1, the gradients calculated by SAM and SGD are nearly identical for the majority of parameters, suggesting that only a small fraction of the parameter space is truly "sharp."

Density plots showing gradient redundancy between SAM and SGD.

Methodology: Sparse SAM (SSAM)

To improve efficiency and potentially generalization, the authors propose Sparse SAM (SSAM), which applies a binary mask to the perturbation vector. Instead of perturbing every weight, SSAM targets only the most critical ones. Two distinct strategies are proposed for generating this mask:

  1. SSAM-F (Fisher Information): This version uses the "empirical Fisher Information" as a proxy for the Hessian to identify parameters with high sensitivity. It perturbs only the parameters that contribute most to the landscape's sharpness.
  2. SSAM-D (Dynamic Sparse Training): A more computationally efficient approach inspired by sparse neural network training. It periodically "drops" perturbations in flat regions (small gradients) and "grows" new ones in other dimensions to explore the landscape.

Crucially, the authors provide a theoretical proof showing that SSAM maintains the same $O(\log T / \sqrt{T})$ convergence rate as the original SAM, ensuring that sparsity does not compromise optimization stability.

Experimental Results

The researchers evaluated SSAM across standard computer vision benchmarks, including CIFAR-10, CIFAR-100, and ImageNet-1K, using architectures like ResNet-50 and WideResNet-28-10.

Performance on ImageNet

On the large-scale ImageNet-1K dataset, SSAM demonstrates remarkable robustness to sparsity. As illustrated in Figure 3, SSAM-F and SSAM-D consistently outperform standard SGD and often exceed the performance of full SAM, even when only a fraction of parameters are perturbed.

SSAM performance on ImageNet-1K across various sparsity levels.

Key Insights

  • The "Less is More" Paradox: Surprisingly, SSAM often outperforms full SAM. By only perturbing the sharpest dimensions, the model avoids the "noise" of perturbing dimensions that are already flat. Visualizations show that SSAM actually produces a flatter surface than standard SAM.
  • Efficiency Gains: While standard SAM has a 2.0x FLOP overhead compared to SGD, SSAM with 50% sparsity reduces this to roughly 1.65x.
  • Robustness to High Sparsity: Performance remains competitive even at 99% sparsity on CIFAR datasets, suggesting the essence of SAM's benefit is concentrated in a tiny fraction of parameters.

Conclusion

SSAM offers a more efficient and effective path to sharpness-aware optimization. By focusing perturbations on the most sensitive parameters, it reduces computational costs and improves generalization. While current software support for unstructured sparsity limits immediate wall-clock speedups, future work focusing on structured sparse perturbations (like NVIDIA's 2:4 pattern) could bridge the gap between theoretical efficiency and practical training speed.

Summary updated

BibTeX
@inproceedings{mi2022make,
  author = {Peng Mi and Li Shen and Tianhe Ren and Yiyi Zhou and Xiaoshuai Sun and Rongrong Ji and Dacheng Tao},
  title = {{Make Sharpness-Aware Minimization Stronger: A Sparsified Perturbation Approach}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2022},
  url = {https://openreview.net/forum?id=88_wNI6ZBDZ},
}
Figure