[论文解读] Toward Understanding Why Adam Converges Faster Than SGD for Transformers
本文通过引入方向性尖锐度作为关键度量,解释了为何Adam在训练Transformer时收敛速度优于SGD:SGD由于坐标间梯度不平衡导致方向性尖锐度较高,而Adam的自适应学习率降低了这种尖锐度。作者提出坐标级裁剪以缓解此问题,在多种优化算法中均验证了其收敛速度提升与局部损失降低的效果。
While stochastic gradient descent (SGD) is still the most popular optimization algorithm in deep learning, adaptive algorithms such as Adam have established empirical advantages over SGD in some deep learning applications such as training transformers. However, it remains a question that why Adam converges significantly faster than SGD in these scenarios. In this paper, we propose one explanation of why Adam converges faster than SGD using a new concept directional sharpness. We argue that the performance of optimization algorithms is closely related to the directional sharpness of the update steps, and show SGD has much worse directional sharpness compared to adaptive algorithms. We further observe that only a small fraction of the coordinates causes the bad sharpness and slow convergence of SGD, and propose to use coordinate-wise clipping as a solution to SGD and other optimization algorithms. We demonstrate the effect of coordinate-wise clipping on sharpness reduction and speeding up the convergence of optimization algorithms under various settings. We show that coordinate-wise clipping improves the local loss reduction when only a small fraction of the coordinates has bad sharpness. We conclude that the sharpness reduction effect of adaptive coordinate-wise scaling is the reason for Adam's success in practice and suggest the use of coordinate-wise clipping as a universal technique to speed up deep learning optimization.
研究动机与目标
- 理解尽管理论收敛率相近,Adam为何在训练Transformer时优于SGD。
- 识别影响深度学习中优化轨迹收敛速度的几何特性。
- 分析网络坐标间梯度不平衡对SGD性能下降的影响。
- 提出一种简单且通用的技术——坐标级裁剪,通过降低方向性尖锐度来改善收敛性。
- 验证通过自适应缩放降低尖锐度是Adam在实践中取得成功的关键原因。
提出的方法
- 引入方向性尖锐度作为沿更新方向曲率的度量,认为其比标准度量更能预测优化性能。
- 将方向性尖锐度定义为Hessian矩阵在更新方向上的投影的谱范数,以捕捉局部函数的平滑性。
- 提出坐标级裁剪,以限制高梯度、高尖锐度坐标的影响,从而降低整体方向性尖锐度。
- 使用高斯-牛顿Hessian近似来估计神经网络交叉熵损失的局部曲率。
- 在参数更新前对梯度应用裁剪,从而实现更大的稳定步长并提升局部损失减少效果。
- 在Transformer和ResNet上对多种优化器(SGD、Adam、Adafactor等)评估方向性尖锐度与收敛速度。
实验结果
研究问题
- RQ1为何Adam在训练Transformer时收敛速度显著快于SGD,尽管其理论收敛保证相近?
- RQ2优化轨迹的何种几何特性与深度学习中的快速收敛相关?
- RQ3SGD性能差劣在多大程度上是由坐标间梯度不平衡导致的高方向性尖锐度所致?
- RQ4坐标级裁剪是否能通过降低方向性尖锐度,普遍改善各类优化算法的收敛性?
- RQ5所观察到的尖锐度行为是否仅限于Transformer架构,还是在各类架构中均具普遍性?
主要发现
- SGD在Transformer训练初期表现出显著高于Adam的方向性尖锐度。
- 仅1%至2.5%的坐标贡献了SGD方向性尖锐度的绝大部分,表明梯度幅值存在强烈不平衡。
- 通过坐标级裁剪移除这些高尖锐度坐标后,函数平滑性提升2至3倍,从而实现更快的局部损失减少。
- 坐标级裁剪在所有测试优化器(包括Adam和Adafactor)中均降低了方向性尖锐度,并持续提升了收敛速度。
- 在非Transformer架构(如ResNet)上,自适应算法(如Adam和Adafactor)的方向性尖锐度甚至可能超过SGD,表明该现象具有Transformer特异性。
- 在最优步长下,低方向性尖锐度算法实现了显著更优的局部损失减少,证实尖锐度是性能的关键预测因子。
更好的研究,从现在开始
从阅读论文到最终审阅,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。