Augmenting Attention with Exponentially Decaying Memory Improves Query-Aware KV Sparsity

Xiuying Wei, Caglar GulcehrearXiv 2026

TL;DR

Instead of trying to patch downstream sparse attention algorithms to handle long contexts, this paper shows that upgrading the underlying model architecture with an exponentially decaying memory backbone (RAT+) dramatically improves performance. When combined with popular query-aware sparsity methods like Quest, MoBA, and SnapKV, the RAT+ backbone maintains near-perfect accuracy on long-context retrieval tasks even under extreme (up to 98%) KV-cache sparsity budgets.

What Problem Does This Paper Address?

As large language models (LLMs) tackle increasingly long contexts, the Key-Value (KV) cache becomes a massive computational and memory bottleneck. Standard attention scales quadratically with context length, prompting researchers to develop downstream "sparse inference" methods. These methods dynamically drop or compress less important tokens or blocks during either the prefilling stage or decoding stage to save FLOPs and memory.

However, these sparsity techniques have a breaking point. Under aggressive compression budgets (e.g., keeping only 1/16th of the KV cache), their accuracy degrades severely on complex, multi-key retrieval tasks. The authors of this paper ask a fundamental question: Instead of only optimizing the downstream selection algorithms, can we design an upstream attention backbone that is inherently more resilient to sparsity?

Methods

The authors leverage RAT+, a recently introduced architecture that augments standard attention with a lightweight recurrence mechanism. This recurrence acts as an exponentially decaying memory over the Key ($K$) and Value ($V$) states. At each time step $t$, the states are updated via an input-dependent gate $g_t$:

$$\tilde{v}_t = g_t \odot \tilde{v}_{t-1} + (1 - g_t) \odot v_t$$ $$\tilde{k}_t = g_t \odot \tilde{k}_{t-1} + (1 - g_t) \odot k_t$$

By limiting the effective memory length to 64 tokens, the module remains stable and adds only $O(1)$ additional computation per token.

The core experiment of the paper is evaluating how this memory-augmented backbone interacts with three representative downstream query-aware sparse inference methods, each targeting a different efficiency bottleneck:

Table 1: Our evaluated sparse patterns with RAT+.
  1. Quest: Reduces decoding-time FLOPs by selecting the most relevant KV blocks using min/max block statistics.
  2. MoBA: Reduces prefilling-time FLOPs by routing queries to mean-pooled block representatives.
  3. SnapKV: Reduces KV-cache storage by selecting and retaining only important tokens based on an observation window.

Datasets

The authors evaluated their approach on eight needle-in-a-haystack (NIAH) retrieval tasks from the RULER benchmark, using a 4K context window. These tasks range from simple single-item lookups (S-1 to S-3) to complex multi-key lookups (MK-1 to MK-3), variable values (MV), and multiple queries (MQ).

For model configurations, they tested:

  • A 7B model trained from scratch on 100B tokens.
  • OLMo2-7B, an industry-scale model trained on trillions of tokens, which they continued pretraining for 10B tokens on the FineWeb-Edu dataset to integrate the RAT+ memory module.

Key Insights and Ideas

The paper proposes and validates two fascinating hypotheses for why an upstream decaying memory rescues downstream sparsity:

  • Hypothesis 1: Memory sharpens token selection. Because the KV states contain historical context propagated through time, the scoring functions used by sparse selectors become more accurate. The authors proved this by measuring the "head-level hit rate" (how often an attention head successfully includes the golden answer token in its sparse budget). RAT+ consistently yielded higher hit rates.
Figure 2: H1: Head-level hit-rate distributions for the top-50 heads ranked by hit rate. We mainly analyze Quest (top row) and SnapKV (bottom row) in H1, be- cause their token selection during decoding is more di- rectly aligned with individual generated answer tokens. Results are reported on the released 7B checkpoints from Wei and Gulcehre (2026). Additional results are provided in Fig. 4, Fig. 3.
  • Hypothesis 2: Memory acts as an alternative information path. Even if a sparse selector completely misses the exact block containing the answer, the recurrence mechanism has already bled that information forward into adjacent, selected blocks. To isolate this effect, the authors replaced the intelligent selectors with a completely random selector. Remarkably, the RAT+ backbone still significantly outperformed standard attention, proving that the information is distributed robustly across the sequence.

Key Results

The addition of the RAT+ memory module led to massive accuracy recoveries across all sparse budgets, particularly under the tightest constraints (1/16 budget):

  • SnapKV (Storage Reduction): On the 7B model trained from scratch, under a 1/16 budget, RAT+ boosted SnapKV's accuracy on the S-1 task from a dismal 39.2% to 84.2%.
  • Quest (Decoding FLOPs Reduction): On the OLMo2-7B checkpoints under a 1/16 budget, RAT+ elevated Quest's performance on the challenging Multi-Key-2 (MK-2) task from 76.4% to 99.4%, and on MK-3 from 68.0% to 98.6%.
  • MoBA (Prefilling FLOPs Reduction): On OLMo2-7B under a 1/16 budget, MoBA's accuracy on MK-3 skyrocketed from 53.6% to 94.8%.
Figure 1: Performance on eight NIAH tasks of two types of checkpoint. Due to space limits, the three NIAH-Single tasks and additional challenging settings are reported in Table 3 and Table 4. Top row: evaluation on the 7B checkpoints from Wei and Gulcehre (2026), where standard attention and RAT+ are pretrained from scratch on 100B tokens. Bottom row: evaluation on OLMo2-7B (OLMo et al., 2024), which is pretrained on trillions of tokens; the corresponding RAT+ backbone is obtained by 10B-token continued pretraining with the additional exponentially decaying memory module. The KV budget denotes per-query KV access; Quest and MoBA still store the full KV cache. Some curves overlap due to near-perfect accuracy.

Limitations and Future Work

While compelling, the study has a few limitations acknowledged by the authors:

  • Context Length Constraints: Due to resource limitations, evaluations were capped at a maximum sequence length of 4K tokens. Testing on ultra-long contexts (e.g., 32K or 100K+) remains future work.
  • Task Scope: The evaluation focused heavily on synthetic, retrieval-heavy NIAH tasks from the RULER benchmark. Performance on broader downstream tasks (like long-form generation or code compilation) was not explored.
  • Scale: The experiments were primarily restricted to 7B parameter model sizes.

Summary updated

BibTeX
@misc{wei2026augmenting,
  author = {Xiuying Wei and Caglar Gulcehre},
  title = {{Augmenting Attention with Exponentially Decaying Memory Improves Query-Aware KV Sparsity}},
  year = {2026},
  eprint = {2605.28640},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2605.28640},
}
Figure