NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

SCOPE: Optimizing Key-Value Cache Compression in Long-context Generation

Jialong Wu, Zhenglin Wang, Linhai Zhang, Yilong Lai, Yulan He, Deyu Zhou

Large Language Models (LLMs) are increasingly tasked with processing massive context windows, from entire codebases to long-form literature. However, this capability is hindered by the "memory wall"—the exponential growth of the Key-Value (KV) cache. SCOPE introduces a novel framework that decouples KV cache compression into two distinct phases: prefill and decoding, achieving high performance with significantly reduced memory overhead.

The Challenge: Reasoning Fragility and the Memory Wall

As context windows expand, the KV cache—which stores keys and values for every token to avoid redundant computation—can easily exceed the memory limits of modern GPUs. For instance, a Llama-3.1-8B model with a 128K context window requires more memory than a consumer-grade RTX 3090 can provide.

Existing compression methods often fail on complex reasoning tasks. The authors identify two primary issues:

  1. Reasoning Fragility: While simple retrieval tasks are robust to heavy compression, reasoning tasks (like multi-step math) collapse if the initial input (prefill) cache is pruned too aggressively.
  2. Heavy Hitter Deviation: In unified compression schemes, the model often evicts crucial "anchor" tokens from the original prompt to make room for newly generated output tokens, leading to a loss of context.
Empirical evidence showing (a) performance collapse on reasoning tasks under high compression, (b) the shift in "heavy hitter" tokens during decoding, and (c) attention patterns in long-context reasoning.

The SCOPE Framework: Decoupled Optimization

SCOPE (Separating prefill and decoding) is the first framework to treat input processing and output generation as distinct optimization problems. By separating these phases, SCOPE prevents the generated output from "distracting" the model into evicting essential input tokens.

  • Prefill Phase: SCOPE identifies and preserves a fixed set of "heavy hitters" (pivotal tokens) and a local window from the input. This ensures the model maintains the "reasoning anchors" necessary for the task.
  • Decoding Phase: Instead of allowing the cache to grow linearly, SCOPE manages the output cache using dynamic strategies that prioritize recent and high-impact tokens.
Comparison of KV cache management strategies: (1) Prefill-Only, which crashes during long generation; (2) Unified, which risks evicting crucial input info; and (3) Separating (SCOPE), which preserves input anchors while managing output growth.

Tailored Decoding Strategies

To optimize the decoding phase, SCOPE introduces three specific strategies designed to balance memory, accuracy, and speed:

  1. Slide: Employs a sliding window to maintain a constant cache size for generated tokens, selecting only the most essential information.
  2. Adaptive: Recognizes that a full history window isn't always required. It starts with a minimal budget and grows it linearly as generation progresses, maximizing memory savings in the early stages.
  3. Discontinuous: Addresses the I/O bottleneck caused by frequent GPU memory updates. By recalculating the cache selection only every few steps, it significantly reduces overhead with negligible impact on accuracy.

Key Results and Performance

SCOPE demonstrates that it is possible to maintain near-full cache performance while using only 35% of the total KV cache budget. On the LONGGENBENCH-4K benchmark—a new suite designed for long-input/long-output reasoning—SCOPE (Slide) achieved a score of 56.21, outperforming popular baselines like H2O (50.88) and StreamingLLM (29.48).

Furthermore, the Discontinuous strategy provides a substantial speedup, increasing generation throughput from 18.28 to 25.92 tokens per second by reducing the frequency of memory transfers. SCOPE is designed as a "plug-in" framework, making it compatible with existing prefill-only compression methods like SnapKV to enhance their utility in long-generation scenarios.

Conclusion

SCOPE addresses the critical bottleneck of KV cache growth by recognizing the fundamental difference between how LLMs process inputs and generate outputs. By decoupling these phases and introducing adaptive decoding strategies, SCOPE enables efficient, high-performance long-context generation on standard hardware, paving the way for more accessible and capable large-scale AI applications.

Summary updated

BibTeX
@inproceedings{wu2025scope,
  author = {Jialong Wu and Zhenglin Wang and Linhai Zhang and Yilong Lai and Yulan He and Deyu Zhou},
  title = {{SCOPE: Optimizing Key-Value Cache Compression in Long-context Generation}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure