arXiv:2505.14302cs.LGcs.CL2025-05被引 16

提出4比特量化训练统一规律,揭示误差来源并指导精度优化。

Scaling Law for Quantization-Aware Training

  • 构建包含模型规模、数据量与分组粒度的量化训练统一规律
  • 发现训练数据越多、分组越粗,量化误差越大,权重误差增长更快
  • 定位全连接层激活值异常为4比特瓶颈,可针对性用混合精度改进

大语言模型(LLMs)需大量计算与内存资源,部署困难。量化感知训练(QAT)通过降低模型精度维持性能,但其在4比特精度(W4A4)下的缩放行为尚不明确。现有缩放规律常忽略训练样本数与量化粒度等关键因素。本文提出统一的QAT缩放规律,将量化误差建模为模型规模、训练数据量与量化分组大小的函数。通过268次QAT实验发现:量化误差随模型增大而下降,但随训练样本增多和分组变粗而上升。分解权重与激活量化误差后发现,两者均遵循总体趋势,但权重误差对训练数据更敏感。进一步分析表明,FC2层因异常值导致的激活量化误差是W4A4 QAT的主要瓶颈。通过引入混合精度量化,使权重与激活误差趋于一致。此外,数据量增加时,权重误差最终超过激活误差,提示此时也应关注权重精度提升。这些发现为优化QAT研究提供关键洞见。

原文摘要 · Abstract (English)

Large language models (LLMs) demand substantial computational and memory resources, creating deployment challenges. Quantization-aware training (QAT) addresses these challenges by reducing model precision while maintaining performance. However, the scaling behavior of QAT, especially at 4-bit precision (W4A4), is not well understood. Existing QAT scaling laws often ignore key factors such as the number of training tokens and quantization granularity, which limits their applicability. This paper proposes a unified scaling law for QAT that models quantization error as a function of model size, training data volume, and quantization group size. Through 268 QAT experiments, we show that quantization error decreases as model size increases, but rises with more training tokens and coarser quantization granularity. To identify the sources of W4A4 quantization error, we decompose it into weight and activation components. Both components follow the overall trend of W4A4 quantization error, but with different sensitivities. Specifically, weight quantization error increases more rapidly with more training tokens. Further analysis shows that the activation quantization error in the FC2 layer, caused by outliers, is the primary bottleneck of W4A4 QAT quantization error. By applying mixed-precision quantization to address this bottleneck, we demonstrate that weight and activation quantization errors can converge to similar levels. Additionally, with more training data, weight quantization error eventually exceeds activation quantization error, suggesting that reducing weight quantization error is also important in such scenarios. These findings offer key insights for improving QAT research and development.

量化大模型训练规律4比特

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