Source-linked AI summary

Spectral Geometry of Attention: From Information Routing to Uncertainty

Giulio Viganò, Simone Melzi, Maks Ovsjanikov

arXiv:2610.06012v1cs.LG

TL;DR

Prior attention analyses leave global single-step operator structure and its relation to token routing comparatively unexplored, while output-probability uncertainty signals can be unreliable when task-relevant distinctions are compressed before logits. The paper introduces an intrinsic-geometry Token Difference Operator and uses its spectrum to describe routing and head-output dimensionality. It reports that this framework separates sink effects from routing capacity and supports an uncertainty estimator that improves over related attention-based baselines on long-range tasks.

  • Problem

    Prior attention perspectives focus mainly on pairwise interactions, while probability-based uncertainty signals can be unreliable when task-relevant distinctions are compressed before reaching logits.

    Source: §1 · p. 1, §5 · p. 7
  • Method

    The paper defines the Token Difference Operator for attention between token-space geometries and derives an intrinsic probability geometry whose spectrum measures centered routing capacity.

    Source: §1 · p. 1
  • Results

    The intrinsic spectrum separates sink concentration from routing capacity, and SAUQ improves over closely related attention-based baselines on long-range tasks.

    Source: §1 · p. 2, §6 · p. 10
  • Takeaways & Limitations

    The framework connects attention’s spectral structure to the dimensionality of the routed head output and supports single-pass uncertainty estimation from routing capacity.

    Source: §1 · p. 2, §5 · p. 8

    The analysis is per-head, per-input, and single-step before residual mixing, MLP updates, and cross-head projection; computing the full spectrum also costs more than scalar statistics.

    Source: §6 · p. 10

Abstract

from arXiv · show

In this work, we study transformer attention through the lens of spectral geometry and operator theory. We view each attention head as a functional map between Hilbert spaces of functions on the token sequence and derive a Token Difference Operator, whose spectral structure controls how token-space information is routed to the output. We show that standard Euclidean spectra are structurally biased by sinks, conflating mass concentration with genuine routing capacity. By recasting token space in the intrinsic probability geometry induced by attention, the token difference spectrum disentangles sink effects from routing capacity and provides a spectral description of the dimensionality of the head output. This yields a unified framework for analyzing attention maps, explaining sinks, routing collapse, and output dimensionality within a single operator-theoretic framework. In practice, by grounding attention heuristics in spectral geometry, we develop a novel attention-based uncertainty estimator that complements probability-based scores, with the largest gains on long-context inputs.

1 Introduction

The introduction reframes attention as a global operator whose spectrum can describe token routing, rather than focusing only on pairwise interactions. It presents the Token Difference Operator and an attention-based uncertainty estimator as applications of this view.

1 Introduction

  • The paper identifies a gap in accounts centered on pairwise token interactions or models that do not describe attention’s single-pass effect.It instead asks how global attention-operator structure relates to hidden-representation dimensionality and transformer output.Source: §1 · p. 1
  • The Token Difference Operator (TDO) models an attention map as a functional operator between token-space geometries, with a spectrum describing its global, multi-scale behavior.The authors connect that spectrum to phenomena including attention sinks and model uncertainty.Source: §1 · p. 1
  • The standard Euclidean spectrum can be biased by attention sinks, while an intrinsic probability geometry separates sink mass from token-dependent routing.The intrinsic geometry decomposes the output into a transported mean and centered routing component.Source: §1 · pp. 1–2
  • SAUQ is an unsupervised, single-pass uncertainty estimator based on routing capacity, and it improves over closely related attention-based methods, especially on long-form summarization.The authors report that its spectral diagnostics are less dominated by sink score and align more closely with head-output dimensionality.Source: §1 · p. 2
  • The TDO’s nontrivial spectrum controls the dimensionality of the head output by describing token-dependent routing apart from the mean mode.The introduction presents this as a theoretical separation of sinks from dimensional collapse.Source: §1 · p. 2

2 Related Work

Prior work studies attention through probability, graph, transition-matrix, row-statistic, and spectral perspectives. This paper instead analyzes the single-step routing map with a spectrum defined by attention’s intrinsic geometry, and applies that view to uncertainty estimation.

Attention Interpretability

  • Attention research has treated attention weights as soft similarities [37], Markov chains, graph operators [7], and spectral or localization structure.These approaches typically analyze attention as a probability matrix, graph, or repeated operator, whereas this paper studies the single-step map V 7→AV with an intrinsic geometry.Source: §2 · p. 3

Sinks and representation collapse

  • Prior analyses of sinks and collapse include embedding spectra [8], information propagation, geometric analyses, and links to oversquashing, sinks, and feed-forward spiking [3].The paper says Euclidean spectral diagnostics can confuse sink concentration with routing capacity and introduces an intrinsic spectrum to separate them.Source: §2 · p. 3

