Source-linked AI summary

GateSight: Recurrent Memory Anticipates Attention Memory for Query-Agnostic KV Eviction in Hybrid LLMs

Junjie Li, Jiong Lou, Jie Li

arXiv:2610.14754v1cs.AI

TL;DR

Hybrid models retain attention KV caches that grow with context, raising the question of whether recurrent GDN memory can anticipate which entries will be needed. GateSight predicts future KV utility from prefill-time GDN signals and uses the predictions to evict cache entries. With a tenth of the attention KV cache, it leads the reported query-agnostic comparisons across SCBench and RULER-4096 evaluations.

  • Problem

    Hybrid models still retain attention KV caches that grow with context, and it is difficult to know which entries will be needed before later questions supply queries.

    Source: §1 · pp. 1–2
  • Method

    GateSight uses per-head MLPs to predict future KV utility from prefill-time GDN signals and entry age, with the attention output gate setting each layer’s retention budget.

    Source: §1 · p. 2
  • Results

    10% of the attention KV cache: GateSight is most accurate of five query-agnostic methods on three of four model–benchmark pairs and leads KVzip on all four by 9.5 to 47.2 points.

    Source: §1 · p. 2
  • Takeaways & Limitations

    GateSight scores the cache once after prefill and physically compacts it for reuse across later questions.

    Source: §1 · p. 2

Abstract

from arXiv · show

Hybrid language models interleave Gated DeltaNet (GDN) layers, whose recurrent memory has a fixed size, with full-attention layers, whose key-value (KV) cache grows with the context and dominates serving memory. In this paper, we ask whether the recurrent memory already knows what the attention memory will need. We first show that which GDN heads of Qwen3.8-27B keep long memories is fixed by the weights rather than by the document. Next, we define the future utility of a KV entry by how much removing it changes the attention output over the model's own continuations, and find that the write gate, decay and write magnitude that GDN layers emit during prefill anticipate this utility before any query is seen. Because the relation is spread across many GDN heads and layers, and a linear map recovers its trend but less of its high-utility tail than a nonlinear one, we propose GateSight, which learns it with lightweight per-head multilayer perceptrons that read these signals and no attention score. Their predicted utility decides which entries each attention layer keeps, and how much each layer keeps is set by the model's native attention output gate, whose mean differs by more than an order of magnitude across layers. Finally, at serving time, GateSight scores the cache once after prefill and physically releases discarded KV entries. Experimental results on SCBench and RULER-4096 with Qwen3.8-27B and, with the same recipe, the sparse-attention model Qwen3.8-Flash-Next, up to the 262K-token limit of the models, show that with a tenth of the attention KV cache, GateSight is the most accurate of five query-agnostic methods on three of the four model-benchmark pairs and leads KVzip on all four, by 9.5 to 47.2 points. Notably, it scores a full-length context with negligible overhead relative to prefill.

1 INTRODUCTION

Hybrid models reduce recurrent-memory growth but retain attention KV caches that grow with context, so entries must be selected before later questions are known. GateSight tests whether prefill-time GDN dynamics anticipate future KV need and uses them to prune the cache.

  • GDN heads differ greatly in memory duration, and which heads retain information longer is determined by weights and remains stable across documents.This observation concerns Qwen3.8-27B’s GDN memory dynamics.Source: §1 · p. 2
  • GDN write gates, decay, and write magnitudes emitted during prefill predict future KV utility before any query exists, across document lengths and retrieval tasks.Source: §1 · p. 2
  • The utility relation is distributed and nonlinear: no single signal, head, or layer captures it reliably, and nonlinear prediction recovers more of its high-utility tail than a linear map.Source: §1 · p. 2
  • GateSight uses per-head MLPs to predict future KV utility from GDN signals and entry age, while the attention output gate sets each layer’s retention budget.It scores once after prefill without materializing attention scores, then physically compacts the cache for reuse across later questions.Source: §1 · p. 2
  • With 10% of the attention KV cache, GateSight is most accurate of five query-agnostic methods on three of four model–benchmark pairs and leads KVzip on all four by 9.5 to 47.2 points.Evaluations use SCBench and RULER-4096 with Qwen3.8-27B and Qwen3.8-Flash-Next, up to 262K tokens.Source: §1 · p. 2

