Learning to grok: Emergence of in-context learning and skill composition in modular arithmetic tasks
Not on the map. Why?
Abstract (arXiv)
Large language models can solve tasks that were not present in the training set. This capability is believed to be due to in-context learning and skill composition. In this work, we study the emergence of in-context learning and skill composition in a collection of modular arithmetic tasks. Specifically, we consider a finite collection of linear modular functions z = a , x + b , y ;mod; p labeled by the vector (a, b) ∈ mathbbZp2. We use some of these tasks for pre-training and the rest for out-of-distribution testing. We empirically show that a GPT-style transformer exhibits a transition from in-distribution to out-of-distribution generalization as the number of pre-training tasks increases. We find that the smallest model capable of out-of-distribution generalization requires two transformer blocks, while for deeper models, the out-of-distribution generalization phase is transient, necessitating early stopping. Finally, we perform an interpretability study of the pre-trained models, revealing highly structured representations in both attention heads and MLPs; and discuss the learned algorithms. Notably, we find an algorithmic shift in deeper models, as we go from few to many in-context examples.
Key facts. Cited by 40 papers in the map (data through 7 Oct 2026). Builds on 5 of its 29 references that are in the map. First posted on arXiv 4 Jun 2024.
Builds on
5 of 29 references.
References · 5
- 2022Emergent Abilities of Large Language Modelscited by 2,483
- 2022Grokking: Generalization Beyond Overfitting on Small Algorithmic Datasetscited by 599
- 2023A Theory for Emergence of Complex Skills in Language Modelscited by 111
- 2023Grokking modular arithmeticcited by 77
- 2023To grok or not to grok: Disentangling generalization and memorization on corrupted algorithmic datasetscited by 24
Built on by
Citing papers per year: 2024: 5; 2025: 25; 2026: 10.
40 papers.
Sort:
By area:
- 2025The Origins of Representation Manifolds in Large Language Modelscited by 46
- 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 44
- 2025Emergent Abilities in Large Language Models: A Surveycited by 34
- 2024Not All LLM Reasoners Are Created Equalcited by 29
- 2024A Percolation Model of Emergence: Analyzing Transformers Trained on a Formal Languagecited by 26
- 2025Strategy Coopetition Explains the Emergence and Transience of In-Context Learningcited by 17
- 2025Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Timecited by 15
- 2025Let Me Grok for You: Accelerating Grokking via Embedding Transfer from a Weaker Modelcited by 13
- 2025When can in-context learning generalize out of task distribution?cited by 13
- 2025Does Data Scaling Lead to Visual Compositional Generalization?cited by 13
- 2025Dynamics of Transient Structure in In-Context Linear Regression Transformerscited by 12
- 2025Beyond Induction Heads: In-Context Meta Learning Induces Multi-Phase Circuit Emergencecited by 10
28 more
- 2024Emergence and Effectiveness of Task Vectors in In-Context Learning: An Encoder Decoder Perspectivecited by 9
- 2025An explainable transformer circuit for compositional generalizationcited by 8
- 2025Position: Solve Layerwise Linear Models First to Understand Neural Dynamical Phenomena (Neural Collapse, Emergence, Lazy/Rich Regime, and Grokking)cited by 8
- 2025Circuit Stability Characterizes Language Model Generalizationcited by 6
- 2024Task Diversity Shortens the ICL Plateaucited by 5
- 2025Distinct Computations Emerge From Compositional Curricula in In-Context Learningcited by 5
- 2025Decomposing Complex Visual Comprehension into Atomic Visual Skills for Vision Language Modelscited by 4
- 2025In-Context Algebracited by 4
- 2026Skill Neologisms: Towards Skill-based Continual Learningcited by 4
- 2026Model Capacity Determines Grokking through Competing Memorisation and Generalisation Speedscited by 4
- 2025On the Emergence of Induction Heads for In-Context Learningcited by 3
- 2025On the geometry and topology of representations: the manifolds of modular additioncited by 3
- 2025Understanding Post-Training Structural Changes in Large Language Modelscited by 2
- 2025Softmax ≥ Linear: Transformers may learn to classify in-context by kernel gradient descentcited by 2
- 2025Explainability of Large Language Models: Opportunities and Challenges toward Generating Trustworthy Explanationscited by 2
- 2025Emergence and Localisation of Semantic Role Circuits in LLMscited by 2
- 2025Beyond Progress Measures: Theoretical Insights into the Mechanism of Grokkingcited by 1
- 2026Bayesian Optimality of In-Context Learning with Selective State Spacescited by 1
- 2026Quantifying Hyperparameter Transfer and the Importance of Embedding Layer Learning Ratecited by 1
- 2024Identifying Sub-networks in Neural Networks via Functionally Similar Representationscited by 0
- 2025Learning Pseudorandom Numbers with Transformers: Permuted Congruential Generators, Curricula, and Interpretabilitycited by 0
- 2025Multimodal LLMs Do Not Compose Skills Optimally Across Modalitiescited by 0
- 2026A Bayesian Perspective on the Role of Epistemic Uncertainty for Delayed Generalization in In-Context Learningcited by 0
- 2026To See the Unseen: on the Generalization Ability of Transformers in Symbolic Reasoningcited by 0
- 2026Temporal Task Diversity: Inductive Biases Under Non-Stationarity in Synthetic Sequence Modellingcited by 0
- 2026Assign and Add: A Mechanistic Study of Compositional Arithmeticcited by 0
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatchcited by 0
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformerscited by 0
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers31 Aug 2026
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatch4 Jul 2026
- 2026Assign and Add: A Mechanistic Study of Compositional Arithmetic29 May 2026
- 2026Quantifying Hyperparameter Transfer and the Importance of Embedding Layer Learning Rate20 May 2026
- 2026Temporal Task Diversity: Inductive Biases Under Non-Stationarity in Synthetic Sequence Modelling18 May 2026
- 2026Model Capacity Determines Grokking through Competing Memorisation and Generalisation Speeds10 May 2026
- 2026Skill Neologisms: Towards Skill-based Continual Learning6 May 2026
- 2026To See the Unseen: on the Generalization Ability of Transformers in Symbolic Reasoning23 Apr 2026
- 2026A Bayesian Perspective on the Role of Epistemic Uncertainty for Delayed Generalization in In-Context Learning14 Apr 2026
- 2026Bayesian Optimality of In-Context Learning with Selective State Spaces19 Feb 2026
- 2025On the geometry and topology of representations: the manifolds of modular addition31 Dec 2025
- 2025In-Context Algebra18 Dec 2025
28 more
- 2025Emergence and Localisation of Semantic Role Circuits in LLMs25 Nov 2025
- 2025Multimodal LLMs Do Not Compose Skills Optimally Across Modalities11 Nov 2025
- 2025On the Emergence of Induction Heads for In-Context Learning2 Nov 2025
- 2025Learning Pseudorandom Numbers with Transformers: Permuted Congruential Generators, Curricula, and Interpretability30 Oct 2025
- 2025Explainability of Large Language Models: Opportunities and Challenges toward Generating Trustworthy Explanations20 Oct 2025
- 2025Softmax ≥ Linear: Transformers may learn to classify in-context by kernel gradient descent12 Oct 2025
- 2025Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Time1 Oct 2025
- 2025Understanding Post-Training Structural Changes in Large Language Models22 Sep 2025
- 2025Does Data Scaling Lead to Visual Compositional Generalization?9 Jul 2025
- 2025Distinct Computations Emerge From Compositional Curricula in In-Context Learning16 Jun 2025
- 2025When can in-context learning generalize out of task distribution?5 Jun 2025
- 2025Circuit Stability Characterizes Language Model Generalization30 May 2025
- 2025Decomposing Complex Visual Comprehension into Atomic Visual Skills for Vision Language Models26 May 2025
- 2025The Origins of Representation Manifolds in Large Language Models23 May 2025
- 2025Beyond Induction Heads: In-Context Meta Learning Induces Multi-Phase Circuit Emergence22 May 2025
- 2025Let Me Grok for You: Accelerating Grokking via Embedding Transfer from a Weaker Model17 Apr 2025
- 2025Beyond Progress Measures: Theoretical Insights into the Mechanism of Grokking4 Apr 2025
- 2025Strategy Coopetition Explains the Emergence and Transience of In-Context Learning7 Mar 2025
- 2025Emergent Abilities in Large Language Models: A Survey28 Feb 2025
- 2025Position: Solve Layerwise Linear Models First to Understand Neural Dynamical Phenomena (Neural Collapse, Emergence, Lazy/Rich Regime, and Grokking)28 Feb 2025
- 2025An explainable transformer circuit for compositional generalization19 Feb 2025
- 2025Dynamics of Transient Structure in In-Context Linear Regression Transformers29 Jan 2025
- 2025Training Dynamics of In-Context Learning in Linear Attention27 Jan 2025
- 2024Emergence and Effectiveness of Task Vectors in In-Context Learning: An Encoder Decoder Perspective16 Dec 2024
- 2024Identifying Sub-networks in Neural Networks via Functionally Similar Representations21 Oct 2024
- 2024Task Diversity Shortens the ICL Plateau7 Oct 2024
- 2024Not All LLM Reasoners Are Created Equal2 Oct 2024
- 2024A Percolation Model of Emergence: Analyzing Transformers Trained on a Formal Language22 Aug 2024
- 2025The Origins of Representation Manifolds in Large Language Modelscited by 46
- 2025Training Dynamics of In-Context Learning in Linear Attentioncited by 44
- 2025Emergent Abilities in Large Language Models: A Surveycited by 34
- 2024A Percolation Model of Emergence: Analyzing Transformers Trained on a Formal Languagecited by 26
- 2025Strategy Coopetition Explains the Emergence and Transience of In-Context Learningcited by 17
- 2025Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Timecited by 15
- 2025Let Me Grok for You: Accelerating Grokking via Embedding Transfer from a Weaker Modelcited by 13
- 2025When can in-context learning generalize out of task distribution?cited by 13
- 2025Does Data Scaling Lead to Visual Compositional Generalization?cited by 13
- 2025Dynamics of Transient Structure in In-Context Linear Regression Transformerscited by 12
- 2025Beyond Induction Heads: In-Context Meta Learning Induces Multi-Phase Circuit Emergencecited by 10
- 2024Emergence and Effectiveness of Task Vectors in In-Context Learning: An Encoder Decoder Perspectivecited by 9
12 most cited of 35 All 35 (JSON)
- 2026Universal Transformers for Circuit Computations: Perfect Length Generalization in Tiny Transformers31 Aug 2026
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatch4 Jul 2026
- 2026Assign and Add: A Mechanistic Study of Compositional Arithmetic29 May 2026
- 2026Quantifying Hyperparameter Transfer and the Importance of Embedding Layer Learning Rate20 May 2026
- 2026Temporal Task Diversity: Inductive Biases Under Non-Stationarity in Synthetic Sequence Modelling18 May 2026
- 2026Model Capacity Determines Grokking through Competing Memorisation and Generalisation Speeds10 May 2026
- 2026Skill Neologisms: Towards Skill-based Continual Learning6 May 2026
- 2026A Bayesian Perspective on the Role of Epistemic Uncertainty for Delayed Generalization in In-Context Learning14 Apr 2026
- 2025On the geometry and topology of representations: the manifolds of modular addition31 Dec 2025
- 2025In-Context Algebra18 Dec 2025
- 2025Emergence and Localisation of Semantic Role Circuits in LLMs25 Nov 2025
- 2025On the Emergence of Induction Heads for In-Context Learning2 Nov 2025
12 newest of 35 All 35 (JSON)