As large language models have grown larger, low-precision numerical formats such as NVFP4 have become increasingly popular due to the speed and memory benefits they provide. However, to accelerate computation with NVFP4, all matrix multiplication operands--weights and activations in the forward pass, and weights, activations, and gradients in the backward pass--must be quantized to NVFP4, often leading to divergence during training and performance degradation during inference. NVFP4 by evaluating multiple potential scale factors for each block of values. To address this issue, in this work we introduce Four Over Six (4/6), a modification to the NVFP4 quantization algorithm that evaluates two potential scale factors for each block of values. Unlike integer formats, floating-point formats such as FP4 have the most quantization error on near-maximal values in each block, which we find to be primarily responsible for downstream performance degradation. We find that for some blocks, scaling to smaller FP4 values makes the distribution of representable values more uniform, improving representation of near-maximal values. Importantly, 4/6 can be implemented efficiently on NVIDIA Blackwell GPUs, making it viable to use while training LLMs with NVFP4. In pre-training experiments with transformer and hybrid model architectures, we find that 4/6 prevents divergence in several cases, bringing training loss significantly closer to BF16 compared to models trained with current state-of-the-art NVFP4 training recipes. We also find that 4/6 can be easily incorporated into many different post-training quantization methods and generally improves downstream accuracy. We hope this inspires future work in training and deploying models with NVFP4.


翻译:随着大语言模型规模的不断扩大,NVFP4等低精度数值格式因其提供的速度与内存优势而日益普及。然而,要利用NVFP4加速计算,所有矩阵乘法操作数——前向传播中的权重和激活值,以及反向传播中的权重、激活值和梯度——都必须量化为NVFP4格式,这通常会导致训练过程中的发散和推理时的性能下降。NVFP4通过为每个数值块评估多个潜在的缩放因子来应对此问题。为解决这一挑战,本研究提出了四分之六(4/6)方法,这是对NVFP4量化算法的改进,它为每个数值块评估两个潜在的缩放因子。与整数格式不同,FP4等浮点格式在每个块中接近最大值的数值上会产生最大的量化误差,我们发现这主要是导致下游性能下降的原因。研究表明,对于某些数值块,缩放到较小的FP4值可使可表示值的分布更均匀,从而改善接近最大值数值的表示效果。重要的是,4/6方法可在NVIDIA Blackwell GPU上高效实现,使其在NVFP4训练大语言模型时具备可行性。在基于Transformer及混合模型架构的预训练实验中,我们发现4/6方法在多种情况下能有效防止训练发散,相较于采用当前最先进NVFP4训练方案的模型,其训练损失显著更接近BF16基准。我们还发现4/6方法可轻松集成到多种后训练量化方案中,并普遍提升下游任务精度。我们希望这项工作能激发未来在NVFP4模型训练与部署领域的进一步探索。

0
下载
关闭预览

相关内容

FlowQA: Grasping Flow in History for Conversational Machine Comprehension
专知会员服务
34+阅读 · 2019年10月18日
Keras François Chollet 《Deep Learning with Python 》, 386页pdf
专知会员服务
163+阅读 · 2019年10月12日
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Unsupervised Learning via Meta-Learning
CreateAMind
43+阅读 · 2019年1月3日
STRCF for Visual Object Tracking
统计学习与视觉计算组
15+阅读 · 2018年5月29日
Focal Loss for Dense Object Detection
统计学习与视觉计算组
12+阅读 · 2018年3月15日
IJCAI | Cascade Dynamics Modeling with Attention-based RNN
KingsGarden
13+阅读 · 2017年7月16日
国家自然科学基金
13+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
VIP会员
相关资讯
Transferring Knowledge across Learning Processes
CreateAMind
29+阅读 · 2019年5月18日
Unsupervised Learning via Meta-Learning
CreateAMind
43+阅读 · 2019年1月3日
STRCF for Visual Object Tracking
统计学习与视觉计算组
15+阅读 · 2018年5月29日
Focal Loss for Dense Object Detection
统计学习与视觉计算组
12+阅读 · 2018年3月15日
IJCAI | Cascade Dynamics Modeling with Attention-based RNN
KingsGarden
13+阅读 · 2017年7月16日
相关基金
国家自然科学基金
13+阅读 · 2017年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
2+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员