Which Question Is Your Attention Metric Answering? Attention Rows as Compositional Data
Authors: Marios Papamichalis, Regina Ruane
Organizations: Human Nature Lab, Yale University, New Haven, CT 06511 · Department of Statistics and Data Science, The Wharton School, University of Pennsylvania, 3733 Spruce Street, Philadelphia, PA 19104-6340
Each row of a transformer's attention matrix is a probability distribution over tokens, and in trained models most of that probability lands on a single sink token, usually the first. Standard tools for comparing attention rows (cosine similarity, Jensen--Shannon divergence, Shannon entropy) therefore hinge on a choice papers rarely report: keep the sink, or drop it and renormalize. This choice can reverse conclusions. On ten pretrained models from five families, 17--47% of verdicts about which of two heads is more similar flip with the convention, and the most prominent structure in a standard BERT head-clustering pipeline is an artifact of it. The reason is that one-number summaries mix two questions: how much attention the sink takes, and how the rest is divided among the content tokens. Treating rows as compositional data separates them exactly: the Aitchison distance splits orthogonally into a sink term and a content term, entropy splits by an exact identity, and the content distance is characterized by invariances the transformer itself possesses. The separation matters in practice: most measured entropy collapse during training is the sink growing, not attention sharpening (30% of the drop at 70M parameters, 95% at 1B, 79% at 1.4B), and pruning heads with the wrong channel can inflate perplexity more than a hundredfold. We map where each convention is safe, test a frozen out-of-sample predictor (one confirmation, one abstention, one failure), and release code regenerating every number.
Figures & tables
Figure 1: The reversal in one construction (Theorem 1 ). Three attention rows over {sink,a,b} : p=(0.90,0.08,0.02) , q=(0.70,0.24,0.06) , r=(0.90,0.02,0.08) . (a) With the sink column, p and r share the same sink mass while q differs. (b) Dropping the sink and renormalizing, a routine, usually undocumented preprocessing choice, makes p′ and q′ identical (both allocate content 4:1 to a:b ) while r′ mirrors them. (c) Cosine, JS, and Euclidean distance all say r is the closer head with the sink and q without it: the scientific conclusion is an artifact of the convention. The Aitchison distance returns the same verdict in both views, and its content part dA⊥ is numerically identical.
with sink
sink dropped
metric
d(p,q)
d(p,r)
closer
d(p′,q′)
d(p′,r′)
closer
cosine
0.9693
0.9956
r
1.0000
0.4706
q
reversal
JS
0.0324
0.0193
r
0.0000
0.1927
q
reversal
Euclidean
0.2592
0.0849
r
0.0000
0.8485
q
reversal
dA
1.1022
1.9605
q
0.0000
1.9605
q
stable
Table 1: Exact witness for Theorem 1 with p=(0.90,0.08,0.02) , q=(0.70,0.24,0.06) , r=(0.90,0.02,0.08) : q shares p ’s content ratio ( 4:1 ) and r shares p ’s sink mass with mirrored content. “Closer” means larger cosine similarity or smaller dissimilarity. All three classical verdicts reverse; the JS and Euclidean values also violate subcompositional dominance ( JS(p′,r′)>JS(p,r) , ∥p′−r′∥>∥p−r∥ ).
Figure 2: Entropy conflates sink strength with content spread; CA⊥ separates them. Synthetic 12-layer models, 4,000 rows per layer. (a) Sink mass grows 0.06→0.85 with content log-ratio dispersion held fixed: mean Shannon entropy falls 2.71→0.82 nats ( −70% , a textbook “entropy collapse”) while CA⊥ moves 48.1→48.0 ( −0.3% ): the collapse is phantom. (b) Content genuinely collapses while the sink recedes 0.70→0.05 : entropy drifts 1.73→1.27 ( −27% , reads as mild) while CA⊥ rises 10.0→70.4 ( 7× ): the real collapse is masked.
Figure 3: Calibrated reversal curves and ten measured models. Curves: Monte Carlo closer-head disagreement rates between sink conventions for cosine, JS, and Euclidean distance, computed before any pretrained model was run (solid α=0.1 , dashed α=1 ). Stars: the ten models, placed at the sink mass of the signatures the distances are computed on; mean absolute deviation from the solid curves is 4.8 points (max 13 ). The dA⊥ rates are zero identically (Lemma 1 ), plotted as a code check.
ranking-reversal rate
Model
sink (row/sig.)
cosine
JS
Euclid.
Hell./FR
collapse disagr.
GPT-2 (124M)
0.68/0.78
36.1±0.1 %
35.0±0.2 %
38.1±0.2 %
34.4±0.2 %
27.3±0.0 %
Llama-3.2-1B
0.84/0.94
46.1±0.2 %
44.1±0.2 %
47.2±0.3 %
43.6±0.2 %
46.7±0.0 %
Qwen2.5-1.5B
0.68/0.82
43.9±0.1 %
42.5±0.1 %
44.3±0.1 %
42.3±0.1 %
29.6±0.0 %
Llama-3.2-3B
0.86/0.95
45.0±0.3 %
43.7±0.3 %
46.7±0.3 %
43.5±0.3 %
37.0±0.0 %
ViT-B/16
0.04/0.07
22.4±0.1 %
17.3±0.1 %
23.2±0.1 %
18.1±0.1 %
9.1±0.0 %
Table 2: Measured convention-dependence on ten pretrained models (mean ± sd over three seeds). Reversal = % of 50,000 head triples whose closer-head verdict flips between sink conventions (bit-identical across the ε sweep). Rates rise with signature sink mass (Figure 3 ). Hell./FR: Hellinger reversal; Fisher–Rao is identical since both are strictly monotone in the Bhattacharyya coefficient, so every ranking verdict coincides. Collapse disagr.: fraction of adjacent-layer transitions on which H and the content entropy H(π) move in opposite directions. Sink (row/sig.): arithmetic row-level mean and the sink mass of the Aitchison-mean signatures the distances use. The content-distance column is omitted: its rate is zero by construction (Lemma 1 ).
Figure 4: Measured layer-wise collapse decomposed. Mean Shannon entropy H (red) versus content entropy H(π) (green), sink mass dotted (seed 0); shaded bands mark adjacent-layer transitions on which the two disagree in sign. Where the sink strengthens with depth, H reports deepening collapse that the content channel does not show: Proposition 1 ’s conflation observed in pretrained models.
Figure 5: Prospectively specified downstream outcomes. (a) reversal tracks sink mass, which strengthens with scale within each family. (b) at Pythia-410M H collapses while H(π) barely moves; the share 1−ΔH(π)/ΔH is 30/53/70/95/79% across 70M–1.4B, rising to 95% at 1B ( 79% at 1.4B).
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 6: The reversal region is not thin. Fixing p and r of the witness and sweeping the third row q over the interior of the simplex ( 20,000 Dirichlet (1,1,1) samples with all parts >0.004 ), the cosine verdict about which of q,r is closer to p differs between the with-sink and sink-dropped conventions on 77.9% of positions (red).
Figure 7: A measured Llama-3.2-1B head triple realizing Theorem 1 . Found automatically by find_real_triple.py from the saved seed-0 signatures: with the sink, cosine, JS, and Euclidean distance all rank r closer to p ; after dropping the sink and re-closing, all three rank q closer; the dA⊥ verdict is identical in both pipelines.
Perm.
Perturb. ( ⊕ )
Temp.
Sink
Dom.
Euclidean
✓
×
×
×
×
cosine
✓
×
×
×
×
JS
✓
×
×
×
×
Shannon H
✓
×
×
×
n/a
dA
✓
✓
✓ †
✓ ‡
✓
ρA (ILR-cosine)
✓
×
✓ †
n/a
n/a
Appendix
Table 4: Invariance matrix. Perm. = permutation invariance; Perturb. = invariance to a shared logit bias (Prop. 2 (i)); Temp. = global-temperature ranking preservation; Sink = coherent under keep-vs-drop of the sink column; Dom. = subcompositional dominance. † : dA is 1/τ -equivariant, so rankings are exact; ρA is invariant even to per-head temperatures. ‡ : dA decomposes exactly (Lemma 1 ); dA⊥,CA⊥ are exactly sink-invariant. “n/a”: not applicable.
Model
1−cos
JS
Euclid.
BERT-base
0.024
0.066
0.030
GPT-2 (124M)
−0.014
0.022
−0.061
Llama-3.2-1B
−0.030
−0.082
−0.086
Appendix
Table 5: Measured taxonomy stability across sink conventions (the dA⊥ column is omitted: its partitions are identical across conventions by construction, Proposition 3 (i), with ARI =1 verified in code) (mean ARI over K∈{4,6,8} , average linkage; reanalyze_clustering.py ). The dA⊥ column is exact by Proposition 3 (i).
Model
Hell. rev.
FR rev.
share <10−6
ρ
NN agr.
cross-ARI
GPT-2 (124M)
0.35
0.34
0.046
0.957
0.73
0.40
Llama-3.2-1B
0.43
0.44
0.003
0.978
0.81
0.33
Qwen2.5-1.5B
0.43
0.42
0.000
0.993
0.86
0.63
Llama-3.2-3B
0.44
0.44
0.000
0.971
0.80
0.60
ViT-B/16
0.19
0.18
0.000
0.998
0.85
0.77
Pythia-70M
0.30
0.30
0.000
0.970
0.81
0.87
Appendix
Table 6: Estimator and rival-geometry audit (seed-0 signatures). Hell./FR = closer-head reversal rate between sink conventions under Hellinger and Fisher–Rao. Share = fraction of squared dA⊥ carried by coordinate pairs with smaller entry below 10−6 . Last three columns compare dropped-row JS with dA⊥ on the content channel: Spearman correlation of pairwise distances, nearest-neighbor agreement, and mean cross-ARI of the induced taxonomies over K∈{4,6,8} .
arithmetic mean
Aitchison mean
Model
cosine
JS
Euclid.
cosine
JS
Euclid.
GPT-2 (124M)
0.33
0.30
0.35
0.36
0.35
0.38
Llama-3.2-1B
0.40
0.37
0.41
0.46
0.44
0.47
Qwen2.5-1.5B
0.40
0.37
0.41
0.44
0.43
0.45
Llama-3.2-3B
0.44
0.41
0.45
0.45
0.44
0.47
ViT-B/16
0.21
0.18
0.22
0.22
0.18
0.23
Appendix
Table 7: Aggregation robustness : with-sink versus sink-dropped reversal rates (seed 0) computed on arithmetic-mean signatures (the classical metrics’ native aggregation) and on Aitchison-mean signatures.
temperature (JS ′ )
sink set flips
Model
flip (max)
set retention (min)
JS ′
dA⊥
GPT-2 (124M)
0.066
0.69
0.064
0.039
Llama-3.2-1B
0.046
0.87
0.154
0.128
Qwen2.5-1.5B
0.027
0.96
0.086
0.075
Llama-3.2-3B
0.040
0.90
0.205
0.176
ViT-B/16
0.017
0.93
0.010
0.012
Appendix
Table 8: Convention stakes (seed-0 signatures). Temperature: worst-case dropped-JS verdict flip rate and top- 20% prune-set retention over τ∈{0.5,0.7,1.5,2} (the dA⊥ values are exactly 0 and 1 on every model, verified to the bit, and are omitted). Sink set: closer-head verdict flip rate between the first-token and first-four-token sink definitions.
JS
cosine
dA⊥
K
cross
SEP Jac. (keep)
SEP Jac. (drop)
cross
cross
SEP Jac.
4
0.05
0.92
0.49
0.06
1
0.47
5
0.04
0.87
0.49
0.01
1
0.48
6
0.01
0.87
0.46
0.01
1
0.50
8
0.03
0.87
0.48
0.00
1
0.50
Appendix
Table 9: Clark-style clustering on the full 128 -token support (BERT-base; sink set { CLS, SEP } ). Cross = between-convention ARI; SEP Jac. = Jaccard of the SEP-head set with its best-matching cluster.
Model
sparsity
base
JS
dA⊥
dA (total)
GPT-2 (124M)
10%
43.5±0.4
50.5±0.5
88.9±0.9
61.5±0.7
20%
74.5±0.7
104.7±0.7
104.8±0.8
30%
85.2±1.0
122.3±1.1
117.4±1.6
Llama-3.2-1B
10%
15.3±0.1
358.0±31.1
45.6±2.9
18.2±0.4
20%
2094.1±139.7
63.6±4.1
2480.3±210.5
30%
2961.7±150.0
79.8±7.7
51742.6±6382.9
Appendix
Table 10: Full pruning sweep at 10/20/30% sparsity (mean ± sd over three seeds). LMs: perplexity (lower better); ViT: top-1 agreement (higher better; base =1 by definition). All rates in Table 3 are bit-identical across ε∈{10−5,10−6,10−7} , as the fixed-support protocol predicts.
Model
total dA
JS ′ -L1
random A/B
GPT-2 (124M)
104.8±0.8
268.0±3.1
314 / 171
Llama-3.2-1B
2480.3±210.5
2642.2±242.6
187 / 296
Qwen2.5-1.5B
32.3±0.2
28.4±0.5
30 / 35
Llama-3.2-3B
36.4±0.6
24.1±0.5
39 / 309
ViT-B/16
0.573±0.005
0.562±0.011
0.520 / 0.535
Pythia-70M
1484.9±11.3
2051.1±27.0
1556 / 1085
Appendix
Table 11: Additional pruning baselines at 20% sparsity (mean ± sd over three resampling seeds; two random draws shown individually). Total dA re-mixes the sink balance; JS ′ -L1 is dropped-row JS under the same-layer keep-one protocol; the 10/30% values are in the released JSONs.
When attention concentrates on a single token, a sink, what is the model actually computing? Attention sinks are ubiquitous in softmax transformers, yet this shared visual signature can hide fundamentally different algorithms. We show that visually similar sink patterns can reflect two distinct mechanisms: (i) adaptive nop, where a head suppresses its update by routing to a null token, and (ii) broadcast, where a sink aggregates and redistributes global information. Each mechanism leaves distinct traces (nop-sinks exhibit negligible value norms; broadcast sinks induce low-rank outputs), which we formalize on synthetic tasks and use to derive practical diagnostics. Applied to pretrained vision transformers, these diagnostics reveal that both mechanisms exist at scale: sinks transition from CLS in early layers to patches in deeper layers and concentrate in specialized heads. Causal interventions further connect these signatures to near-null suppression and shared residual contributions. We then use architectural interventions to show how these computations can be reorganized: gating eliminates detected nop-like sinks but increases broadcast-like sinks, registers relocate rather than remove sink computation, and our position-free global pathway provides an explicit route for shared communication that reduces the broadcast-like sinks induced by gating. On dense probes, combining gating with the global pathway gives the strongest results among the tested variants, despite retaining some broadcast-like sinks. Overall, we find that the same attention pattern can reflect two very different computations, and that effective intervention depends not only on identifying the computation, but also on providing architectural alternatives through which the model can reorganize it.
Lukas Fesser*, Mozes Jacobs*, Thomas Fel* +2
Kempner Institute Harvard University Cambridge, MA
The number of attention heads in a transformer is usually set by convention or grid search. We test a simple heuristic for setting it in advance: estimate the intrinsic dimension of token representations without labels, and use roughly that many heads. We estimate intrinsic dimension with a nested-dropout VAE trained on DistilBERT embeddings of WikiText-2, choosing the KL weight at the knee of the VAE's rate-distortion curve rather than by hand. This gives k∗=9.2 (95% CI [8.6, 9.8]). In a small 4-layer transformer trained from scratch, 10 heads and 32 heads are statistically equivalent on SST-2 and on MRPC (paired TOST over 10 seeds, ±1 point margin), with 69% fewer attention parameters for the 10-head model. Training 10 heads from the start also slightly outperforms training 32 heads and pruning to 10 (0.6 points, p=0.008). The evidence is narrow: two classification tasks, one small architecture, no pretrained models, and no formal link between intrinsic dimension and head count. We present the result as a practical heuristic worth testing at larger scale, not as a general principle.
Arjun Boya, Charan Sai Bandaru, Masthanaiah Pillimetla +1
Institute of Cognitive Science University of Osnabrück · Department of Social Sciences and Technology Technical University of Munich
Computationally demanding and opaque deep learning models can be better understood and optimized by analyzing how they transform data. While deep transformers have been widely studied in computer vision and natural language processing, their application in tabular data remains relatively underexplored. This paper presents one of the first applications of an importance-scoring metric to interpret multi-head transformer models in learning from tabular data. Experiments conducted on 40 diverse tabular datasets demonstrate robustness to head drops based on the proposed head importance score. In 72.5% of experimental examples, the model remains most resilient to performance drops when heads with the lowest importance scores are gradually removed. In contrast, removing the most important attention head first results in the greatest reduction in classification performance. A closer look at individual head importance scores across six attention layers reveals that important heads are scattered across layers, with no consistent layer-specific trends. In contrast to the image and language domains, the importance of individual attention heads varies considerably across tabular datasets with different schemas and feature spaces. The proposed importance score can improve efficiency and redundancy within transformer architectures. We make the source code for measuring the importance of individual attention heads publicly available.
Ahmad Jad Allah, Kazi F. Akhter, Md. Kamrozzaman Bhuiyan +1
Department of Computer Science Tennessee State University Nashville, TN, USA · Enosis Solutions Dhaka, Bangladesh · Department of Computer Science North Carolina Agricultural and Technical University Greensboro, NC, USA