Inference-Time Hyper-Scaling with KV Cache Compression

Adrian Łańcucki, Konrad Staniszewski, Piotr Nawrot, Edoardo M. Ponti

TL;DR

Inference-time scaling (generating long reasoning chains) significantly boosts LLM accuracy but is severely bottlenecked by the massive memory footprint and latency of the KV cache. This paper introduces Dynamic Memory Sparsification (DMS), a highly data-efficient method to retrofit LLMs with an intelligent token eviction policy, achieving up to 8$\times$ KV cache compression with minimal training. By shrinking the cache, DMS unlocks "hyper-scaling"—allowing models to process longer or more parallel reasoning paths within the same compute and memory budget, yielding dramatic accuracy gains.

What Problem Does This Paper Address?

State-of-the-art reasoning models like OpenAI's o1 and DeepSeek's R1 achieve high accuracy by "thinking" before they answer—generating long, intermediate reasoning chains (sequential scaling) or exploring multiple paths in parallel (parallel scaling). However, in standard Transformer architectures, this process is fundamentally bottlenecked by the Key-Value (KV) cache. The KV cache stores past token representations to avoid recomputation, growing linearly with the length and number of reasoning chains.

Because autoregressive generation is heavily memory-bound, loading this massive cache from High-Bandwidth Memory (HBM) dominates latency and quickly exhausts GPU VRAM. Existing solutions fall short: training-free eviction heuristics (like discarding low-attention tokens) severely degrade reasoning accuracy at high compression ratios, while learned compression methods (like token merging) require expensive, long-term continued training.

Methods

The authors propose Dynamic Memory Sparsification (DMS), a novel approach to teach pre-trained LLMs an adaptive token eviction policy. DMS introduces two key innovations over previous learned compression methods:

  1. Simple Eviction over Merging: Instead of complex token-merging operations, DMS simply drops tokens flagged for eviction, which proves to be much more sample-efficient to train.
  2. Delayed Eviction via a Sliding Window: When a token is flagged for eviction, it isn't dropped immediately. Instead, it remains available within a sliding window (e.g., 256 tokens). This delay gives the model time to integrate the token's information into subsequent representations before it disappears.

DMS is trained via logit distillation, where the original LLM acts as a teacher to guide the student model operating with the compressed cache. A one-sided $\ell_1$ loss forces the model to meet a target compression ratio. Crucially, DMS requires only 1,000 training steps to achieve an 8$\times$ compression ratio, making it orders of magnitude more data-efficient than prior methods.

Overview of DMS key cache management and attention masking during training

Datasets

The authors evaluated DMS on several challenging reasoning and general-purpose benchmarks:

  • Math & Science: MATH-500, AIME 2024, and GPQA Diamond (physics, chemistry, biology).
  • Coding: LiveCodeBench and HumanEval.
  • General Knowledge & Language: MMLU, MMLU-Pro, GSM8K, and HellaSwag.
  • Long-Context Processing: Needle in a Haystack (NIAH) and Variable Tracking (VT).

For retrofitting training, they utilized the OpenR1-Math-220k dataset (filtered for correctness) for Qwen-R1 models, and a mixture of programming examples and synthetic math data for Llama models.

Key Insights and Ideas

  • Disentangling Generation Length from Compute Budget: Traditionally, a larger token budget meant higher latency and memory load. By compressing the KV cache, DMS breaks this link, allowing models to generate more reasoning tokens for the same computational cost.
  • The Power of Delayed Eviction: Dropping tokens immediately causes catastrophic failure because the model cannot adapt. Giving the model a "grace period" (the sliding window) allows it to extract and pass forward critical context before eviction, stabilizing training and preserving accuracy.
  • Extreme Data Efficiency: DMS achieves 8$\times$ compression with up to 60$\times$ less training data than token-merging alternatives, proving that learning when to drop is much easier for an LLM to master than learning how to merge.
  • Layer-Dependent Compression: When left to optimize freely, the model naturally learns to compress early layers less aggressively than later layers, preserving rich foundational context.

Key Results

DMS consistently outperforms both vanilla LLMs and state-of-the-art training-free baselines (like Quest and TOVA), establishing a superior Pareto frontier across accuracy, memory reads, and peak memory load.

  • Accuracy Boosts: For an equivalent number of memory reads (a proxy for latency), DMS enhanced Qwen-R1 32B by an average of 12.0 points on AIME 24, 8.6 points on GPQA, and 9.7 points on LiveCodeBench.
  • Throughput Gains: DMS enables up to 5$\times$ higher throughput in multi-user or parallel scaling environments because the smaller KV cache allows for much larger batch sizes before hitting VRAM limits.
  • General-Purpose Reliability: Outside of inference-time scaling, DMS 8$\times$ models closely matched or even exceeded vanilla models on long-context tasks like Variable Tracking, proving they can serve as robust, general-purpose LLMs.
Figure 1: Average absolute gains of DMS over the original LLMs during inference-time scaling on reasoning tasks for the same KV cache memory reads, (a proxy for latency).
Figure 3: Inference-time scaling results comparing exact-match accuracy (y-axis) against perfor- mance metrics (x-axis). Point colors indicate the compression algorithm used, shapes the compression ratio, and W–L labels denote the scaling strategy (W: number of sampled reasoning threads; L: se- quence length). Colored lines indicate the respective Pareto frontiers. The horizontal black lines mark the accuracy reported by Guo et al. (2025) for the 1–32K vanilla model. Top: A comparison in terms of KV-cache token reads, used as an implementation-agnostic proxy for attention compute. Middle: A comparison in terms of the peak number of tokens in memory, reflecting memory load. Bottom: Throughput calculated at the maximum batch size that accommodates the corresponding W–L configuration. Across plots, DMS attains the best Pareto frontiers, indicating that KV-cache compression is an effective strategy for improving inference-time scaling.

Limitations and Future Work

  • Scale and Context Limits: The study evaluated models up to 32B parameters and context lengths up to 32K tokens. Testing on frontier-scale models (e.g., 70B+) and longer contexts remains an open area.
  • Alternative Attention Architectures: DMS was validated on standard multi-head/grouped-query attention. Extending it to architectures like DeepSeek's Multi-head Latent Attention (MLA) is a promising next step.
  • Complementary Efficiency Methods: The authors note that DMS is orthogonal to page-retrieval methods (like Quest), quantization (like KIVI), and SVD decomposition. Combining DMS with these techniques could push the efficiency frontier even further.

Summary updated

BibTeX
@inproceedings{ancucki2025inference,
  author = {Adrian Łańcucki and Konrad Staniszewski and Piotr Nawrot and Edoardo M. Ponti},
  title = {{Inference-Time Hyper-Scaling with KV Cache Compression}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2025},
  url = {https://openreview.net/forum?id=8ZiElzQxf1},
}
Figure