mlsanityData to 14 Oct 2026

How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representations

arXiv 2310.10616 ↗First posted 16 Oct 2023cs.LGcited by 75

Not on the map. Why?

Abstract (arXiv)

While large language models based on the transformer architecture have demonstrated remarkable in-context learning (ICL) capabilities, understandings of such capabilities are still in an early stage, where existing theory and mechanistic understanding focus mostly on simple scenarios such as learning simple function classes. This paper takes initial steps on understanding ICL in more complex scenarios, by studying learning with representations. Concretely, we construct synthetic in-context learning problems with a compositional structure, where the label depends on the input through a possibly complex but fixed representation function, composed with a linear function that differs in each instance. By construction, the optimal ICL algorithm first transforms the inputs by the representation function, and then performs linear ICL on top of the transformed dataset. We show theoretically the existence of transformers that approximately implement such algorithms with mild depth and size. Empirically, we find trained transformers consistently achieve near-optimal ICL performance in this setting, and exhibit the desired dissection where lower layers transforms the dataset and upper layers perform linear ICL. Through extensive probing and a new pasting experiment, we further reveal several mechanisms within the trained transformers, such as concrete copying behaviors on both the inputs and the representations, linear ICL capability of the upper layers alone, and a post-ICL representation selection mechanism in a harder mixture setting. These observed mechanisms align well with our theory and may shed light on how transformers perform ICL in more realistic scenarios.

Key facts. Cited by 75 papers in the map (data through 14 Oct 2026). Builds on 36 of its 42 references that are in the map. First posted on arXiv 16 Oct 2023.

Builds on

36 of 42 references.

References · 36

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2023GPT-4 Technical Reportcited by 18,396
  3. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 13,028
  4. 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,459
  5. 2022Locating and Editing Factual Associations in GPTcited by 2,691
  6. 2023Sparks of Artificial General Intelligence: Early experiments with GPT-4cited by 2,592
  7. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
  8. 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,392
  9. 2016Understanding intermediate layers using linear classifier probescited by 1,353
  10. 2021What Makes Good In-Context Examples for GPT-3?cited by 1,195
  11. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
  12. 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,135
24 more
  1. 2022In-context Learning and Induction Headscited by 964
  2. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
  3. 2022Transformers learn in-context by gradient descentcited by 732
  4. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  5. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  6. 2021Learning To Retrieve Prompts for In-Context Learningcited by 648
  7. 2014Convex Optimization: Algorithms and Complexitycited by 575
  8. 2021MetaICL: Learning to Learn In Contextcited by 454
  9. 2021Causal Abstractions of Neural Networkscited by 422
  10. 2023Larger language models do in-context learning differentlycited by 394
  11. 2023Trained Transformers Learn Linear Models In-Contextcited by 337
  12. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 309
  13. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
  14. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
  15. 2021Noisy Channel Language Model Prompting for Few-Shot Text Classificationcited by 165
  16. 2023Birth of a Transformer: A Memory Viewpointcited by 161
  17. 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 146
  18. 2022Impact of Pretraining Term Frequencies on Few-Shot Reasoningcited by 142
  19. 2022Toward Transparent AI: A Survey on Interpreting the Inner Structures of Deep Neural Networkscited by 129
  20. 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 118
  21. 2022General-Purpose In-Context Learning by Meta-Learning Transformerscited by 105
  22. 2023A Study on ReLU and Softmax in Transformercited by 53
  23. 2023Replacing softmax with ReLU in Vision Transformerscited by 44
  24. 2023Dissecting Chain-of-Thought: Compositionality through In-Context Filtering and Learningcited by 19

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2023: 2; 2024: 40; 2025: 21; 2026: 12.

75 papers.

Sort:

By area:

  1. 2024The Evolution of Statistical Induction Heads: In-Context Learning Markov Chainscited by 118
  2. 2024Can large language models explore in-context?cited by 76
  3. 2024From Words to Numbers: Your Large Language Model Is Secretly A Capable Regressor When Given In-Context Examplescited by 57
  4. 2024Active-Dormant Attention Heads: Mechanistically Demystifying Extreme-Token Phenomena in LLMscited by 56
  5. 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 46
  6. 2024Why Larger Language Models Do In-context Learning Differently?cited by 45
  7. 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 38
  8. 2024Transformers are Minimax Optimal Nonparametric In-Context Learnerscited by 37
  9. 2025Bayesian Teaching Enables Probabilistic Reasoning in Large Language Modelscited by 37
  10. 2024How Do Nonlinear Transformers Learn and Generalize in In-Context Learning?cited by 35
  11. 2023The Mystery of In-Context Learning: A Comprehensive Survey on Interpretation and Analysiscited by 34
  12. 2024In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initializationcited by 33
