When can in-context learning generalize out of task distribution?
Not on the map. Why?
Abstract (arXiv)
In-context learning (ICL) is a remarkable capability of pretrained transformers that allows models to generalize to unseen tasks after seeing only a few examples. We investigate empirically the conditions necessary on the pretraining distribution for ICL to emerge and generalize out-of-distribution. Previous work has focused on the number of distinct tasks necessary in the pretraining dataset. Here, we use a different notion of task diversity to study the emergence of ICL in transformers trained on linear functions. We find that as task diversity increases, transformers undergo a transition from a specialized solution, which exhibits ICL only within the pretraining task distribution, to a solution which generalizes out of distribution to the entire task space. We also investigate the nature of the solutions learned by the transformer on both sides of the transition, and observe similar transitions in nonlinear regression problems. We construct a phase diagram to characterize how our concept of task diversity interacts with the number of pretraining tasks. In addition, we explore how factors such as the depth of the model and the dimensionality of the regression problem influence the transition.
Key facts. Cited by 16 papers in the map (data through 14 Oct 2026). Builds on 22 of its 26 references that are in the map. First posted on arXiv 5 Jun 2025.
Builds on
22 of 26 references.
References · 22
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2017Decoupled Weight Decay Regularizationcited by 1,831
- 2020In Search of Lost Domain Generalizationcited by 1,054
- 2022Transformers learn in-context by gradient descentcited by 732
- 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
- 2021Towards Out-Of-Distribution Generalization: A Surveycited by 436
- 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
- 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 146
10 more
- 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 118
- 2023The Transient Nature of Emergent In-Context Learning in Transformerscited by 76
- 2021Out of Distribution Generalization in Machine Learningcited by 60
- 2024Asymptotic theory of in-context learning by linear attentioncited by 55
- 2023Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear Regressioncited by 49
- 2023Pretraining Data Mixtures Enable Narrow Model Selection Capabilities in Transformer Modelscited by 45
- 2024Learning to grok: Emergence of in-context learning and skill composition in modular arithmetic taskscited by 40
- 2023A Closer Look at In-Context Learning under Distribution Shiftscited by 25
- 2024Differential learning kinetics govern the transition from memorization to generalization during in-context learningcited by 21
- 2023Breaking through the learning plateaus of in-context learning in Transformercited by 8
Built on by
Citing papers per year: 2025: 3; 2026: 13.
16 papers.
Sort:
By area:
- 2025Pretrain-Test Task Alignment Governs Generalization in In-Context Learningcited by 8
- 2026Distinct mechanisms underlying in-context learning in transformerscited by 4
- 2026Bifrost: Steering Strategic Trajectories to Bridge Contextual Gaps for Self-Improving Agentscited by 2
- 2025Multi-Layer Attention is the Amplifier of Demonstration Effectivenesscited by 1
- 2026The Effect of Training Task Diversity on In-Context Learning through the Lens of Low-Dimensional Subspacescited by 1
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatchcited by 1
- 2026In-context Learning of Single-index Targets: Comparing Kernel and Feature Learnerscited by 1
- 2025In-Context Curiosity: Distilling Exploration for Decision-Pretrained Transformers on Bandit Taskscited by 0
- 2026When Looks Do Not Lie: Discourse Structure Guided In-Context Learning for Faithful Diagram Generationcited by 0
- 2026The Generalization Spectrum: A Chromatographic Approach to Evaluating Learning Algorithmscited by 0
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Modelscited by 0
- 2026Shortcut Before Circuit: Document Statistics Time In-Context Conflict Resolutioncited by 0
4 more
- 2026The Illusion of Replacement: Rethinking Specialized Machine Learning Models in the Foundation Model Eracited by 0
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learningcited by 0
- 2026How Well Do Prior-Data Fitted Networks Amortize Bayesian Inference?cited by 0
- 2026Fisher information and the geometry of memorization in neural networkscited by 0
- 2026Fisher information and the geometry of memorization in neural networks12 Oct 2026
- 2026How Well Do Prior-Data Fitted Networks Amortize Bayesian Inference?9 Oct 2026
- 2026In-context Learning of Single-index Targets: Comparing Kernel and Feature Learners1 Oct 2026
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026The Illusion of Replacement: Rethinking Specialized Machine Learning Models in the Foundation Model Era29 Aug 2026
- 2026Shortcut Before Circuit: Document Statistics Time In-Context Conflict Resolution25 Aug 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
- 2026The Generalization Spectrum: A Chromatographic Approach to Evaluating Learning Algorithms24 Jun 2026
- 2026The Effect of Training Task Diversity on In-Context Learning through the Lens of Low-Dimensional Subspaces5 Jun 2026
- 2026Distinct mechanisms underlying in-context learning in transformers14 Apr 2026
- 2026Bifrost: Steering Strategic Trajectories to Bridge Contextual Gaps for Self-Improving Agents5 Feb 2026
4 more
- 2026When Looks Do Not Lie: Discourse Structure Guided In-Context Learning for Faithful Diagram Generation28 Jan 2026
- 2025In-Context Curiosity: Distilling Exploration for Decision-Pretrained Transformers on Bandit Tasks30 Sep 2025
- 2025Pretrain-Test Task Alignment Governs Generalization in In-Context Learning30 Sep 2025
- 2025Multi-Layer Attention is the Amplifier of Demonstration Effectiveness1 Aug 2025
- 2025Pretrain-Test Task Alignment Governs Generalization in In-Context Learningcited by 8
- 2026Distinct mechanisms underlying in-context learning in transformerscited by 4
- 2025Multi-Layer Attention is the Amplifier of Demonstration Effectivenesscited by 1
- 2026The Effect of Training Task Diversity on In-Context Learning through the Lens of Low-Dimensional Subspacescited by 1
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatchcited by 1
- 2026In-context Learning of Single-index Targets: Comparing Kernel and Feature Learnerscited by 1
- 2025In-Context Curiosity: Distilling Exploration for Decision-Pretrained Transformers on Bandit Taskscited by 0
- 2026When Looks Do Not Lie: Discourse Structure Guided In-Context Learning for Faithful Diagram Generationcited by 0
- 2026The Generalization Spectrum: A Chromatographic Approach to Evaluating Learning Algorithmscited by 0
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Modelscited by 0
- 2026Shortcut Before Circuit: Document Statistics Time In-Context Conflict Resolutioncited by 0
- 2026The Illusion of Replacement: Rethinking Specialized Machine Learning Models in the Foundation Model Eracited by 0
12 most cited of 15 All 15 (JSON)
- 2026Fisher information and the geometry of memorization in neural networks12 Oct 2026
- 2026How Well Do Prior-Data Fitted Networks Amortize Bayesian Inference?9 Oct 2026
- 2026In-context Learning of Single-index Targets: Comparing Kernel and Feature Learners1 Oct 2026
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026The Illusion of Replacement: Rethinking Specialized Machine Learning Models in the Foundation Model Era29 Aug 2026
- 2026Shortcut Before Circuit: Document Statistics Time In-Context Conflict Resolution25 Aug 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
- 2026The Generalization Spectrum: A Chromatographic Approach to Evaluating Learning Algorithms24 Jun 2026
- 2026The Effect of Training Task Diversity on In-Context Learning through the Lens of Low-Dimensional Subspaces5 Jun 2026
- 2026Distinct mechanisms underlying in-context learning in transformers14 Apr 2026
- 2026When Looks Do Not Lie: Discourse Structure Guided In-Context Learning for Faithful Diagram Generation28 Jan 2026
12 newest of 15 All 15 (JSON)