提出在线向量量化方法TurboQuant,实现接近最优的压缩失真率。
TurboQuant: Online Vector Quantization with Near-optimal Distortion Rate
- 通过随机旋转与坐标独立性,对每维独立使用最优标量量化器。
- 在3.5比特/通道下保持精度不变,2.5比特时仅轻微退化。
- 适合大模型推理中的键值缓存压缩与最近邻搜索任务。
向量量化源于香农信源编码理论,旨在以最小失真压缩高维欧氏向量。本文提出TurboQuant,同时优化均方误差(MSE)和内积失真,突破现有方法无法达到最优失真率的局限。所提数据无关算法适用于在线场景,在所有位宽与维度下均达到近似最优失真率(仅差常数因子约2.7)。其核心思想是随机旋转输入向量,使坐标服从集中型贝塔分布,并利用高维下坐标近独立特性,对各维分别应用最优标量量化器。针对MSE最优量化器引入内积估计偏差的问题,提出两阶段方案:先用MSE量化器处理,再对残差进行1比特量化约翰逊-林登斯特拉夫(QJL)变换,获得无偏内积量化结果。我们还给出了任意向量量化器所能达到的最佳失真率的信息论下界,证明TurboQuant与此下界仅差一个微小常数因子。实验验证了理论结论:在键值缓存量化中,3.5比特/通道实现绝对质量中立,2.5比特时仅有轻微质量下降;在最近邻搜索任务中,召回率优于现有产品量化方法,且索引时间几乎为零。
原文摘要 · Abstract (English)
Vector quantization, a problem rooted in Shannon's source coding theory, aims to quantize high-dimensional Euclidean vectors while minimizing distortion in their geometric structure. We propose TurboQuant to address both mean-squared error (MSE) and inner product distortion, overcoming limitations of existing methods that fail to achieve optimal distortion rates. Our data-oblivious algorithms, suitable for online applications, achieve near-optimal distortion rates (within a small constant factor) across all bit-widths and dimensions. TurboQuant achieves this by randomly rotating input vectors, inducing a concentrated Beta distribution on coordinates, and leveraging the near-independence property of distinct coordinates in high dimensions to simply apply optimal scalar quantizers per each coordinate. Recognizing that MSE-optimal quantizers introduce bias in inner product estimation, we propose a two-stage approach: applying an MSE quantizer followed by a 1-bit Quantized JL (QJL) transform on the residual, resulting in an unbiased inner product quantizer. We also provide a formal proof of the information-theoretic lower bounds on best achievable distortion rate by any vector quantizer, demonstrating that TurboQuant closely matches these bounds, differing only by a small constant ($\approx 2.7$) factor. Experimental results validate our theoretical findings, showing that for KV cache quantization, we achieve absolute quality neutrality with 3.5 bits per channel and marginal quality degradation with 2.5 bits per channel. Furthermore, in nearest neighbor search tasks, our method outperforms existing product quantization techniques in recall while reducing indexing time to virtually zero.
Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。