Stream: Scaling up Mechanistic Interpretability to Long Context in LLMs via Sparse Attention
Not on the map. Why?
Abstract (arXiv)
As Large Language Models (LLMs) scale to million-token contexts, traditional Mechanistic Interpretability techniques for analyzing attention scale quadratically with context length, demanding terabytes of memory beyond 100,000 tokens. We introduce Sparse Tracing, a novel technique that leverages dynamic sparse attention to efficiently analyze long context attention patterns. We present Stream, a compilable hierarchical pruning algorithm that estimates per-head sparse attention masks in near-linear time O(T log T) and linear space O(T), enabling one-pass interpretability at scale. Stream performs a binary-search-style refinement to retain only the top-k key blocks per query while preserving the model's next-token behavior. We apply Stream to long chain-of-thought reasoning traces and identify thought anchors while pruning 97-99% of token interactions. On the RULER benchmark, Stream preserves critical retrieval paths while discarding 90-96% of interactions and exposes layer-wise routes from the needle to output. Our method offers a practical drop-in tool for analyzing attention patterns and tracing information flow without terabytes of caches. By making long context interpretability feasible on consumer GPUs, Sparse Tracing helps democratize chain-of-thought monitoring. Code is available at https://anonymous.4open.science/r/stream-03B8/.
Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Builds on 34 of its 42 references that are in the map. First posted on arXiv 22 Oct 2025.
Builds on
34 of 42 references.
References · 34
- 2025DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learningcited by 6,146
- 2021Measuring Mathematical Problem Solving With the MATH Datasetcited by 5,203
- 2021RoFormer: Enhanced Transformer with Rotary Position Embeddingcited by 4,581
- 2024GPT-4o System Cardcited by 4,467
- 2025Gemini 2.5: Pushing the Frontier with Advanced Reasoning, Multimodality, Long Context, and Next Generation Agentic Capabilitiescited by 3,655
- 2022FlashAttention: Fast and Memory-Efficient Exact Attention with IO-Awarenesscited by 3,611
- 2023Lost in the Middle: How Language Models Use Long Contextscited by 3,383
- 2020Longformer: The Long-Document Transformercited by 3,362
- 2022Locating and Editing Factual Associations in GPTcited by 2,609
- 2023Code Llama: Open Foundation Models for Codecited by 2,105
- 2025Gemma 3 Technical Reportcited by 1,686
- 2020Big Bird: Transformers for Longer Sequencescited by 1,673
22 more
- 2023GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpointscited by 1,311
- 2024RULER: What's the Real Context Size of Your Long-Context Language Models?cited by 1,270
- 2024Qwen2.5-Math Technical Report: Toward Mathematical Expert Model via Self-Improvementcited by 1,057
- 2023Extending Context Window of Large Language Models via Positional Interpolationcited by 721
- 2023YaRN: Efficient Context Window Extension of Large Language Modelscited by 584
- 2025Native Sparse Attention: Hardware-Aligned and Natively Trainable Sparse Attentioncited by 391
- 2024Retrieval Head Mechanistically Explains Long-Context Factualitycited by 219
- 2025Thought Anchors: Which LLM Reasoning Steps Matter?cited by 126
- 2025Why do LLMs attend to the first token?cited by 122
- 2024Retrieval Augmented Generation or Long-Context LLMs? A Comprehensive Study and Hybrid Approachcited by 117
- 2024Round and Round We Go! What makes Rotary Positional Encodings useful?cited by 111
- 2024Automatically Interpreting Millions of Features in Large Language Modelscited by 106
- 2024AtP*: An efficient and scalable method for localizing LLM behaviour to componentscited by 100
- 2024Information Flow Routes: Automatically Interpreting Language Models at Scalecited by 92
- 2024Transformers need glasses! Information over-squashing in language taskscited by 87
- 2025Understanding Reasoning in Thinking Language Models via Steering Vectorscited by 69
- 2024Attention Heads of Large Language Models: A Surveycited by 65
- 2024How to think step-by-step: A mechanistic understanding of chain-of-thought reasoningcited by 53
- 2024A Mechanistic Analysis of a Transformer Trained on a Symbolic Multi-Step Reasoning Taskcited by 49
- 2024Iteration Head: A Mechanistic Study of Chain-of-Thoughtcited by 31
- 2024Understanding the RoPE Extensions of Long-Context LLMs: An Attention Perspectivecited by 13
- 2025A Survey on Transformer Context Extension: Approaches and Evaluationcited by 11
Built on by
Citing papers per year: 2026: 2.
2 papers.
Similar, not cited
Close in wording, no citation either way
- 2025DAM: Dynamic Attention Mask for Long-Context Large Language Model Inference Acceleration
- 2026You Only Index Once: Cross-Layer Sparse Attention with Shared Routing
- 2025LServe: Efficient Long-sequence LLM Serving with Unified Sparse Attention
- 2025Every Token Counts: Generalizing 16M Ultra-Long Context in Large Language Models
- 2026Full Attention Strikes Back: Transferring Full Attention into Sparse within Hundred Training Steps
- 2024From Sparse Dependence to Sparse Attention: Unveiling How Chain-of-Thought Enhances Transformer Sample Efficiency
- 2026Simplified Sparse Attention via Gist Tokens
- 2026Double-P: Hierarchical Top-P Sparse Attention for Long-Context LLMs