Adaptive Mass-Segmented KV Compression for Long-Context Reasoning

Junzhe Yang, Xiaoyu ShenNeurIPS 2026

TL;DR

When large language models think through long, multi-step problems, their memory—the Key-Value (KV) cache—balloons rapidly, forcing us to evict less "important" tokens to save space. Standard compression methods treat this like a global battle royale where individual tokens compete to survive, accidentally erasing entire paragraphs of crucial intermediate logic in a failure mode called Region Wipe-out. This paper introduces Adaptive Mass-Segmented (AMS) KV compression, a universal plug-in that shifts from cutthroat token competition to smart neighborhood zoning, ensuring every step of a model's train of thought keeps a seat at the table.

What Problem Does This Paper Address?

Imagine trying to solve a complex math proof while someone periodically rips random pages out of your scratchpad to save desk space. When LLMs generate long Chain-of-Thought (CoT) sequences, their KV cache (which stores past token representations so the model doesn't recompute them) grows linearly, hitting a severe memory bandwidth wall.

To bound memory, existing decoding-time compressors periodically score cached tokens (using attention weights or geometry) and keep the global Top-$k$ winners. The authors discover a glaring structural flaw in this global competition: attention naturally spikes around a few "heavy hitter" tokens. Under tight budgets, entire contiguous blocks of distributed, intermediate reasoning get outcompeted and deleted simultaneously—a phenomenon they term Region Wipe-out.

Figure 2: Motivating dropped-token burst example. Purple pixels denote dropped tokens. The full-sequence view highlights a local region where TOVA forms a dense contiguous dropped-token burst. The zoomed view shows the same token window across compression rounds: AMS-TOVA fragments the dropped positions in the selected round, illustrating a local failure mode that motivates adaptive segment-wise allocation.

When an entire bridge of logic vanishes, the model loses the plot. It silently alters problem constraints (Problem Drifting), abandons valid intermediate conclusions (Premature Overturning), or spirals into endless, degenerate text loops (Repetition Collapse).

Methods

Instead of inventing yet another token-importance scorer, the authors rethink how memory budgets are distributed, proposing an "allocate-then-score" paradigm. AMS is a training-free, plug-and-play layer that wraps around existing scorers in four steps:

  1. Spatial Mass Partitioning: Rather than using recent attention scores directly for survival, AMS normalizes them into a 1D probability distribution ("quality mass") across the sequence. By slicing this sequence whenever cumulative mass crosses fixed thresholds, high-attention regions are carved into fine-grained segments, while quieter regions are grouped into broader ones.
  2. Guaranteed Regional Quotas: Before any token is judged, AMS distributes the memory budget across segments proportional to their mass. Crucially, every segment gets a strict minimum quota (protecting intermediate steps from total wipe-out), alongside standard "must-keep" rules for initial sink tokens and the very latest tokens.
  3. Local Plug-and-Play Scoring: Now, whatever base scorer you prefer (e.g., TOVA, Expected Attention, KeyDiff) runs locally within each segment to pick the Top-$q_i$ tokens for that specific zone, physically gathering them into a compact cache (which works cleanly with paged memory systems like vLLM).
  4. EMA Temporal Smoothing: Because attention spikes jump around as generation progresses, segment boundaries can jitter wildly across compression rounds. AMS keeps an Exponential Moving Average (EMA) "credit" history of past mass, smoothing out transient spikes so consistently useful regions stay protected.
Figure 1: Overview of AMS for decoding-time KV compression. (1) Given a long chain-of-thought reasoning process, the base model generates tokens and a training-free scorer assigns token-level importance scores. (2) AMS converts recent attention-based usage into a normalized quality mass, partitions the sequence into adaptive segments based on cumulative mass, and allocates larger quotas to dense segments and smaller quotas to sparse ones. (3) Within each segment, AMS performs segment-wise top-k selection under the segment quota, drops evicted tokens, and gathers the retained KV entries into a compact cache. (4) At the next compression event, AMS reuses an EMA-based credit signal that accumulates past mass, making consistently high-mass tokens more likely to remain and stabilizing selection across events.

Datasets

Because AMS requires no training, all datasets are existing benchmarks used strictly for evaluation:

  • Mathematical Reasoning: MATH500, AIME24, AIME25, and GSM8K (shorter natural-language word problems).
  • General Long-Context & Retrieval: Code completion (Repo), Open-Domain QA (TriviaQA), LongBench, and Needle-in-a-Haystack (NIAH) for sparse retrieval.

Key Insights and Ideas

  • Attention is a better map than a guillotine: Using attention purely to execute individual tokens causes myopia. Treating attention macroscopically as a spatial density map preserves the narrative arc of a reasoning chain.
  • Less memory can yield smarter answers: Counterintuitively, compressed caches with AMS occasionally beat the uncompressed Full KV baseline. Pruning low-utility tokens while preserving regional structure appears to reduce "attention dilution," helping the model focus.
  • Better compression actually speeds up wall-clock generation: You might expect extra segmentation math to slow things down. Instead, because standard compressors starve the model of context, they trigger Repetition Collapse—causing the model to babble in loops until hitting max token limits. By preventing logical deadlocks, AMS finishes problems in fewer tokens and less time.

Key Results

Tested primarily on DeepSeek-R1-Distill-Qwen (7B and 32B) and OpenThinker3-7B across tight per-layer budgets ($T_{\text{keep}} \in \{256, 512, 1024\}$):

  • Massive gains under tight budgets: At $T_{\text{keep}} = 256$ on MATH500 (7B), plugging AMS into Expected Attention jumps pass@1 accuracy by +16.0 points (32.6% $\rightarrow$ 48.6%), and boosts KeyDiff by +20.0 points (22.8% $\rightarrow$ 42.8%).
  • Beating uncompressed baselines: On MATH500, AMS-Expected hits 54.0% ($T_{\text{keep}}=512$) and 54.2% ($T_{\text{keep}}=1024$), surpassing uncompressed Full KV (52.8%). It also beats Full KV on code completion (27.44% vs. 24.04%).
  • Universal modularity & scale: AMS improves every tested scorer—including geometric (TriAttention, up to +6.4 points) and reasoning-specific (R-KV, up to +8.4 points) methods—and scales cleanly to 32B models (+16.8 points over AdaKV-ExpE2 at budget 256).
  • System efficiency: On MATH500, AMS-Expected uses the exact same physical memory as standard gather-based eviction (15.0 GB vs. 39.6 GB for masking-based AdaKV) while cutting average decoding time from 67.1s (TOVA) down to 41.4s, and reducing token repetition rates by 5.4%.

Limitations and Future Work

In the main text, the authors explicitly state that production-serving efficiency (such as multi-request throughput at scale, beyond single-request latency and vLLM compatibility validation) remains outside the scope of their measurements. Broader methodological limitations and societal impacts are deferred to Appendix A, which is not included in the provided document.

Summary updated

Abstract

Long-context autoregressive reasoning in large language models is severely bottlenecked by key-value (KV) cache memory, making decoding-time compression essential. Existing methods typically rely on global or per-head token-wise selection. Under tight memory budgets and repeated compression events, however, these policies tend to over-focus on local attention spikes, causing **Region Wipe-out**: the severe depletion of contiguous spans of intermediate reasoning from the cache. This fragmentation disrupts reasoning, leading to Problem Drifting and Repetition Collapse. To address this, we propose Adaptive Mass-Segmented (AMS), a scorer-agnostic KV compression framework based on an "allocate-then-score" paradigm. By decoupling budget allocation from token scoring, AMS acts as a **plug-in** that shifts attention from a strictly micro-level retention metric to a macro-level spatial partitioning tool. Specifically, AMS derives an attention-based quality-mass distribution to partition each head's cache into adaptive segments, enforcing region-wise quotas with minimum-keep guarantees. Furthermore, an exponential moving average (EMA) credit mechanism makes this allocation history-aware, smoothing cache evolution across repeated recompressions. Experiments on MATH500, AIME24, AIME25, and GSM8K using 7B and 32B backbones show AMS improves pass@1 accuracy by up to 20.0 points over corresponding base scorers. AMS demonstrates generalization across diverse long-context workloads, including code completion, open-domain QA, and sparse retrieval. AMS seamlessly integrates with token-level scorers, consistently improves their performance, sometimes surpasses uncompressed full-KV decoding, and incurs negligible practical decoding-time overhead.
BibTeX
@inproceedings{yang2026adaptive,
  author = {Junzhe Yang and Xiaoyu Shen},
  title = {{Adaptive Mass-Segmented KV Compression for Long-Context Reasoning}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=M9KP5PrKtK},
}
Figure