提出新方法让SAM加速40%且不损失精度
Adaptively Sampling-Reusing-Mixing Decomposed Gradients to Speed Up Sharpness Aware Minimization
- 将SAM梯度分解为一阶与二阶投影,动态复用部分梯度
- 在CIFAR上实现40%加速,精度接近原版SAM
- 适用于姿态估计、量化等复杂任务,实用性强
Sharpness-Aware Minimization (SAM) 能提升模型泛化能力,但使SGD的计算成本翻倍。为此,本文提出自适应采样-重用-混合分解梯度的方法(ARSAM),显著加速SAM。我们发现SAM梯度可分解为SGD梯度与二阶梯度在一次梯度方向上的投影(PSF)。训练过程中,SGD梯度与PSF动态演化,且PSF对寻找平坦极小值的作用逐渐增强。因此,ARSAM通过重用历史PSF并适时更新,保持了模型泛化能力。大量实验表明,ARSAM在多种网络架构上达到与SAM相当的性能,于CIFAR-10/100上速度提升约40%。同时,在人体姿态估计、模型量化等挑战性任务中也实现加速且不牺牲性能,展现广泛实用性。代码已公开:https://github.com/ajiaaa/ARSAM。
原文摘要 · Abstract (English)
Sharpness-Aware Minimization (SAM) improves model generalization but doubles the computational cost of Stochastic Gradient Descent (SGD) by requiring twice the gradient calculations per optimization step. To mitigate this, we propose Adaptively sampling-Reusing-mixing decomposed gradients to significantly accelerate SAM (ARSAM). Concretely, we firstly discover that SAM's gradient can be decomposed into the SGD gradient and the Projection of the Second-order gradient onto the First-order gradient (PSF). Furthermore, we observe that the SGD gradient and PSF dynamically evolve during training, emphasizing the growing role of the PSF to achieve a flat minima. Therefore, ARSAM is proposed to the reused PSF and the timely updated PSF still maintain the model's generalization ability. Extensive experiments show that ARSAM achieves state-of-the-art accuracies comparable to SAM across diverse network architectures. On CIFAR-10/100, ARSAM is comparable to SAM while providing a speedup of about 40\%. Moreover, ARSAM accelerates optimization for the various challenge tasks (\textit{e.g.}, human pose estimation, and model quantization) without sacrificing performance, demonstrating its broad practicality.% The code is publicly accessible at: https://github.com/ajiaaa/ARSAM.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。