Multi-Head Self Attention is a Parameter Identification Mechanism
cs.LG, stat.ML
Submitted: 2026-09-01
Updated: 2026-09-01
Code: https://github.com/karpathy/nan
License: http://creativecommons.org/licenses/by/4.0/
The gist: We prove that a multi-head scaled dot product attention can be viewed as a parameter identification strategy.
Terminology
Abstract
We prove that a multi-head scaled dot product attention can be viewed as a parameter identification strategy. The ratio of unidentified parameters to the total number of parameters scales like the reciprocal of the number of heads (1/2 to 1/(2H)), meaning models with more heads are structurally more identified. A subtle side effect of the mathematics observation that attention can never be fully identified. Similarly we also show that some bias terms can have no effect on softmax-based attention layers in both the single- and multiple-head settings, though this is mostly a curiosity that should have a marginal effect on model size and model training/prediction efficiency. We also touch on modern improvements to transformers including RoPE and GQA from this perspective, illustrating how those as well can improve the ratio of ``meaningful'' parameters to all parameters. Simple numerical examples demonstrate that training can indeed involve updates that overlap model-invariant subspaces that arise from a lack of identification. As part of our experiments we use a ``rebalancing'' approach that can ``fix'' updates that overlap unindentified subspaces but do not try to present evidence this should actually be adopted. Instead we simply view our numerical results as exploring and confirming the theoretical results. As a whole we discuss a purely mathematical/statistical explanation, identification, for why specific architectural choices in transformers may have improved performance.
Sources
- GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints
- On the Optimization of Deep Networks: Implicit Acceleration by Overparameterization
- Low-Rank Bottleneck in Multi-head Attention Models
- The Lottery Ticket Hypothesis: Finding Sparse, Trainable Neural Networks
- Formal Algorithms for Transformers
- RoFormer: Enhanced Transformer with Rotary Position Embedding
- Attention Is All You Need
- Length Generalization of Causal Transformers without Position Encoding
- Beyond the Permutation Symmetry of Transformers: The Role of Rotation for Model Fusion
- Symmetry in Neural Network Parameter Spaces
Related papers
- Polynomial-Augmented Neural Networks (PANNs) with Weak Orthogonality Constraints for Enhanced Function and PDE Approximation
- AIRL-S: Unifying Reinforcement Learning and Search-Based Test-Time Scaling via Adversarial Inverse Reinforcement Learning
- Transformers as Bayesian In-Context Experimenters: Smoothness-Adaptive Efficient ATE Estimation
- Convergence issues in Relational Concept Analysis based on AOC-posets
- Beliefs Beyond Posteriors: The Predictive Cost of ELBO Binding
- Understanding Diffusion Models via Ratio-Based Function Approximation with SignReLU Networks