Transformers as Algorithms: Generalization and Stability in In-context Learning
Not on the map. Why?
Abstract (arXiv)
In-context learning (ICL) is a type of prompting where a transformer model operates on a sequence of (input, output) examples and performs inference on-the-fly. In this work, we formalize in-context learning as an algorithm learning problem where a transformer model implicitly constructs a hypothesis function at inference-time. We first explore the statistical aspects of this abstraction through the lens of multitask learning: We obtain generalization bounds for ICL when the input prompt is (1) a sequence of i.i.d. (input, label) pairs or (2) a trajectory arising from a dynamical system. The crux of our analysis is relating the excess risk to the stability of the algorithm implemented by the transformer. We characterize when transformer/attention architecture provably obeys the stability condition and also provide empirical verification. For generalization on unseen tasks, we identify an inductive bias phenomenon in which the transfer learning risk is governed by the task complexity and the number of MTL tasks in a highly predictable manner. Finally, we provide numerical evaluations that (1) demonstrate transformers can indeed implement near-optimal algorithms on classical regression problems with i.i.d. and dynamic data, (2) provide insights on stability, and (3) verify our theoretical predictions.
Key facts. Cited by 220 papers in the map (data through 7 Oct 2026). Builds on 44 of its 67 references that are in the map. First posted on arXiv 17 Jan 2023.
Builds on
44 of 67 references.
References · 44
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2017Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networkscited by 4,861
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
- 2022In-context Learning and Induction Headscited by 930
- 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
- 2017The Implicit Bias of Gradient Descent on Separable Datacited by 649
- 2022TabPFN: A Transformer That Solves Small Tabular Classification Problems in a Secondcited by 643
- 2020Few-Shot Learning via Learning the Representation, Provablycited by 213
32 more
- 2015The Benefit of Multitask Representation Learningcited by 194
- 2020On the Theory of Transfer Learning: The Importance of Task Diversitycited by 186
- 2022In-context Reinforcement Learning with Algorithm Distillationcited by 186
- 2020Provable Meta-Learning of Linear Representationscited by 161
- 2018Learning Without Mixing: Towards A Sharp Analysis of Linear System Identificationcited by 158
- 2017On the Sample Complexity of the Linear Quadratic Regulatorcited by 151
- 2016A vector-contraction inequality for Rademacher complexitiescited by 141
- 2022General-Purpose In-Context Learning by Meta-Learning Transformerscited by 102
- 2018Near optimal finite time identification of arbitrary linear dynamical systemscited by 89
- 2020Active Learning for Nonlinear System Identification with Guaranteescited by 78
- 2020On the Value of Target Data in Transfer Learningcited by 62
- 2020Asymptotics of Ridge (less) Regression under General Source Conditioncited by 61
- 2022Statistical Learning Theory for Control: A Finite Sample Perspectivecited by 52
- 2020Meta Learning Backpropagation And Improving Itcited by 49
- 2020Learning nonlinear dynamical systems from a single trajectorycited by 46
- 2020Meta-learning for mixed linear regressioncited by 44
- 2017Geometry of Optimization and Implicit Regularization in Deep Learningcited by 39
- 2020Non-asymptotic and Accurate Learning of Nonlinear Dynamical Systemscited by 39
- 2022Learning with little mixingcited by 33
- 2022MAML and ANIL Provably Learn Representationscited by 30
- 2022Provable Benefit of Multitask Representation Learning in Reinforcement Learningcited by 29
- 2022Single Trajectory Nonparametric Learning of Nonlinear Dynamicscited by 26
- 2022Multi-Task Imitation Learning for Linear Dynamical Systemscited by 22
- 2022Towards Sample-efficient Overparameterized Meta-learningcited by 21
- 2019A Tutorial on Concentration Bounds for System Identificationcited by 19
- 2021Joint Learning of Linear Time-Invariant Dynamical Systemscited by 16
- 2022Provable and Efficient Continual Representation Learningcited by 14
- 2022Non-Stationary Representation Learning in Sequential Linear Banditscited by 13
- 2015Regularized linear system identification using atomic, nuclear and kernel-based norms: the role of the stability constraintcited by 11
- 2022Understanding Benign Overfitting in Gradient-Based Meta Learningcited by 11
- 2022Generalization Properties of Retrieval-based Modelscited by 5
- 2022Joint Learning-Based Stabilization of Multiple Unknown Linear Systemscited by 3
Built on by
Citing papers per year: 2023: 32; 2024: 82; 2025: 70; 2026: 36.
220 papers.
Sort:
By area:
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2023Function Vectors in Large Language Modelscited by 292
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2023Understanding Catastrophic Forgetting in Language Models via Implicit Inferencecited by 138
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 135
- 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 115
- 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 112
- 2023In-Context Convergence of Transformerscited by 112
- 2023Are Emergent Abilities in Large Language Models just In-Context Learning?cited by 109
- 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
38 more
- 2023In-Context Learning with Iterative Demonstration Selectioncited by 74
- 2024Why are Sensitive Functions Hard for Transformers?cited by 74
- 2023Transformers as Support Vector Machinescited by 67
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Surveycited by 62
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMscited by 62
- 2023Max-Margin Token Selection in Attention Mechanismcited by 57
- 2024Asymptotic theory of in-context learning by linear attentioncited by 54
- 2023Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear Regressioncited by 47
- 2024Universal Vulnerabilities in Large Language Models: Backdoor Attacks for In-context Learningcited by 47
- 2023Pretraining Data Mixtures Enable Narrow Model Selection Capabilities in Transformer Modelscited by 45
- 2024Why Larger Language Models Do In-context Learning Differently?cited by 44
- 2024A Theoretical Understanding of Self-Correction through In-context Alignmentcited by 43
- 2025CausalPFN: Amortized Causal Effect Estimation via In-Context Learningcited by 43
- 2024Dual Operating Modes of In-Context Learningcited by 42
- 2023Memorization Capacity of Multi-Head Attention in Transformerscited by 39
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 39
- 2024Attention with Markov: A Framework for Principled Analysis of Transformers via Markov Chainscited by 39
- 2024Adaptive In-conversation Team Building for Language Model Agentscited by 38
- 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
- 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited 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
- 2024From Self-Attention to Markov Models: Unveiling the Dynamics of Generative Transformerscited by 34
- 2024Mechanics of Next Token Prediction with Self-Attentioncited by 34
- 2024Elephants Never Forget: Memorization and Learning of Tabular Data in Large Language Modelscited by 34
- 2024Large Language Models as Markov Chainscited by 33
- 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
- 2023Large Language Model for Multi-objective Evolutionary Optimizationcited by 29
- 2024Linear Transformers are Versatile In-Context Learnerscited by 28
- 2023Understanding In-Context Learning from Repetitionscited by 27
- 2023IDEAL: Influence-Driven Selective Annotations Empower In-Context Learners in Large Language Modelscited by 26
- 2023A Closer Look at In-Context Learning under Distribution Shiftscited by 25
- 2024Unlocking Tokens as Data Points for Generalization Bounds on Larger Language Modelscited by 25
- 2024Zero-shot forecasting of chaotic systemscited by 25
50 most cited of 220 All 220 (JSON)
- 2026TabFM-Auto: Self-Evolving Pipelines for Tabular Foundation Models29 Sep 2026
- 2026TabFM: A Zero-Shot Foundation Model for Tabular Data29 Sep 2026
- 2026When Can Prefixes Compile LoRA? Exact Resource-Capped Tests for Frozen Attention29 Sep 2026
- 2026Convergent Emergence of In-Context Learning Across Modalities12 Sep 2026
- 2026Transformers as In-Context Samplers: From Closed-Form Diffusion to Estimation-Free Sampling8 Sep 2026
- 2026Unifying ICL, SFT, KL-Regularized RL Through a Bayesian Lens4 Sep 2026
- 2026Grounding latent algorithm routing in transformer reasoning27 Jul 2026
- 2026Loop the Loopies!17 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
- 2026A Theoretical Interpretation of In-Context Learning via Probabilistic Modeling27 Jun 2026
- 2026Graph-based Target Back-Propagation for Context Adaptation in Multi-LLM Agentic Systems12 Jun 2026
38 more
- 2026Provable Data Scaling Law for Meta Learning via Complexity Minimization1 Jun 2026
- 2026Why Do Time Series Models Need Long Context Windows?1 Jun 2026
- 2026Algorithmic Recourse of In-Context Learning for Tabular Data29 May 2026
- 2026Understanding Generalization and Forgetting in In-Context Continual Learning27 May 2026
- 2026Distributional Alignment as a Criterion for Designing Task Vectors in In-Context Learning20 May 2026
- 2026TabQL: In-Context Q-Learning with Tabular Foundation Models18 May 2026
- 2026Attention-based PCA18 May 2026
- 2026Lossless Anti-Distillation Sampling12 May 2026
- 2026In-Context Examples Suppress Scientific Knowledge Recall in LLMs30 Apr 2026
- 2026Symmetry Reveals Layerwise Dynamics: How Transformers Perform In-Context Classification13 Apr 2026
- 2026Visual prompting reimagined: The power of the Activation Prompts7 Apr 2026
- 2026Towards Initialization-dependent and Non-vacuous Generalization Bounds for Overparameterized Shallow Neural Networks1 Apr 2026
- 2026Implicit Statistical Inference in Transformers: Approximating Likelihood-Ratio Tests In-Context11 Mar 2026
- 2026Fine-Tuning Without Forgetting In-Context Learning: A Theoretical Analysis of Linear Attention Models26 Feb 2026
- 2026Bigger Is Safer: Provable Robustness in In-Context Learning Scales with Capacity19 Feb 2026
- 2026Approximation Theory for Lipschitz Continuous Transformers17 Feb 2026
- 2026Size Transferability of Graph Transformers with Convolutional Positional Encodings16 Feb 2026
- 2026Covariance-Aware Transformers for Quadratic Programming and Decision Making16 Feb 2026
- 2026Learning Nonlinear Systems In-Context: From Synthetic Data to Real-World Motor Control6 Feb 2026
- 2026Free Energy Mixer6 Feb 2026
- 2026Multi-layer Cross-attention is Provably Optimal for Multi-modal In-context Learning4 Feb 2026
- 2026Self-Generative Adversarial Fine-Tuning for Large Language Models1 Feb 2026
- 2026A Constrained Optimization Perspective of Unrolled Transformers24 Jan 2026
- 2026Efficient and Minimax Optimal In-context Nonparametric Regression with Transformers21 Jan 2026
- 2025Task Schema and Binding: A Double Dissociation Study of In-Context Learning19 Dec 2025
- 2025Impact of Positional Encoding: Clean and Adversarial Rademacher Complexity for Transformers under In-Context Regression10 Dec 2025
- 2025Genomic Next-Token Predictors are In-Context Learners16 Nov 2025
- 2025Scaling Laws and In-Context Learning: A Unified Theoretical Framework9 Nov 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
- 2025A Framework for Quantifying How Pre-Training and Context Benefit In-Context Learning26 Oct 2025
- 2025Optimality and NP-Hardness of Transformers in Learning Markovian Dynamical Functions21 Oct 2025
- 2025AI Agents as Universal Task Solvers14 Oct 2025
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning13 Oct 2025
- 2025On the Relationship Between the Choice of Representation and In-Context Learning9 Oct 2025
- 2025Fine-Grained Emotion Recognition via In-Context Learning8 Oct 2025
- 2025Data Selection for Fine-tuning Vision Language Models via Cross Modal Alignment Trajectories1 Oct 2025
- 2025Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Time1 Oct 2025
50 newest of 220 All 220 (JSON)
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Surveycited by 62
- 2024A Theoretical Understanding of Self-Correction through In-context Alignmentcited by 43
- 2025Bayesian Teaching Enables Probabilistic Reasoning in Large Language Modelscited by 36
- 2025CoT-ICL Lab: A Synthetic Framework for Studying Chain-of-Thought Learning from In-Context Demonstrationscited by 2
- 2025Neither Stochastic Parroting nor AGI: LLMs Solve Tasks through Context-Directed Extrapolation from Training Data Priorscited by 0
- 2026In-Context Examples Suppress Scientific Knowledge Recall in LLMscited by 0
- 2026Grounding latent algorithm routing in transformer reasoningcited by 0
- 2026Grounding latent algorithm routing in transformer reasoning27 Jul 2026
- 2026In-Context Examples Suppress Scientific Knowledge Recall in LLMs30 Apr 2026
- 2025Neither Stochastic Parroting nor AGI: LLMs Solve Tasks through Context-Directed Extrapolation from Training Data Priors29 May 2025
- 2025Bayesian Teaching Enables Probabilistic Reasoning in Large Language Models21 Mar 2025
- 2025CoT-ICL Lab: A Synthetic Framework for Studying Chain-of-Thought Learning from In-Context Demonstrations21 Feb 2025
- 2024A Theoretical Understanding of Self-Correction through In-context Alignment28 May 2024
- 2023Towards Better Chain-of-Thought Prompting Strategies: A Survey8 Oct 2023
- 2023Understanding Catastrophic Forgetting in Language Models via Implicit Inferencecited by 138
- 2026Self-Generative Adversarial Fine-Tuning for Large Language Modelscited by 1
- 2025SPECTRA: Revealing the Full Spectrum of User Preferences via Distributional LLM Inferencecited by 0
- 2026Unifying ICL, SFT, KL-Regularized RL Through a Bayesian Lenscited by 0
- 2026Unifying ICL, SFT, KL-Regularized RL Through a Bayesian Lens4 Sep 2026
- 2026Self-Generative Adversarial Fine-Tuning for Large Language Models1 Feb 2026
- 2025SPECTRA: Revealing the Full Spectrum of User Preferences via Distributional LLM Inference29 Sep 2025
- 2023Understanding Catastrophic Forgetting in Language Models via Implicit Inference18 Sep 2023
- 2024Universal Vulnerabilities in Large Language Models: Backdoor Attacks for In-context Learningcited by 47
- 2025When is Task Vector Provably Effective for Model Editing? A Generalization Analysis of Nonlinear Transformerscited by 38
- 2024Cognitive Overload Attack:Prompt Injection for Long Contextcited by 13
- 2025Tuning without Peeking: Provable Generalization Bounds and Robust LLM Post-Trainingcited by 1
- 2025Tuning without Peeking: Provable Generalization Bounds and Robust LLM Post-Training2 Jul 2025
- 2025When is Task Vector Provably Effective for Model Editing? A Generalization Analysis of Nonlinear Transformers15 Apr 2025
- 2024Cognitive Overload Attack:Prompt Injection for Long Context15 Oct 2024
- 2024Universal Vulnerabilities in Large Language Models: Backdoor Attacks for In-context Learning11 Jan 2024
- 2025Compression Barriers for Autoregressive Transformerscited by 5
- 2025Compression Barriers for Autoregressive Transformers21 Feb 2025
- 2026Loop the Loopies!cited by 4
- 2026Loop the Loopies!17 Jul 2026
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2023Function Vectors in Large Language Modelscited by 292
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2023Looped Transformers are Better at Learning Learning Algorithmscited by 135
- 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 115
- 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 112
- 2023In-Context Convergence of Transformerscited by 112
- 2023Are Emergent Abilities in Large Language Models just In-Context Learning?cited by 109
- 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
- 2023In-Context Learning with Iterative Demonstration Selectioncited by 74
12 most cited of 193 All 193 (JSON)
- 2026TabFM: A Zero-Shot Foundation Model for Tabular Data29 Sep 2026
- 2026When Can Prefixes Compile LoRA? Exact Resource-Capped Tests for Frozen Attention29 Sep 2026
- 2026Convergent Emergence of In-Context Learning Across Modalities12 Sep 2026
- 2026Transformers as In-Context Samplers: From Closed-Form Diffusion to Estimation-Free Sampling8 Sep 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
- 2026A Theoretical Interpretation of In-Context Learning via Probabilistic Modeling27 Jun 2026
- 2026Provable Data Scaling Law for Meta Learning via Complexity Minimization1 Jun 2026
- 2026Why Do Time Series Models Need Long Context Windows?1 Jun 2026
- 2026Algorithmic Recourse of In-Context Learning for Tabular Data29 May 2026
- 2026Understanding Generalization and Forgetting in In-Context Continual Learning27 May 2026
- 2026Distributional Alignment as a Criterion for Designing Task Vectors in In-Context Learning20 May 2026
12 newest of 193 All 193 (JSON)