Latest / Daily Paper Cast / Language Models Can Control Their Own Attention
Transcript
- 0:03Evan: Welcome to Daily Paper Cast.
- 0:06Ashley: Today’s paper is from the Hugging Face daily paper list of September 3, 2026, and it has received 37 upvotes.
- 0:14Evan: The paper we’re discussing today is titled: 'Language Models Can Control Their Own Attention.'
- 0:20Ashley: The first two authors are Namgyu Ho and Huzama Ahmad, with Se-Young Yun as the corresponding author.
- 0:27They are affiliated with KAIST AI.
- 0:30Evan: Alright, let’s dive into the Introduction section of the paper.
- 0:34Ashley: Transformers, the architecture behind many state-of-the-art language models, calculate attention over all preceding tokens at every decoding step.
- 0:42This design, while powerful, becomes computationally expensive as the length of the context grows.
- 0:49Evan: Exactly.
- 0:50At the core of this complexity is the Key-Value, or KV, cache memory access latency, which significantly impacts the decoding time for long contexts.
- 1:00Ashley: To give you a perspective, in a model like Qwen-3.5-397B-A17B, handling a conversation with a 1-million-token context could require loading roughly 15 gigabytes of KV cache per sequence at every decoding step.
- 1:17This demand is comparable to loading the model’s 17 billion active parameters.
- 1:21Evan: Wow, and that’s just for one sequence.
- 1:24So, how do humans approach similar tasks?
- 1:27Ashley: Humans typically don't re-read every prior word when processing long texts.
- 1:32Instead, we focus on relevant sections.
- 1:36This intuition aligns with empirical findings—attention scores usually concentrate on a small fraction of the context tokens.
- 1:43Evan: So, if attention naturally focuses on smaller, critical parts of the context, why is it challenging for models to do the same?
- 1:52Ashley: The core challenge lies in the fact that true attention scores are unknown until the entire attention matrix is computed, making it infeasible to identify important tokens dynamically.
- 2:02Previous methods have attempted to predict and mask attention-heavy tokens based on static heuristics and lightweight scans, but these solutions still struggle with efficiency when scaling to long contexts.
- 2:14Evan: That brings us to this paper’s approach.
- 2:17What exactly do the authors propose?
- 2:19Ashley: They introduce an innovative solution called Declarative Attention, or DA.
- 2:24Instead of externally scoring the relevance of tokens, DA allows the model to explicitly declare where it needs to focus its attention during its chain of thought.
- 2:33Essentially, they propose that the model should narrate its attention strategy as part of the text generation process.
- 2:40Evan: Interesting.
- 2:41So, how does Declarative Attention work?
- 2:44Ashley: The DA protocol segments the generation process into three distinct attention modes: global, focus, and local.
- 2:52Evan: Could you break down these modes for us?
- 2:55Ashley: Certainly.
- 2:56In global mode, the model surveys the entire context to identify relevant segments.
- 3:01In focus mode, the model zeroes in on specific, pre-named contextual regions.
- 3:06Finally, in local mode, it focuses solely on recent output, ignoring the broader context.
- 3:12Evan: Got it.
- 3:13So, by switching between these modes, the model avoids reading the entire KV cache at every step?
- 3:20Ashley: Exactly.
- 3:21This selective attention approach dynamically constructs the attention mask based on declarations present in the model’s output.
- 3:28By parsing these declarations, the inference engine can skip reading most of the KV cache, leading to significant efficiency gains.
- 3:35Evan: And how well does this approach work in practice?
- 3:39Ashley: Under zero-shot evaluations, DA reduced the total attended tokens during decoding by 52% on the Gemma-4-31B model and 31% on the Qwen-3.6-27B model.
- 3:53The accuracy drop was modest, with only a 1.27 percentage points reduction in accuracy for Gemma-4-31B and 2.75 percentage points for Qwen-3.6-27B, and the gap narrows as the models scale.
- 4:08Evan: That's quite impressive, reducing the attended tokens significantly while maintaining accuracy.
- 4:14Ashley: It is.
- 4:15Their results show a promising new axis of sparse attention that doesn’t require auxiliary scorers or model retraining, making it applicable to off-the-shelf models.
- 4:25Evan: That wraps up our coverage of the Introduction section of this paper.
- 4:31Ashley: Let's now move on to the Method section detailing Declarative Attention, or DA.
- 4:36Evan: Ashley, how does DA fundamentally restructure the model’s attention mechanism?
- 4:41Ashley: The DA protocol fundamentally changes the way a language model handles its attention spans during the text generation process by making the attention plan legible.
- 4:51Essentially, it has the model declare its attention mode at each step.
- 4:55Evan: Right, and you mentioned three attention modes earlier: global, focus, and local.
- 5:01How does the model decide which mode to use?
- 5:04Ashley: Each mode is chosen based on the model's current reasoning needs.
- 5:08The model uses special tags to signal these modes as it generates text.
- 5:12Let's break down how these modes are structured and how they guide the attention process.
- 5:17Evan: Let's dive into each of these modes.
- 5:20Ashley: Sure.
- 5:21We'll start with global mode.
- 5:22In global mode, the model can access the entire context.
- 5:26This mode is used for navigation - when the model needs to identify which part of the context is relevant to the current task.
- 5:34Evan: So, essentially, global mode is for scanning the broader context to zero in on specific information?
- 5:41Ashley: Exactly.
- 5:42Once the model identifies a relevant section, it switches to focus mode.
- 5:47Evan: And what happens in focus mode?
- 5:49Ashley: In focus mode, the model restricts its attention to specific, named segments of the context.
- 5:55These segments contain the pertinent information needed for the next steps of reasoning.
- 6:00The model uses tags to mark these segments.
- 6:03Evan: Got it.
- 6:03So, in focus mode, the model hones in on a targeted piece of information, right?
- 6:09Ashley: Exactly.
- 6:10Once the necessary information has been extracted, the model can then use local mode.
- 6:15Evan: And what’s the role of local mode?
- 6:18Ashley: Local mode is used for self-contained reasoning based on the information accumulated so far.
- 6:24Here, the model only refers to its own recent outputs, ignoring the broader context.
- 6:29Evan: So, it’s like the model is summarizing or synthesizing the gathered information without looking back into the larger context?
- 6:38Ashley: That’s correct.
- 6:39This mode helps to reduce computational overhead by avoiding unnecessary context reads.
- 6:45Evan: Interesting.
- 6:46How is the context segmented to make this process efficient?
- 6:50Ashley: The context is divided into addressable segments called magic chunks.
- 6:54Each segment is roughly 2048 tokens long, ensuring each chunk is a manageable size and aligns with natural language boundaries like sentences or paragraphs.
- 7:05Evan: Why use the term 'magic chunks'?
- 7:08Ashley: The name was likely chosen to emphasize that these segments are arbitrary retrieval units and don’t necessarily align with the document's original sections or chapters.
- 7:18Evan: And how does the model interact with these magic chunks during the different modes?
- 7:23Ashley: Great question.
- 7:24During focus mode, the model references specific magic chunks by marking them with tags.
- 7:30This signals the inference engine to only consider those chunks during the attention process, ignoring everything else.
- 7:37Evan: Efficient.
- 7:38And the inference engine dynamically constructs the attention mask based on these tags?
- 7:43Ashley: Exactly.
- 7:44The inference engine parses the tags emitted by the model and updates the attention mask in real-time.
- 7:50This minimizes the number of tokens read from the KV cache during each decoding step.
- 7:55Evan: So this approach eliminates the need for external scoring mechanisms that were used in previous methods?
- 8:02Ashley: Yes, the DA protocol doesn’t rely on auxiliary scorers or any extrinsic selection methods.
- 8:09It leverages the model’s own reasoning capabilities to handle attention efficiently.
- 8:13Evan: What about implementing this on existing models?
- 8:16Is training required?
- 8:18Ashley: No training is required.
- 8:20DA works zero-shot on off-the-shelf models, meaning it can be applied directly without the need for task-specific fine-tuning.
- 8:28Evan: That’s highly practical.
- 8:30Are there any results on how effective this method is?
- 8:33Ashley: Indeed.
- 8:34The authors evaluated DA on a range of long-context tasks using models Gemma-4-31B and Qwen-3.6-27B.
- 8:44The results demonstrated substantial reductions in the number of attended tokens.
- 8:49Evan: Can you provide some specifics on the evaluations?
- 8:52Ashley: Of course.
- 8:53On average, DA reduced the attended tokens by 52% for the Gemma-4-31B model and 31.1% for the Qwen-3.6-27B model.
- 9:04These savings came with only modest accuracy drops, showcasing the efficiency of DA.
- 9:10Evan: That’s impressive.
- 9:11How do these results vary with model scale?
- 9:14Ashley: The accuracy drop tends to decrease as the model scales up.
- 9:18For instance, the accuracy drop for smaller models was slightly higher compared to larger models.
- 9:24This indicates that the DA protocol leverages the increased capability of larger models more effectively.
- 9:30Evan: It definitely sounds like a promising direction.
- 9:33Before we wrap up the Method section, how does this protocol integrate with existing inference systems?
- 9:39Ashley: The authors integrated DA into vLLM to utilize a block-aligned, in-place KV cache masking that is compatible with FlashAttention.
- 9:48This implementation projects that DA’s attention savings could reduce total decode wall-clock costs to 71% of the vanilla setup on the Gemma-4-31B model and to 77% on the Qwen-3.6-27B model.
- 10:03Evan: So to sum up, DA provides a protocol for models to declare their attention focus in real-time, significantly cutting down the attention costs without compromising much on accuracy.
- 10:14And it works out-of-the-box with no additional training required.
- 10:18Ashley: Precisely.
- 10:19That concludes our discussion on the Method section.
- 10:23Evan: Let's continue by diving into the Experiment and Results section of the paper.
- 10:28Ashley: The authors conducted a thorough evaluation of Declarative Attention, or DA, across various models and tasks to measure its efficacy.
- 10:36Evan: Right.
- 10:37They used six models from two different families: Gemma-4 and Qwen-3.5/6.
- 10:44The main comparison focused on the largest models from these families, namely Gemma-4-31B and Qwen-3.6-27B, with a broader analysis covering all six models.
- 10:56Ashley: Exactly.
- 10:57The evaluation was conducted on 15 long-context sources divided into two task categories: single-span retrieval and reasoning, and multi-span reasoning.
- 11:08These sources ranged from textbooks and novels to code repositories and conversation transcripts.
- 11:13Evan: So, what kind of benchmarks did they use for these tasks?
- 11:18Ashley: They drew from several long-context benchmarks including RULER, LongBench v1 and v2, LooGLE, and ZeroScrolls.
- 11:26The contexts varied significantly in length, with the longest reaching up to 1 million tokens.
- 11:32Evan: That’s a wide range.
- 11:34What were the key metrics they focused on for evaluation?
- 11:37Ashley: They used two main metrics: accuracy and attended tokens.
- 11:41Accuracy measured how often the model's answers were correct, while attended tokens counted the total number of tokens the model attended to during decoding.
- 11:50They also estimated real-world costs using roofline wall-time analysis.
- 11:54Evan: Let’s get into the results then.
- 11:56How did DA perform overall?
- 11:58Ashley: DA produced impressive results.
- 12:01On average, it reduced the attended-token count per response by 52% on Gemma-4-31B and 31.1% on Qwen-3.6-27B, with accuracy drops of only 1.27 and 2.75 percentage points, respectively.
- 12:20Evan: That’s quite a reduction in computational load.
- 12:24Did the performance vary significantly across different tasks?
- 12:28Ashley: Yes.
- 12:28The reduction in attended tokens was more consistent across single-span tasks compared to multi-span reasoning tasks.
- 12:36For instance, in the single-span tasks, DA showed an average token reduction of 54.8% on Gemma and 29.7% on Qwen.
- 12:46Evan: And in multi-span tasks?
- 12:48Ashley: In multi-span tasks, the average token reduction was slightly lower—48.5% on Gemma and 32.6% on Qwen.
- 12:58This is attributed to the complex nature of multi-span reasoning, which requires navigating through various segments of the context more frequently.
- 13:06Evan: Interesting.
- 13:07And how about the accuracy—were there any significant gains or losses depending on the task type?
- 13:13Ashley: Accuracy varied by task as well.
- 13:15DA consistently matched or even improved upon the vanilla setup in certain tasks, with clear single-task gains observed in areas like long-dependency QA and code repository QA.
- 13:26Evan: What about the impact of model size on DA's performance?
- 13:31Ashley: DA scaled positively with model size.
- 13:34Larger models like Gemma-4-31B and Qwen-3.6-27B showed smaller accuracy drops, indicating that more capable models could leverage the DA protocol more effectively.
- 13:46For instance, the accuracy gap between DA and vanilla narrowed as the model size increased from 4 billion to 31 billion parameters.
- 13:55Evan: That’s encouraging.
- 13:56Did the authors explore any specific integration details with existing systems?
- 14:01Ashley: Yes, they integrated DA into the vLLM framework.
- 14:05By adopting block-aligned, in-place KV cache masking, they projected significant reductions in decode wall-clock costs.
- 14:13For instance, they estimated decode time could be reduced to about 71% of the vanilla configuration on Gemma-4-31B and to 77% on Qwen-3.6-27B.
- 14:25Evan: That’s quite practical.
- 14:27Any notable failure modes or areas where DA struggled?
- 14:31Ashley: The authors noted some failure modes.
- 14:33In cases where the context required global arithmetic or tallying over large spans, DA struggled due to the segmentation of information.
- 14:41Additionally, tasks that inherently generated long output per segment also saw less dramatic token savings.
- 14:48Evan: So, while there are areas for improvement, DA seems to offer a substantial leap in computational efficiency.
- 14:55Ashley: The DA protocol opens up new avenues for more efficient, context-aware language model usage, with significant real-world implications for deployments in resource-limited settings.
- 15:07Evan: That brings us to the end of the Experiment section.
- 15:11Evan: Let's move on to the Related Work section.
- 15:14Ashley: In the Related Work section, the authors discuss various lines of research that intersect with the Declarative Attention protocol.
- 15:22Evan: Right, so what are the primary areas of focus in this section?
- 15:26Ashley: The authors categorize prior work into five main areas: dynamic sparse attention at decode, KV-cache eviction, complementary KV-cache axes, model-controlled inference and self-generated control tokens, and self-declared and steered attention.
- 15:44Evan: Great, let's start with dynamic sparse attention at decode.
- 15:48What does this involve?
- 15:50Ashley: Dynamic sparse attention aims to reduce the number of tokens attended to at each decoding step by identifying the most relevant tokens dynamically.
- 15:59Early methods used fixed heuristics like recency and attention magnitude to predict these tokens, but more recent approaches use lightweight scans or learned sparse indexing to achieve the same goal.
- 16:11Evan: So how does this compare to Declarative Attention?
- 16:15Ashley: The key difference is that Declarative Attention eliminates the need for these external predictors by having the model declare its own attention plan.
- 16:23Instead of dynamically approximating attention scores, the DA protocol directly reads the intended scope from the model’s own generated text, making it more efficient.
- 16:32Evan: I see.
- 16:34How about KV-cache eviction?
- 16:36Ashley: KV-cache eviction strategies focus on permanently dropping certain tokens from the attention cache based on their calculated importance.
- 16:44Techniques like Scissorhands, SnapKV, and FastGen are notable examples.
- 16:49However, these strategies risk not being able to retrieve previously discarded tokens if needed later.
- 16:55In contrast, DA keeps all tokens resident and uses masking to selectively attend to them, providing reversibility and preserving accuracy.
- 17:04Evan: And what about complementary KV-cache axes?
- 17:08Ashley: Complementary KV-cache axes focus on reducing the size and memory bandwidth required for KV-cache reads.
- 17:15This includes methods like low-bit quantization and offloading KV-cache to host memory.
- 17:21Although these techniques can be combined with DA, they differ in that DA specifically reduces the number of tokens read per step by masking, not by shrinking or relocating the cached entries.
- 17:32Evan: Interesting.
- 17:33Now let's discuss model-controlled inference and self-generated control tokens.
- 17:38Ashley: Model-controlled inference involves the model generating tokens that control and steer its own computation.
- 17:44Examples include ReAct, Self-RAG, and MemGPT, which use control tokens to trigger specific actions like retrieving information or allocating more compute resources.
- 17:54Declarative Attention fits into this broader trend by having the model control its own attention process through parseable declarations embedded within its output.
- 18:03Evan: Okay, and what constitutes self-declared and steered attention?
- 18:08Ashley: Self-declared and steered attention involves methods where the model explicitly dictates its attention spans.
- 18:14Self-Selected Attention Span, or SSAS, is a prime example where the model outputs the spans to focus on during training.
- 18:23While similar in spirit to DA, SSAS is task-specific and requires fine-tuning.
- 18:29DA, on the other hand, is elicited zero-shot and does not need specific training, making it more versatile.
- 18:35Evan: It sounds like Declarative Attention borrows concepts from these areas but adds its unique twist for real-time, zero-shot application.
- 18:44Ashley: Exactly.
- 18:45It combines the interpretability of model-generated control with the efficiency of dynamic sparse attention without needing external scores or extensive training.
- 18:55Evan: That wraps up our look into the Related Work section.
- 18:59Evan: Let's wrap up today's discussion by summarizing the key contributions and takeaways from this paper.
- 19:06Ashley: To recap, the paper introduces a novel protocol called Declarative Attention, or DA, that allows language models to manage their own attention spans by declaring where they need to focus during the text generation process.
- 19:19Evan: The core innovation here is the use of three distinct attention modes: global, focus, and local.
- 19:27These modes enable the model to efficiently navigate and process long contexts by dynamically adjusting the scope of attention.
- 19:34Ashley: Through zero-shot evaluations, DA has shown impressive results, cutting down the number of attended tokens during decoding by 52% on the Gemma-4-31B model and 31.1% on the Qwen-3.6-27B model.
- 19:50This significant reduction in computational load comes with only modest drops in accuracy.
- 19:55Evan: Another key advantage of DA is that it requires no additional training and can be applied to off-the-shelf models directly.
- 20:03This makes it highly practical for real-world applications, particularly in resource-constrained settings.
- 20:09Ashley: The authors also integrated DA into existing inference systems like vLLM, demonstrating that it can reduce total decode wall-clock costs substantially.
- 20:19This shows the real-world feasibility and efficiency of DA.
- 20:22Evan: Overall, Declarative Attention opens up new possibilities for efficient long-context processing in language models, making it a noteworthy contribution to the field.
- 20:33Ashley: That brings us to the end of our discussion for today.
- 20:36Thanks for tuning in to Daily Paper Cast.
- 20:39Evan: We hope you found this paper as fascinating as we did.
- 20:42Be sure to join us next time as we continue to explore the latest research in AI and NLP.