提出2比特向量量化方法,让大模型推理更快更省显存。
VPTQ: Extreme Low-bit Vector Post-Training Quantization for Large Language Models
- 用二阶优化设计向量量化算法,实现极低比特压缩。
- 2比特下在多个大模型上降低困惑度0.01-7.34,准确率提升1%-22%。
- 仅需10%-18%计算时间,推理速度提升1.6-1.8倍,适合部署场景。
大规模语言模型(LLMs)的扩展显著增加了部署与推理的挑战。由于权重冗余,近期研究聚焦于将权重仅量化至极低比特(甚至2比特),以降低内存需求、优化存储成本并减少推理时的内存带宽消耗。然而,传统标量量化因数值表示限制难以实现极端低比特。向量量化(VQ)通过查找表将向量压缩为索引,展现出极低比特量化的潜力。本文提出向量后训练量化(VPTQ),采用二阶优化构建LLM VQ问题,并据此指导量化算法设计。通过分解优化问题,提出一种高效代码本初始化方法;进一步引入通道无关的二阶优化实现精细化量化。此外,扩展支持残差与异常值量化,提升精度并增强压缩效果。实验表明,VPTQ在2比特下相较现有最优方法,使LLaMA-2困惑度降低0.01-0.34,Mistral-7B降低0.38-0.68,LLaMA-3降低4.41-7.34,平均准确率提升0.79%-1.5%(LLaMA-2)、1%(Mistral-7B)、11%-22%(LLaMA-3,QA任务)。仅消耗10.4%-18.6%的量化执行时间,推理吞吐量提升1.6-1.8倍。
原文摘要 · Abstract (English)
Scaling model size significantly challenges the deployment and inference of Large Language Models (LLMs). Due to the redundancy in LLM weights, recent research has focused on pushing weight-only quantization to extremely low-bit (even down to 2 bits). It reduces memory requirements, optimizes storage costs, and decreases memory bandwidth needs during inference. However, due to numerical representation limitations, traditional scalar-based weight quantization struggles to achieve such extreme low-bit. Recent research on Vector Quantization (VQ) for LLMs has demonstrated the potential for extremely low-bit model quantization by compressing vectors into indices using lookup tables. In this paper, we introduce Vector Post-Training Quantization (VPTQ) for extremely low-bit quantization of LLMs. We use Second-Order Optimization to formulate the LLM VQ problem and guide our quantization algorithm design by solving the optimization. We further refine the weights using Channel-Independent Second-Order Optimization for a granular VQ. In addition, by decomposing the optimization problem, we propose a brief and effective codebook initialization algorithm. We also extend VPTQ to support residual and outlier quantization, which enhances model accuracy and further compresses the model. Our experimental results show that VPTQ reduces model quantization perplexity by $0.01$-$0.34$ on LLaMA-2, $0.38$-$0.68$ on Mistral-7B, $4.41$-$7.34$ on LLaMA-3 over SOTA at 2-bit, with an average accuracy improvement of $0.79$-$1.5\%$ on LLaMA-2, $1\%$ on Mistral-7B, $11$-$22\%$ on LLaMA-3 on QA tasks on average. We only utilize $10.4$-$18.6\%$ of the quantization algorithm execution time, resulting in a $1.6$-$1.8\times$ increase in inference throughput compared to SOTA.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。