38 more
  1. 2024Iteration Head: A Mechanistic Study of Chain-of-Thoughtcited by 31
  2. 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 31
  3. 2024A phase transition between positional and semantic learning in a solvable model of dot-product attentioncited by 30
  4. 2024Linear Transformers are Versatile In-Context Learnerscited by 28
  5. 2024A Percolation Model of Emergence: Analyzing Transformers Trained on a Formal Languagecited by 26
  6. 2024How Well Can Transformers Emulate In-context Newton's Method?cited by 25
  7. 2024In-context Time Series Predictorcited by 23
  8. 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
  9. 2024Bypassing the Exponential Dependency: Looped Transformers Efficiently Learn In-context by Multi-step Gradient Descentcited by 22
  10. 2025How Do LLMs Perform Two-Hop Reasoning in Context?cited by 20
  11. 2024What Can Transformer Learn with Varying Depth? Case Studies on Sequence Learning Taskscited by 19
  12. 2024Understanding the Language Model to Solve the Symbolic Multi-Step Reasoning Problem from the Perspective of Buffer Mechanismcited by 15
  13. 2024Intrinsic Self-correction for Enhanced Morality: An Analysis of Internal Mechanisms and the Superficial Hypothesiscited by 15
  14. 2024On the Training Convergence of Transformers for In-Context Classification of Gaussian Mixturescited by 15
  15. 2024A Survey to Recent Progress Towards Understanding In-Context Learningcited by 14
  16. 2024Reinforced In-Context Black-Box Optimizationcited by 14
  17. 2024Transformers Learn Low Sensitivity Functions: Investigations and Implicationscited by 14
  18. 2024How Transformers Utilize Multi-Head Attention in In-Context Learning? A Case Study on Sparse Linear Regressioncited by 14
  19. 2024Training Nonlinear Transformers for Chain-of-Thought Inference: A Theoretical Generalization Analysiscited by 14
  20. 2025Formalizing Learning from Language Feedback with Provable Guaranteescited by 13
  21. 2024AlgoFormer: An Efficient Transformer Framework with Algorithmic Structurescited by 11
  22. 2025Solving Empirical Bayes via Transformerscited by 11
  23. 2025Talk to Your Slides: High-Efficiency Slide Editing via Language-Driven Structured Data Manipulationcited by 11
  24. 2025From Condensation to Rank Collapse: A Two-Stage Analysis of Transformer Training Dynamicscited by 10
  25. 2024Dissecting the Interplay of Attention Paths in a Statistical Mechanics Theory of Transformerscited by 9
  26. 2023Transformers are Provably Optimal In-context Estimators for Wireless Communicationscited by 8
  27. 2025Understanding In-context Learning of Addition via Activation Subspacescited by 8
  28. 2025On the Role of Transformer Feed-Forward Layers in Nonlinear In-Context Learningcited by 7
  29. 2024In-Context Learning of Linear Systems: Generalization Theory and Applications to Operator Learningcited by 6
  30. 2024Context-Scaling versus Task-Scaling in In-Context Learningcited by 6
  31. 2025Transformers Meet In-Context Learning: A Universal Approximation Theorycited by 6
  32. 2026Outcome-Based RL Provably Leads Transformers to Reason, but Only With the Right Datacited by 6
  33. 2024Task Diversity Shortens the ICL Plateaucited by 5
  34. 2024Global Convergence in Training Large-Scale Transformerscited by 5
  35. 2025In-Context Learning of Linear Dynamical Systems with Transformers: Approximation Bounds and Depth-Separationcited by 4
  36. 2025CoT-ICL Lab: A Synthetic Framework for Studying Chain-of-Thought Learning from In-Context Demonstrationscited by 4
  37. 2025On the Robustness of Transformers against Context Hijacking for Linear Classificationcited by 4
  38. 2025Improving Model Representation and Reducing KV Cache via Skip Connections with First Value Headscited by 4

50 most cited of 75 All 75 (JSON)