随着大语言模型的增长,人们对低精度数值格式如NVFP4的兴趣增加,以提高速度和减少内存使用。然而,将模型量化到NVFP4仍然具有挑战性,因为精度的缺乏通常会降低模型性能。在本工作中,我们通过Four Over Six(4/6)对块缩放的NVFP4量化算法进行了修改,从而减少了量化误差。与整数格式不同,浮点格式具有非均匀的步长,这在较大的值上会产生更大的量化误差。4/6利用这一点,通过自适应地将某些块缩放为更小的FP4值,使可表示值的分布更加均匀,从而减少接近最大值的量化误差。我们证明,4/6可以在现代硬件加速器上高效实现,从而在预训练和推理过程中带来性能提升,同时计算开销极低。在使用Nemotron 3 Nano 30B-A3B模型架构的预训练实验中,我们发现4/6使训练损失更接近BF16,相比使用当前最先进的NVFP4训练配方的模型。我们的代码可在https://github.com/mit-han-lab/fouroversix上获取。
英文摘要:
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.
Department of Computer Science and Technology, University of Cambridge(计算机科学与技术系,剑桥大学);Department of Electrical & Electronic Engineering, Imperial College London(电气与电子工程系,伦敦帝国学院);Department of Computer Science, University of Hong Kong(计算机科学系,香港大学);School of Informatics, University of Edinburgh(信息学院,爱丁堡大学)
LoPRo: Enhancing Low-Rank Quantization via Permuted Block-Wise Rotation
Institute of Software Chinese Academy of Sciences(中国科学院软件研究所);University of Chinese Academy of Sciences(中国科学院大学);Beijing University of Aeronautics and Astronautics(北京航空航天大学)
Block Rotation is All You Need for MXFP4 Quantization
Nanjing University of Science and Technology(南京理工大学);School of Artificial Intelligence, University of Chinese Academy of Sciences(中国科学院大学人工智能学院);Zhongguancun Academy(中关村学院);School of Computer Science, University of Sydney(悉尼大学计算机科学学院)
Pushing the Limits of Block Rotations in Post-Training Quantization
Advanced Micro Devices, Inc. (AMD)(Advanced Micro Devices公司);State University of New York at Buffalo(纽约州立大学布法罗分校);Norwegian University of Science(挪威科学与技术大学)
From Attention Sensitivity to Layer Role: Revisiting Mixed-Precision Quantization of Transformers
Sharif University of Technology(谢里夫理工大学);GISMA University of Applied Sciences(GISMA应用科学大学);BRAINS, Brandenburg Research Center for Applied Intelligent Systems(勃兰登堡应用智能系统研究中心);Max Planck Institute for Security and Privacy(马克斯·普朗克安全与隐私研究所);Computer Vision Center (CVC)(计算机视觉中心);University of Cambridge(剑桥大学)
G$^2$PTQ: Improving LLM Post-Training Quantization with Generalized Gradient Compensation
ZTE Corporation(中兴通讯);The Chinese University of Hong Kong(香港中文大学);Northwestern Polytechnical University(西北工业大学);Peking University(北京大学);Nanjing University of Aeronautics and Astronautics(南京航空航天大学)
BitsMoE: Cost-Aware Bit Allocation in Spectral Space for MoE LLM Quantization
School of Microelectronics, University of Science and Technology of China(中国科学技术大学微电子学院);College of Computing and Data Science, Nanyang Technological University(南洋理工大学计算与数据科学学院);School of Electrical and Electronic Engineering, Nanyang Technological University(南洋理工大学电子与电气工程学院)