通过自适应分块缩放,提升NVFP4量化精度,减少大数值误差。
Four Over Six: More Accurate NVFP4 Quantization with Adaptive Block Scaling
- 采用自适应分块缩放策略优化浮点格式分布
- 在30B模型上训练损失接近BF16,优于现有NVFP4方法
- 适合追求高效低精度训练的AI工程师
随着大语言模型规模扩大,人们越来越关注像NVFP4这样的低精度数值格式以提升速度并降低内存占用。然而,将模型量化至NVFP4仍具挑战性,因精度不足通常导致性能下降。本文提出四过六(4/6),一种对块缩放NVFP4量化的改进方法,显著降低量化误差。与整数格式不同,浮点格式具有非均匀步长,使大数值产生更大量化误差。4/6利用这一特性,自适应地将部分块缩放为更小的FP4值,使可表示数值分布更均匀,从而降低接近最大值时的量化误差。我们证明4/6可在现代硬件加速器上高效实现,在预训练和推理阶段均带来性能提升,计算开销极小。在Nemotron 3 Nano 30B-A3B模型架构的预训练实验中,4/6使训练损失更接近BF16,优于当前最先进的NVFP4训练方案。代码已开源:https://github.com/mit-han-lab/fouroversix。
原文摘要 · Abstract (English)
As large language models have grown larger, interest has grown in low-precision numerical formats such as NVFP4 as a way to improve speed and reduce memory usage. However, quantizing models to NVFP4 remains challenging as the lack of precision generally degrades model performance. In this work, we address this issue with Four Over Six (4/6), a modification to the block-scaled NVFP4 quantization algorithm that yields reduced quantization error. Unlike integer formats, floating point formats have non-uniform step sizes which create larger quantization error on larger values. 4/6 takes advantage of this by adaptively scaling some blocks to smaller FP4 values, making the distribution of representable values more uniform and reducing quantization error for near-maximal values. We show that 4/6 can be implemented efficiently on modern hardware accelerators, resulting in performance gains during both pre-training and inference with minimal computational overhead. In pre-training experiments with the Nemotron 3 Nano 30B-A3B model architecture, we find that 4/6 brings training loss closer to BF16 compared to models trained with current state-of-the-art NVFP4 training recipes. Our code is available at https://github.com/mit-han-lab/fouroversix.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。