arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2412.13148cs.LGcs.AI
收藏

SWAN:带归一化与白化的SGD可实现无状态大语言模型训练

SWAN: SGD with Normalization and Whitening Enables Stateless LLM Training

Microsoft Research(微软研究院)

Chao Ma, Wenbo Gong, Meyer Scetbon, Edward Meeds

AI总结:

针对自适应优化器内存开销大的问题,提出无状态优化器SWAN,通过对SGD梯度做归一化和白化处理,在大语言模型训练中实现与Adam相当甚至更优的性能,同时大幅降低内存成本、提升训练速度。

摘要:

Adam(Kingma & Ba, 2015)等自适应优化器一直是大语言模型成功的核心。但这类优化器通常需要在训练全程维护优化器状态,导致内存需求可达模型占用空间的数倍。这种开销对可扩展性和计算效率造成了限制。相比之下,随机梯度下降(SGD)是一种无状态优化器,训练过程中无需追踪状态变量,因此能实现最优内存效率,但它在大语言模型训练中的能力有限(Zhao et al., 2024b)。本研究表明,以无状态方式对SGD进行预处理,可在大语言模型训练中达到与Adam优化器相当的性能,同时大幅降低内存成本。具体而言,我们提出使用归一化和白化对瞬时随机梯度进行预处理:归一化可稳定梯度分布,白化可抵消损失景观的局部曲率,由此得到SWAN(SGD with Whitening And Normalization,带白化与归一化的SGD)——一种无需存储任何优化器状态的随机优化器。实验表明,SWAN的内存占用与SGD相同,与Adam相比,端到端总内存减少约50%。在语言建模任务中,SWAN的性能与Adam相当甚至更优:在预训练参数量为350M和1.3B的LLaMA模型时,SWAN仅需一半的token数即可达到相同的评估困惑度,实现了2倍的速度提升。

英文摘要:

Adaptive optimizers such as Adam (Kingma & Ba, 2015) have been central to the success of large language models. However, they often require to maintain optimizer states throughout training, which can result in memory requirements several times greater than the model footprint. This overhead imposes constraints on scalability and computational efficiency. Stochastic Gradient Descent (SGD), in contrast, is a stateless optimizer, as it does not track state variables during training. Consequently, it achieves optimal memory efficiency. However, its capability in LLM training is limited (Zhao et al., 2024b). In this work, we show that pre-processing SGD in a stateless manner can achieve the same performance as the Adam optimizer for LLM training, while drastically reducing the memory cost. Specifically, we propose to pre-process the instantaneous stochastic gradients using normalization and whitening. We show that normalization stabilizes gradient distributions, and whitening counteracts the local curvature of the loss landscape. This results in SWAN (SGD with Whitening And Normalization), a stochastic optimizer that eliminates the need to store any optimizer states. Empirically, SWAN has the same memory footprint as SGD, achieving $\approx 50\%$ reduction on total end-to-end memory compared to Adam. In language modeling tasks, SWAN demonstrates comparable or even better performance than Adam: when pre-training the LLaMA model with 350M and 1.3B parameters, SWAN achieves a 2x speedup by reaching the same evaluation perplexity using half as many tokens.

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

↑