Dissecting the Interplay of Attention Paths in a Statistical Mechanics Theory of Transformers
Not on the map. Why?
Abstract (arXiv)
Despite the remarkable empirical performance of Transformers, their theoretical understanding remains elusive. Here, we consider a deep multi-head self-attention network, that is closely related to Transformers yet analytically tractable. We develop a statistical mechanics theory of Bayesian learning in this model, deriving exact equations for the network's predictor statistics under the finite-width thermodynamic limit, i.e., N,Prightarrow∞, P/N=O(1), where N is the network width and P is the number of training examples. Our theory shows that the predictor statistics are expressed as a sum of independent kernels, each one pairing different 'attention paths', defined as information pathways through different attention heads across layers. The kernels are weighted according to a 'task-relevant kernel combination' mechanism that aligns the total kernel with the task labels. As a consequence, this interplay between attention paths enhances generalization performance. Experiments confirm our findings on both synthetic and real-world sequence classification tasks. Finally, our theory explicitly relates the kernel combination mechanism to properties of the learned weights, allowing for a qualitative transfer of its insights to models trained via gradient descent. As an illustration, we demonstrate an efficient size reduction of the network, by pruning those attention heads that are deemed less relevant by our theory.
Key facts. Cited by 9 papers in the map (data through 14 Oct 2026). Builds on 56 of its 70 references that are in the map. First posted on arXiv 24 May 2024.
Builds on
56 of 70 references.
References · 56
- 2017Attention Is All You Needcited by 60,361
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,399
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 30,186
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,548
- 2017Fashion-MNIST: a Novel Image Dataset for Benchmarking Machine Learning Algorithmscited by 4,349
- 2016Matching Networks for One Shot Learningcited by 2,255
- 2016Understanding deep learning requires rethinking generalizationcited by 1,674
- 2018Reconciling modern machine learning practice and the bias-variance trade-offcited by 927
- 2019Analyzing Multi-Head Self-Attention: Specialized Heads Do the Heavy Lifting, the Rest Can Be Prunedcited by 856
- 2017Deep Neural Networks as Gaussian Processescited by 622
38 more
- 2023TinyStories: How Small Can Language Models Be and Still Speak Coherent English?cited by 449
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 406
- 2018Pyro: Deep Universal Probabilistic Programmingcited by 380
- 2023Trained Transformers Learn Linear Models In-Contextcited by 337
- 2017A Structured Self-attentive Sentence Embeddingcited by 318
- 2018Gaussian Process Behaviour in Wide Deep Neural Networkscited by 317
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
- 2023Deja Vu: Contextual Sparsity for Efficient LLMs at Inference Timecited by 252
- 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 222
- 2016A Decomposable Attention Model for Natural Language Inferencecited by 215
- 2017A Conceptual Introduction to Hamiltonian Monte Carlocited by 209
- 2019Composable Effects for Flexible and Accelerated Probabilistic Programming in NumPyrocited by 191
- 2018A mathematical theory of semantic development in deep neural networkscited by 186
- 2020Spectral Bias and Task-Model Alignment Explain Generalization in Kernel Regression and Infinitely Wide Neural Networkscited by 166
- 2023A mathematical perspective on Transformerscited by 164
- 2016Long Short-Term Memory-Networks for Machine Readingcited by 161
- 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
- 2020Infinite attention: NNGP and NTK for deep attention networkscited by 121
- 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 118
- 2023The mechanistic basis of data dependence and abrupt learning in an in-context classification taskcited by 118
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
- 2022Self-Consistent Dynamical Field Theory of Kernel Evolution in Wide Neural Networkscited by 105
- 2023Scan and Snap: Understanding Training Dynamics and Token Composition in 1-layer Transformercited by 102
- 2017Structured Attention Networkscited by 95
- 2022Vision Transformers provably learn spatial structurecited by 93
- 2023A Theoretical Understanding of Shallow Vision Transformers: Learning, Generalization, and Sample Complexitycited by 77
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 75
- 2020Statistical Mechanics of Deep Linear Neural Networks: The Back-Propagating Kernel Renormalizationcited by 71
- 2023Max-Margin Token Selection in Attention Mechanismcited by 58
- 2019Torchmeta: A Meta-Learning library for PyTorchcited by 52
- 2023Transformers learn through gradual rank increasecited by 52
- 2023The Shaped Transformer: Attention Models in the Infinite Depth-and-Width Limitcited by 47
- 2023Dynamics of Finite Width Kernel and Prediction Fluctuations in Mean Field Neural Networkscited by 43
- 2023Bayes-optimal Learning of Deep Random Networks of Extensive-widthcited by 41
- 2023What can a Single Attention Layer Learn? A Study Through the Random Features Lenscited by 40
- 2024How Do Nonlinear Transformers Learn and Generalize in In-Context Learning?cited by 35
- 2022Unraveling Attention via Convex Duality: Analysis and Interpretations of Vision Transformerscited by 30
50 most cited of 56 All 56 (JSON)
Built on by
Citing papers per year: 2024: 3; 2025: 3; 2026: 3.
9 papers.
- 2024Optimal Protocols for Continual Learning via Statistical Physics and Control Theorycited by 14
- 2024High-dimensional learning of narrow neural networkscited by 12
- 2026Perceptrons and localization of attention's mean-field landscapecited by 8
- 2024When narrower is better: the narrow width limit of Bayesian parallel branching neural networkscited by 1
- 2025Attention with Trained Embeddings Provably Selects Important Tokenscited by 1
- 2025Intra-neuronal attention within language models Relationships between activation and semanticscited by 0
- 2025Polysemy of Synthetic Neurons Towards a New Type of Explanatory Categorical Vector Spacescited by 0
- 2026HyperLens: Quantifying Cognitive Effort in LLMs with Fine-grained Confidence Trajectorycited by 0
- 2026Pre-registered tests of solid-state-physics-inspired LLM compression: a cluster-level negative result at small-language-model scalecited by 0
- 2026Pre-registered tests of solid-state-physics-inspired LLM compression: a cluster-level negative result at small-language-model scale28 Sep 2026
- 2026HyperLens: Quantifying Cognitive Effort in LLMs with Fine-grained Confidence Trajectory7 May 2026
- 2026Perceptrons and localization of attention's mean-field landscape29 Jan 2026
- 2025Attention with Trained Embeddings Provably Selects Important Tokens22 May 2025
- 2025Polysemy of Synthetic Neurons Towards a New Type of Explanatory Categorical Vector Spaces30 Apr 2025
- 2025Intra-neuronal attention within language models Relationships between activation and semantics17 Mar 2025
- 2024Optimal Protocols for Continual Learning via Statistical Physics and Control Theory26 Sep 2024
- 2024High-dimensional learning of narrow neural networks20 Sep 2024
- 2024When narrower is better: the narrow width limit of Bayesian parallel branching neural networks26 Jul 2024