TL;DR
As Transformers swallow millions of tokens, standard softmax attention faces a dilemma: either drown in the noise of the crowd ("attention fading") or overcorrect and fixate on a single nearest neighbor. By treating long contexts like a problem in statistical physics, this paper derives the exact mathematical "Goldilocks" temperature scaling needed to keep attention selective without collapsing. Surprisingly, this critical threshold isn't logarithmic as previously thought—it’s a polynomial law governed directly by the geometric dimension of the key space.
What Problem Does This Paper Address?
Imagine shouting a question in a crowded stadium. If five people answer, you can pick out the most relevant voice. If a million people murmur back, even a loud, relevant answer gets drowned out by the sheer sum of the crowd.
In Transformers, this is called attention dilation or attention fading. As the context length ($n$) grows toward infinity, the denominator in the softmax function balloons, flattening all attention weights toward $1/n$ (uniform averaging). To fight this, engineers multiply attention scores by an "inverse temperature" parameter, $\beta_n$, which sharpens the distribution as $n$ grows.
Turn $\beta_n$ up too slowly, and attention blurs into useless averaging. Crank it up too fast, and it collapses into a rigid argmax, focusing on a single token and ignoring the rest of the context. Previous simplified theories—which suppressed random token-to-token fluctuations—suggested scaling $\beta_n$ logarithmically ($\log n$). The authors ask: What happens when we treat the context keys as genuinely random vectors and analyze the exact probability distributions that emerge as $n \to \infty$?
Methods
The authors analyze a Post-LayerNorm self-attention head using tools from extreme-value theory—the branch of probability that studies rare events and outliers.
They fix a query vector $q$ on a $d$-dimensional unit sphere ($\mathbb{S}^{d-1}$) and model the $n$ context keys as independent, identically distributed random samples drawn from a smooth probability density on that same sphere. Instead of looking at raw dot products, they track the distance-to-query (D2Q), which measures how close each random key lands to the query.
As $n \to \infty$, two forces compete: more tokens naturally land close to $q$, while increasing $\beta_n$ shrinks the "active window" around $q$ where tokens actually receive meaningful softmax weight. By balancing the geometric volume of this shrinking spherical cap against the growing number of tokens, the authors derive limiting probability laws for both the ordered attention weights and the final attention output vector across all possible scaling speeds of $\beta_n$.
Datasets
Not discussed in the paper. Because this is a foundational theoretical study, the authors validate their mathematical predictions using synthetic numerical simulations—specifically, sampling $n = 1,000$ to $10,000$ random tokens from uniform and exponential distributions on low-dimensional spheres ($\mathbb{S}^2$ and $\mathbb{S}^4$).
Key Insights and Ideas
Unified schematic of the ordered-weight and attention-output regimes as inverse temperature varies.
- Geometry dictates a polynomial—not logarithmic—critical scale: The critical inverse temperature scales as $\beta_n^\ast \asymp n^{2/(d-1)}$, where $d$ is the ambient embedding dimension (making $d-1$ the intrinsic dimension of the sphere). Unlike prior $\log n$ rules, this is the first scaling prescription that explicitly depends on the dimension of the key space. Only local geometry near the query matters; global features of the context distribution wash out.
- Three distinct phases of attention: Depending on how $\beta_n$ scales relative to $n^{2/(d-1)}$, attention falls into one of three worlds (illustrated in Figure 1):
- Supercritical ($\beta_n \gg n^{2/(d-1)}$): Single-key collapse. The closest token takes 100% of the weight.
- Critical ($\beta_n \asymp n^{2/(d-1)}$): The sweet spot. A finite handful of close neighbors share macroscopic weight, governed by a mathematical structure called a Poisson point process.
- Subcritical ($\beta_n \ll n^{2/(d-1)}$): Every individual weight vanishes toward zero, turning the attention output into a smooth local average around $q$.
- Subcritical attention runs heat flow in reverse: Inside the subcritical regime, there is a secondary transition at $\beta_n \asymp n^{2/(d+1)}$ where random Gaussian noise gives way to a deterministic drift. When combined with a residual connection and LayerNorm, this drift pushes token representations uphill—from low-density to high-density regions. Mathematically, the layer acts like a one-step discretization of the backward heat equation, actively clustering tokens together rather than diffusing them!
Key Results
The paper’s core contributions are exact mathematical limit theorems, backed up by clean numerical visualizations:
- Exact weight profiles: At the critical scale $\beta_n \asymp n^{2/(d-1)}$, ordered weights converge to normalized exponential arrivals of a Poisson point process. Below criticality, individual weights vanish, but the ratio of the $k$-th largest weight to the top weight follows a clean deterministic curve: $\exp(-x^\alpha)$, where $\alpha = 2/(d-1)$ and $x$ is the rescaled rank. Simulations on $\mathbb{S}^4$ ($n=1,000$) match this curve hampir-perfectly.
- Vector field transitions: Simulations with $n = 10,000$ tokens on $\mathbb{S}^2$ (where $d=3$, putting criticality at $\beta_n = n$ and the drift transition at $\beta_n = n^{1/2}$) visually confirm the theory: supercritical outputs look jagged and noisy, while lowering $\beta_n$ to $n^{1/4}$ smoothly recovers the exact theoretical log-density gradient field.
Limitations and Future Work
- Single-layer isolation: The math isolates a single attention row with a fixed query and value matrix. It does not yet capture the coupled, multi-layer dynamics of full Transformers with MLPs and residual streams.
- Untested at LLM scale: While the authors show in the appendix that their math extends to Rotary Positional Embeddings (RoPE) and weakly correlated tokens, testing this dimension-dependent scaling law on production-scale LLMs remains an open empirical question.
- Global random fields: In the subcritical regime, attention generates a Gaussian random field across the sphere; exploring the global behavior of this field across many queries simultaneously is a ripe direction for future probability research.
Summary updated