arXiv:2505.06653cs.LGcs.CL2025-05被引 4

4-bit量化新方法,显著降低大模型推理误差。

Improving Block-Wise LLM Quantization by 4-bit Block-Wise Optimal Float (BOF4): Analysis and Variations

  • 提出新型4位块量化方法BOF4,优化量化误差分布。
  • 结合零值与大权值精准表示,提升语言建模性能。
  • 设计混合精度策略OPQ,保留异常权重精度,适合高要求场景。

大语言模型在微调和推理中需要大量内存。为实现内存高效微调,现有方法采用块级量化技术(如NF4、AF4)对网络权重进行压缩。本文指出这些方法存在次优量化误差。为此,首次提出块级量化的优化方法,设计出4位块级最优浮点(BOF4)系列量化器,可一致降低量化误差。提供了理论与数据驱动的优化方案,并证明其实际等价性。其次,基于符号绝对块最大值的归一化改进(BOF4-S),进一步减小量化误差,实证显示语言建模性能下降更少。第三,通过实验研究了准确表示零值和大振幅权重的重要性,以及针对不同误差指标的优化效果。最后,提出一种混合精度量化策略——异常值保留量化(OPQ),将异常权重以16位精度存储,其余使用BOF4-S,使4位块量化在困惑度上达到领先表现。

原文摘要 · Abstract (English)

Large language models (LLMs) demand extensive memory capacity during both fine-tuning and inference. To enable memory-efficient fine-tuning, existing methods apply block-wise quantization techniques, such as NF4 and AF4, to the network weights. We show that these quantization techniques incur suboptimal quantization errors. Therefore, as a first novelty, we propose an optimization approach for block-wise quantization. Using this method, we design a family of quantizers named 4-bit block-wise optimal float (BOF4), which consistently reduces the quantization error compared to both baseline methods. We provide both a theoretical and a data-driven solution for the optimization process and prove their practical equivalence. Secondly, we propose a modification to the employed normalization method based on the signed absolute block maximum (BOF4-S), enabling further reduction of the quantization error and empirically achieving less degradation in language modeling performance. Thirdly, we explore additional variations of block-wise quantization methods applied to LLMs through an experimental study on the importance of accurately representing zero and large-amplitude weights on the one hand, and optimization towards various error metrics on the other hand. Lastly, we introduce a mixed-precision quantization strategy dubbed outlier-preserving quantization (OPQ) to address the distributional mismatch induced by outlier weights in block-wise quantization. By storing outlier weights in 16-bit precision (OPQ) while applying BOF4-S, we achieve top performance among 4-bit block-wise quantization techniques w.r.t. perplexity.

量化大模型4比特混合精度

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。