2 BACKGROUND AND PROBLEM SETTING

The setting combines fixed-size recurrent GDN states with attention layers whose token-indexed KV caches grow with context. The problem is to select cache entries and allocate a fixed budget across layers using a query-agnostic estimate of future utility.

  • The native GDN signals are the per-token write gate, log-decay, and write magnitude, obtained from the prefill without another forward pass.Source: §2 · p. 3
  • GDN layers maintain recurrent matrix states, while full-attention layers retain a KV entry for every token, making the attention cache grow linearly with context.In Qwen3.8-27B, the attention cache stores 64 KiB per token in bfloat16.Source: §2 · p. 3
  • Each KV entry is the eviction unit: removing it removes that position from the softmax of all six query heads in its group, while leaving GDN states untouched.Source: §2 · p. 3
  • At a given kept fraction, eviction divides into choosing entries within each layer and allocating the total cache budget across layers.The model-wide budget excludes a protected instruction prefix kept by every method.Source: §2 · p. 3
  • Future utility is the change in attention-layer output when a KV entry is removed across sampled model continuations, and serves as the analysis and training target rather than a serving-time calculation.The output gate is omitted from the leave-one-out influence calculation.Source: §2 · p. 3

3 THREE OBSERVATIONS ABOUT RECURRENT MEMORY IN A HYBRID MODEL

Qwen3.8-27B’s GDN heads have document-stable memory roles, and their prefill signals are positively associated with future KV utility. That relation is distributed across heads and layers, with a nonlinear predictor recovering more high-utility entries than a linear one.

3.1 OBSERVATION 1: GDN MEMORY DYNAMICS ARE STRUCTURED AND STABLE ACROSS DOCUMENTS

  • Across 2,304 heads, document-pair half-life rankings agree at Spearman 0.99–0.997, while checkpoint-derived half-lives match measured ordering at 0.942.Median half-life is about 24 tokens, but each layer spans heads that forget within a handful of tokens and heads that retain information for hundreds to thousands of tokens.Source: §3.1 · p. 4

3.2 OBSERVATION 2: GDN WRITE AND FORGET SIGNALS ANTICIPATE FUTURE KV UTILITY

  • Slow-head effective write correlates with utility at +0.23 versus +0.10 for all heads, and the highest write decile reaches the top utility decile with 18.2% probability.The lowest slow-head write decile reaches the bottom utility decile with 19.2% probability; forgetting is also positively correlated with utility (+0.06 to +0.19). The fixed slow set carries over to 2K–8K documents and RULER-8K without re-estimation.Source: §3.2 · pp. 4–5

3.3 OBSERVATION 3: THE RELATION IS DISTRIBUTED AND NONLINEAR

  • Predictive signal is distributed: 40–70% of preceding (layer, head) cells correlate with utility at |ρ| > 0.1, but no cell exceeds 0.39.The best fixed heuristic recovers 19.2% of true top-10% entries, the slow-head effective write 18.2%, and the best single-cell in-sample ceiling 22.6%.Source: §3.3 · p. 5
  • The per-head MLP recovers 41.0% of true top-10% entries versus 38.6% for ridge, despite slightly lower Spearman correlation (0.543 versus 0.548).It also covers 58.4% of utility mass versus 55.8% for ridge, and leads in all sixteen attention layers on both measures.Source: §3.3 · p. 5

4 GATESIGHT: A LEARNED CROSS-MEMORY UTILITY ESTIMATOR

