Language Models Can Control Their Own Attention
Reading guide · Based on sections of the original paper
Why read this
This is for practitioners serving long-context models who want KV-read savings without per-step proxy scoring, kernel changes or fine-tuning.
What the authors found
- Over 15 selected long-context sources and three runs, attended tokens per response fall 45.8% on Gemma-4-31B and 19.6% on Qwen-3.6-27B versus vanilla full attention. Average accuracy drops 1.40pp and 2.10pp, with larger drops on multi-span tasks. On Qwen, attended tokens rose above vanilla on three sources. DA cuts global attention cost by 46% on Gemma and 20% on Qwen.
- This is a roofline estimate on a B200 at an assumed 40% MFU and 70% MBU, not a measurement. Full-response decode time is 0.76× vanilla on Gemma and 0.87× on Qwen, including DA's 38% and 32% extra decode steps and excluding prefill. On Qwen, one run reached parity. Separately, measured per-step savings reach 55% and 31% only above a 90% mask ratio. The roofline estimate puts DA’s decode time at 0.76 × \times of vanilla on Gemma and 0.87 × \times on Qwen.
- An ablation using the DA prompt without the mask loses no accuracy but generates longer responses, which raise attended tokens above vanilla. Applying the mask turns this into a net saving and accounts for all of DA's accuracy loss. The attention mask leaves only 49% of previous tokens attended on Gemma and 53% on Qwen.
Main limitation
The authors chose the 15-source suite as the sources where DA works. Six other evaluated sources lost accuracy or token savings. Small models also degrade sharply, for example to 29% of vanilla accuracy on Gemma-4-E4B. E.3 Sources outside the suite
Where to start
Results. · On DeepSeek-V4-Flash, combining DA with an existing sparse indexer halves the per-step scan, but 2.78× more decode steps raise the total scan to 1.28× vanilla. This matters if you already serve indexer-based models.
Abstract
Language models spend most of their attention on a small fraction of context, yet they read the entire KV cache to find the few tokens that matter. If the user asks about a previous detail in a 1M-token conversation, global attention layers must scan the full context to generate each token of the reply. A prominent approach mitigates this cost by pre-selecting relevant tokens via lightweight proxy scores, but this extrinsic scoring still incurs O(N) per step. We take an intrinsic approach motivated by the simple question: wouldn't the model already know which parts of the context are relevant? To this end, we introduce Declarative Attention (DA), a protocol that elicits the model to declare where it needs to attend within its chain-of-thought, partitioning generation into three modes: <global> (full context), <focus> (a specific region), and <local> (recent output only). The inference engine parses these declarations like tool calls and skips most of the KV cache read. Under zero-shot evaluation across 15 long-context tasks, DA on off-the-shelf models (Gemma-4-31B, Qwen-3.6-27B) significantly reduces total attended tokens during decoding (52.0%, 31.1%) with modest accuracy drops (1.27pp, 2.75pp) that shrink with model scale. DA unlocks a new axis of sparse attention, with further potential under training-based methods that future work can explore.