EMASAM用平均模型引导扰动,实现高效且稳定的SAM训练。
EMASAM: a Computationally Efficient Sharpness-Aware Minimization via EMA-Guided Perturbations

- 用EMA模型与主模型的差异定义扰动方向,避免额外反向传播。
- 相比SAM计算成本减半,测试准确率提升0.3%~1.2%。
- 适合追求训练效率与泛化能力平衡的研究者使用。
优化研究揭示损失曲面的平坦度是缩小泛化差距的关键因素。为此,尖锐感知最小化(SAM)被提出以增强模型泛化能力。然而,由于其扰动步骤需额外梯度计算,导致计算成本翻倍。为此,我们提出指数移动平均尖锐感知最小化(EMASAM),一种计算高效的SAM变体。EMASAM在扰动步骤中无需损失梯度,而是基于主模型与EMA影子模型之间的差异定义扰动方向。该扰动从稳定平均位置指向较不稳定区域,作为对SAM最坏情况扰动的更柔和且低成本替代方案。此外,由于扰动不依赖于噪声小批量梯度,有效缓解了SAM固有的梯度不稳定性。因此,EMASAM在消除额外反向传播需求的同时,保持了类SAM的泛化能力。多项实验验证了该方法的高效性与鲁棒性。
原文摘要 · Abstract (English)
Recent progress in optimization research has highlighted the sharpness of the loss landscape as a key factor in narrowing the generalization gap. Motivated by this insight, Sharpness-Aware Minimization (SAM) was proposed as a training strategy that enhances generalization. Despite the promising performance, SAM suffers from its twice computational cost due to its core algorithm requiring an extra gradient computation during the perturbation step. To overcome this limitation, we introduce Exponential Moving Average Sharpness-Aware Minimization (EMASAM), a computationally efficient variant of SAM. EMASAM does not require the loss gradient in the perturbation step. Instead, EMASAM defines the perturbation direction based on the discrepancy between the main model and the EMA shadow model. This perturbation travels away from the stable average position toward the less stable area, acting as a softer yet cheaper alternative to SAM's worst-case scenario perturbation. Moreover, since EMASAM's perturbation does not rely on noisy mini-batch gradients, it mitigates the gradient-induced instability inherent in SAM. Hence, EMASAM eliminates the need for an extra backpropagation while also preserving the generalization ability of the SAM-style training. Several experiments have been performed and confirm the efficiency and robustness of our method.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。