GATESIGHT turns the paper’s observations into a query-agnostic eviction method for hybrid models. It separates within-layer selection, per-layer allocation, and deployment of the compacted cache.

  • GATESIGHT predicts which entries to keep within each layer, allocates each layer’s cache budget from its own attention output gate, and deploys by compacting the cache for later questions.The observations determine the estimator, while the output gate supplies the allocation signal and deployment serves the compacted cache.Source: §4 · p. 5
  • The estimator uses recurrent-memory observations to choose entries within a layer, while allocation answers how much each layer keeps.The allocation uses a signal from the attention layer itself: its output gate.Source: §4 · p. 5
  • Deployment compacts the cache so it can serve later questions.The method’s three parts are the estimator, allocation, and deployment.Source: §4 · p. 5

1 Prefill once 2 Estimate utility 3 Budget & selection 4 Compact & serve

GATESIGHT scores a context after prefill using per-head MLPs, then selects entries under output-gate-proportional layer budgets. It physically compacts the retained cache for reuse by later questions.

1 Prefill once 2 Estimate utility 3 Budget & selection 4 Compact & serve

  • After one prefill, a per-head MLP predicts entry utility, each head keeps its top-K entries under the gate-proportional layer budget, and discarded blocks return to the pool.The selection computes no attention score.Source: Figure 3 · p. 6, §1 · p. 6

4.1 ESTIMATOR

  • Each estimator maps native signals from up to six preceding GDN layers and three normalized age features to predicted utility.The input has 867 dimensions; each estimator is a one-hidden-layer MLP with 64 units, and Qwen3.8-27B uses 64 estimators totaling 3.4M parameters.Source: §4.1 · p. 6

4.2 PER-LAYER ALLOCATION FROM THE OUTPUT GATE

  • Each layer’s budget is proportional to its mean attention output-gate magnitude, with the same model-wide total as a flat allocation.The mean gate ranges from 0.022 to 0.459 across layers; a per-layer budget also keeps each layer’s retained cache as a dense prefix.Source: §4.2 · p. 6

4.3 DEPLOYMENT IN VLLM WITH PHYSICAL COMPACTION AND SESSION REUSE

  • At prefill’s end, the estimator scores the context once, retained entries move to the front of each layer’s pages, and freed blocks return to the pool.The compacted cache is reused for later questions with the GDN states restored.Source: §4.3 · p. 7

5 EXPERIMENTS

Experiments compare GateSight with query-agnostic eviction methods on two hybrid models and two benchmarks. They also measure scoring cost, sparse-cache pruning, and the effect of GateSight’s per-layer budget rule.

5.1 SETUP

  • The evaluation uses SCBench’s shared-context multi-query mode and RULER’s 13 synthetic tasks at 4,096 tokens, comparing five query-agnostic methods under a shared vLLM protocol.It tests Qwen3.8-27B and Qwen3.8-Flash-Next, with kept fractions from 0.9 to 0.1.Source: §5.1 · p. 7

5.2 MAIN RESULTS

  • On Qwen3.8-27B, GateSight beats SnapKV, TriAttention, and KeyDiff at every kept fraction; on Flash-Next, its lead varies by benchmark and competitor.On Flash-Next, it beats SnapKV and KeyDiff throughout SCBench, while TriAttention is close at higher fractions; on RULER-4096, KeyDiff leads at p ≤ 0.5.Source: §5.2 · p. 8

5.3 SCORING COST

  • At 256K tokens, GateSight scoring takes 0.246 s, or 0.5% of the 46.4 s prefill time; KVzip’s second pass takes 1.5 to 2.2 times prefill time.Across 4K–256K contexts, GateSight scoring takes 0.5% to 2.6% of prefill time.Source: Table 2 · p. 8, §5.3 · p. 8

