arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2309.17224cs.LGcs.ARcs.CLcs.ETcs.PF
收藏

使用 8 位浮点数训练和推理大型语言模型

Training and inference of large language models using 8-bit floating point

Graphcore(Graphcore公司)

Sergio P. Perez, Yan Zhang, James Briggs, Charlie Blake, Josh Levy-Kramer, Paul Balanca, Carlo Luschi, Stephen Barlow, Andrew William Fitzgibbon

AI总结:

针对 FP8 动态范围有限导致的缩放选择难题,本文提出动态更新权重、梯度和激活值逐张量尺度的方法,并在 111M 至 70B 的 GPT 与 Llama 2 模型上验证 FP8 训练和推理。

摘要:

FP8 格式正日益流行,用于提升大型深度学习模型训练和推理的计算效率。其主要挑战在于,与更高精度格式相比,FP8 的动态范围较小,因此需要谨慎选择缩放因子,以避免性能下降。尽管已有大量文献研究如何为 INT 格式选择此类缩放,但 FP8 的这一关键方面仍有待解决。本文提出了一种为 FP8 线性层选择缩放的方法,该方法基于动态更新权重、梯度和激活值的逐张量尺度。我们将该方法应用于使用 FP8 训练和验证 GPT 与 Llama 2 类型的大型语言模型,模型规模从 111M 到 70B 不等。为促进对 FP8 动态特性的理解,我们的结果还附有训练和推理期间权重、激活值及梯度的逐张量尺度分布图。

英文摘要:

FP8 formats are gaining popularity to boost the computational efficiency for training and inference of large deep learning models. Their main challenge is that a careful choice of scaling is needed to prevent degradation due to the reduced dynamic range compared to higher-precision formats. Although there exists ample literature about selecting such scalings for INT formats, this critical aspect has yet to be addressed for FP8. This paper presents a methodology to select the scalings for FP8 linear layers, based on dynamically updating per-tensor scales for the weights, gradients and activations. We apply this methodology to train and validate large language models of the type of GPT and Llama 2 using FP8, for model sizes ranging from 111M to 70B. To facilitate the understanding of the FP8 dynamics, our results are accompanied by plots of the per-tensor scale distribution for weights, activations and gradients during both training and inference.

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

↑