KV Cache Compression via Attention Output Distortion Minimization

Yi Wang, Yixuan Cao, Qiang Ding, Zelin Gao, Ping LuoNeurIPS 2026

TL;DR

When Large Language Models read massive documents, their short-term memory—the KV cache—balloons and bottlenecks your GPU. Rather than blindly compressing every memory entry equally or ruthlessly deleting older ones, ODM-KV treats memory management as a unified optimization problem: it assigns each token a bespoke bit-width (from 0 bits for eviction up to 16 bits for full precision) to directly minimize changes in the model’s actual attention output. The result is 4-bit quality on a 2-bit budget, and remarkably intact reasoning even when squeezed down to an average of just 1 bit per token.

What Problem Does This Paper Address?

Modern LLMs avoid re-reading past text by storing previous Keys and Values in a KV cache. The catch? This cache grows linearly with context length, devouring GPU memory and capping how much text—or how many users—you can process at once.

Historically, engineers have shrunk the KV cache in one of two ways:

  1. Quantization: Compressing all vectors to fewer bits (e.g., 4-bit instead of 16-bit) to minimize vector reconstruction error. However, a small numerical error on a crucial token can derail the model, while a huge error on an irrelevant token might not matter at all.
  2. Token Eviction: Dropping "unimportant" tokens entirely based on how often the model looks at them, while keeping the rest at full precision—a blunt, all-or-nothing choice.
Comparison of Uniform Quantization, Token Eviction, and ODM-KV

What was missing was a single mathematical ruler to compare dropping a token against quantizing it to various precisions, guided by what actually matters: preserving the final output of the attention layer.

Methods

The authors introduce ODM-KV (Output-Distortion Minimization for the KV cache), which unifies eviction and mixed-precision quantization by assigning each token entry a bit-width from the set $\mathcal{B} = \{0, 2, 3, 4, 8, 16\}$ under a global average bit budget.

Evaluating every combination of bit-widths across thousands of tokens is combinatorially impossible, especially since future queries aren't known yet. ODM-KV makes this tractable in two clever steps:

  • Separable Distortion Cost Model (Novel): Using a first-order perturbation analysis (essentially a Taylor expansion of the attention mechanism), the authors show that the attention-output error caused by compressing token $i$ to $b$ bits neatly decouples into $s_i \cdot \tilde{\varepsilon}(b)$.
  • $s_i$ is a token sensitivity score computed on the fly during prefill. Using a mean-field approximation of future queries, it captures both how much error is injected via the Value vector and how much Key errors warp the softmax attention weights.
  • $\tilde{\varepsilon}(b)$ is the precision error, calibrated offline using an existing rotation-based quantizer (TurboQuant-MSE, whose random rotations conveniently make quantization noise uniform in all directions). Eviction ($b=0$) is assigned a tunable penalty cost.
  • Lagrangian Bit Allocation (Novel): Because token costs add up independently, the global budget constraint can be absorbed using a Lagrange multiplier $\lambda$—think of $\lambda$ as a "price per bit." Given a price $\lambda$, every token independently picks its best bit-width in parallel. A fast binary search (~10 steps on GPU) finds the exact price that hits the target memory budget.

Datasets

No model training is required. The authors evaluate ODM-KV on Llama-3.1-8B-Instruct and Qwen3-8B using:

  • LongBench: A 16-subtask suite covering single/multi-document QA, summarization, few-shot learning, code, and synthetic tasks.
  • RULER: A synthetic long-context retrieval and reasoning benchmark tested from 4K up to 128K context lengths.
  • PG19 & AIME25: Used in ablations and appendix checks for language modeling perplexity/KL-divergence and math reasoning, respectively. (No new datasets were introduced.)

Key Insights and Ideas

  • Attention frequency isn't enough: Standard eviction methods keep tokens with high attention weights. ODM-KV’s perturbation math reveals that a token’s Key norm and how much its Value differs from the average output ($\|v_i - \bar{o}\|^2$) heavily dictate how much damage compression causes. Swapping ODM-KV's scorer for a standard attention-prior scorer drops 1-bit RULER accuracy by up to 30 points.
  • The magic of the middle ground: At an extreme 1-bit average budget, uniform 1-bit quantization collapses completely, and pure eviction throws away too much context (dropping over 93% of tokens). Allowing the allocator to mix eviction ($0$-bit) with $2, 3, 4, 8,$ and $16$-bit anchors rescues performance dramatically.