5.4 PRUNING A SPARSE-ATTENTION CACHE

  • For Flash-Next’s sparse cache, GateSight regroups kept tokens into QSA blocks, reducing each layer’s index from n/4 compressed keys to an average of pn/4.Each query attends to 2,048 context tokens, while the indexer scans one compressed key per four context tokens.Source: §5.4 · p. 8

5.5 COMPARISON WITH KVZIP

  • At p = 0.1, GateSight leads KVzip by 9.5 and 47.2 points on Qwen3.8-27B, and by 15.4 and 25.6 points on Flash-Next (SCBench and RULER-4096).On Qwen3.8-27B, KVzip leads at intermediate fractions, while GateSight stays within 1.2 points at p ≥ 0.7.Source: Table 3 · p. 8, §5.5 · p. 8

5.6 ABLATIONS

  • With equal total budgets, gate-proportional allocation is at least as accurate as flat and PyramidKV at every kept fraction; on RULER-4096 at p = 0.1, it scores 98.6% versus 95.5% and 52.1%.The comparison isolates where entries are kept by holding the total number of entries fixed.Source: Table 4 · p. 9, §5.6 · p. 9

6 RELATED WORK

Prior KV eviction methods use attention-derived scores, static policies, reconstruction, or key-based scores; GateSight instead uses signals from the model’s recurrent memory.

6 RELATED WORK

  • Attention-score eviction methods include heavy hitters, persistence, observation windows, per-head policies, redundancy terms, and layer- or head-varying budgets, but require queries or a context probe.The cited examples include heavy hitters [Zhang et al., 2023], persistence [Liu et al., 2023], observation windows [Li et al., 2024], and redundancy terms [Cai et al., 2025a].Source: §6 · p. 9
  • Query-agnostic alternatives preserve attention sinks and recent tokens [Xiao et al., 2024], use static head partitions [Xiao et al., 2025], reconstruct context [Kim et al., 2025], or score cached keys [Mao et al., 2026; Park et al., 2025; Devoto et al., 2024].The paper notes that Observation 1 finds an analogous static structure in recurrent layers.Source: §6 · p. 9
  • GateSight is query-agnostic like KVzip and probe-free like TriAttention and KeyDiff, but reads the recurrent state rather than the attention layer.The authors state that, to their knowledge, prior work had not used recurrent layers to manage attention-layer KV caches.Source: §6 · p. 9

7 CONCLUSION

The conclusion presents recurrent GDN signals as predictive of future KV utility and GateSight as a way to evict cache entries after prefill. The paper also reports its AI-use practices and released materials.

7 CONCLUSION

  • GDN write and forget decisions are structured, stable across texts, and predictive of which KV entries later change attention output; GateSight uses them to evict entries after prefill without a query or attention score.With a tenth of the attention KV cache, GateSight is the most accurate of five query-agnostic methods on three of four model–benchmark pairs and leads KVzip on all four by 9.5 to 47.2 points.Source: §7 · p. 9

AI USE STATEMENT

  • The authors used language-model assistants for drafting, editing, and coding, but not for research ideas or method and experiment design.They report checking the generated numbers against raw-result scripts and testing AI-written code.Source: AI USE STATEMENT · p. 10

REPRODUCIBILITY STATEMENT

  • The release includes GateSight code, trained estimators, calibration artifacts, evaluation and training scripts, and a pinned software environment.The paper points to its repository and lists appendices covering hyperparameters, evaluation protocol, and observation definitions.Source: REPRODUCIBILITY STATEMENT · p. 10

A EVALUATION PROTOCOL

The evaluation protocol uses a shared prefix, method-specific scoring, and physically compacted child sessions reused for each question. The utility-label procedure measures how removing a KV entry changes attention output over sampled continuations.

