What can a Single Attention Layer Learn? A Study Through the Random Features Lens
Not on the map. Why?
Abstract (arXiv)
Attention layers -- which map a sequence of inputs to a sequence of outputs -- are core building blocks of the Transformer architecture which has achieved significant breakthroughs in modern artificial intelligence. This paper presents a rigorous theoretical study on the learning and generalization of a single multi-head attention layer, with a sequence of key vectors and a separate query vector as input. We consider the random feature setting where the attention layer has a large number of heads, with randomly sampled frozen query and key matrices, and trainable value matrices. We show that such a random-feature attention layer can express a broad class of target functions that are permutation invariant to the key vectors. We further provide quantitative excess risk bounds for learning these target functions from finite samples, using random feature attention with finitely many heads. Our results feature several implications unique to the attention structure compared with existing random features theory for neural networks, such as (1) Advantages in the sample complexity over standard two-layer random-feature networks; (2) Concrete and natural classes of functions that can be learned efficiently by a random-feature attention layer; and (3) The effect of the sampling distribution of the query-key weight matrix (the product of the query and key matrix), where Gaussian random weights with a non-zero mean result in better sample complexities over the zero-mean counterpart for learning certain natural target functions. Experiments on simulated data corroborate our theoretical findings and further illustrate the interplay between the sample size and the complexity of the target function.
Key facts. Cited by 39 papers in the map (data through 7 Oct 2026). Builds on 82 of its 107 references that are in the map. First posted on arXiv 21 Jul 2023.
Builds on
82 of 107 references.
References · 82
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2023GPT-4 Technical Reportcited by 18,132
- 2014Neural Machine Translation by Jointly Learning to Align and Translatecited by 4,530
- 2018Neural Tangent Kernel: Convergence and Generalization in Neural Networkscited by 2,597
- 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,579
- 2021Decision Transformer: Reinforcement Learning via Sequence Modelingcited by 1,528
- 2022In-context Learning and Induction Headscited by 930
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
38 more
- 2022A Generalist Agentcited by 802
- 2018A Convergence Theory for Deep Learning via Over-Parameterizationcited by 784
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2018On Lazy Training in Differentiable Programmingcited by 671
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
- 2018Gradient Descent Provably Optimizes Over-parameterized Neural Networkscited by 655
- 2018Gradient Descent Finds Global Minima of Deep Neural Networkscited by 572
- 2019Fine-Grained Analysis of Optimization and Generalization for Overparameterized Two-Layer Neural Networkscited by 562
- 2018A Mean Field View of the Landscape of Two-Layers Neural Networkscited by 463
- 2018On the Global Convergence of Gradient Descent for Over-parameterized Models using Optimal Transportcited by 422
- 2019The generalization error of random features regression: Precise asymptotics and double descent curvecited by 410
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
- 2015An Introduction to Matrix Concentration Inequalitiescited by 391
- 2018Learning and Generalization in Overparameterized Neural Networks, Going Beyond Two Layerscited by 340
- 2014Breaking the Curse of Dimensionality with Convex Neural Networkscited by 329
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 286
- 2018Learning Overparameterized Neural Networks via Stochastic Gradient Descent on Structured Datacited by 260
- 2022Transformers Learn Shortcuts to Automatacited by 260
- 2023Looped Transformers as Programmable Computerscited by 224
- 2020How Neural Networks Extrapolate: From Feedforward to Graph Neural Networkscited by 218
- 2016A Decomposable Attention Model for Natural Language Inferencecited by 214
- 2018Just Interpolate: Kernel "Ridgeless" Regression Can Generalizecited by 190
- 2021Thinking Like Transformerscited by 182
- 2019On the Inductive Bias of Neural Tangent Kernelscited by 177
- 2019Towards moderate overparameterization: global convergence guarantees for training shallow neural networkscited by 176
- 2016Generalization Properties of Learning with Random Featurescited by 163
- 2022Neural Networks can Learn Representations with Gradient Descentcited by 161
- 2019Linearized two-layers neural networks in high dimensioncited by 155
- 2020When Do Neural Networks Outperform Kernel Methods?cited by 150
- 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
- 2023SGD learning on neural networks: leap complexity and saddle-to-saddle dynamicscited by 142
- 2022The merged-staircase property: a necessary and nearly sufficient condition for SGD learning of sparse functions on two-layer neural networkscited by 141
- 2020Tensor Programs II: Neural Tangent Kernel for Any Architecturecited by 139
- 2018Regularization Matters: Generalization and Optimization of Neural Nets v.s. their Induced Kernelcited by 131
- 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
- 2020Infinite attention: NNGP and NTK for deep attention networkscited by 117
- 2021Generalization error of random features and kernel methods: hypercontractivity and kernel matrix concentrationcited by 110
50 most cited of 82 All 82 (JSON)
Built on by
Citing papers per year: 2023: 4; 2024: 18; 2025: 10; 2026: 7.
39 papers.
Sort:
By area:
- 2023Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretrainingcited by 82
- 2023Transformers as Support Vector Machinescited by 67
- 2023Replacing softmax with ReLU in Vision Transformerscited by 43
- 2024Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chainscited by 39
- 2024From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformerscited by 34
- 2024Mechanics of Next Token Prediction with Self-Attentioncited by 34
- 2024A phase transition between positional and semantic learning in a solvable model of dot-product attentioncited by 30
- 2023Sequence Length Independent Norm-Based Generalization Bounds for Transformerscited by 28
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
- 2024Provably learning a multi-head attention layercited by 21
- 2024What Can Transformer Learn with Varying Depth? Case Studies on Sequence Learning Taskscited by 19
27 more
- 2024HSR-Enhanced Sparse Attention Accelerationcited by 19
- 2024Towards Understanding Inductive Bias in Transformers: A View From Infinitycited by 13
- 2024A Survey to Recent Progress Towards Understanding In-Context Learningcited by 12
- 2024Attention Meets Post-hoc Interpretability: A Mathematical Perspectivecited by 11
- 2025Generalization or Hallucination? Understanding Out-of-Context Reasoning in Transformerscited by 10
- 2024Dissecting the Interplay of Attention Paths in a Statistical Mechanics Theory of Transformerscited by 9
- 2024Towards Understanding the Word Sensitivity of Attention Layers: A Study via Random Featurescited by 5
- 2024Learning Linear Attention in Polynomial Timecited by 5
- 2024Global Convergence in Training Large-Scale Transformerscited by 5
- 2024On the Benefits of Rank in Attention Layerscited by 4
- 2025Tensor Sketch: Fast and Scalable Polynomial Kernel Approximationcited by 4
- 2026ZeroS: Zero-Sum Linear Attention for Efficient Transformerscited by 4
- 2025Bayes optimal learning of attention-indexed modelscited by 3
- 2025When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical Perspectivecited by 2
- 2025How Can Mamba Learn In Context with Outliers and Generalize Provably?cited by 2
- 2026Breaking the Reversal Curse in Autoregressive Language Models via Identity Bridgecited by 2
- 2024Learning Expressive Random Feature Models via Parametrized Activationscited by 1
- 2025On the Generalization Properties of Learning the Random Feature Models with Learnable Activation Functionscited by 1
- 2026Algebraic Invariants of Lightning Self-Attentioncited by 1
- 2026On the global convergence of gradient flow for wide shallow models beyond homogeneous nonlinearitiescited by 1
- 2026Transformers Provably Learn to Internalize Chain-of-Thoughtcited by 1
- 2025Softplus Attention with Re-weighting Boosts Length Extrapolation in Large Language Modelscited by 0
- 2025Theoretical Foundations of Representation Learning using Unlabeled Data: Statistics and Optimizationcited by 0
- 2025Minimax Rates for Learning Pairwise Interactions in Attention-Style Modelscited by 0
- 2025One-Bit Quantization for Random Features Modelscited by 0
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adaptcited by 0
- 2026When Can Attention Heads Be Statically Defined?cited by 0
- 2026When Can Attention Heads Be Statically Defined?28 Sep 2026
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adapt14 Jun 2026
- 2026Transformers Provably Learn to Internalize Chain-of-Thought27 May 2026
- 2026On the global convergence of gradient flow for wide shallow models beyond homogeneous nonlinearities11 May 2026
- 2026Algebraic Invariants of Lightning Self-Attention17 Apr 2026
- 2026ZeroS: Zero-Sum Linear Attention for Efficient Transformers5 Feb 2026
- 2026Breaking the Reversal Curse in Autoregressive Language Models via Identity Bridge2 Feb 2026
- 2025One-Bit Quantization for Random Features Models17 Oct 2025
- 2025On the Generalization Properties of Learning the Random Feature Models with Learnable Activation Functions17 Oct 2025
- 2025Minimax Rates for Learning Pairwise Interactions in Attention-Style Models13 Oct 2025
- 2025How Can Mamba Learn In Context with Outliers and Generalize Provably?1 Oct 2025
- 2025Theoretical Foundations of Representation Learning using Unlabeled Data: Statistics and Optimization23 Sep 2025
27 more
- 2025Generalization or Hallucination? Understanding Out-of-Context Reasoning in Transformers12 Jun 2025
- 2025Bayes optimal learning of attention-indexed models2 Jun 2025
- 2025Tensor Sketch: Fast and Scalable Polynomial Kernel Approximation13 May 2025
- 2025When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical Perspective14 Mar 2025
- 2025Softplus Attention with Re-weighting Boosts Length Extrapolation in Large Language Models23 Jan 2025
- 2024Learning Expressive Random Feature Models via Parametrized Activations29 Nov 2024
- 2024Global Convergence in Training Large-Scale Transformers31 Oct 2024
- 2024HSR-Enhanced Sparse Attention Acceleration14 Oct 2024
- 2024Learning Linear Attention in Polynomial Time14 Oct 2024
- 2024On the Benefits of Rank in Attention Layers23 Jul 2024
- 2024Dissecting the Interplay of Attention Paths in a Statistical Mechanics Theory of Transformers24 May 2024
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics7 May 2024
- 2024What Can Transformer Learn with Varying Depth? Case Studies on Sequence Learning Tasks2 Apr 2024
- 2024Mechanics of Next Token Prediction with Self-Attention12 Mar 2024
- 2024From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformers21 Feb 2024
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitzness18 Feb 2024
- 2024Towards Understanding Inductive Bias in Transformers: A View From Infinity7 Feb 2024
- 2024Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chains6 Feb 2024
- 2024Provably learning a multi-head attention layer6 Feb 2024
- 2024A phase transition between positional and semantic learning in a solvable model of dot-product attention6 Feb 2024
- 2024Attention Meets Post-hoc Interpretability: A Mathematical Perspective5 Feb 2024
- 2024Towards Understanding the Word Sensitivity of Attention Layers: A Study via Random Features5 Feb 2024
- 2024A Survey to Recent Progress Towards Understanding In-Context Learning3 Feb 2024
- 2023Sequence Length Independent Norm-Based Generalization Bounds for Transformers19 Oct 2023
- 2023Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretraining12 Oct 2023
- 2023Replacing softmax with ReLU in Vision Transformers15 Sep 2023
- 2023Transformers as Support Vector Machines31 Aug 2023
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
- 2025Generalization or Hallucination? Understanding Out-of-Context Reasoning in Transformerscited by 10
- 2026Breaking the Reversal Curse in Autoregressive Language Models via Identity Bridgecited by 2
- 2026Transformers Provably Learn to Internalize Chain-of-Thoughtcited by 1
- 2026Transformers Provably Learn to Internalize Chain-of-Thought27 May 2026
- 2026Breaking the Reversal Curse in Autoregressive Language Models via Identity Bridge2 Feb 2026
- 2025Generalization or Hallucination? Understanding Out-of-Context Reasoning in Transformers12 Jun 2025
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamics7 May 2024
- 2023Transformers as Support Vector Machinescited by 67
- 2023Replacing softmax with ReLU in Vision Transformerscited by 43
- 2024Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chainscited by 39
- 2024From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformerscited by 34
- 2024Mechanics of Next Token Prediction with Self-Attentioncited by 34
- 2024A phase transition between positional and semantic learning in a solvable model of dot-product attentioncited by 30
- 2023Sequence Length Independent Norm-Based Generalization Bounds for Transformerscited by 28
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
- 2024Provably learning a multi-head attention layercited by 21
- 2024What Can Transformer Learn with Varying Depth? Case Studies on Sequence Learning Taskscited by 19
- 2024HSR-Enhanced Sparse Attention Accelerationcited by 19
- 2024Towards Understanding Inductive Bias in Transformers: A View From Infinitycited by 13
12 most cited of 33 All 33 (JSON)
- 2026When Can Attention Heads Be Statically Defined?28 Sep 2026
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adapt14 Jun 2026
- 2026On the global convergence of gradient flow for wide shallow models beyond homogeneous nonlinearities11 May 2026
- 2026Algebraic Invariants of Lightning Self-Attention17 Apr 2026
- 2026ZeroS: Zero-Sum Linear Attention for Efficient Transformers5 Feb 2026
- 2025One-Bit Quantization for Random Features Models17 Oct 2025
- 2025On the Generalization Properties of Learning the Random Feature Models with Learnable Activation Functions17 Oct 2025
- 2025Minimax Rates for Learning Pairwise Interactions in Attention-Style Models13 Oct 2025
- 2025Theoretical Foundations of Representation Learning using Unlabeled Data: Statistics and Optimization23 Sep 2025
- 2025Bayes optimal learning of attention-indexed models2 Jun 2025
- 2025Tensor Sketch: Fast and Scalable Polynomial Kernel Approximation13 May 2025
- 2025When Do Transformers Outperform Feedforward and Recurrent Networks? A Statistical Perspective14 Mar 2025
12 newest of 33 All 33 (JSON)