arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2502.20566cs.LG
收藏

用于大语言模型训练的随机舍入:理论与实践

Stochastic Rounding for LLM Training: Theory and Practice

AWS AI(亚马逊云科技人工智能部门)

Kaan Ozkara, Tao Yu, Youngsuk Park

AI总结:

本文提出基于随机舍入的BF16+SR训练策略,通过理论分析其正则化与收敛性,并在分布式场景下扩展,首次在6.7B参数模型上证明其优于混合精度策略,提升吞吐量并降低内存。

摘要:

随着大语言模型(LLM)的参数规模扩展到数千亿,对高效训练方法的需求——在保持准确率的同时平衡更快的计算速度和更少的内存占用——变得比以往任何时候都更为关键。近年来,人们提出了各种混合精度策略,这些策略涉及优化器组件采用不同的精度级别,以在最小精度损失的情况下提高训练速度。然而,这些策略通常需要手动调整,且缺乏理论依据。在本工作中,我们利用随机舍入(SR)来解决低精度表示训练中的数值误差问题。我们提供了在Adam优化器下使用SR时的隐式正则化和收敛性的理论分析。基于这些分析的见解,我们将先前的BF16+SR策略扩展到分布式设置中,增强了大规模训练的稳定性和性能。首次对高达6.7B参数的模型进行预训练的实证结果表明,我们的BF16+SR策略优于(BF16,FP32)混合精度策略,实现了更好的验证困惑度,吞吐量最高提升1.54倍,内存使用量减少30%。

英文摘要:

As the parameters of Large Language Models (LLMs) have scaled to hundreds of billions, the demand for efficient training methods -- balancing faster computation and reduced memory usage without sacrificing accuracy -- has become more critical than ever. In recent years, various mixed precision strategies, which involve different precision levels for optimization components, have been proposed to increase training speed with minimal accuracy degradation. However, these strategies often require manual adjustments and lack theoretical justification. In this work, we leverage stochastic rounding (SR) to address numerical errors of training with low-precision representation. We provide theoretical analyses of implicit regularization and convergence under the Adam optimizer when SR is utilized. With the insights from these analyses, we extend previous BF16 + SR strategy to be used in distributed settings, enhancing the stability and performance for large scale training. Empirical results from pre-training models with up to 6.7B parameters, for the first time, demonstrate that our BF16 with SR strategy outperforms (BF16, FP32) mixed precision strategies, achieving better validation perplexity, up to $1.54\times$ higher throughput, and $30\%$ less memory usage.

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

↑