A EVALUATION PROTOCOL

  • Each method scores a prefilled parent session, then a physically compacted child is reused for every question; answers are token-identical to a fresh run.Contexts exceeding engine limits are middle-truncated before prefill, and comparisons require a real fork and physical compaction.Source: A EVALUATION PROTOCOL · p. 12
  • SCBench evaluates each context with all its questions up to 262K tokens, while RULER covers retrieval, tracing, extraction, and question-answering tasks.RULER tasks use 100 items each, generated with the official scripts and seed 42.Source: A EVALUATION PROTOCOL · p. 12
  • Two SCBench tasks use revised scorers: the corrections shift Qwen3.8-27B task means by +5.6 and −12.3 points, while the five-method ranking order remains unchanged under the official scorer.The revisions address answer parsing in qa chn and choice eng and apply to every method, budget, and model.Source: A EVALUATION PROTOCOL · pp. 12–13

B UTILITY LABEL

  • The utility label is the maximum leave-one-out attention-output change over sampled continuation tokens, max-normalised per document, layer, and KV head.The procedure recomputes continuation attention in float32 and checks the closed form against brute-force key deletion to within 1.4 × 10−5.Source: B UTILITY LABEL · p. 13

C DETAILS BEHIND THE OBSERVATIONS

The analyses test how GDN signals relate to future KV utility across documents, layers, and context lengths. They find predictive value in the signals and an advantage for learned combinations when recovering high-utility entries.

Example document

  • Figure 5 shows a median-correlation example, with traces scaled to their post-first-token maxima; Figure 6 reports per-cell correlations at four attention layers.The example document is selected by its median Spearman correlation between slow-head β∥v∥ and the KV-head mean of utility at attention layer 55.Source: C DETAILS BEHIND THE OBSERVATIONS · p. 13, Figure 6 · p. 14

Predictor evaluation

  • Adding GDN signals raises top-10% overlap by 23.1 percentage points over an age-only model, which recovers 17.9%.The MLP's advantage over ridge in overlap@10% holds in all nine corpora and is widest on SFT code, 45.1 against 38.3%.Source: C DETAILS BEHIND THE OBSERVATIONS · p. 14
  • The estimator and slow-head effective write recover 42.6% and 41.1% of top-10% entries on niah single 1, versus 40.7% and 30.3% on niah multikey 3.Across five RULER tasks, the estimator's top-10% recovery ranges from 31.2% to 52.3%; the largest gain from learning the combination occurs on multi-key retrieval.Source: C DETAILS BEHIND THE OBSERVATIONS · p. 15

Context length and task text

  • Slow-head β∥v∥ correlates with utility at +0.34, +0.34, and +0.33 on the 2K, 4K, and 8K cohorts, and +0.30 on RULER-8K.The slow-head set is not re-estimated; the estimator was trained on 2,428 short documents and applied unchanged, making its 1K row in-sample and the other rows held out.Source: C DETAILS BEHIND THE OBSERVATIONS · pp. 14–15

D GATE ABLATION

The output gate contributes to GATESIGHT through layer-level budget allocation, not token ranking. The ablations compare that choice with per-head and flat allocations and test whether proportionality needs an exponent.

Within a head the gate does not rank tokens

  • Applying the output gate to values barely changes within-head token rankings: gated and ungated scores have Spearman 0.995, with indistinguishable end-to-end scores.The gate therefore enters GATESIGHT as a per-layer budget weight rather than as a per-token utility signal.Source: D GATE ABLATION · pp. 15–16

Per layer, not per head

  • Layer means of the attention output gate span 0.022 to 0.459, and gate-proportional per-layer budgets outperform flat allocation at p = 0.2 and 0.5 on the RULER-8K five-task mean.At p = 0.2 and 0.5, per-layer scores are 80.0 and 95.0, versus 74.0 and 87.0 for flat allocation.Source: D GATE ABLATION · p. 16

Proportionality needs no exponent

  • At p = 0.05, gate-proportional budgets score 61.5, versus 59.2 and 60.8 with gate powers 0.5 and 1.5, and 53.8 for flat allocation.The analysis includes tasks solvable at that budget, excluding multi-key retrieval; the method uses the natural exponent of one throughout.Source: D GATE ABLATION · p. 16

