Command Palette
Search for a command to run...
TurboQuant: 근사 최적 왜곡률을 갖는 온라인 Vector Quantization
TurboQuant: 근사 최적 왜곡률을 갖는 온라인 Vector Quantization
Amir Zandieh Majid Daliri Majid Hadian Vahab Mirrokni
초록
Shannon의 소스 코딩 이론(source coding theory)에 뿌리를 둔 벡터 양자화(Vector quantization)는 기하학적 구조의 왜곡(distortion)을 최소화하면서 고차원 유클리드 벡터를 양자화하는 것을 목표로 합니다. 본 논문에서는 평균 제곱 오차(MSE)와 내적 왜곡(inner product distortion)을 모두 해결하기 위해 TURBOQUANT를 제안하며, 최적의 왜곡률(distortion rates)을 달성하지 못하는 기존 방식들의 한계를 극복합니다. 온라인 애플리케이션에 적합한 데이터 무관(data-oblivious) 알고리즘인 TURBOQUANT는 모든 비트 폭(bit-width)과 차원(dimension)에 걸쳐 최적에 가까운 왜곡률(작은 상수 계수 이내)을 달성합니다.TURBOQUANT는 입력 벡터를 무작위로 회전시켜 좌표에 집중된 Beta 분포를 유도하고, 고차원에서 서로 다른 좌표들이 갖는 준독립성(near-independence) 특성을 활용함으로써 각 좌표에 최적의 스칼라 양자화기(scalar quantizer)를 간단히 적용하는 방식으로 이를 구현합니다. MSE 최적 양자화기가 내적 추정 시 편향(bias)을 유발한다는 점을 인지하여, 본 연구에서는 2단계 접근 방식을 제안합니다. 즉, MSE 양자화기를 먼저 적용한 후 잔차(residual)에 1-bit Quantized JL (QJL) 변환을 적용함으로써 편향되지 않은(unbiased) 내적 양자화기를 도출합니다. 또한, 어떠한 벡터 양자화기에 의해서도 달성 가능한 최선의 왜곡률에 대한 정보 이론적 하한선(information-theoretic lower bounds)을 정식으로 증명하며, TURBOQUANT가 단지 작은 상수 계수의 차이만을 보일 뿐 이러한 하한선에 매우 근접함을 입증합니다.
One-sentence Summary
TurboQuant is a data-oblivious online vector quantization framework that achieves near-optimal distortion rates within a small constant factor for mean-squared error and inner product distortion across all bit-widths and dimensions by randomly rotating input vectors to enable optimal scalar quantization per coordinate and employing a two-stage approach that applies an MSE quantizer followed by a 1-bit Quantized JL transform on the residual to yield an unbiased inner product quantizer and match information-theoretic lower bounds.
Key Contributions
- The paper introduces TURBOQUANT, a data-oblivious algorithm designed to minimize both mean-squared error and inner product distortion in vector quantization. This method achieves near-optimal distortion rates across all bit-widths and dimensions by randomly rotating input vectors to leverage near-independence properties for scalar quantization.
- A two-stage approach is presented to eliminate bias in inner product estimation by applying an MSE quantizer followed by a 1-bit Quantized JL transform on the residual vector. This composition yields an unbiased inner product quantizer with provably optimal distortion bounds.
- The work provides a formal proof of information-theoretic lower bounds on the best achievable distortion rate for any vector quantizer. TURBOQUANT closely matches these bounds and achieves an exponential improvement over existing methods in terms of bit-width dependence.
Introduction
Vector quantization is essential for compressing high-dimensional vectors in large language models and vector databases to reduce memory demands and inference latency. Prior work often faces a trade-off where algorithms lack accelerator compatibility for real-time applications or suffer from suboptimal distortion bounds relative to bit-width. To overcome these limitations, the authors present TurboQuant, a lightweight online method optimized for modern hardware accelerators. This approach utilizes a two-stage process combining an MSE-optimal quantizer with a residual quantizer to deliver unbiased inner product estimates with provably optimal distortion rates.
Method
The TURBOQUANT framework addresses vector quantization by designing specific maps to minimize Mean-Squared Error (MSE) and inner product distortion. The core objective involves defining a quantization map Q:Rd→{0,1}B and an inverse dequantization map Q−1:{0,1}B→Rd. The authors aim to minimize the expected distortion for worst-case vectors without making assumptions about the input dataset.
For MSE optimization, the method employs a random rotation strategy to simplify the quantization landscape. The process begins by multiplying the input vector x with a random rotation matrix Π∈Rd×d. This rotation ensures that the resulting vector is uniformly distributed on the unit hypersphere. Consequently, each coordinate of the rotated vector follows a Beta distribution, which converges to a Gaussian distribution in high dimensions. Leveraging the near-independence of distinct coordinates in high dimensions, the authors apply optimal scalar quantizers to each coordinate independently. Optimal centroids for the Beta distribution are precomputed using the Max-Lloyd algorithm and stored in codebooks. During quantization, the algorithm identifies the nearest centroid for each rotated coordinate. Dequantization involves retrieving these centroids and applying the inverse rotation Π⊤ to reconstruct the vector in the original basis. A pseudocode for these procedures is given in Algorithm 1.
To handle inner product estimation, the authors recognize that MSE-optimal quantizers introduce bias. They propose a two-stage algorithm to achieve unbiased inner product estimates. The first stage applies the MSE-optimized quantizer Qmse using a bit-width of b−1. The second stage processes the residual error vector using a 1-bit Quantized Johnson-Lindenstrauss (QJL) transform. The QJL map projects the residual onto a random matrix with Gaussian entries and applies a sign function. The final reconstruction combines the MSE-dequantized vector and the scaled QJL reconstruction of the residual. This hybrid approach ensures the inner product estimator remains unbiased while maintaining low distortion rates. A pseudocode for this procedure is given in Algorithm 2.
Theoretical analysis establishes that TURBOQUANT achieves near-optimal distortion rates. By leveraging Shannon's lower bound and Yao's minimax principle, the authors prove that the MSE distortion is within a small constant factor of the information-theoretic lower bound. Similarly, the inner product distortion bounds are proven to be nearly optimal for any given bit-width. These guarantees hold across all bit-widths and dimensions, validating the efficiency of the proposed data-oblivious algorithms for online applications.
Experiment
The experiments utilize an NVIDIA A100 GPU to validate theoretical error bounds on the DBpedia dataset and evaluate downstream performance on long-context tasks using Llama-3.1-8B-Instruct and Ministral-7B-Instruct models. Results confirm that the proposed methods align with theoretical predictions by maintaining unbiased inner product estimation and achieving recall scores comparable to full-precision models under significant compression. Furthermore, near-neighbor search evaluations demonstrate consistent superiority over baseline quantization techniques in recall accuracy, highlighting the approach's robustness for high-dimensional search and generation tasks.
The authors evaluate KV cache compression methods on the LongBench dataset using Llama-3.1-8B-Instruct and Ministral-7B-Instruct models. Results indicate that TURBOQUANT achieves performance comparable to the full-precision baseline while utilizing significantly lower bit precisions. TURBOQUANT achieves average scores comparable to the full-precision baseline on the Llama model. The method maintains high performance on the Ministral model with reduced cache sizes. TURBOQUANT demonstrates competitive results against baselines like KIVI and PolarQuant across various tasks.
The the the table compares the quantization time of three different approaches across varying vector dimensions. TURBOQUANT consistently demonstrates significantly faster processing speeds compared to both Product Quantization and RabitQ. The efficiency advantage of TURBOQUANT becomes increasingly pronounced as the dimensionality of the data grows. TURBOQUANT maintains the lowest time cost across all tested dimensions. RabitQ incurs the highest computational overhead, especially at larger dimensions. Product Quantization is faster than RabitQ but lags significantly behind TURBOQUANT.
The evaluation assesses TURBOQUANT on the LongBench dataset using Llama-3.1-8B-Instruct and Ministral-7B-Instruct models to validate KV cache compression effectiveness. Results indicate that the method achieves performance comparable to full-precision baselines and remains competitive against approaches like KIVI and PolarQuant while utilizing significantly lower bit precisions. Furthermore, quantization time comparisons show that TURBOQUANT consistently processes data faster than Product Quantization and RabitQ across varying vector dimensions, with its efficiency advantage becoming more pronounced as dimensionality grows.