arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2305.14342cs.LGcs.CLmath.OC
收藏

Sophia:一种用于语言模型预训练的可扩展随机二阶优化器

Sophia: A Scalable Stochastic Second-order Optimizer for Language Model Pre-training

Stanford University(斯坦福大学)

Hong Liu, Zhiyuan Li, David Hall, Percy Liang, Tengyu Ma

AI总结:

本文提出可扩展二阶优化器 Sophia,通过低频估计对角 Hessian、移动平均预条件和逐元素裁剪,在 125M–1.5B GPT 上较 Adam 实现约 2 倍训练加速。

摘要:

鉴于语言模型预训练的巨大成本,对优化算法进行一项并非微不足道的改进,就会显著减少训练时间和成本。多年来,Adam 及其变体一直代表最先进水平,而更复杂的二阶(基于 Hessian 的)优化器通常会产生过高的单步开销。本文提出 Sophia(Second-order Clipped Stochastic Optimization,二阶裁剪随机优化),这是一种简单且可扩展的二阶优化器,使用对对角 Hessian 的轻量级估计作为预条件子。其更新方式为:将梯度的移动平均值除以估计 Hessian 的移动平均值,随后进行逐元素裁剪。裁剪控制了最坏情况下的更新幅度,并抑制了沿轨迹出现的非凸性和 Hessian 快速变化所带来的负面影响。Sophia 仅每隔若干次迭代估计一次对角 Hessian,因此其平均单步时间和内存开销可以忽略不计。在参数规模从 125M 到 1.5B 的 GPT 模型语言建模任务中,与 Adam 相比,Sophia 在步数、总算力和挂钟时间方面均实现了 2 倍加速:它以少 50% 的步数、更少的总算力以及更短的挂钟时间达到相同的困惑度。在理论方面,我们表明,在一个大幅简化的设定中,Sophia 能够适应不同参数维度上的异质曲率,因此其运行时间界不依赖于损失函数的条件数。

英文摘要:

Given the massive cost of language model pre-training, a non-trivial improvement of the optimization algorithm would lead to a material reduction on the time and cost of training. Adam and its variants have been state-of-the-art for years, and more sophisticated second-order (Hessian-based) optimizers often incur too much per-step overhead. In this paper, we propose Sophia, Second-order Clipped Stochastic Optimization, a simple scalable second-order optimizer that uses a light-weight estimate of the diagonal Hessian as the pre-conditioner. The update is the moving average of the gradients divided by the moving average of the estimated Hessian, followed by element-wise clipping. The clipping controls the worst-case update size and tames the negative impact of non-convexity and rapid change of Hessian along the trajectory. Sophia only estimates the diagonal Hessian every handful of iterations, which has negligible average per-step time and memory overhead. On language modeling with GPT models of sizes ranging from 125M to 1.5B, Sophia achieves a 2x speed-up compared to Adam in the number of steps, total compute, and wall-clock time, achieving the same perplexity with 50% fewer steps, less total compute, and reduced wall-clock time. Theoretically, we show that Sophia, in a much simplified setting, adapts to the heterogeneous curvatures in different parameter dimensions, and thus has a run-time bound that does not depend on the condition number of the loss.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