TL;DR
As Large Language Models (LLMs) swallow entire books in a single prompt, their working memory—the Key-Value (KV) cache—threatens to overflow GPU VRAM. RankVQ shrinks this memory footprint down to ultra-low sub-1-bit regimes by discovering and exploiting hidden low-rank patterns inside quantization codebooks during offline setup. Best of all, the extra math vanishes before deployment, giving you sharper long-context recall and math reasoning at zero extra runtime cost.
What Problem Does This Paper Address?
Every time an LLM generates a token, it avoids recomputing the past by storing intermediate Key and Value vectors in a KV cache. At 128K context lengths, this cache grows linearly and quickly hogs GPU memory.
Vector Quantization (VQ) compresses this cache by replacing bulky continuous vectors with compact integer indices pointing to a lookup table (a codebook). However, modern LLMs use Rotary Position Embeddings (RoPE), which geometrically rotate Key vectors based on token position. Normally, you would have to reconstruct the full vectors before applying rotations—slowing down decoding.
Recent "commutative VQ" methods solved the speed issue by constraining codewords to special $2 \times 2$ pseudo-symmetric matrices ($\begin{smallmatrix} a & b \\ -b & a \end{smallmatrix}$) that commute with 2D rotations, allowing attention scores to be computed directly from compressed indices. Yet, these methods treat the scalar building blocks ($a$ and $b$) across every subspace and codeword as completely independent numbers. As Figure 1 shows, both the token representations and those learned parameter matrices actually exhibit rapidly decaying singular values—meaning they are packed with unexploited, low-rank redundancy.
Methods
What is standard here is the online inference path: RankVQ keeps the exact same fast, reconstruction-free lookup and commutative attention kernel as prior RoPE-aware VQ (specifically CommVQ). What is new happens entirely offline before the model ever serves a user.
Instead of compressing the deployed $2 \times 2$ codebooks directly—which would break the delicate algebraic symmetry required to commute with RoPE—RankVQ factorizes the global scalar coefficient matrices $A$ and $B$ (which stack all the $a$'s and $b$'s across subspaces and codewords) into shared low-rank matrices ($A = S_A V_A^\top$).
To build these codebooks offline, RankVQ uses a three-step recipe:
- SVD Warm Start: Train a standard full-rank reference codebook on calibration data and decompose its coefficient matrices via truncated Singular Value Decomposition (SVD).
- Low-Rank EM Refinement: Run an Expectation-Maximization (EM) loop. The E-step assigns calibration vectors to their nearest current codewords; the M-step updates the low-rank factors using regularized Alternating Least Squares (ALS). They apply this same parameterization to Value codebooks too.
- Reconstruct and Discard: Multiply the refined factors back together to form standard codebooks, and throw the low-rank factors away.
Datasets
- Calibration (Offline Codebook Construction): A subset of FineWeb-Edu (using pre-RoPE Key and Value activations).
- Evaluation: Long-context understanding and retrieval are tested on LongBench, InfiniteBench, and Needle-in-a-Haystack (up to 128K tokens). Mathematical reasoning is evaluated on GSM8K and MATH-500. No new benchmarks are introduced.
Key Insights and Ideas
- Factorize the recipe, not the cake: Applying low-rank approximations directly to deployed codewords ruins RoPE commutativity. Factorizing the underlying scalar coefficient tables preserves exact $2 \times 2$ pseudo-symmetry while forcing subspaces and codewords to share dominant patterns.
- Implicit Nuclear-Norm Regularization: Even when the rank limit isn't strictly bottlenecking the matrix size, Frobenius-norm penalties on the two low-rank factors mathematically act as nuclear-norm regularization—nudging EM toward cleaner, better-generalizing codebooks rather than just approximating a fixed solution post-hoc.
- Values benefit just as much as Keys: Even though Value vectors never touch RoPE rotations, their codebook parameters share the exact same spectral redundancy; refining them via low-rank EM contributes roughly half the total accuracy jump.
Key Results
Evaluated primarily on LLaMA-3.1-8B-Instruct:
- 2-bit Regime (1.64 Avg. bits): RankVQ-2 scores 48.30 on LongBench (edging out the 16-bit FP16 baseline's 48.05) and 76.54 on GSM8K (matching FP16's 76.27).
- Ultra-Low 1-bit Regime (0.86 Avg. bits): RankVQ-1 reaches 46.36 on LongBench (vs. 44.94 for CommVQ-1 at 1.03 bits, and 16.70 for KIVI-1). On InfiniteBench's brutal
R.KVkey-value retrieval task, every other 1-bit baseline collapses to 0.00, whereas RankVQ-1 retains 8.01. On GSM8K, it hits 70.07 (beating CommVQ-1 by 3.5 points). - System Efficiency (128K Context, Batch Size 1): RankVQ-1 slashes the KV cache from 16.80 GB (FP16) to 1.44 GB (smaller than CommVQ-1's 2.45 GB) while decoding at 65.37 ms/token—nearly matching FP16 speed (63.78 ms/token) and running faster than KIVI-1 (75.42 ms/token) and CommVQ-1 (70.60 ms/token).
Limitations and Future Work
The paper does not include a dedicated "Limitations and Future Work" section in the main text. However, the authors explicitly note an upfront offline compute cost: constructing the codebooks for LLaMA-3.1-8B takes roughly 6 GPU hours (a one-time cost amortized over future inference). Additionally, they note that main-text benchmark tables compare baselines at nearby rather than identical bit-widths (due to group-size and residual-stage mechanics), deferring strict equal-budget controls to the appendix. Future research directions are not discussed in the paper.
Summary updated