Pretraining Large Language Models with NVFP4
这篇论文提出了一种使用NVFP4格式稳定且准确地训练大型语言模型(LLMs)的新方法,实现了在4位精度下与FP8相当的训练损失和下游任务准确性。
更新于 2025-10-01。作者:NVIDIA、Felix Abecassis、Anjulie Agrusa、Dong Ahn、Jonah Alben、Stefania Alborghetti、Michael Andersch、Sivakumar Arayandi、Alexis Bjorlin、Aaron Blakeman、Evan Briones、Ian Buck、Bryan Catanzaro、Jinhang Choi、Mike Chrzanowski、Eric Chung、Victor Cui、Steve Dai、Bita Darvish Rouhani、Carlo del Mundo、Deena Donia、Burc Eryilmaz、Henry Estela、Abhinav Goel、Oleg Goncharov、Yugi Guvvala、Robert Hesse、Russell Hewett、Herbert Hum、Ujval Kapasi、Brucek Khailany、Mikail Khona、Nick Knight、Alex Kondratenko、Ronny Krashinsky、Ben Lanir、Simon Layton、Michael Lightstone、Daniel Lo、Paulius Micikevicius、Asit Mishra、Tim Moon、Deepak Narayanan、Chao Ni、Abhijit Paithankar、Satish Pasumarthi、Ankit Patel、Mostofa Patwary、Ashwin Poojary、Gargi Prasad、Sweta Priyadarshi、Yigong Qin、Xiaowei Ren、Oleg Rybakov、Charbel Sakr、Sanjeev Satheesh、Stas Sergienko、Pasha Shamis、Kirthi Shankar、Nishant Sharma、Mohammad Shoeybi、Michael Siu、Misha Smelyanskiy、Darko Stosic、Dusan Stosic、Bor-Yiing Su、Frank Sun、Nima Tajbakhsh、Shelby Thomas、Przemek Tredak、Evgeny Tsykunov、Gandhi Vaithilingam、Aditya Vavre、Rangharajan Venkatesan、Roger Waleffe、Qiyu Wan、Hexin Wang、Mengdi Wang、Lizzie Wei、Hao Wu、Evan Wu、Keith Wyss、Ning Xu、Jinze Xue、Charlene Yang、Yujia Zhai、Ruoxi Zhang、Jingyang Zhu、Zhongbo Zhu。
中文摘要
大型语言模型(LLMs)如今在众多领域都是强大的问题解决者,随着模型规模、训练集规模和训练集质量的扩大,它们的力量也在不断增强,这一点得到了整个行业广泛的研究和实验证明。如今训练前沿模型需要达到数十到数百Yottaflops的算力,这是一项巨大的时间、计算和能源投资。因此,提高预训练效率对于实现下一代更强大的LLMs至关重要。尽管8位浮点(FP8)训练现在已被广泛采用,但过渡到更窄的精度,如4位浮点(FP4),可以解锁计算速度和资源利用的额外改进。然而,在这一层面的量化对训练稳定性、收敛性和实现提出了挑战,尤其是在训练时间跨度较长的长标记序列的大规模模型中。在本研究中,我们提出了一种使用NVFP4格式稳定且精确训练大型语言模型(LLMs)的新方法。我们的方法集成了随机Hadamard变换(RHT)以限制块级异常值,采用二维量化方案以确保正向和反向传递中的统一表示,利用随机舍入进行无偏梯度估计,并纳入选择性高精度层。我们通过在10万亿个标记上训练一个120亿参数的模型来验证我们的方法——这是迄今为止4位精度中记录的最长训练运行。我们的结果表明,使用基于NVFP4的预训练技术的模型在训练损失和下游任务准确性方面与FP8基线相当。这些发现突显了NVFP4结合我们的训练方法在窄精度LLM训练算法方面取得了重大进展。
英文摘要
Large Language Models (LLMs) today are powerful problem solvers across many domains, and they continue to get stronger as they scale in model size, training set size, and training set quality, as shown by extensive research and experimentation across the industry. Training a frontier model today requires on the order of tens to hundreds of yottaflops, which is a massive investment of time, compute, and energy. Improving pretraining efficiency is therefore essential to enable the next generation of even more capable LLMs. While 8-bit floating point (FP8) training is now widely adopted, transitioning to even narrower precision, such as 4-bit floating point (FP4), could unlock additional improvements in computational speed and resource utilization. However, quantization at this level poses challenges to training stability, convergence, and implementation, notably for large-scale models trained on long token horizons. In this study, we introduce a novel approach for stable and accurate training of large language models (LLMs) using the NVFP4 format. Our method integrates Random Hadamard transforms (RHT) to bound block-level outliers, employs a two-dimensional quantization scheme for consistent representations across both the forward and backward passes, utilizes stochastic rounding for unbiased gradient estimation, and incorporates selective high-precision layers. We validate our approach by training a 12-billion-parameter model on 10 trillion tokens -- the longest publicly documented training run in 4-bit precision to date. Our results show that the model trained with our NVFP4-based pretraining technique achieves training loss and downstream task accuracies comparable to an FP8 baseline. These findings highlight that NVFP4, when combined with our training approach, represents a major step forward in narrow-precision LLM training algorithms.
解读
一句话总结
这篇论文提出了一种使用NVFP4格式稳定且准确地训练大型语言模型(LLMs)的新方法,实现了在4位精度下与FP8相当的训练损失和下游任务准确性。
问题1:这篇论文想要解决什么具体问题?
- 问题背景:大规模语言模型的训练需要大量的计算资源,提高预训练效率对于实现下一代更强大的LLMs至关重要。
- 现有方案不足:尽管8位浮点数(FP8)训练已被广泛采用,但向更窄精度,如4位浮点数(FP4)的过渡可能带来计算速度和资源利用率的进一步改进,但这也对训练稳定性、收敛性和实现提出了挑战。
- 研究目标:开发一种使用NVFP4格式的稳定和准确的LLMs预训练方法,以实现高效的计算速度和资源利用率。
问题2:论文的核心创新点是什么?
- 技术创新:引入了NVFP4格式,这是一种改进的4位数据格式,比MXFP4具有更好的数值特性。
- 方法改进:结合了多种技术,包括保留数值敏感层的高精度、随机哈达玛变换、二维块缩放和随机舍入。
- 优势:在4位精度下实现了与FP8相当的训练损失和下游任务准确性,同时提高了计算速度和资源利用率。
问题3:实验结果如何验证了方法的有效性?
- 关键实验:在10万亿个标记上训练了一个12亿参数的模型,这是公开记录中4位精度下最长的一次训练运行。
- 性能提升:与FP8基线相比,NVFP4训练技术在训练损失和下游任务准确性方面取得了可比的结果。
- 对比结果:NVFP4训练的模型在MMLU-pro准确率上达到了62.58%,几乎与FP8预训练的62.62%准确率相当。
问题4:这个研究的实际应用价值是什么?
- 应用场景:适用于需要高效计算和低资源消耗的场景,如移动设备和边缘计算。
- 实施建议:采用混合精度策略,保留数值敏感层的高精度,并使用随机哈达玛变换、二维块缩放和随机舍入等技术。
- 局限与展望:目前的研究主要集中在LLMs的预训练上,未来可以扩展到其他类型的模型和任务,并进一步优化算法以提高性能。
来源
机器可读索引:llms.txt