This question is about the structure of attention heads in trained transformers.
TL;DR: Why do trained bilinear forms behave similarly to rank-one forms?
An attention head computes interactions between tokens x,y using its bilinear form xTKTQy, where Q and K are n×N matrices and n≤N/2. Write L=KTQ=S+T for symmetric S and antisymmetric T.
The following facts hold away from a subset of Q,K of measure zero:
S has signature (n,n,N−2n),
T has rank 2n, with n nonzero singular values each of multiplicity two,
So every head has three lists of n positive numbers, each sorted in decreasing order: the positive eigenvalues λ+ of S, the absolute values λ− of its negative eigenvalues, and the singular values σ(T) of T counted once.
In 21,080 trained heads from 18 open-source language models trained on natural language, two additional relations approximately hold for their spectral data. The first is that the antisymmetric spectrum is approximately determined by the symmetric spectrum.
(1) The singular values of T are geometric means of the eigenvalues of S:
σ(T)i≈(λ+)i(λ−)i,i=1,…,n.
For a real vector x write (x)+=max(x,0) and (x)−=max(−x,0) entrywise. The squared Frobenius norm of L splits into four nonnegative terms:
So to each nonzero bilinear form we get a point (a,b,c,d) in the tetrahedron Δ. Let Θ={a=b,cd=0}⊂Δ.
The second observation is that trained heads accumulate along Θ.
(2) Trained heads lie close to Θ and spread along it.
Random models. If Q,K have independent Gaussian entries, both relations hold approximately, but with λ+≈λ−, so all profiles sit at the single point (21,21,0,0) of Θ. If K=rQ+1−r2G with Q,G independent Gaussian, the profile moves along Θ to c−d≈r∣r∣. So the observed spread along Θ seems likely to be due to a correlation between Q and K that remains to be described.
Rank one matrices. Rank one matrices satisfy the first observation exactly. Let L=uvT with u,v unit and t=uTv. Then S=21(uvT+vuT) has eigenvectors u+v and u−v with eigenvalues 21+t and −21−t, so λ+=21+t and λ−=21−t. The antisymmetric part T=21(uvT−vuT) has two equal singular values σ with 2σ2=∥T∥2=21−t2, so σ(T)=211−t2=λ+λ−. Consequently L has (a,b,c,d)=(21−t2,21−t2,(t)+2,(t)−2), so Θ={(aL,bL,cL,dL):rkL=1}.
So in some sense, bilinear forms in trained attention heads are behaving like rank-one forms even though their effective rank is far from one.
Short answer: yes. There is a natural class of query/key forms for which relations (1) and (2) hold exactly, and a natural Gaussian ensemble whose profiles converge to profiles of forms in that class. Every theorem in this answer is checked in Lean, and the full project (proofs, scripts, data) is at github.com/andrewcritch/question-2026-11-20-odesky.
Notation and relations (1) and (2) are as in the question: S, T, λ+, λ−, σ(T), a,b,c,d and Θ, all computed from the form L=K⊤Q of a head. The profile of L is π(L):=(a(L),b(L),c(L),d(L)).
Attribution. This solution was found by a collaboration between AI models: Claude Opus 5.5, GPT-6 Astra and GPT-6.1 Sol (both via Codex), Gemini 4 Carbon (via Antigravity), and Grok 4.7 (via Grok Build). Claude Opus 5.5 coordinated the work, found the ordering condition that makes relations (1) and (2) exact, built the ensemble from the other models' ideas, and ran the measurements on trained models; GPT-6 Astra found the exact identity for a and the rearrangement argument that the ordering condition sharpens; a second Claude Opus 5.5 instance proposed writing the ensemble through Q+K and K−Q; Gemini 4 Carbon proposed tying how closely each query row aligns with its key row to how large the pair is, and found the correction at a fixed ratio N/n; Grok 4.7 characterized the structure of trained heads outside the ensemble; and GPT-6.1 Sol and Claude Opus 5.5 subagents wrote the Lean proofs. attribution.md gives the details.
1. Coordinates
Let L=K⊤Q have rank n≥1. Write L=UΣV⊤, where Σ=diag(σ1,…,σn) holds the n nonzero singular values σ1,…,σn>0 (in any order), and U,V∈RN×n have orthonormal columns ui, vi. Let W:=U⊤V, the n×n matrix of cosines Wij=ui⊤vj between the left and right singular vectors of L.
For N≥2n, the pair (Σ,W) determines L up to the congruence L↦OLO⊤ with O orthogonal. The profile and relations (1) and (2) are invariant under this congruence, so (Σ,W) determines them.
Let ti:=Wii=ui⊤vi, the tilt of the pair (ui,vi); let F:=∑iσi2, m2:=∑iσi2ti2/F, and q:=∑i=jσiσjWijWji/F. Then exactly
a=21(1−m2−q),a−b=c+d−m2−q.
Let F∈R2n×N be the matrix whose rows are the n rows of Q followed by the n rows of K. For every head with rankF=2n, ∑ilogσ(T)i=21∑ilog(λ+,iλ−,i), because ∏iσ(T)i2=∏iλ+,iλ−,i=detG/4n, where G:=FF⊤ is the 2n×2n Gram matrix of the rows of F. So the log-ratios ri:=logσ(T)i−21log(λ+,iλ−,i) sum to zero, and if they are all equal they are all zero: relation (1) can fail only through the spread of the ri over i.
A sum of rank-one forms on orthogonal planes is L=∑iσiuivi⊤ with σi>0, unit vectors ui,vi with ui=±vi, and the planes span(ui,vi) mutually orthogonal (so W is diagonal). The summand σiuivi⊤ is blocki; its tilt ti=ui⊤vi (defined in §1) lies in (−1,1). Put αi:=σi(1+ti)/2 and βi:=σi(1−ti)/2. The blocks are similarly ordered if (αi−αj)(βi−βj)≥0 for all i,j. L is in normal form if the blocks of L are similarly ordered and the tilts of L are all ≥0 or all ≤0.
Lemma 1. The symmetric part of block i has eigenvalues αi>0 and −βi<0, and the antisymmetric part of block i has singular value αiβi with multiplicity 2. (Proof: the rank-one computation in the question, applied to each block.)
Theorem 1. Let L be a sum of n≥1 rank-one forms on orthogonal planes. Then:
a≤b, with equality if and only if the blocks of L are similarly ordered.
If the blocks are similarly ordered, relation (1) holds with equality at every index k=1,…,n.
If the blocks are similarly ordered, then c−d=∑iwiti∣ti∣ with wi:=σi2/F; d=0 if and only if every ti≥0; and c=0 if and only if every ti≤0.
π(L)∈Θ, i.e., relation (2) holds, if and only if L is in normal form.
Every point of Θ other than the two endpoints of Θ is π(L′) for some L′ in normal form.
Proof sketch of Theorem 1. By Lemma 1, λ+ is the list of the αi sorted decreasingly, and λ− is the list of the βi sorted decreasingly. So b=2∑kλ+,kλ−,k/F pairs the αi with the βi in sorted order, while a=2∑iαiβi/F pairs them block by block. By the rearrangement inequality, a≤b, with equality exactly when one permutation sorts both lists; that permutation also gives items 2 and 3. Equal tilts ti=t give the rank-one profiles, which gives item 5. Lean checks Lemma 1 in Geometry.lean and Spectral.lean, and Theorem 1 in TheoremAExtra.lean and Main.lean.
By Theorem 1(4), among sums of rank-one forms on orthogonal planes, the forms that "behave like rank-one forms", in the question's phrase, are exactly the forms in normal form. Items 1–4 of Theorem 1 hold for every number n≥1 of blocks. Theorem 1 says nothing about forms whose planes are not orthogonal.
3. Random ensemble
Fix n≥1, a law μ on R, and functions f,g:R→(0,∞) that are both nondecreasing. Draw an i.i.d. sequence ρ1,ρ2,… from μ; a head with n blocks uses ρ1,…,ρn. For each N≥2n, let P,M∈Rn×N be the first N columns of two infinite arrays of i.i.d. standard Gaussian entries, independent of each other and of the ρi. Define Q and K by
Theorem 2. Fix the values of ρ1,…,ρn (since P,M are independent of ρ, this is conditioning on ρ). As N→∞ with n fixed, almost surely π(L) converges to π(L∞), where L∞ is a sum of rank-one forms on orthogonal planes with αi=f(ρi) and βi=g(ρi). The blocks of L∞ are similarly ordered, because f and g are nondecreasing. Hence a−b→0, and relation (1) holds with equality in the limit. If f−g does not change sign on R, then L∞ is in normal form, so relation (2) holds in the limit. If also E[(f+g)(ρ)2]<∞ for ρ∼μ, then, as n→∞, almost surely
c(L∞)−d(L∞)→E[(f+g)(ρ)2]E[(f−g)(ρ)∣(f−g)(ρ)∣].
The right-hand side is the (f+g)2-weighted mean of t∣t∣, where t=(f−g)/(f+g) is the tilt of a block of L∞.
Proof sketch of Theorem 2. Let x1,…,x2n∈RN be the n rows of P/N followed by the n rows of M/N. As N→∞, the Gram matrix of x1,…,x2n tends to I almost surely, by the strong law of large numbers. So these rows lie within a distance δ→0 of an orthonormal family. The form whose rows are built from the orthonormal family, in place of x1,…,x2n, is exactly a sum of rank-one forms on orthogonal planes with αi=f(ρi) and βi=g(ρi). Replacing the orthonormal family by x1,…,x2n changes S and T⊤T by O(δ) in operator norm. By Weyl's inequality, every sorted eigenvalue of S and of T⊤T then changes by O(δ), uniformly in N. The squared Frobenius norms of L and T are polynomials in the Gram matrix, so they converge too. The n→∞ limit of c−d follows from the strong law of large numbers applied to the formula of Theorem 1(3). Hence Theorem 2 holds. Lean checks the convergence statement as theoremB_ae in TheoremBFull.lean, the consequences and the limit of c−d in TheoremBExtra.lean, and the strong law for the ratio as ratio_slln in Probability.lean.
In words: row i of Q+K has squared norm close to 4f(ρi) (a "match" strength), row i of K−Q has squared norm close to 4g(ρi) (a "mismatch" strength), and f and g are both nondecreasing in a shared latent parameter ρi. Special cases of the ensemble:
f,g constant: take the question's correlated Gaussian model K=rQ+1−r2G, with ∣r∣<1 and Q,G having independent standard Gaussian entries. For each entry, (Q+K,K−Q) has the law of two independent centered Gaussians with variances 2(1+r) and 2(1−r). For f=(1+r)/2 and g=(1−r)/2, this is the law of the corresponding entry of (2fP,2gM), i.e., of N(Q+K,K−Q) in the ensemble.
f=g constant: for r=0, the question's model has Q and K with independent standard Gaussian entries, and the previous item matches it entry by entry, up to the factor N, with f=g=21. This case is the Gaussian baseline. By Theorem 2, its limit profile is the midpoint (21,21,0,0) of Θ.
4. Comparison with trained heads
The numbers in this section are measurements on model weights, not theorems; the one theorem this section uses is Theorem 1(1). All measurements use raw L=K⊤Q (the LayerNorm gains are not multiplied into Q and K; for RoPE, L at relative position 0), in GPT-2 small (144 heads), GPT-2 medium (384 heads) and Pythia-160m (RoPE, 144 heads). Each value is the median over heads. The relation-(1) relative error is ∥σ(T)−λ+λ−∥/∥σ(T)∥, with entrywise products and square roots. The Gaussian baseline replaces Q and K by independent Gaussian matrices of the same shape. The scripts are in delegations/round1_brief/: gpt2_W.py and comono.py for GPT-2 small, medium.py for GPT-2 medium and large, pythia.py, and bloom.py; the results are entries R3, R13, R15, R16, R18 and R19 of record.md.
quantity
GPT-2 small
GPT-2 medium
Pythia-160m
Gaussian baseline
Kendall τ(α,β) from σi and ti (1 = similarly ordered)
0.76
0.77
0.85
—
diagonal share of ∣W∣F2
0.18
0.21
0.13
0.016
off-diagonal RMS of W / N−1/2
1.34
1.35
1.30
1.00
relation-(1) relative error
0.059
0.051
0.044
0.011
fraction of heads with a>b
0.31
0.22
0.31
—
corr(q,a−b) across heads
−0.97
−0.97
−0.96
—
Reading:
Training raises the diagonal share of ∥W∥F2. In GPT-2 small, the diagonal share is 0.18, about 11 times its Gaussian-baseline value 0.016.
The off-diagonal entries of W are mostly at the size that random vectors give. Their RMS matches the off-diagonal RMS of W for random frames in dimension about 0.55N, in GPT-2 small and in GPT-2 medium.
Trained heads depart from the normal form in two separate ways.Departure 1 is imperfect similar ordering of α and β (Kendall τ≈0.77). Departure 1 pushes a below b and accounts for most of the relation-(1) error. Departure 2 is the reciprocal off-diagonal overlap q (defined in §1), which decides the sign of a−b. By Theorem 1(1), every sum of rank-one forms on orthogonal planes has a≤b, so the roughly 30% of trained heads with a>b are not sums of rank-one forms on orthogonal planes. Across heads, a−b tracks −q (correlation −0.97). The heads with the largest a−b are layer-0 heads with q≈−0.2, from an antisymmetric coupling among the top singular directions of W.
Relation (1) has a larger error in trained heads than under the Gaussian baseline. The Gaussian baseline has its limit profile at the midpoint of Θ, where relation (1) has a small error. Training moves the profiles of heads away from the midpoint, along Θ, and adds departures 1 and 2.
5. Summary
Relations (1) and (2) hold exactly for the forms in normal form (Theorem 1). For the Gaussian ensemble of §3 with f−g of one sign, the profile of L converges to the profile of a form in normal form as the embedding dimension N grows (Theorem 2), and, entry by entry, the question's correlated Gaussian model has the same law as that ensemble with constant f,g, up to the factor N. Trained attention heads are close to the normal form, and §4 measured their departures from it.
6. Lean verification
Every theorem and identity in §1–§3 is checked in Lean 4 with Mathlib (hereafter, Lean), in lean/, with no unproved steps; #print axioms on each headline theorem gives only propext, Classical.choice and Quot.sound. In these checks, Lean computes the profile from decreasingly sorted eigenvalues of S and T⊤T (Mathlib's sorted eigenvalues, or decreasing lists of the characteristic-polynomial roots, which a lemma identifies) and from squared Frobenius norms. For degenerate heads, Lean pads missing entries of the spectral lists with zeros and takes x/0=0; the statements about the relation-(1) error assume T=0, where its denominator is positive. For the limit form L∞ and the special cases, Lean works with the formulas of Theorem 1 in terms of α and β, which Main.lean and Limit.lean identify with the profile of the operator.
claim
Lean theorems
file
§1: every L=K⊤Q of rank n has the form UΣV⊤ used in §1, and the profile, the spectral lists and the relation-(1) error depend only on L
§3: the Gaussian baseline has limit profile (21,21,0,0); for each entry, (Q+K,K−Q) in the question's correlated model has the law of independent centered Gaussians with variances 2(1±r), for ∣r∣<1
The table in §4 covers GPT-2 small, GPT-2 medium and Pythia-160m (RoPE) only. BLOOM-560m (ALiBi, 384 heads) and GPT-2 large (720 heads) give values close to those of the table, as medians over heads: diagonal share of ∥W∥F2: 0.18 and 0.24; Kendall τ: 0.76 and 0.78; relation-(1) relative error: 0.044 and 0.050; fraction of heads with a>b: 0.19 and 0.21; corr(q,a−b): −0.97 and −0.98.
Whether the LayerNorm gains are multiplied into L matters for how close heads are to Θ: with the gains and centering multiplied in, 20% of GPT-2-small heads have ∣a−b∣>0.1, against 7.6% for raw L (gpt2_more.py).
Some finite-N ensembles reproduce departures 1 and 2 of §4. One example, in delegations/answers/round2/, uses eight parameters per head, and its median relation-(1) relative error over heads equals the measured median. But these ensembles are descriptive fits, not natural ensembles, and none of them reproduces the layer-0 heads with the largest a−b.
Theorem 2 states convergence as N→∞ with n fixed. At a fixed ratio N=κn with n→∞, the limit can differ, and Theorem 2 does not cover that regime. A numerical observation, not a theorem: for constant f,g, simulations agree with 1−2a→(1+1/κ)(f−g)2/((f+g)2+(f−g)2/κ), against (f−g)2/(f+g)2 for the iterated limit, which is 1−2a of L∞ (at f=2, g=1, n=400, N=800: 1−2a=0.1598 measured, 0.1579 predicted, 0.1111 for the iterated limit). Writing x for the iterated-limit value and y for the fixed-ratio value, x≤y≤x(1+1/κ): for f=g, a relative difference of at most 1/κ, which is 5–8% for the measured models (κ=12–20), and for f=g, x=y=0; Lean checks this bound as fixed_ratio_bound in Ratio.lean, and the value of x as const_one_sub_two_a in Extras.lean.
Some parts of this answer are not mathematical theorems, so Lean does not check them: the measurements of §4 and of the caveats above (other models, LayerNorm, finite-N fits), and the fixed-ratio formula of the previous caveat, which is a numerical observation.
Thanks Andrew! Actually GPT 6.1 showed me the same construction at some point; while this random model recovers (1) and (2) and is certainly interesting, I wasn't able to convince myself that it's the right model for trained attention heads. The data in your paragraph 4 give a comparison to trained heads based on the spectra of S and T, but it'd be more convincing to have a comparison with L=S+T itself. When I compared this model with trained heads I got the impression that this construction wasn't the whole story, though I don't doubt that it's probably an important ingredient!
Thanks Andrew! Actually GPT 6.1 showed me the same construction at some point; while this random model recovers (1) and (2) and is certainly interesting, I wasn't able to convince myself that it's the right model for trained attention heads. The data in your paragraph 4 give a comparison to trained heads based on the spectra of S and T, but it'd be more convincing to have a comparison with L=S+T itself. When I compared this model with trained heads I got the impression that this construction wasn't the whole story, though I don't doubt that it's probably an important ingredient!