Key Results

LongBench and RULER 4K evaluation results

Table 1: LongBench category scores and full RULER averages at 4K. S-QA/M-QA, Sum., Few, and Syn. denote single-/multi-document QA, summarization, few-shot learning, and synthetic tasks, respectively. LongBench Avg. covers all 16 subtasks. Bits denote nominal average budgets. An eviction rate of 88% gives 1.92 bits, rounded to 2. QAQ uses 2.5/3.5 bits on Llama/Qwen. Its RULER results are unreported (–). RULER configuration details are in Appendix D.2.
  • 4-bit quality at half the bits: At a 2-bit average budget on LongBench, ODM-KV scores 48.10 (Llama) and 46.68 (Qwen), matching 4-bit KIVI (47.54 / 47.96) and nearly tying uncompressed BF16 (47.88 / 48.14).
  • Surviving the 1-bit cliff: At 1 bit on LongBench, uniform quantization (KIVI) crashes to 5.86 / 6.12, and the best eviction baselines hit 33.88 / 32.95. ODM-KV holds strong at 45.81 / 45.34—and reaches 81.55 / 90.48 on 4K RULER.
  • Long-context scaling: Across 32K, 64K, and 128K contexts on RULER hard-5, ODM-KV beats the strongest eviction baseline (KVzip) in all 12 tested configurations (e.g., 85.37 vs. 63.42 at 64K, 2-bit on Llama).
  • Real hardware wins: Running a custom GPU kernel on an NVIDIA H20 for a $16 \times 32\text{K}$ workload, the 1-bit target slashes KV cache memory from 65.0 GiB to 5.2 GiB and boosts decoding speed by 23.7%—while preventing Out-Of-Memory crashes at batch size 32 (enabling 35.5% higher peak throughput than BF16).

Limitations and Future Work

  • System overhead at small batches: Computing scores, searching bit allocations, and packing mixed-bit integers takes time. At batch size 1—and across all completed 2-bit configurations—decoding is actually slower than uncompressed FullKV. Speedups currently require large batches and tight (1-bit) budgets.
  • Extreme 128K degradation: While beating baselines at 128K and 1-bit, absolute accuracy still drops substantially compared to uncompressed models (e.g., 44.45 vs. 83.55 on Llama).
  • Future directions: Testing variable-length production serving, optimizing kernels for awkward bit-widths like 3-bit, and evaluating across broader GPU architectures.

Summary updated

Abstract

Efficient long-context inference requires compressing the KV cache under strict memory budgets without degrading model outputs. We formulate this problem as a constrained optimization: minimize the total attention-output distortion subject to a shared average bit-width budget, where each token's KV entry can be assigned a bit-width ranging from 0 (eviction), through mixed precision, to 16 (no compression). The central challenge is to estimate each token's contribution to attention-output distortion. We address this via a first-order perturbation analysis of the attention mechanism, which motivates a separable approximation to the distortion. Specifically, we approximate each token's compression cost by the product of (i) a token-specific risk score that captures the sensitivity of the attention output to perturbations of that entry, and (ii) a precision-dependent quantization error determined by the chosen bit-width. Building on this approximation, we allocate bits via Lagrangian relaxation, reducing the relaxed problem to independent per-token decisions. Experiments on LongBench and RULER with Llama-3.1-8B-Instruct and Qwen3-8B show that our method achieves comparable accuracy to uniform 4-bit quantization while using an average of 2 bits per entry. At an average of 1 bit, our method maintains substantially higher accuracy than both uniform quantization and token eviction baselines, which deteriorate sharply in this regime. We also implement a native mixed-bit inference system for ODM-KV that reduces GPU memory usage and can improve decoding throughput at larger batch sizes. Our code is available at https://github.com/yiiwang118/ODM-KV.
BibTeX
@inproceedings{wang2026kv,
  author = {Yi Wang and Yixuan Cao and Qiang Ding and Zelin Gao and Ping Luo},
  title = {{KV Cache Compression via Attention Output Distortion Minimization}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=IZ1HIOsJHX},
}

Loading related content...

Figure