Uncertainty quantification in LLMs

  • LLM uncertainty estimates use output probabilities such as entropy, perplexity, and likelihood, sampling-based consistency, or output-logit spectra.Probability-based signals can be unreliable when task-relevant distinctions are compressed before reaching logits [3].Source: §2 · p. 3
  • Related hidden-state and attention-based uncertainty methods use representations, attention values [34], previous-token relations, graph Laplacians [7], or topological divergence.This approach replaces scalar or graph-based summaries with the intrinsic TDO spectrum in a single-pass estimator.Source: §2 · p. 3

3 Theoretical Framework

The framework treats a fixed attention head as a linear token-routing operator between weighted function spaces. Its intrinsic probability geometry removes the Euclidean sink bias, separates mean transport from centered routing, and uses the resulting spectrum to characterize routed dimensionality.

3 Theoretical Framework

  • For a fixed input, the framework analyzes one head at a time, treating its row-stochastic causal attention matrix as a linear token-routing operator on the value matrix.The full multi-head output concatenates head outputs and projects them.Source: §3 · p. 3

3.1 Attention as a functional mapping and Token Difference Operator

  • The TDO is built from an attention map and its adjoint between weighted token Hilbert spaces, and its properties depend on the input and output measures.The operator is self-adjoint and positive semidefinite in the input geometry, and relates to how much the map stretches an input signal.Source: §3.1 · p. 4

3.1.1 Euclidean scenario: structural sink bias

  • In counting geometry, row-stochastic attention is generally non-contractive; its leading Euclidean spectrum is sensitive to accumulated sink mass.For an extreme causal sink, the top singular value squared is n and all spectral energy lies in the sink coordinate.Source: §3.1.1 · p. 4

3.1.2 Probability geometry scenario: intrinsic non-expansion

  • With intrinsic probability measures, attention is non-expansive and has a unit-gain constant mode; centered routing is governed by the next eigenvalue.The input measure is the attention-weighted average over keys, and the constant mode is separated from token-dependent variation.Source: §3.1.2 · pp. 4–5

3.2 From functions to representations

  • The head output decomposes into a transported attention-weighted mean and a centered, token-dependent routing component.The TDO spectrum controls how much centered variation survives and the dimensionality of the routed component.Source: §3.2 · p. 5

3.3 Spectral metrics

  • The normalized participation ratio summarizes the TDO spectrum: larger values indicate several active routing directions, while smaller values indicate compression of the centered component.Figure 2 shows the intrinsic TDO score distinguishing pure sink heads from copying, shifting, and sink-biased heads.Source: §3.3 · p. 6, Figure 2 · p. 6

4 Sinks, Routing, and Output Dimensionality

This section tests whether intrinsic TDO spectra separate sink concentration from token-dependent routing and track head-output dimensionality. Across theoretical constraints, representative heads, and head-population comparisons, centered intrinsic diagnostics show less sink dependence and closer alignment with output entropy.

Evaluation

  • The evaluation compares intrinsic and centered TDO diagnostics with attention, sink, previous-token, entropy, log-determinant, Laplacian, and PR(A⊤A) measures against sink score and H(AV).The tested predictions are reduced sink bias and a centered spectrum that tracks output dimensionality.Source: §4 · p. 6

Representative heads

  • PR(Dµ,π) scores copying, shifting, and sink-biased heads as routing-rich while separating them from sink collapse, matching routed output dimensionality across the four examples.The copying head nevertheless has low output dimensionality, which also depends on V.Source: §4 · p. 6
  • Previous-token score flags the shifting head but misses copying, while counting-geometry and graph-based diagnostics confuse sink-biased routing with sink collapse.The shifting score is tailored to that pattern; the sink-biased head combines substantial sink mass with nontrivial routing.Source: §4 · p. 6

Sink dependence and output dimensionality

  • For causal row-stochastic attention, rank deficiency forces sink concentration and loss of centered TDO modes, but imbalanced column sums can coexist with rich centered spectra.Thus sink behavior alone does not imply representational collapse.Source: §4 · pp. 6–7
  • Intrinsic TDO diagnostics are less sink-dependent than conventional metrics, while centered PR(Dµ,π) aligns more closely with H(AV) than raw-attention or counting-geometry ranks.Figure 3 compares diagnostics against sink score (top) and head-output spectral entropy (bottom).Source: §4 · p. 7, Figure 3 · p. 7

5 Spectral Attention Uncertainty Quantification

The section introduces SAUQ, a single-pass uncertainty estimator based on attention routing spectra, and evaluates it as a complementary signal whose clearest gains are on summarization tasks.

