arXiv:2409.11321cs.LGcs.AI2024-09被引 215

SOAP让高阶优化器更高效稳定,比Adam快40%以上

SOAP: Improving and Stabilizing Shampoo using Adam

  • 在预训练器的特征空间中运行Adam,用低频更新预处理矩阵
  • 大批次下比AdamW少40%迭代,比Shampoo快20%
  • 仅新增一个超参数,适合追求训练效率的模型开发者

Shampoo作为一种高阶预处理优化方法,在深度学习任务中表现优于Adam,但存在额外超参数和计算开销。本文揭示了以1/2次幂实现的Shampoo与Adafactor之间的理论联系:Shampoo等价于在预处理矩阵的特征基下运行Adafactor。基于此洞察,提出SOAP算法——在预处理矩阵的缓慢变化坐标系中持续更新二阶矩的运行平均,类似Adam机制。该方法仅引入一个额外超参数(预处理频率),在3.6亿和6.6亿参数的语言模型预训练中,大批次下相比AdamW减少40%以上迭代次数和35%以上实际耗时,相较Shampoo提升约20%。代码已开源。

原文摘要 · Abstract (English)

There is growing evidence of the effectiveness of Shampoo, a higher-order preconditioning method, over Adam in deep learning optimization tasks. However, Shampoo's drawbacks include additional hyperparameters and computational overhead when compared to Adam, which only updates running averages of first- and second-moment quantities. This work establishes a formal connection between Shampoo (implemented with the 1/2 power) and Adafactor -- a memory-efficient approximation of Adam -- showing that Shampoo is equivalent to running Adafactor in the eigenbasis of Shampoo's preconditioner. This insight leads to the design of a simpler and computationally efficient algorithm: $\textbf{S}$hampo$\textbf{O}$ with $\textbf{A}$dam in the $\textbf{P}$reconditioner's eigenbasis (SOAP). With regards to improving Shampoo's computational efficiency, the most straightforward approach would be to simply compute Shampoo's eigendecomposition less frequently. Unfortunately, as our empirical results show, this leads to performance degradation that worsens with this frequency. SOAP mitigates this degradation by continually updating the running average of the second moment, just as Adam does, but in the current (slowly changing) coordinate basis. Furthermore, since SOAP is equivalent to running Adam in a rotated space, it introduces only one additional hyperparameter (the preconditioning frequency) compared to Adam. We empirically evaluate SOAP on language model pre-training with 360m and 660m sized models. In the large batch regime, SOAP reduces the number of iterations by over 40% and wall clock time by over 35% compared to AdamW, with approximately 20% improvements in both metrics compared to Shampoo. An implementation of SOAP is available at https://github.com/nikhilvyas/SOAP.

优化器深度学习高效训练

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。