Abstract
$\delta$-SAM is a novel optimization algorithm designed to improve model generalization by bridging the gap between "per-batch" and "per-instance" Sharpness-Aware Minimization (SAM). By employing a dynamic reweighting scheme to approximate computationally expensive per-instance perturbations, $\delta$-SAM achieves superior performance across various Natural Language Processing (NLP) tasks. Notably, it maintains high efficiency, incurring only a marginal (12-18%) increase in computational cost over standard SAM.
Introduction
Deep Neural Networks (DNNs) are frequently overparameterized, possessing capacity far beyond what is necessary to memorize training data. This often results in poor generalization, where models perform exceptionally on training sets but fail on unseen data.
A prominent solution is Sharpness-Aware Minimization (SAM), which seeks "flat" regions in the loss landscape where loss remains low despite small weight perturbations. However, standard SAM typically calculates a single "average" weight perturbation for an entire batch (per-batch). While theoretically superior, calculating unique "worst-case" perturbations for every instance (per-instance) is computationally prohibitive, requiring $N$ separate updates for a batch of size $N$. This paper introduces $\delta$-SAM to capture the benefits of per-instance optimization without the associated overhead.
Methodology: $\delta$-SAM
The core innovation of $\delta$-SAM (Sharpness-Aware Minimization with Dynamic Reweighting) is the mathematical approximation of per-instance perturbations through a weighted per-batch approach.
- Theoretical Alignment: Using Taylor expansion and Hessian analysis, the authors demonstrate that the gradient of a per-instance objective is proportional to a reweighted batch gradient. Instances exhibiting higher local curvature (faster gradient change) are assigned greater weights.
- Efficient Weight Estimation: To avoid the second-order derivative costs of Hessian calculation, $\delta$-SAM utilizes a "random noise" trick. Three rapid forward passes with random Gaussian noise estimate the instance weights ($g_i$) without requiring gradient storage.
- Algorithmic Flow: The process involves sampling a batch, estimating instance weights based on the local loss landscape, calculating a single shared perturbation for the reweighted batch, and updating the model accordingly.
Experimental Setup
The effectiveness of $\delta$-SAM was evaluated across several benchmarks:
- GLUE Benchmark: Eight tasks including sentiment analysis (SST-2), natural language inference (MNLI, RTE, QNLI), and linguistic acceptability (CoLA).
- Self-supervised Semantic Textual Similarity (STS): Seven datasets (STS12-16, STS-B, SICK-R) for evaluating sentence embeddings.
- Abstractive Summarization: CNN/DailyMail dataset using the BART model.
Key Results and Discussion
$\delta$-SAM addresses the "Weak Adversary" problem inherent in standard SAM, where a shared perturbation acts as a compromise that may not sufficiently challenge individual instances. By prioritizing sensitive instances with high local curvature, $\delta$-SAM more effectively steers models toward flatter minima.
Performance Gains
On the GLUE benchmark, $\delta$-SAM consistently outperformed standard SAM and other strong baselines. It improved BERT-base by 1.8% and RoBERTa-large by 1.2% over base models.
Efficiency and Generalization
- State-of-the-Art in STS: Applied to Mirror-BERT, $\delta$-SAM achieved top results in 11 of 14 sentence embedding setups.
- Lower Adversarial Risk: Analysis confirmed that $\delta$-SAM achieves lower adversarial risk than standard SAM, indicating the discovery of flatter minima.
- Computational Efficiency: $\delta$-SAM is approximately 7x faster than per-instance SAM and only 12-18% slower than standard SAM, making it a practical drop-in replacement.
Conclusion and Future Work
While $\delta$-SAM significantly reduces the overhead of per-instance methods, it still roughly doubles training time compared to vanilla SGD/Adam due to extra passes. Future research could explore its application to Vision Transformers and other complex tasks like sequence tagging or question answering. Additionally, investigating the sensitivity of the new hyperparameter ($\eta$) across broader domains remains an open area for exploration.
Summary updated