提出新方法补偿量化误差,显著提升低比特大模型性能。
First-Order Error Matters: Accurate Compensation for Quantized Large Language Models
- 显式建模一阶误差,改进量化补偿机制
- 3比特量化下Llama3-8B困惑度降低17.3%
- 兼容先进压缩技术,适合追求高效部署的开发者
后训练量化(PTQ)能有效压缩大语言模型,降低内存访问和计算开销。现有基于补偿的权重量化方法通常依赖二阶泰勒展开建模量化误差,假设一阶项可忽略。但我们发现,渐进式补偿过程会累积潜在权重与全精度版本间的一阶偏差,使该假设根本错误。为此,我们提出FOEM,一种新型PTQ方法,显式引入一阶梯度项以改进量化误差补偿。FOEM通过在预量化权重处进行一阶泰勒展开近似梯度,得到基于潜在权重与全精度权重差异及海森矩阵的近似表达式。代入理论解后,无需显式计算海森矩阵,避免了反向传播方法的高成本与泛化局限,仅引入极小额外开销。大量实验表明,FOEM在多种模型与基准上持续优于经典GPTQ方法。在3比特权重量化下,Llama3-8B的困惑度降低17.3%,5样本MMLU准确率从GPTAQ的53.8%提升至56.1%。此外,FOEM可无缝结合SpinQuant等先进技术,在严苛的W4A4KV4设置下进一步提升性能,缩小与全精度基线差距,超越现有最先进方法。
原文摘要 · Abstract (English)
Post-training quantization (PTQ) offers an efficient approach to compressing large language models (LLMs), significantly reducing memory access and computational costs. Existing compensation-based weight calibration methods often rely on a second-order Taylor expansion to model quantization error, under the assumption that the first-order term is negligible in well-trained full-precision models. However, we reveal that the progressive compensation process introduces accumulated first-order deviations between latent weights and their full-precision counterparts, making this assumption fundamentally flawed. To address this, we propose FOEM, a novel PTQ method that explicitly incorporates first-order gradient terms to improve quantization error compensation. FOEM approximates gradients by performing a first-order Taylor expansion around the pre-quantization weights. This yields an approximation based on the difference between latent and full-precision weights as well as the Hessian matrix. When substituted into the theoretical solution, the formulation eliminates the need to explicitly compute the Hessian, thereby avoiding the high computational cost and limited generalization of backpropagation-based gradient methods. This design introduces only minimal additional computational overhead. Extensive experiments across a wide range of models and benchmarks demonstrate that FOEM consistently outperforms the classical GPTQ method. In 3-bit weight-only quantization, FOEM reduces the perplexity of Llama3-8B by 17.3% and increases the 5-shot MMLU accuracy from 53.8% achieved by GPTAQ to 56.1%. Moreover, FOEM can be seamlessly combined with advanced techniques such as SpinQuant, delivering additional gains under the challenging W4A4KV4 setting and further narrowing the performance gap with full-precision baselines, surpassing existing state-of-the-art methods.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。