E PER-TASK AND PER-BUDGET RESULTS

Per-task results show where GATESIGHT's comparison with KVzip varies across models and benchmarks. Its advantage is concentrated at low kept fractions on many tasks, while some retrieval and verbatim-copy tasks favor other methods.

SCBench

  • On Qwen3.8-27B SCBench, GATESIGHT leads KVzip by 16.0 points at p = 0.1 on seven tasks, retaining 98% of unpruned accuracy versus KVzip's 64%.KVzip leads on several verbatim-answer tasks; GATESIGHT is at least as accurate on ten of twelve tasks at p = 0.1.Source: E PER-TASK AND PER-BUDGET RESULTS · p. 16, Figure 9 · p. 17
  • On Qwen3.8-Flash-Next SCBench, GATESIGHT leads KVzip by 23.1 points at p = 0.1 on seven tasks, retaining 98% of unpruned accuracy versus KVzip's 51%.It is at least as accurate as KVzip on eleven of twelve tasks at p = 0.1, while KVzip's gains again come from verbatim-answer tasks.Source: E PER-TASK AND PER-BUDGET RESULTS · p. 16, Figure 10 · p. 18

RULER

  • On Qwen3.8-27B RULER, KVzip reaches at most 2% on five tasks at p = 0.1, while GATESIGHT reaches at least 99.8%; these tasks account for 81% of the 47.2-point mean gap.GATESIGHT is at least as accurate on ten of thirteen tasks at every kept fraction, though KVzip leads on three tasks at some fractions.Source: E PER-TASK AND PER-BUDGET RESULTS · pp. 16–17, Figure 11 · p. 19
  • On Qwen3.8-Flash-Next RULER, GATESIGHT is at least as accurate as KVzip on twelve of thirteen tasks at p = 0.1, but KVzip leads on several tasks at intermediate fractions.KeyDiff's mean lead at p ≤0.5 comes from four needle tasks; on those tasks it scores at least 83.5% at every kept fraction.Source: E PER-TASK AND PER-BUDGET RESULTS · pp. 17–18, Figure 12 · p. 20

F ABLATIONS

The ablations support a six-layer estimator window and detail how the method compacts caches in the serving pipeline. The Flash-Next evaluation adapts selection to sparse-attention blocks, while the related-work discussion distinguishes GATESIGHT by its use of recurrent-layer signals.

F ABLATIONS

  • A six-layer window is retained: widening it to 9 or 12 layers raises Ov@10 by only 0.2 or 0.3 points, at 1.5 or 1.9 times the parameters.Halving the window to 3 lowers Ov@10 by 0.8 points; gains per added layer fall above six.Source: F ABLATIONS · p. 21, Table 7 · p. 21

G IMPLEMENTATION DETAILS

  • After prefill, each attention layer gathers its retained entries to the front of its pages and returns discarded blocks to the pool for physical memory release.The plugin restores GDN states for later questions, which reuse the compacted cache.Source: G IMPLEMENTATION DETAILS · p. 22

H QWEN3.8-FLASH-NEXT

  • On Qwen3.8-Flash-Next, GATESIGHT scoring takes 1.0% to 1.4% of prefill time, or 0.175 s against 14.2 s at 256K tokens.For sparse attention, retained tokens are regrouped into new four-token blocks, and layer budgets are proportional to mean output gate.Source: H QWEN3.8-FLASH-NEXT · pp. 22–23, Table 8 · p. 23

I EXTENDED RELATED WORK

  • GATESIGHT differs from query-agnostic key-scoring methods by reading recurrent-state signals rather than only the attention layer's keys.The paper states that, to the authors' knowledge, prior work had not used hybrid-model recurrent layers to manage attention-layer KV caches.Source: I EXTENDED RELATED WORK · pp. 23–24
Loading 2610.14754v1…