用金字塔向量量化让大模型压缩更高效,3.25比特仍保98%精度。
Pyramid Vector Quantization for LLMs
- 基于球面几何设计无代码本的金字塔向量量化方法
- 将Llama-3 70B压缩至3.25比特/权重,保持98%下游任务准确率
- 融合海森信息优化量化,适合追求极致压缩的部署场景
近期基于量化的大语言模型压缩研究通过重参数化使权重分布于球面上,提升可量化性并减少权重异常值,同时不影响网络输出。本文进一步利用权重的球面几何特性,提出金字塔向量量化(PVQ)用于大语言模型。在高维空间中均匀排列球面点极为困难,且显式存储码本会带来额外内存开销。为此,PVQ采用投影到1-球面的固定整数格点,实现无需显式码本的高效编码解码。为获得实用算法,我们结合尺度量化,并在经验验证假设下推导出理论最优量化方案。此外,我们将PVQ扩展至利用海森信息,在预期特征激活下最小化量化误差,而非仅依赖权重幅度。实验表明,该方法在权重与激活比特数之间达到帕累托最优,性能优于现有方法。在仅量化权重的情况下,可将Llama-3 70B模型压缩至3.25比特/权重,下游任务准确率达98%。
原文摘要 · Abstract (English)
Recent works on compression of large language models (LLM) using quantization considered reparameterizing the architecture such that weights are distributed on the sphere. This demonstratively improves the ability to quantize by increasing the mathematical notion of coherence, resulting in fewer weight outliers without affecting the network output. In this work, we aim to further exploit this spherical geometry of the weights when performing quantization by considering Pyramid Vector Quantization (PVQ) for large language models. Arranging points evenly on the sphere is notoriously difficult, especially in high dimensions, and in case approximate solutions exists, representing points explicitly in a codebook is typically not feasible due to its additional memory cost. Instead, PVQ uses a fixed integer lattice on the sphere by projecting points onto the 1-sphere, which allows for efficient encoding and decoding without requiring an explicit codebook in memory. To obtain a practical algorithm, we propose to combine PVQ with scale quantization for which we derive theoretically optimal quantizations, under empirically verified assumptions. Further, we extend pyramid vector quantization to use Hessian information to minimize quantization error under expected feature activations, instead of only relying on weight magnitudes. Experimentally, we achieves state-of-the-art quantization performance with pareto-optimal trade-off between performance and bits per weight and bits per activation, compared to compared methods. On weight-only, we find that we can quantize a Llama-3 70B model to 3.25 bits per weight and retain 98\% accuracy on downstream tasks.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。