Trained Transformers Learn Linear Models In-Context
Not on the map. Why?
Cited by 23 in LLM reasoning, but placed by its own abstract, which didn’t fit.
Abstract (arXiv)
Attention-based neural networks such as transformers have demonstrated a remarkable ability to exhibit in-context learning (ICL): Given a short prompt sequence of tokens from an unseen task, they can formulate relevant per-token and next-token predictions without any parameter updates. By embedding a sequence of labeled training data and unlabeled test data as a prompt, this allows for transformers to behave like supervised learning algorithms. Indeed, recent work has shown that when training transformer architectures over random instances of linear regression problems, these models' predictions mimic those of ordinary least squares. Towards understanding the mechanisms underlying this phenomenon, we investigate the dynamics of ICL in transformers with a single linear self-attention layer trained by gradient flow on linear regression tasks. We show that despite non-convexity, gradient flow with a suitable random initialization finds a global minimum of the objective function. At this global minimum, when given a test prompt of labeled examples from a new prediction task, the transformer achieves prediction error competitive with the best linear predictor over the test prompt distribution. We additionally characterize the robustness of the trained transformer to a variety of distribution shifts and show that although a number of shifts are tolerated, shifts in the covariate distribution of the prompts are not. Motivated by this, we consider a generalized ICL setting where the covariate distributions can vary across prompts. We show that although gradient flow succeeds at finding a global minimum in this setting, the trained transformer is still brittle under mild covariate shifts. We complement this finding with experiments on large, nonlinear transformer architectures which we show are more robust under covariate shifts.
Key facts. Cited by 331 papers in the map (data through 7 Oct 2026). Builds on 39 of its 52 references that are in the map. First posted on arXiv 16 Jun 2023.
Builds on
39 of 52 references.
References · 39
- 2017Attention Is All You Needcited by 59,932
- 2014Adam: A Method for Stochastic Optimizationcited by 36,960
- 2020An Image is Worth 16x16 Words: Transformers for Image Recognition at Scalecited by 29,915
- 2023GPT-4 Technical Reportcited by 18,132
- 2019Transformer-XL: Attentive Language Models Beyond a Fixed-Length Contextcited by 1,830
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
- 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
- 2018Universal Transformerscited by 613
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
27 more
- 2019Implicit Regularization in Deep Matrix Factorizationcited by 402
- 2017Implicit Regularization in Matrix Factorizationcited by 318
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2018On the Optimization of Deep Networks: Implicit Acceleration by Overparameterizationcited by 280
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
- 2022Transformers Learn Shortcuts to Automatacited by 260
- 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 220
- 2022Exploring Length Generalization in Large Language Modelscited by 204
- 2018Algorithmic Regularization in Learning Deep Homogeneous Models: Layers are Automatically Balancedcited by 172
- 2018Nonconvex Optimization Meets Low-Rank Matrix Factorization: An Overviewcited by 159
- 2020Towards Resolving the Implicit Bias of Gradient Descent for Matrix Factorization: Greedy Low-Rank Learningcited by 148
- 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
- 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
- 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 112
- 2022Vision Transformers provably learn spatial structurecited by 92
- 2020On the Computational Power of Transformers and its Implications in Sequence Modelingcited by 85
- 2023How Do Transformers Learn Topic Structure: Towards a Mechanistic Understandingcited by 85
- 2020O(n) Connections are Expressive Enough: Universal Approximability of Sparse Transformerscited by 82
- 2023In-Context Learning through the Bayesian Prismcited by 78
- 2021On the Implicit Bias of Initialization Shape: Beyond Infinitesimal Mirror Descentcited by 69
- 2023Mimetic Initialization of Self-Attention Layerscited by 52
- 2021On the Expressive Power of Self-Attention Matricescited by 44
- 2023The Closeness of In-Context Learning and Weight Shifting for Softmax Regressioncited by 41
- 2023Understanding Incremental Learning of Gradient Descent: A Fine-grained Analysis of Matrix Sensingcited by 40
- 2023A Closer Look at In-Context Learning under Distribution Shiftscited by 25
- 2023A Mechanism for Sample-Efficient In-Context Learning for Sparse Retrieval Taskscited by 17
- 2020On implicit regularization: Morse functions and applications to matrix factorizationcited by 11
Built on by
Citing papers per year: 2023: 35; 2024: 112; 2025: 107; 2026: 77.
331 papers.
Sort:
By area:
- 2023In-Context Unlearning: Language Models as Few Shot Unlearnerscited by 214
- 2024Many-Shot In-Context Learningcited by 203
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 135
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 114
- 2023In-Context Convergence of Transformerscited by 112
- 2023Are Emergent Abilities in Large Language Models just In-Context Learning?cited by 109
- 2023Linear attention is (maybe) all you need (to understand transformer optimization)cited by 97
- 2023Uncovering mesa-optimization algorithms in Transformerscited by 94
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2023Transformers as Decision Makers: Provable In-Context Reinforcement Learning via Supervised Pretrainingcited by 82
- 2024Can large language models explore in-context?cited by 75
38 more
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 72
- 2023Transformers as Support Vector Machinescited by 67
- 2023Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Contextcited by 63
- 2024Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning?cited by 60
- 2024Asymptotic theory of in-context learning by linear attentioncited by 54
- 2024Active-Dormant Attention Heads: Mechanistically Demystifying Extreme-Token Phenomena in LLMscited by 54
- 2023JoMA: Demystifying Multilayer Transformers via JOint Dynamics of MLP and Attentioncited by 52
- 2024Transformers Provably Solve Parity Efficiently with Chain of Thoughtcited by 49
- 2023Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear Regressioncited by 47
- 2024Why Larger Language Models Do In-context Learning Differently?cited by 44
- 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 44
- 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 43
- 2024A Theoretical Understanding of Self-Correction through In-context Alignmentcited by 43
- 2024Dual Operating Modes of In-Context Learningcited by 42
- 2024Transformers are Universal In-context Learnerscited by 42
- 2025Learning without training: The implicit dynamics of in-context learningcited by 41
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 39
- 2024Do Large Language Models Have Compositional Ability? An Investigation into Limitations and Scalabilitycited by 39
- 2025On the generalization of language models from in-context learning and finetuning: a controlled studycited by 39
- 2025When is Task Vector Provably Effective for Model Editing? A Generalization Analysis of Nonlinear Transformerscited by 38
- 2023On the Optimization and Generalization of Multi-head Attentioncited by 37
- 2023Which Examples to Annotate for In-Context Learning? Towards Effective and Efficient Selectioncited by 36
- 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 36
- 2024Transformers are Minimax Optimal Nonparametric In-Context Learnerscited by 36
- 2025Bayesian Teaching Enables Probabilistic Reasoning in Large Language Modelscited by 36
- 2024How Do Nonlinear Transformers Learn and Generalize in In-Context Learning?cited by 35
- 2023How are Prompts Different in Terms of Sensitivity?cited by 34
- 2024Do LLM Agents Have Regret? A Case Study in Online Learning and Gamescited by 33
- 2024The broader spectrum of in-context learningcited by 33
- 2023In-Context Learning for Attention Scheme: from Single Softmax Regression to Multiple Softmax Regression via a Tensor Trickcited by 32
- 2024Conv-Basis: A New Paradigm for Efficient Attention Inference and Gradient Computation in Transformerscited by 32
- 2025Transformers Learn to Implement Multi-step Gradient Descent with Chain of Thoughtcited by 32
- 2024Implicit Bias and Fast Convergence Rates for Self-attentioncited by 31
- 2024A phase transition between positional and semantic learning in a solvable model of dot-product attentioncited by 30
- 2024In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initializationcited by 30
- 2024Training Tensor Attention Efficiently: From Cubic to Almost Linear Timecited by 29
- 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 29
- 2024Linear Transformers are Versatile In-Context Learnerscited by 28
50 most cited of 331 All 331 (JSON)
- 2026Leaner Transformers Can Easily Learn to Cluster7 Oct 2026
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026From Weak Data to Strong Policy: Q-Targets Enable Provable In-Context Reinforcement Learning24 Sep 2026
- 2026On the Importance of Gating: Memorization vs. In-Context Learning in State Space Models15 Sep 2026
- 2026Retrieval-Guided Fine-Tuning as Noisy Estimation: Risk bounds and Architectural Analysis13 Sep 2026
- 2026Data Efficient Sample Selection for In-Context Learning6 Sep 2026
- 2026Training-Free Universal Approximation by Prompting Random Transformers10 Aug 2026
- 2026Versatile On-device Adaptation at the Edge by Unifying Few-shot, Zero-shot, Continual, and In-context Learning31 Jul 2026
- 2026Training with (Swap) Regret Loss in a Single-Layer Self-Attention Model: A Case Study on the Probability Simplex25 Jul 2026
- 2026In-context learning of closed form solution to simple linear regression task using transformer with linear self-attention17 Jul 2026
- 2026Data-Efficient Adaptation of LLMs via Attention Head Reweighting15 Jul 2026
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Models5 Jul 2026
38 more
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatch4 Jul 2026
- 2026Induction Heads Interpolate N-Grams2 Jul 2026
- 2026When Does Depth Matter For In-Context Learning? Adaptive Inference in Deep Transformers15 Jun 2026
- 2026The Effect of Training Task Diversity on In-Context Learning through the Lens of Low-Dimensional Subspaces5 Jun 2026
- 2026Reachability and asymptotics of Gaussian Transformer dynamics29 May 2026
- 2026Algorithmic Recourse of In-Context Learning for Tabular Data29 May 2026
- 2026In-Context Reward Adaptation for Robust Preference Modeling28 May 2026
- 2026Parallax: Parameterized Local Linear Attention for Language Modeling27 May 2026
- 2026Understanding Generalization and Forgetting in In-Context Continual Learning27 May 2026
- 2026Transformers Provably Learn to Internalize Chain-of-Thought27 May 2026
- 2026Fine-Tuning Dynamics of In-Context Factual Recall in Transformers26 May 2026
- 2026Transformers Can Learn Posterior Predictive Distributions In-Context26 May 2026
- 2026The Stability of Singular Distribution: A Spectral Perspective on the Two-Phase Dynamics of Language Model Pre-training26 May 2026
- 2026Unbiased Gradients, Moving Stability Boundaries: Exact Mini-Batch Geometry in Linear Self-Attention20 May 2026
- 2026Self-Attention as a Covariance Readout: A Unified View of In-Context Learning and Repetition11 May 2026
- 2026FERA: Uncertainty-Aware Federated Reasoning for Large Language Models11 May 2026
- 2026Large Language Models for Sequential Decision-Making: Improving In-Context Learning via Supervised Fine-Tuning9 May 2026
- 2026Transformers Can Implement Preconditioned Richardson Iteration for In-Context Gaussian Kernel Regression8 May 2026
- 2026Transformers Provably Implement In-Context Reinforcement Learning with Policy Improvement7 May 2026
- 2026Understanding In-Context Learning for Nonlinear Regression with Transformers: Attention as Featurizer6 May 2026
- 2026Ordinary Least Squares is a Special Case of Transformer15 Apr 2026
- 2026Why Multimodal In-Context Learning Lags Behind? Unveiling the Inner Mechanisms and Bottlenecks15 Apr 2026
- 2026Understanding and Improving Continuous Adversarial Training for LLMs via In-context Learning Theory14 Apr 2026
- 2026Distinct mechanisms underlying in-context learning in transformers14 Apr 2026
- 2026How Transformers Learn to Plan via Multi-Token Prediction13 Apr 2026
- 2026Symmetry Reveals Layerwise Dynamics: How Transformers Perform In-Context Classification13 Apr 2026
- 2026Learning to Adapt: In-Context Learning Beyond Stationarity13 Apr 2026
- 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descent12 Apr 2026
- 2026Transformers Learn the Optimal DDPM Denoiser for Multi-Token GMMs11 Apr 2026
- 2026Visual prompting reimagined: The power of the Activation Prompts7 Apr 2026
- 2026Contrast Matters: Understanding Robustness of In-Context Fine-Tuning to Target-Context Relatedness2 Apr 2026
- 2026Transformers in the Dark: Navigating Unknown Search Spaces via Bandit Feedback25 Mar 2026
- 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledge21 Mar 2026
- 2026Demonstrations, CoT, and Prompting: A Theoretical Analysis of ICL20 Mar 2026
- 2026Transformers Learn Robust In-Context Regression under Distributional Uncertainty19 Mar 2026
- 2026Transformers Can Learn Rules They've Never Seen: Proof of Computation Beyond Interpolation17 Mar 2026
- 2026Reconciling In-Context and In-Weight Learning via Dual Representation Space Encoding13 Mar 2026
- 2026Modality-free Graph In-context Alignment13 Mar 2026
50 newest of 331 All 331 (JSON)
- 2024Transformers Provably Solve Parity Efficiently with Chain of Thoughtcited by 49
- 2024A Theoretical Understanding of Self-Correction through In-context Alignmentcited by 43
- 2025On the generalization of language models from in-context learning and finetuning: a controlled studycited by 39
- 2025Bayesian Teaching Enables Probabilistic Reasoning in Large Language Modelscited by 36
- 2025Transformers Learn to Implement Multi-step Gradient Descent with Chain of Thoughtcited by 32
- 2024Towards a Theoretical Understanding of the 'Reversal Curse' via Training Dynamicscited by 27
- 2025How Do LLMs Perform Two-Hop Reasoning in Context?cited by 20
- 2024Training Nonlinear Transformers for Chain-of-Thought Inference: A Theoretical Generalization Analysiscited by 14
- 2024A Theoretical Understanding of Chain-of-Thought: Coherent Reasoning and Error-Aware Demonstrationcited by 13
- 2025Generalization or Hallucination? Understanding Out-of-Context Reasoning in Transformerscited by 10
- 2026Outcome-Based RL Provably Leads Transformers to Reason, but Only With the Right Datacited by 5
- 2025Understanding the Role of Training Data in Test-Time Scalingcited by 4
12 most cited of 23 All 23 (JSON)
- 2026Transformers Provably Learn to Internalize Chain-of-Thought27 May 2026
- 2026FERA: Uncertainty-Aware Federated Reasoning for Large Language Models11 May 2026
- 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledge21 Mar 2026
- 2026Feature Resemblance: Towards a Theoretical Understanding of Analogical Reasoning in Transformers5 Mar 2026
- 2026Provable and Practical In-Context Policy Optimization for Self-Improvement2 Mar 2026
- 2026Breaking the Reversal Curse in Autoregressive Language Models via Identity Bridge2 Feb 2026
- 2026Outcome-Based RL Provably Leads Transformers to Reason, but Only With the Right Data21 Jan 2026
- 2025Transformers with RL or SFT Provably Learn Sparse Boolean Functions, But Differently22 Nov 2025
- 2025Provable Benefit of Curriculum in Transformer Tree-Reasoning Post-Training10 Nov 2025
- 2025Understanding the Role of Training Data in Test-Time Scaling4 Oct 2025
- 2025Bounds of Chain-of-Thought Robustness: Reasoning Steps, Embed Norms, and Beyond25 Sep 2025
- 2025Generalization or Hallucination? Understanding Out-of-Context Reasoning in Transformers12 Jun 2025
12 newest of 23 All 23 (JSON)
- 2023In-Context Unlearning: Language Models as Few Shot Unlearnerscited by 214
- 2025When is Task Vector Provably Effective for Model Editing? A Generalization Analysis of Nonlinear Transformerscited by 38
- 2025Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical Evidencecited by 13
- 2026Understanding and Improving Continuous Adversarial Training for LLMs via In-context Learning Theorycited by 1
- 2026Understanding and Improving Continuous Adversarial Training for LLMs via In-context Learning Theory14 Apr 2026
- 2025When is Task Vector Provably Effective for Model Editing? A Generalization Analysis of Nonlinear Transformers15 Apr 2025
- 2025Short-length Adversarial Training Helps LLMs Defend Long-length Jailbreak Attacks: Theoretical and Empirical Evidence6 Feb 2025
- 2023In-Context Unlearning: Language Models as Few Shot Unlearners11 Oct 2023
- 2026In-Context Reward Adaptation for Robust Preference Modeling28 May 2026
- 2024Can MLLMs Perform Text-to-Image In-Context Learning?cited by 13
- 2024Can MLLMs Perform Text-to-Image In-Context Learning?2 Feb 2024
- 2024Many-Shot In-Context Learningcited by 203
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 135
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 114
- 2023In-Context Convergence of Transformerscited by 112
- 2023Are Emergent Abilities in Large Language Models just In-Context Learning?cited by 109
- 2023Linear attention is (maybe) all you need (to understand transformer optimization)cited by 97
- 2023Uncovering mesa-optimization algorithms in Transformerscited by 94
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2024Can large language models explore in-context?cited by 75
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 72
- 2023Transformers as Support Vector Machinescited by 67
12 most cited of 284 All 284 (JSON)
- 2026Leaner Transformers Can Easily Learn to Cluster7 Oct 2026
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026From Weak Data to Strong Policy: Q-Targets Enable Provable In-Context Reinforcement Learning24 Sep 2026
- 2026On the Importance of Gating: Memorization vs. In-Context Learning in State Space Models15 Sep 2026
- 2026Retrieval-Guided Fine-Tuning as Noisy Estimation: Risk bounds and Architectural Analysis13 Sep 2026
- 2026Data Efficient Sample Selection for In-Context Learning6 Sep 2026
- 2026Training-Free Universal Approximation by Prompting Random Transformers10 Aug 2026
- 2026Versatile On-device Adaptation at the Edge by Unifying Few-shot, Zero-shot, Continual, and In-context Learning31 Jul 2026
- 2026Training with (Swap) Regret Loss in a Single-Layer Self-Attention Model: A Case Study on the Probability Simplex25 Jul 2026
- 2026In-context learning of closed form solution to simple linear regression task using transformer with linear self-attention17 Jul 2026
- 2026Data-Efficient Adaptation of LLMs via Attention Head Reweighting15 Jul 2026
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Models5 Jul 2026
12 newest of 284 All 284 (JSON)