cs.LGSep 19, 2026
SaveOn attention heads and bilinear forms
Abstract
We study the symmetric and antisymmetric parts of bilinear forms in the attention heads of trained large language models. We introduce an orthogonally invariant profile map from real bilinear forms to a three-dimensional simplex and observe that profiles of trained bilinear forms accumulate near profiles of rank-one bilinear forms. We prove that the symmetric part of a bilinear form in an attention head is the sum of a hyperbolic form and a zero form for a Zariski-dense subset of query-key matrices.
Figures & tables
Figure 1. The simplex of profiles of nonzero bilinear forms. Red segments comprise . denotes a symmetric matrix whose spectrum is symmetric about zero and a positive semidefinite matrix. The front-right facet corresponds to symmetric forms, the bottom facet to , and the left facet to . Fibers of over the relative interiors of the back facet and the top-right edge are empty.
Figure 2. Profiles of the bilinear forms of gpt2-large and of Mistral-Small-24B-Base . The left model uses QKV attention while the right uses RoPE, showing that accumulation occurs for both types of positional encoding. Markers ( Type , Type , Type ) indicate parity.
Figure 3. The mean eigenvalue distribution of symmetric parts for gpt2 .
Figure 4. Measured eigenvalue distributions in gpt2 , attached to their branches or midpoint of . Each histogram shows the mean of the sorted, unit-length spectra of the ten most extreme heads in one cluster. Here has spectrum symmetric about zero and is positive semidefinite.
Figure 5. Projection of gpt2 ’s symmetric part eigenvalue distributions to the first three principal components (left), and to the second and third components (right).
| Model | Scoring parameters ( ) |
|---|---|
| QKV/RoPE/ALiBi attention | |
| Biaffine attention | |
| Bilinear attention | |
| Multi-head QKV/RoPE/ALiBi attention | |
| Multi-head bilinear |
Table 1. Trainable scoring parameter counts in the attention blocks; value map and positional encoding parameters are excluded. Here , is the sequence length, and is the number of heads. The last row uses fixed coordinate projections as described above.
| model | heads | Type | Type | Type |
|---|---|---|---|---|
| distilgpt2 | ||||
| gpt2 | ||||
| gpt2-medium | ||||
| gpt2-large | ||||
| opt-125m | ||||
| opt-350m |
Table 2. Percentage of the heads by parity, classified using , with tolerance for Type .
Figure 6. Average error of each fitted family over the heads of a model, against the size of the model; lower is a closer fit. The error is the root mean square difference between the heights of a -bin histogram of the sample and the fitted density, after rescaling the sample to unit mean.
Figure 7. The simplex of profiles of bilinear forms (left) and its face of symmetric forms (right). Here has spectrum symmetric about zero and is positive semidefinite. The fiber over the dashed edge is empty away from its endpoints.
| face | fiber of | |
|---|---|---|
| vertex | antisymmetric forms | |
| vertex | symmetric forms with | |
| vertex | positive semidefinite forms | |
| vertex | negative semidefinite forms | |
| edge | forms with | |
| edge | forms with positive semidefinite |
Table 3. The fibers of over the faces of ; denotes a symmetric matrix with spectrum symmetric about zero and a positive semidefinite matrix.
Figure 8. Profiles of the heads of gpt2 on the simplex .
Figure 9. Profiles of the symmetric parts of the heads of gpt2 on . Here has spectrum symmetric about zero and is positive semidefinite.
Figure 10. Profiles of spectra sampled from with , , , for and eigenvalues per side, plotted by their coordinate along the edge , drawn horizontally from the vertex to the vertex , together with the limit point of Theorem 5 ( ).
| Observation | Status | Source |
|---|---|---|
| 1 : the symmetric part is balanced | Proved: Theorem 3 | |
| 2 : head profiles accumulate near rank-one profiles | Partially explained: Theorem 5 ; the proportionality of the lobes in its proof holds approximately at the heads (§ 5.2 ) | |
| 3 : has two gamma-like lobes | Unexplained | |
| 4 : symmetric bias of attention heads | Partially explained: [ 10 , Theorem 2.4] for the bidirectional case with assumptions, unexplained for decoder-only | [ 10 ] |
| 5 : the sorted spectral lobes are approximately proportional | Linked to profile accumulation by Theorem 5 ; see § 5.2.1 | |
| 6 : and have gamma-like profiles | Unexplained | [ 3 ] |
Appendix figures & tables4 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 11. Distribution of the trained-head pairing scores in Figure 14 . Dashed lines mark model medians.
Figure 12. Parity by layer in all fourteen models. Each cell shows the percentage of a layer’s heads of the indicated type, with a shared scale from white ( ) to black ( ). Types use the symmetric profile: Type has ; otherwise gives Type and the remaining heads are Type . Layers are indexed from zero; RoPE models use relative position zero.
Figure 13. Symmetric energy at each attention head. For each model, the trained heads (left) are paired with independent random products (right), with iid standard normal of the same dimensions. Rows index layers and columns index heads, both starting at zero. The shared color scale is white at , red above and blue below; the random baseline has expectation . RoPE models use relative position .
Figure 14. Pairing score at each attention head. Each model’s trained heads (left) are paired with independent Gaussian QK products of the same dimensions (right), as in Figure 13 . Rows index layers and columns index heads. A score of one means the symmetric spectrum is symmetric about zero. The shared color scale is white at , red above and blue below. RoPE models use relative position .
More in this topic
Attention Head Analysis
Attention head analysis studies how individual Transformer heads route information, support computations, and affect model behavior.
See all 82 papersLarge Language Models (LLMs) achieve strong performance across many domains, but their efficiency is limited by the quadratic cost of attention with respect to prompt length. Sparse attention reduces this cost by retaining only a small fraction of query-key interactions to approximate the full attention matrix. However, existing methods are trapped in a mathematically wrong view: they simply keep large scalar entries or high-mass regions of the attention matrix. This treats the attention matrix as a bag of values, ignoring that it is used as a structured matrix whose entries jointly determine the attention output through multiplication with value vectors. We argue that this is the core conceptual issue: sparse attention should be formulated as matrix approximation, not as blindly choosing the largest values from a bag of entries. Based on this view, we propose Matrix Approximation Sparse Attention (MASA). MASA replaces raw attention-mass ranking with a closed-form score that measures how much each sparse unit reduces matrix-product approximation error. As a theory-grounded plug-in correction, MASA can be added to existing sparse attention frameworks without changing their sparse kernels or budgets. Extensive experiments across multiple sparse attention methods, benchmarks, and LLM backbones show consistent accuracy gains, supporting both MASA and the matrix-approximation view of sparse attention.
Riemannian Gradient Descent for Low-Rank Architectures
We explore Riemannian optimization techniques for rank-factored matrix parameters, targeting contemporary deep learning applications. We examine ten points in the algorithm design space: two geometries for rank- matrices, three geometries for rank- partial isometries, and block-matrix variants of these five, where factors are shared across block-rows and block-columns. We apply our methods to the multihead attention parameters in small language models. After tuning learning rates, our methods do not conclusively outperform an AdamW baseline. Our implementations are available online.
Accelerating Attention with Basis Decomposition
Attention is a core operation in large language models (LLMs). We present BD Attention (BDA), a lossless algorithmic reformulation of attention. BDA is enabled by a simple matrix identity from Basis Decomposition (BD), which restructures multi-head projections into a compact form while preserving exact outputs. Unlike I/O-aware system optimizations such as FlashAttention, BDA provides a mathematically guaranteed acceleration that is architecture-agnostic. On DeepSeek-V2-Lite (16B, FP16), BDA requires only 4s of offline preparation with no retraining required and, on modern GPUs, achieves 34% faster key/value projections and 25% smaller weights, while increasing perplexity (PPL) by just 0.02% (FP16) or 0.0004% (FP32), a negligible effect on model performance. These results position BDA as a theoretically exact method for lossless attention acceleration that is complementary to existing engineering-level optimizations. Our code is available at https://github.com/abcbdf/basis-decomposition-official.