提出WinQ算法,加速低比特量化训练,突破收敛慢瓶颈
WinQ: Accelerating Quantization-Aware Training of Language Models Around Saddle Points
- 通过重置权重到高低精度插值点,缓解鞍点附近梯度稀疏问题
- 在相同训练成本下,4比特以下量化性能提升最高达8.8%
- 适用于各类语言模型与量化方法,实测加速比最高达4倍
量化感知训练(QAT)通过在量化模型上反向传播梯度来训练全精度权重,是语言模型量化的重要手段。但其主要瓶颈在于收敛缓慢且早期性能停滞,尤其在4比特以下时更为显著。本文通过分析损失曲面黑塞矩阵的谱特性发现,权重会收敛至鞍点附近的平坦区域,其中大量特征值正负混杂;随着训练进行,更多特征值聚集于零附近,且幅度减小,低比特下特征值幅度更小。为此,提出WinQ算法:(1) 定期将权重重置为全精度与量化权重的线性插值,缩短与量化网格距离并增大特征值幅度;(2) 通过注入噪声权重计算梯度,对黑塞矩阵进行正则化。大量实验表明,WinQ在多种量化方法与模型上可实现最高4倍加速,相同训练成本下,子4比特量化性能最高提升8.8%,结果在16种不同设置中保持一致。
原文摘要 · Abstract (English)
Quantization-aware training (QAT) is widely adopted to quantize language models by training full-precision weights using gradients from the quantized model. The main bottleneck is its slow convergence and early performance plateau, particularly below 4-bit-widths. While this problem has been observed in prior work, its precise cause remains unclear. In this paper, we analyze the convergence of QAT by estimating the spectrum of the loss-surface Hessians. We find that the weights converge to flat regions around saddle points, where a large fraction of the Hessian eigenvalues are both positive and negative. During training, an increasing fraction of Hessian eigenvalues concentrates around zero, whose magnitude decreases. At lower bit-widths, the magnitude of eigenvalues in the Hessian spectrum is significantly smaller. To mitigate these issues, we propose an algorithm called WinQ to accelerate QAT, which involves: (1) periodically resetting weights to the linear interpolation of full-precision and quantized weights, reducing the distance to the quantization grid and increasing eigenvalue magnitude, and (2) computing gradients of noise-injected weights to regularize the Hessian. Extensive experiments show that WinQ accelerates QAT by up to 4 times across various quantization methods and models. Under the same training cost, WinQ improves state-of-the-art sub-4-bit quantization by up to 8.8%. These results are consistent across 16 settings with different language models, quantization methods, and bit widths.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。