Manuscript Offprint

arXiv:2610.03109

Emergent Structure in the Marginal Attention Space of Language Models

Valentino Maiorca, Walter Nelson, Francesco Locatello

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

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.

1 INTRODUCTION

Despite fundamental differences in architecture, initialization and training objective, neural networks have repeatedly been shown to rediscover a similar representational geometry: the embeddings two models assign to semantically related inputs agree up to a simple transformation (Kornblith et al., 2019; Raghu et al., 2017; Morcos et al., 2018). This phenomenon is strong enough that unrelated models can be composed (Lenc & Vedaldi, 2015; Bansal et al., 2021), even across different architectures, data or modalities (Moschella et al., 2023; Norelli et al., 2023; Maiorca et al., 2023). Building on this empirical evidence, recent work has turned from whether representations agree to why they do, with competing hypotheses (Huh et al., 2024; Gröger et al., 2026).

How the mechanics that produce these representations behave across models, attention in transformers above all, is far less characterized, and is the focus of this paper. We study attention through its marginals: the attention each head pays to an input token, weighted by what the head writes from it and averaged over output positions. On one document, this gives a matrix with one row per head and one column per input token, which we reduce along each axis (Figure 1). Reducing over heads gives the per-token marginal attention, a property of the text, shared across models that differ in lab, data, size, tokenizer and architecture. Reducing over tokens gives the per-head marginal attention, a property of the model, stable across documents and not shared across unrelated models.

To explain the per-token observation, we connect marginal attention to the input-output Jacobian of the language model. In particular, we show that marginal attention, although a simple statistic of the attention matrices alone, approximates the blockwise norms of the input-output Jacobian well. The attention paid to input position s by an output position t, averaged across all heads in the model,

∗^{*}Equal contribution.

Attention of every head →\rightarrow Marginal attention →\rightarrow Two reductions of M

Figure

Figure 1: Marginal attention on its two axes. Averaged over query positions, the attention of Qwen2.5-0.5B on one document is a matrix M of 336 heads by tokens. Its per-token reduction (green) agrees across 67 models on the same document ( ρˉ=0.87\bar{\rho} = 0.87), and its per-head reduction (lavender) on one document matches the model's average over its other documents ( ρˉ=0.95\bar{\rho} = 0.95).

closely approximates the dependence of the output logits at t on the input token s given by the Jacobian. This matters because the Jacobian is a local description of the language model's entire computation, which includes the value stream and higher-order attention dependencies as well as first-order attention effects. Our main theoretical result shows that two smooth models with nearly the same next-token distributions must have similar input-output Jacobians. For models that share a tokenizer the theory is predictive: pairs with closer next-token predictions agree more, in both the marginal influence and the per-token marginal attention.

The per-head observation shows that our quantity is a reliable model-specific signal that is largely independent of the input document, and we leverage this for key-value (KV) cache eviction. An eviction method must decide how much of the cache each head keeps, and it must keep what later queries will retrieve. We therefore build from our per-head marginal attention a static budget computed on the reconstruction queries of a second pass that asks the model to repeat the document (Kim et al., 2025). On those queries the profile is also stable across documents, so the budget is computed once per model, offline, on pretraining text. At inference only a per-token score remains, and since the per-token marginal attention is shared across models, that scoring can also be adjusted by a different, much smaller model.

Our main contributions can be summarized as follows:

• We propose marginal attention as a relevant quantity to study in language models. Aggregated over heads, it is shared across unrelated models. Per head, it is specific to each model.

• We connect attention statistics in language models to the input-output Jacobian, and show that model smoothness and next-token distribution similarity alone are theoretically sufficient for input-output Jacobian near-identifiability across models (Theorem 1).

• We show that per-head marginal attention is a stable quantity across documents, enabling efficient KV cache eviction via a one-time, document-agnostic head budget calculation.

References (100)

Couldn't load all references. Reload the page to try again.