5.1 Method

  • SAUQ converts intrinsic attention spectra into confidence through a recurrence: spectral collapse attenuates propagated confidence, and the maximum across monitored heads makes any head’s collapse raise rejection uncertainty.The recurrence is inherited from RAUQ, with α = 0.2 in the experiments; the authors state that these choices are not dictated by their theory.Source: §5.1 · p. 8, §5 · p. 8
  • A generation-only variant evaluates a Euclidean proxy on generated tokens, but removing prompt columns without renormalizing makes its attention block sub-stochastic, so intrinsic geometry does not apply.Selection, recurrence, and aggregation remain unchanged.Source: §5.1 · pp. 8–9

5.2 Evaluation

  • SAUQ achieves the strongest summarization mean and best performance on SAMSum and XSum, while remaining competitive but not best on average for QA.The reported comparison is for Llama-3.1-8b; the table compares mean PRR across unsupervised methods.Source: §5.2 · p. 9, Table 1 · p. 9
  • With recurrence and protocol held constant, intrinsic TDO routing signals outperform the LapEigval and LogDet spectral signals in the related estimator comparison.The authors attribute the comparison primarily to replacing the scalar attention signal.Source: §5.2 · p. 9
  • On summarization, the attention-induced measure outperforms alternative measures, whereas several measures are comparable on short-range QA and positional weighting is marginally best.Only the intrinsic choice μ = A⊤π satisfies Proposition 2.Source: §5.2 · pp. 9–10

6 Conclusion

The conclusion presents intrinsic spectral geometry as a way to separate sink concentration from routing capacity and connect attention spectra to head-output dimensionality. It also identifies per-head, single-step analysis and full-spectrum cost as limitations.

6 Conclusion

  • Intrinsic probability geometry separates the trivial constant mode from centered modes that control routing capacity, while the TDO spectrum describes head-output dimensionality and supports uncertainty estimation.The conclusion reports improved performance over closely related attention-based baselines on long-range tasks.Source: §6 · p. 10
  • The analysis is per-head, per-input, and single-step before residual mixing, MLP updates, and cross-head projection; computing the full spectrum also costs more than scalar or participation-ratio statistics.The authors identify extending the analysis to full representation dynamics as a next step.Source: §6 · p. 10

A.1 Full Notation

  • The notation describes a decoder-only transformer block using pre-norm, residual multi-head attention, and an MLP update.The block equations specify the layer input, attention output, and subsequent MLP update.Source: §A.1 · p. 14

A.2 TDO is self-adjoint

  • The TDO is self-adjoint and positive semidefinite in the input geometry, and its eigenvalues describe squared attention gains under the input and output geometries.A similar symmetric positive semidefinite matrix has the same eigenvalues, enabling spectral computations through that matrix.Source: §A.2 · p. 14

A.3 Euclidean case: proof of Proposition 1

For row-stochastic attention, the Euclidean spectral norm is at least one and equals one exactly when the matrix is doubly stochastic. The squared singular values describe the spectrum, while the Frobenius budget can concentrate in the leading mode.

A.3 Euclidean case: proof of Proposition 1

  • With counting measures, Dµ,π = AᵀA, so its eigenvalues are the squared singular values of A.Source: §A.3 · p. 15
  • The Euclidean spectral norm satisfies σ1(A) ≥ 1, with equality if and only if A is doubly stochastic.The proof derives this equality condition from the fact that a constant vector attaining the top eigenvalue of AᵀA forces every column sum to equal one.Source: §A.3 · p. 15
  • A large leading singular value concentrates a large fraction of the available Frobenius budget in the leading mode.The Frobenius norm squared is the total squared singular mass; it is at least one, with equality for the fully uniform matrix.Source: §A.3 · p. 15

A.4 Intrinsic probability geometry: proof of Proposition 2

Under the intrinsic probability measures, attention is a contraction between the corresponding L2 spaces with operator norm one. The constant function attains unit gain, and µ is the invariant left measure of the Token Difference Operator.

A.4 Intrinsic probability geometry: proof of Proposition 2

  • Jensen’s inequality applied to each probability-valued attention row, then averaged over query positions, yields contraction in the intrinsic L2 geometry.Source: §A.4 · pp. 15–16
  • The operator norm is exactly one, and the constant function attains the top eigenvalue λ1(Dµ,π) = 1.Source: §A.4 · p. 16
  • The constant function is a right eigenvector, while µ is the corresponding invariant left measure.The invariance identity is µᵀDµ,π = µᵀ.Source: §A.4 · p. 16

A.5 Proof of Corollary 0.1

The centered subspace is preserved by attention and by the Token Difference Operator. The largest eigenvalue on that subspace is λ2, including when the unit eigenvalue has multiplicity greater than one.

