Which Question Is Your Attention Metric Answering? Attention Rows as Compositional Data
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
Abstract
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
| with sink | sink dropped | |||||||
|---|---|---|---|---|---|---|---|---|
| metric | closer | closer | ||||||
| cosine | reversal | |||||||
| JS | reversal | |||||||
| Euclidean | reversal | |||||||
| stable | ||||||||
| ranking-reversal rate | ||||||
|---|---|---|---|---|---|---|
| Model | sink (row/sig.) | cosine | JS | Euclid. | Hell./FR | collapse disagr. |
| GPT-2 (124M) | % | % | % | % | % | |
| Llama-3.2-1B | % | % | % | % | % | |
| Qwen2.5-1.5B | % | % | % | % | % | |
| Llama-3.2-3B | % | % | % | % | % | |
| ViT-B/16 | % | % | % | % | % | |
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
| Perm. | Perturb. ( ) | Temp. | Sink | Dom. | |
|---|---|---|---|---|---|
| Euclidean | ✓ | ||||
| cosine | ✓ | ||||
| JS | ✓ | ||||
| Shannon | ✓ | n/a | |||
| ✓ | ✓ | ✓ † | ✓ ‡ | ✓ | |
| (ILR-cosine) | ✓ | ✓ † | n/a | n/a |
| Model | JS | Euclid. | |
|---|---|---|---|
| BERT-base | |||
| GPT-2 (124M) | |||
| Llama-3.2-1B |
| Model | Hell. rev. | FR rev. | share | NN agr. | cross-ARI | |
|---|---|---|---|---|---|---|
| GPT-2 (124M) | ||||||
| Llama-3.2-1B | ||||||
| Qwen2.5-1.5B | ||||||
| Llama-3.2-3B | ||||||
| ViT-B/16 | ||||||
| Pythia-70M |
| arithmetic mean | Aitchison mean | |||||
|---|---|---|---|---|---|---|
| Model | cosine | JS | Euclid. | cosine | JS | Euclid. |
| GPT-2 (124M) | ||||||
| Llama-3.2-1B | ||||||
| Qwen2.5-1.5B | ||||||
| Llama-3.2-3B | ||||||
| ViT-B/16 | ||||||
| temperature (JS ′ ) | sink set flips | |||
|---|---|---|---|---|
| Model | flip (max) | set retention (min) | JS ′ | |
| GPT-2 (124M) | ||||
| Llama-3.2-1B | ||||
| Qwen2.5-1.5B | ||||
| Llama-3.2-3B | ||||
| ViT-B/16 | ||||
| JS | cosine | |||||
|---|---|---|---|---|---|---|
| cross | SEP Jac. (keep) | SEP Jac. (drop) | cross | cross | SEP Jac. | |
| Model | sparsity | base | JS | (total) | |
|---|---|---|---|---|---|
| GPT-2 (124M) | 10% | ||||
| 20% | |||||
| 30% | |||||
| Llama-3.2-1B | 10% | ||||
| 20% | |||||
| 30% |
| Model | total | JS ′ -L1 | random A/B |
|---|---|---|---|
| GPT-2 (124M) | / | ||
| Llama-3.2-1B | / | ||
| Qwen2.5-1.5B | / | ||
| Llama-3.2-3B | / | ||
| ViT-B/16 | / | ||
| Pythia-70M | / |
Attention Head Analysis
Attention head analysis studies how individual Transformer heads route information, support computations, and affect model behavior.
See all 79 papers