TL;DR
KV² is a two-stage, query-agnostic KV cache compression method that identifies a small subset of "informative" tokens to act as reconstruction queries. By focusing expensive reconstruction compute only on these critical anchors, it achieves massive performance gains at extreme compression ratios (down to 2% budget) while remaining significantly faster and more memory-efficient than full-context reconstruction methods.
What Problem Does This Paper Address?
Long-context Large Language Models (LLMs) are powerful but notoriously memory-hungry. The primary culprit is the Key-Value (KV) cache, which stores the intermediate states of every token in a prompt to avoid recomputing them during generation. As context lengths reach hundreds of thousands or millions of tokens, this cache can require hundreds of gigabytes of GPU memory.
The challenge is even steeper in reusable context scenarios—where one massive document (like a legal code or a codebase) is prefilled once and then queried many times. In this setting, we need query-agnostic compression: we must decide which tokens to evict before knowing what the user will ask.
Existing solutions generally fall into two camps:
- Lightweight Heuristics: Fast but inaccurate, often failing when the memory budget gets tight.
- Full-Context Reconstruction: Highly accurate but prohibitively expensive, as they reprocess the entire prompt to measure each token's importance.
KV² aims to bridge this gap, providing the accuracy of reconstruction at a fraction of the computational cost.
Methods
KV² introduces a two-stage selective reconstruction pipeline:
- Query Selection: Instead of treating every token as equally important for scoring, KV² uses a lightweight "proxy" scorer (like KeyDiff) to identify a small subset of informative tokens.
- Selective Reconstruction (SR): The model reprocesses only these selected tokens in a new forward pass. These tokens act as "probes" that attend to the full cache. The final eviction score for any cached token is the maximum attention it receives from these probes.
To keep this process tractable for very long sequences, KV² processes the context in chunks (defaulting to 4K tokens). Each chunk proposes its own reconstruction queries, and the resulting local scores are eventually merged into a global eviction decision.
The authors also describe an iterative refinement process where the output of one scoring pass can be used as the proxy for the next, though they find that a single pass already captures most of the quality gains.
Datasets
The authors evaluated KV² across several rigorous long-context benchmarks:
- RULER (4K/16K): A stress test for retrieval and aggregation tasks.
- Needle-in-a-Haystack (NIAH): A diagnostic test for finding a specific fact buried in natural prose (Paul Graham essays).
- LongBench: A diverse suite of real-world tasks including multi-doc QA, summarization, and few-shot classification.
- InfiniteBench: Evaluation at the 200K-token scale.
- LongBench-E: A version of LongBench controlled for input length to study scaling behavior.
Key Insights and Ideas
- Sparsity of Information: The core intuition is that at extreme compression (e.g., keeping only 2-5% of the cache), most tokens are either obviously useful (like "attention sinks" at the start of a sequence) or obviously filler. The eviction decision really depends on a sparse set of "informative anchors."
- Global Conditioning, Local Scoring: While the reconstruction queries are conditioned on the entire context (global), they are only used to score tokens within their specific chunk (local). This split allows the method to scale efficiently without losing the context-aware benefits of reconstruction.
- Efficiency through Selection: Because KV² only reconstructs a fraction $\rho$ of the tokens, its runtime and peak activation memory scale with that fraction rather than the full prompt length. This makes it structurally faster than previous reconstruction methods like KVzip.
Key Results
KV² shines most brightly when the memory budget is at its tightest:
- Extreme Robustness: On RULER 16K with a 2% KV-cache budget, KV² improved the average score by over 40 percentage points compared to the next-best baseline on the Qwen3-8B model.
- Superior Retrieval: In Needle-in-a-Haystack tests at a 5% budget, KV² maintained near-perfect recall across context lengths where baselines like KeyDiff and KVzip became "patchy" or failed entirely.
- Efficiency Gains: KV² is consistently faster and uses less peak memory than full reconstruction (KVzip). For example, at a 2% reconstruction ratio, it remains efficient even as chunk sizes grow, whereas full reconstruction quickly hits out-of-memory (OOM) limits.
Limitations and Future Work
- Static Refinement: The current iterative refinement is fixed. The authors suggest that making this process adaptive—continuing only as long as scores are meaningfully changing—could further optimize the compute-quality trade-off.
- Proxy Dependency: While KV² is modular, its performance still depends on the initial proxy. Developing stronger, potentially learned or model-aware proxies could improve the initial token selection.
- Deployment Integration: The current implementation uses masking to simulate compression. To realize actual latency and memory savings in production, KV² needs to be integrated into serving frameworks that support headwise cache compaction and optimized kernels for variable-length heads.
Summary updated