Introduction
Sharpness-Aware Minimization (SAM) has emerged as a powerful technique for improving model generalization in deep learning. By seeking "flat" minima in the loss landscape—regions where the loss remains low even under small weight perturbations—SAM consistently outperforms standard stochastic gradient descent (SGD) or AdamW. However, this performance boost comes at a significant cost: SAM typically requires 50% more memory than standard optimizers because it must store a full-parameter perturbation vector. For large-scale models already pushing GPU limits, this memory overhead can be prohibitive.
The νSAM Approach
To address this bottleneck, we introduce νSAM (pronounced "new-SAM"). The core insight is that the massive perturbation vector used in standard SAM lacks structural efficiency. By treating each layer's weights as a matrix rather than a flattened vector, we can apply nuclear norm constraints instead of the standard $\ell_2$ norm.
Mathematically, the optimal perturbation under a nuclear norm constraint is a rank-1 matrix. This allows νSAM to approximate the perturbation using only two small vectors ($u$ and $v$) whose outer product ($uv^\top$) represents the layer-wise update. To compute these vectors efficiently, νSAM employs a single power iteration, a fast numerical method that adds negligible computational overhead. Furthermore, by rearranging the update logic, νSAM performs in-place updates, avoiding the need to store the full perturbation and weights simultaneously.
Experimental Evaluation
We evaluated νSAM across a variety of architectures and datasets, including Vision Transformers (ViT) and MLP-Mixers on CIFAR-10/100, as well as BERT-base fine-tuning on the GLUE benchmark.
Key Insights
- Low-Rank Sufficiency: A surprising finding is that a coarse, rank-1 approximation of the perturbation is sufficient to capture the generalization benefits of sharpness-aware training.
- Structural Synergy: νSAM consistently outperformed standard SAM on MLP-Mixer architectures, suggesting that the low-rank constraint aligns well with the inductive biases of these models.
- The Delay Trick: Performance improves significantly when perturbations are activated only after an initial warmup period, allowing the model to reach a stable region before optimizing for flatness.
Results
The primary advantage of νSAM is its extreme memory efficiency. As shown in the results below, νSAM reduces the perturbation memory footprint by over 99.8% for large models like ViT-B/16.
When combined with SGD, νSAM achieves nearly a 1/3 total memory saving compared to standard SAM, bringing its footprint remarkably close to basic SGD. In terms of accuracy, νSAM remains competitive with or superior to standard SAM. For instance, on CIFAR-100 with a Mixer-B/4 architecture, νSAM achieved 70.09% accuracy, surpassing SAM's 69.54%.
Conclusion and Future Work
νSAM demonstrates that the memory tax of sharpness-aware minimization can be almost entirely eliminated by leveraging the matrix structure of neural network layers. While currently optimized for matrix-shaped parameters (common in Transformers and MLPs), future work could extend this approach to convolutional layers. νSAM makes sharpness-aware training accessible for large-scale models on memory-constrained hardware without sacrificing generalization performance.
Summary updated