Trained Transformer Classifiers Generalize and Exhibit Benign Overfitting In-Context
Not on the map. Why?
Abstract (arXiv)
Transformers have the capacity to act as supervised learning algorithms: by properly encoding a set of labeled training ("in-context") examples and an unlabeled test example into an input sequence of vectors of the same dimension, the forward pass of the transformer can produce predictions for that unlabeled test example. A line of recent work has shown that when linear transformers are pre-trained on random instances for linear regression tasks, these trained transformers make predictions using an algorithm similar to that of ordinary least squares. In this work, we investigate the behavior of linear transformers trained on random linear classification tasks. Via an analysis of the implicit regularization of gradient descent, we characterize how many pre-training tasks and in-context examples are needed for the trained transformer to generalize well at test-time. We further show that in some settings, these trained transformers can exhibit "benign overfitting in-context": when in-context examples are corrupted by label flipping noise, the transformer memorizes all of its in-context examples (including those with noisy labels) yet still generalizes near-optimally for clean test examples.
Key facts. Cited by 14 papers in the map (data through 7 Oct 2026). Builds on 30 of its 34 references that are in the map. First posted on arXiv 2 Oct 2024.
Builds on
30 of 34 references.
References · 30
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2016Understanding deep learning requires rethinking generalizationcited by 1,657
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
- 2017The Implicit Bias of Gradient Descent on Separable Datacited by 649
- 2019Benign Overfitting in Linear Regressioncited by 544
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2019Gradient Descent Maximizes the Margin of Homogeneous Neural Networkscited by 308
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
18 more
- 2021Deep learning: a statistical viewpointcited by 239
- 2020Directional convergence and alignment in deep learningcited by 172
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
- 2021Fit without fear: remarkable mathematical phenomena of deep learning through the prism of interpolationcited by 130
- 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 115
- 2018Does data interpolation contradict statistical optimality?cited by 95
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2022On the Implicit Bias in Deep-Learning Algorithmscited by 84
- 2020Finite-sample Analysis of Interpolating Linear Classifiers in the Overparameterized Regimecited by 81
- 2022Benign Overfitting without Linearity: Neural Network Classifiers Trained by Gradient Descent for Noisy Linear Datacited by 74
- 2023Max-Margin Token Selection in Attention Mechanismcited by 57
- 2022Implicit Bias in Leaky ReLU Networks Trained on High-Dimensional Datacited by 46
- 2024Transformers are Minimax Optimal Nonparametric In-Context Learnerscited by 36
- 2024Implicit Bias and Fast Convergence Rates for Self-attentioncited by 31
- 2023Benign Overfitting in Linear Classifiers and Leaky ReLU Networks from KKT Conditions for Margin Maximizationcited by 29
- 2023The Double-Edged Sword of Implicit Bias: Generalization vs. Robustness in ReLU Networkscited by 23
- 2022On the Effective Number of Linear Regions in Shallow Univariate ReLU Networks: Convergence Guarantees and Implicit Biascited by 21
- 2024Implicit Optimization Bias of Next-Token Prediction in Linear Modelscited by 14
Built on by
Citing papers per year: 2024: 2; 2025: 8; 2026: 4.
14 papers.
Sort:
By area:
- 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 44
- 2024The broader spectrum of in-context learningcited by 33
- 2024On the Training Convergence of Transformers for In-Context Classification of Gaussian Mixturescited by 15
- 2025Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical Evidencecited by 13
- 2025On the Robustness of Transformers against Context Hijacking for Linear Classificationcited by 4
- 2025Understanding Generalization in Transformers: Error Bounds and Training Dynamics Under Benign and Harmful Overfittingcited by 2
- 2025Adversarially Pretrained Transformers May Be Universally Robust In-Context Learnerscited by 2
- 2025Stability of In-Context Learning: A Spectral Coverage Perspectivecited by 2
- 2025Learning Linear Regression with Low-Rank Tasks in-Contextcited by 1
- 2025Transformers are almost optimal metalearners for linear classificationcited by 1
- 2026Understanding and Improving Continuous Adversarial Training for LLMs via In-context Learning Theorycited by 1
- 2026Data Distribution as a Lever for Guiding Optimizers Toward Superior Generalization in LLMscited by 0
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026When Does ℓ2-Boosting Overfit Benignly? High-Dimensional Risk Asymptotics and the ℓ1 Implicit Bias7 May 2026
- 2026Understanding and Improving Continuous Adversarial Training for LLMs via In-context Learning Theory14 Apr 2026
- 2026Data Distribution as a Lever for Guiding Optimizers Toward Superior Generalization in LLMs31 Jan 2026
- 2025Transformers are almost optimal metalearners for linear classification22 Oct 2025
- 2025Learning Linear Regression with Low-Rank Tasks in-Context6 Oct 2025
- 2025Stability of In-Context Learning: A Spectral Coverage Perspective25 Sep 2025
- 2025Adversarially Pretrained Transformers May Be Universally Robust In-Context Learners20 May 2025
- 2025On the Robustness of Transformers against Context Hijacking for Linear Classification21 Feb 2025
- 2025Understanding Generalization in Transformers: Error Bounds and Training Dynamics Under Benign and Harmful Overfitting18 Feb 2025
- 2025Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical Evidence6 Feb 2025
- 2025Training Dynamics of In-Context Learning in Linear Attention27 Jan 2025
2 more
- 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 44
- 2024The broader spectrum of in-context learningcited by 33
- 2024On the Training Convergence of Transformers for In-Context Classification of Gaussian Mixturescited by 15
- 2025On the Robustness of Transformers against Context Hijacking for Linear Classificationcited by 4
- 2025Understanding Generalization in Transformers: Error Bounds and Training Dynamics Under Benign and Harmful Overfittingcited by 2
- 2025Adversarially Pretrained Transformers May Be Universally Robust In-Context Learnerscited by 2
- 2025Stability of In-Context Learning: A Spectral Coverage Perspectivecited by 2
- 2025Learning Linear Regression with Low-Rank Tasks in-Contextcited by 1
- 2025Transformers are almost optimal metalearners for linear classificationcited by 1
- 2026Data Distribution as a Lever for Guiding Optimizers Toward Superior Generalization in LLMscited by 0
- 2026When Does ℓ2-Boosting Overfit Benignly? High-Dimensional Risk Asymptotics and the ℓ1 Implicit Biascited by 0
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learningcited by 0
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026When Does ℓ2-Boosting Overfit Benignly? High-Dimensional Risk Asymptotics and the ℓ1 Implicit Bias7 May 2026
- 2026Data Distribution as a Lever for Guiding Optimizers Toward Superior Generalization in LLMs31 Jan 2026
- 2025Transformers are almost optimal metalearners for linear classification22 Oct 2025
- 2025Learning Linear Regression with Low-Rank Tasks in-Context6 Oct 2025
- 2025Stability of In-Context Learning: A Spectral Coverage Perspective25 Sep 2025
- 2025Adversarially Pretrained Transformers May Be Universally Robust In-Context Learners20 May 2025
- 2025On the Robustness of Transformers against Context Hijacking for Linear Classification21 Feb 2025
- 2025Understanding Generalization in Transformers: Error Bounds and Training Dynamics Under Benign and Harmful Overfitting18 Feb 2025
- 2025Training Dynamics of In-Context Learning in Linear Attention27 Jan 2025
- 2024The broader spectrum of in-context learning5 Dec 2024
- 2024On the Training Convergence of Transformers for In-Context Classification of Gaussian Mixtures15 Oct 2024