Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear Regression
On the map: Offline RL and imitation learning from data → Robot learning from demonstration
Abstract (arXiv)
Transformers excel at in-context learning (ICL) -- learning from demonstrations without parameter updates -- but how they do so remains a mystery. Recent work suggests that Transformers may internally run Gradient Descent (GD), a first-order optimization method, to perform ICL. In this paper, we instead demonstrate that Transformers learn to approximate second-order optimization methods for ICL. For in-context linear regression, Transformers share a similar convergence rate as Iterative Newton's Method, both exponentially faster than GD. Empirically, predictions from successive Transformer layers closely match different iterations of Newton's Method linearly, with each middle layer roughly computing 3 iterations; thus, Transformers and Newton's method converge at roughly the same rate. In contrast, Gradient Descent converges exponentially more slowly. We also show that Transformers can learn in-context on ill-conditioned data, a setting where Gradient Descent struggles but Iterative Newton succeeds. Finally, to corroborate our empirical findings, we prove that Transformers can implement k iterations of Newton's method with k + O(1) layers.
Key facts. Cited by 49 papers in the map (data through 14 Oct 2026). Placed in Robot learning from demonstration, one of 13 directions in Offline RL and imitation learning from data. Builds on 43 of its 62 references that are in the map. First posted on arXiv 26 Oct 2023.
Builds on
43 of 62 references.
References · 43
- 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
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,326
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
- 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,392
- 2021Scaling Language Models: Methods, Analysis & Insights from Training Gophercited by 1,202
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,195
- 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,135
- 2023Progress measures for grokking via mechanistic interpretabilitycited by 839
31 more
- 2022Transformers learn in-context by gradient descentcited by 732
- 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 724
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
- 2021Learning To Retrieve Prompts for In-Context Learningcited by 648
- 2022Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasetscited by 629
- 2022Using DeepSpeed and Megatron to Train Megatron-Turing NLG 530B, A Large-Scale Generative Language Modelcited by 559
- 2022Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Spacecited by 532
- 2021MetaICL: Learning to Learn In Contextcited by 454
- 2023Larger language models do in-context learning differentlycited by 394
- 2023DoLa: Decoding by Contrasting Layers Improves Factuality in Large Language Modelscited by 376
- 2023Trained Transformers Learn Linear Models In-Contextcited by 337
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
- 2022Selective Annotation Makes Language Models Better Few-Shot Learnerscited by 243
- 2023Looped Transformers as Programmable Computerscited by 237
- 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 222
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
- 2021Noisy Channel Language Model Prompting for Few-Shot Text Classificationcited by 165
- 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 146
- 2022Ground-Truth Labels Matter: A Deeper Look into Input-Label Demonstrationscited by 116
- 2023Uncovering mesa-optimization algorithms in Transformerscited by 100
- 2023Transformers as Support Vector Machinescited by 74
- 2023In-context Example Selection with Influencescited by 61
- 2022Data Curation Alone Can Stabilize In-context Learningcited by 59
- 2023Max-Margin Token Selection in Attention Mechanismcited by 58
- 2023A Study on ReLU and Softmax in Transformercited by 53
- 2023Replacing softmax with ReLU in Vision Transformerscited by 44
- 2019Memory-Sample Tradeoffs for Linear Regression with Small Errorcited by 22
- 2022How Much Does Attention Actually Attend? Questioning the Importance of Attention in Pretrained Transformerscited by 21
- 2023Is attention required for ICL? Exploring the Relationship Between Model Architecture and In-Context Learning Abilitycited by 17
Built on by
Citing papers per year: 2023: 2; 2024: 12; 2025: 19; 2026: 16.
49 papers.
Sort:
By area:
- 2024Mechanistic Interpretability for AI Safety -- A Reviewcited by 422
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 149
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
- 2024Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning?cited by 65
- 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 46
- 2024IsoBench: Benchmarking Multimodal Foundation Models on Isomorphic Representationscited by 38
- 2023The Mystery of In-Context Learning: A Comprehensive Survey on Interpretation and Analysiscited by 34
- 2025Transformers Learn to Implement Multi-step Gradient Descent with Chain of Thoughtcited by 32
- 2024In-Context Symbolic Regression: Leveraging Large Language Models for Function Discoverycited by 31
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methodscited by 29
- 2024How Well Can Transformers Emulate In-context Newton's Method?cited by 25
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
37 more
- 2024Superiority of Multi-Head Attention in In-Context Linear Regressioncited by 17
- 2025When can in-context learning generalize out of task distribution?cited by 16
- 2024On the Role of Depth and Looping for In-Context Learning with Task Diversitycited by 11
- 2025Solving Empirical Bayes via Transformerscited by 11
- 2024Optimizing Attention with Mirror Descent: Generalized Max-Margin Token Selectioncited by 9
- 2025Transformers Meet In-Context Learning: A Universal Approximation Theorycited by 6
- 2025On the Convergence of Gradient Descent on Learning Transformers with Residual Connectionscited by 6
- 2026TabFM: A Zero-Shot Foundation Model for Tabular Datacited by 6
- 2025In-Context Occam's Razor: How Transformers Prefer Simpler Hypotheses on the Flycited by 5
- 2025Large Language Model Sourcing: A Surveycited by 5
- 2025Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Headscited by 4
- 2024Learning in the Recurrent State: Gradient Descent with Linear Recurrent Networkscited by 3
- 2025Adversarially Pretrained Transformers May Be Universally Robust In-Context Learnerscited by 3
- 2025The Initialization Determines Whether In-Context Learning Is Gradient Descentcited by 3
- 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledgecited by 3
- 2025Deciphering Trajectory-Aided LLM Reasoning: An Optimization Perspectivecited by 2
- 2026Learning to Adapt: In-Context Learning Beyond Stationaritycited by 2
- 2025Brewing Knowledge in Context: Distillation Perspectives on In-Context Learningcited by 1
- 2025On the Existence of Universal Simulators of Attentioncited by 1
- 2025Multi-Layer Attention is the Amplifier of Demonstration Effectivenesscited by 1
- 2025Linear Transformers Implicitly Discover Unified Numerical Algorithmscited by 1
- 2025How Data Mixing Shapes In-Context Learning: Asymptotic Equivalence for Transformers with MLPscited by 1
- 2025Optimal Attention Temperature Improves the Robustness of In-Context Learning under Distribution Shift in High Dimensionscited by 1
- 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descentcited by 1
- 2026Transformers Can Implement Preconditioned Richardson Iteration for In-Context Gaussian Kernel Regressioncited by 1
- 2026Transformers Can Learn Posterior Predictive Distributions In-Contextcited by 1
- 2026Induction Heads Interpolate N-Gramscited by 1
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatchcited by 1
- 2025In-Context Learning with Hypothesis-Class Guidancecited by 0
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classificationcited by 0
- 2026Data Distribution as a Lever for Guiding Optimizers Toward Superior Generalization in LLMscited by 0
- 2026Demonstrations, CoT, and Prompting: A Theoretical Analysis of ICLcited by 0
- 2026In-Context Reward Adaptation for Robust Preference Modelingcited by 0
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Modelscited by 0
- 2026TabFM-Auto: Self-Evolving Pipelines for Tabular Foundation Modelscited by 0
- 2026Generalization of Transformer-Based Neural Quantum States via In-Context Learningcited by 0
- 2026PDE-PFN: Prior-Data Fitted Neural PDE Solvercited by 0
- 2026PDE-PFN: Prior-Data Fitted Neural PDE Solver9 Oct 2026
- 2026Generalization of Transformer-Based Neural Quantum States via In-Context Learning2 Oct 2026
- 2026TabFM-Auto: Self-Evolving Pipelines for Tabular Foundation Models29 Sep 2026
- 2026TabFM: A Zero-Shot Foundation Model for Tabular Data29 Sep 2026
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Models5 Jul 2026
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatch4 Jul 2026
- 2026Induction Heads Interpolate N-Grams2 Jul 2026
- 2026In-Context Reward Adaptation for Robust Preference Modeling28 May 2026
- 2026Transformers Can Learn Posterior Predictive Distributions In-Context26 May 2026
- 2026Transformers Can Implement Preconditioned Richardson Iteration for In-Context Gaussian Kernel Regression8 May 2026
- 2026Learning to Adapt: In-Context Learning Beyond Stationarity13 Apr 2026
- 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descent12 Apr 2026
37 more
- 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
- 2026Data Distribution as a Lever for Guiding Optimizers Toward Superior Generalization in LLMs31 Jan 2026
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classification3 Jan 2026
- 2025The Initialization Determines Whether In-Context Learning Is Gradient Descent3 Dec 2025
- 2025Optimal Attention Temperature Improves the Robustness of In-Context Learning under Distribution Shift in High Dimensions3 Nov 2025
- 2025How Data Mixing Shapes In-Context Learning: Asymptotic Equivalence for Transformers with MLPs29 Oct 2025
- 2025Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Heads19 Oct 2025
- 2025Large Language Model Sourcing: A Survey11 Oct 2025
- 2025Linear Transformers Implicitly Discover Unified Numerical Algorithms24 Sep 2025
- 2025Multi-Layer Attention is the Amplifier of Demonstration Effectiveness1 Aug 2025
- 2025In-Context Occam's Razor: How Transformers Prefer Simpler Hypotheses on the Fly24 Jun 2025
- 2025On the Existence of Universal Simulators of Attention23 Jun 2025
- 2025Brewing Knowledge in Context: Distillation Perspectives on In-Context Learning13 Jun 2025
- 2025When can in-context learning generalize out of task distribution?5 Jun 2025
- 2025On the Convergence of Gradient Descent on Learning Transformers with Residual Connections5 Jun 2025
- 2025Transformers Meet In-Context Learning: A Universal Approximation Theory5 Jun 2025
- 2025Deciphering Trajectory-Aided LLM Reasoning: An Optimization Perspective26 May 2025
- 2025Adversarially Pretrained Transformers May Be Universally Robust In-Context Learners20 May 2025
- 2025Transformers Learn to Implement Multi-step Gradient Descent with Chain of Thought28 Feb 2025
- 2025In-Context Learning with Hypothesis-Class Guidance27 Feb 2025
- 2025Solving Empirical Bayes via Transformers14 Feb 2025
- 2025Training Dynamics of In-Context Learning in Linear Attention27 Jan 2025
- 2024On the Role of Depth and Looping for In-Context Learning with Task Diversity29 Oct 2024
- 2024Optimizing Attention with Mirror Descent: Generalized Max-Margin Token Selection18 Oct 2024
- 2024Learning in the Recurrent State: Gradient Descent with Linear Recurrent Networks15 Oct 2024
- 2024Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning?10 Oct 2024
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methods25 Aug 2024
- 2024In-Context Symbolic Regression: Leveraging Large Language Models for Function Discovery29 Apr 2024
- 2024Mechanistic Interpretability for AI Safety -- A Review22 Apr 2024
- 2024IsoBench: Benchmarking Multimodal Foundation Models on Isomorphic Representations1 Apr 2024
- 2024How Well Can Transformers Emulate In-context Newton's Method?5 Mar 2024
- 2024How Transformers Learn Causal Structure with Gradient Descent22 Feb 2024
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitzness18 Feb 2024
- 2024Superiority of Multi-Head Attention in In-Context Linear Regression30 Jan 2024
- 2023Looped Transformers are Better at Learning Learning Algorithms21 Nov 2023
- 2023The Mystery of In-Context Learning: A Comprehensive Survey on Interpretation and Analysis1 Nov 2023
- 2025Transformers Learn to Implement Multi-step Gradient Descent with Chain of Thoughtcited by 32
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methodscited by 29
- 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledgecited by 3
- 2025Deciphering Trajectory-Aided LLM Reasoning: An Optimization Perspectivecited by 2
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classificationcited by 0
- 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledge21 Mar 2026
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classification3 Jan 2026
- 2025Deciphering Trajectory-Aided LLM Reasoning: An Optimization Perspective26 May 2025
- 2025Transformers Learn to Implement Multi-step Gradient Descent with Chain of Thought28 Feb 2025
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methods25 Aug 2024
- 2026In-Context Reward Adaptation for Robust Preference Modeling28 May 2026
- 2024Mechanistic Interpretability for AI Safety -- A Reviewcited by 422
- 2024Mechanistic Interpretability for AI Safety -- A Review22 Apr 2024
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 149
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
- 2024Can Looped Transformers Learn to Implement Multi-step Gradient Descent for In-context Learning?cited by 65
- 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 46
- 2024IsoBench: Benchmarking Multimodal Foundation Models on Isomorphic Representationscited by 38
- 2023The Mystery of In-Context Learning: A Comprehensive Survey on Interpretation and Analysiscited by 34
- 2024In-Context Symbolic Regression: Leveraging Large Language Models for Function Discoverycited by 31
- 2024How Well Can Transformers Emulate In-context Newton's Method?cited by 25
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
- 2024Superiority of Multi-Head Attention in In-Context Linear Regressioncited by 17
- 2025When can in-context learning generalize out of task distribution?cited by 16
- 2024On the Role of Depth and Looping for In-Context Learning with Task Diversitycited by 11
12 most cited of 40 All 40 (JSON)
- 2026PDE-PFN: Prior-Data Fitted Neural PDE Solver9 Oct 2026
- 2026Generalization of Transformer-Based Neural Quantum States via In-Context Learning2 Oct 2026
- 2026TabFM: A Zero-Shot Foundation Model for Tabular Data29 Sep 2026
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Models5 Jul 2026
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatch4 Jul 2026
- 2026Induction Heads Interpolate N-Grams2 Jul 2026
- 2026Transformers Can Learn Posterior Predictive Distributions In-Context26 May 2026
- 2026Transformers Can Implement Preconditioned Richardson Iteration for In-Context Gaussian Kernel Regression8 May 2026
- 2026Learning to Adapt: In-Context Learning Beyond Stationarity13 Apr 2026
- 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descent12 Apr 2026
- 2026Demonstrations, CoT, and Prompting: A Theoretical Analysis of ICL20 Mar 2026
- 2026Data Distribution as a Lever for Guiding Optimizers Toward Superior Generalization in LLMs31 Jan 2026
12 newest of 40 All 40 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2024Toward generalizable learning of all (linear) first-order methods via memory augmented Transformers
- 2025Trained Mamba Emulates Online Gradient Descent in In-Context Linear Regression
- 2026Finite-Time Analysis of Gradient Descent for Shallow Transformers
- 2025How Transformers Learn In-Context Recall Tasks? Optimality, Training Dynamics and Generalization
- 2023The Transient Nature of Emergent In-Context Learning in Transformers
- 2026Transformers Provably Implement In-Context Reinforcement Learning with Policy Improvement
- 2024Fine-grained Analysis of In-context Linear Estimation: Data, Architecture, and Beyond
- 2026PowerStep: Memory-Efficient Adaptive Optimization via ℓp-Norm Steepest Descent