Emergent Structure in the Marginal Attention Space of Language Models
cs.CL
Submitted: 2026-10-02
Updated: 2026-10-02
Code: https://github.com/Flegyas/marginal-attention
License: http://creativecommons.org/licenses/by/4.0/
The gist: While representation similarity across independently trained language models is well-documented, how internal mechanics such as attention behave across models remains far less characterized.
Abstract
While representation similarity across independently trained language models is well-documented, how internal mechanics such as attention behave across models remains far less characterized. Inspired by this gap, we examine the structure of post-softmax attention weights by marginalizing over query positions, mapping them into a joint token-head "marginal attention space". Evaluating across 60+ diverse LLMs, we find that different properties emerge when reducing this space along its token and head axes. When reduced token-wise, marginal attention yields a text-intrinsic signal robustly conserved across models. To explain this property, we empirically connect marginal attention to the input-output Jacobian of the network, and prove theoretically that under a smoothness assumption, models with similar next-token distributions are guaranteed to have similar input-output Jacobian statistics. When reduced head-wise, it forms a model-private signature conserved across documents. Practically, this provides a natural way to estimate a per-head budget for key-value (KV) cache eviction, effectively decoupling model-specific budget allocation from text-intrinsic token scoring. On standard eviction benchmarks, a per-head budget precomputed offline on pretraining text, combined with a training-free token score, shows competitive performance with methods that recompute the budget on every document or train it per target. Code available at https://github.com/Flegyas/marginal-attention
Sources
- Yi: Open Foundation Models by 01.AI
- SmolLM2: When Smol Goes Big -- Data-Centric Training of a Small Language Model
- The Falcon Series of Open Language Models
- Qwen2.5-VL Technical Report
- Stable LM 2 1.6B Technical Report
- BLOOM: A 176B-Parameter Open-Access Multilingual Language Model
- PyramidKV: Dynamic KV Cache Compression based on Pyramidal Information Funneling
- KV-Lingo: Learning KV-Cache Translators with Distillation
- Aya Expanse: Combining Research Breakthroughs for a New Multilingual Frontier
- DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model
- Latent Space Communication via K-V Cache Alignment
- The Pile: An 800GB Dataset of Diverse Text for Language Modeling
- Gemma 2: Improving Open Language Models at a Practical Size
- The Zamba2 Suite: Technical Report
- The Llama 3 Herd of Models
- DeepSeek-Coder: When the Large Language Model Meets Programming -- The Rise of Code Intelligence
- MiniCPM: Unveiling the Potential of Small Language Models with Scalable Training Strategies
- Qwen2.5-Coder Technical Report
- KVzap: Fast, Adaptive, and Faithful KV Cache Pruning
- Mistral 7B
Related papers
- Exploring Solution Divergence and Its Effect on Large Language Model Problem Solving
- Ishigaki-IDS-Bench: A Benchmark for Generating Information Delivery Specification from BIM Information Requirements
- Subliminal Steering: Stronger Encoding of Hidden Signals
- MedStruct-S: A Benchmark for Key Discovery, Key-Conditioned QA and Semi-Structured Extraction from OCR Clinical Reports
- The End of Transformers? On Challenging Attention and the Rise of Sub-Quadratic Architectures
- Untangling the Mechanisms of Misleading Context in Medical Question Answering