A.5 Proof of Corollary 0.1

  • Attention maps functions centered under µ to functions centered under π, using the invariant-measure identity πᵀA = µᵀ.Source: §A.5 · p. 16
  • The µ-centered subspace is invariant under Dµ,π, so its restricted maximum Rayleigh quotient is λ2.Source: §A.5 · p. 16
  • If the unit eigenvalue has multiplicity greater than one, nonconstant centered modes have unit gain and λ2(Dµ,π) = 1.Source: §A.5 · p. 16

A.6 Proof of Proposition 3

The proof centers the value matrix by subtracting its µ-weighted mean, placing each feature column in the µ-centered subspace. It then establishes orthogonality of the decomposition’s terms in L2(π).

A.6 Proof of Proposition 3

  • For a value matrix V, m is its µ-weighted mean and Vc = V − 1m is its centered component.Source: §A.6 · p. 17
  • Each feature column of Vc has zero µ-mean and therefore lies in the µ-centered subspace.Source: §A.6 · p. 17
  • The proof establishes orthogonality of the decomposition’s two terms in L2(π).This follows from πᵀA = µᵀ and µᵀVc = 0.Source: §A.6 · p. 17

A.7 Proof of Corollary 0.2

The appendix tests spectral diagnostics and SAUQ across models and estimator choices; performance patterns vary by model and by the choice of selection versus routing signal.

A.7 Proof of Corollary 0.2

  • The proof uses a vanishing matrix cross term, zero entropy for a rank-one component, entropy concavity, a two-component mixture bound, continuity, and Proposition 3’s routed contraction bound.The continuity cases are m=0 or Zc=0.Source: §A.7 · pp. 17–18

A.8 Centered participation ratio

  • The centered participation ratio isolates nontrivial routed directions and is set to zero when all centered eigenvalues vanish.Source: §A.8 · p. 18

B.1 Correlation on other models.

  • Across GPT-2, Pythia-410m, and Qwen2-7b, metric relationships appear model-independent, consistent with structural properties shared by attention maps.Figure 5 plots attention diagnostics, sink score, and output dimensionality.Source: §B.1 · p. 18, Figure 5 · p. 19

B.2 Supervised hallucination detection with spectral probes

  • With k=16 leading Dµ,π eigenvalues, TDO features often match or exceed Laplacian features at low k, but richer or cheaper Laplacian features can match or surpass them.Truncation is used because the dense, weighted TDO is more expensive to estimate in full.Source: Table 3 · p. 19, §B.2 · pp. 19–20

B.3 Uncertainty quantification on Qwen2.5-7B

  • SAUQ improves over RAUQ on Qwen2.5-7B summarization (0.3577 vs. 0.3324) and has the best MMLU score (0.7204), but trails RAUQ on the QA mean (0.3724 vs. 0.3944).Probability-based estimators are strongest on summarization, and the generated-only variant exceeds the full-context variant (0.3654 vs. 0.3577).Source: Table 4 · p. 20, §B.3 · p. 20

B.4 Confidence intervals

  • PRR variability is estimated with 5,000 paired bootstrap resamples per dataset; single-pass estimators use greedy generation, while sample-based baselines use 10 samples.Source: §B.4 · p. 20

B.5 Calibration

  • PRR measures uncertainty-score ranking rather than calibration; expected calibration error is reported separately for single-pass estimators.Source: §B.5 · p. 20, Table 6 · p. 21

B.6 Head selection and routing signal

  • On TruthfulQA and SAMSum, intrinsic geometry improves the signal axis but not head selection; centered PR is marginally better than full PR on both datasets.Intrinsic selection would require computing the full TDO for every head, whereas the Euclidean proxy uses only the generated-token block.Source: §B.6 · pp. 21–22, Table 7 · p. 21

B.7 Length-controlled analysis

The appendix controls summarization comparisons for input and output length, describes alternative token-mass measures, and reports the evaluation’s computational requirements.

B.7 Length-controlled analysis

  • After output-length control, the summarization mean SAUQ–RAUQ PRR gain falls from 0.093 to 0.046; input-length control leaves it at 0.093.Residual XSum gains survive both controls and rise across input-length quartiles (+0.025, +0.053, +0.152, +0.170); SAMSum’s advantage falls from +0.066 to +0.013 under output-length control, so only the XSum residual is attributed to long-range routing.Source: §B.7 · p. 22, Table 8 · p. 22

B.8 Choice of measure

  • The measures include uniform mass, positional mass that downweights early-key columns despite larger early-position mass, and a token score based on the centered WU top right singular vector.Figure 6 illustrates token-mass distributions and mean SAUQ PRR for QA and summarization.Source: §B.8 · p. 22, Figure 6 · p. 23

B.9 Resource details.

  • A full unsupervised SAUQ evaluation takes approximately 8 hours per model on one L40S GPU with 48 GB; the routing signal uses matrix traces, so no eigendecomposition is needed.Source: §B.9 · pp. 22–23
Loading 2610.06012v1…