mlsanityData to 7 Oct 2026

Understanding In-Context Learning in Transformers and LLMs by Learning to Learn Discrete Functions

arXiv 2310.03016 ↗First posted 4 Oct 2023cs.LG cs.CLcited by 62

Not on the map. Why?

Abstract (arXiv)

In order to understand the in-context learning phenomenon, recent works have adopted a stylized experimental framework and demonstrated that Transformers can learn gradient-based learning algorithms for various classes of real-valued functions. However, the limitations of Transformers in implementing learning algorithms, and their ability to learn other forms of algorithms are not well understood. Additionally, the degree to which these capabilities are confined to attention-based models is unclear. Furthermore, it remains to be seen whether the insights derived from these stylized settings can be extrapolated to pretrained Large Language Models (LLMs). In this work, we take a step towards answering these questions by demonstrating the following: (a) On a test-bed with a variety of Boolean function classes, we find that Transformers can nearly match the optimal learning algorithm for 'simpler' tasks, while their performance deteriorates on more 'complex' tasks. Additionally, we find that certain attention-free models perform (almost) identically to Transformers on a range of tasks. (b) When provided a teaching sequence, i.e. a set of examples that uniquely identifies a function in a class, we show that Transformers learn more sample-efficiently. Interestingly, our results show that Transformers can learn to implement two distinct algorithms to solve a single task, and can adaptively select the more sample-efficient algorithm depending on the sequence of in-context examples. (c) Lastly, we show that extant LLMs, e.g. LLaMA-2, GPT-4, can compete with nearest-neighbor baselines on prediction tasks that are guaranteed to not be in their training set.

Key facts. Cited by 62 papers in the map (data through 7 Oct 2026). Builds on 35 of its 55 references that are in the map. First posted on arXiv 4 Oct 2023.

Builds on

35 of 55 references.

References · 35

  1. 2017Attention Is All You Needcited by 59,932
  2. 2020Language Models are Few-Shot Learnerscited by 32,199
  3. 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
  4. 2022Training language models to follow instructions with human feedbackcited by 15,712
  5. 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
  6. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
  7. 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
  8. 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
  9. 2022In-context Learning and Induction Headscited by 930
  10. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
  11. 2022Transformers learn in-context by gradient descentcited by 714
  12. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
23 more
  1. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
  2. 2023Retentive Network: A Successor to Transformer for Large Language Modelscited by 594
  3. 2021MetaICL: Learning to Learn In Contextcited by 450
  4. 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
  5. 2023Hyena Hierarchy: Towards Larger Convolutional Language Modelscited by 388
  6. 2023Larger language models do in-context learning differentlycited by 386
  7. 2022Diagonal State Spaces are as Effective as Structured State Spacescited by 350
  8. 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 303
  9. 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
  10. 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 286
  11. 2022Transformers Learn Shortcuts to Automatacited by 260
  12. 2022Neural Networks and the Chomsky Hierarchycited by 214
  13. 2021Noisy Channel Language Model Prompting for Few-Shot Text Classificationcited by 163
  14. 2022Impact of Pretraining Term Frequencies on Few-Shot Reasoningcited by 142
  15. 2021Saturated Transformers are Constant-Depth Threshold Circuitscited by 137
  16. 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
  17. 2022Overcoming a Theoretical Limitation of Self-Attentioncited by 110
  18. 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
  19. 2023In-Context Learning through the Bayesian Prismcited by 78
  20. 2022Simplicity Bias in Transformers and their Ability to Learn Sparse Boolean Functionscited by 68
  21. 2020How Can Self-Attention Networks Recognize Dyck-n Languages?cited by 51
  22. 2023A Closer Look at In-Context Learning under Distribution Shiftscited by 25
  23. 2020On the Practical Ability of Recurrent Neural Networks to Recognize Hierarchical Languagescited by 22

Built on by

Cited by year (2026 to 7 Oct)

Citing papers per year: 2024: 28; 2025: 24; 2026: 10.

62 papers.

Sort:

By area:

  1. 2024Many-Shot In-Context Learningcited by 203
  2. 2024Can Mamba Learn How to Learn? A Comparative Study on In-Context Learning Taskscited by 104
  3. 2024In-Context Language Learning: Architectures and Algorithmscited by 86
  4. 2024Can large language models explore in-context?cited by 75
  5. 2024Mechanistic Design and Scaling of Hybrid Architecturescited by 57
  6. 2024From Words to Numbers: Your Large Language Model Is Secretly A Capable Regressor When Given In-Context Examplescited by 55
  7. 2024A Theoretical Understanding of Self-Correction through In-context Alignmentcited by 43
  8. 2024Elephants Never Forget: Memorization and Learning of Tabular Data in Large Language Modelscited by 34
  9. 2024The broader spectrum of in-context learningcited by 33
  10. 2024In-Context Learning of a Linear Transformer Block: Benefits of the MLP Component and One-Step GD Initializationcited by 30
  11. 2024Separations in the Representational Capabilities of Transformers and Recurrent Architecturescited by 29
  12. 2024Deeper Insights Without Updates: The Power of In-Context Learning Over Fine-Tuningcited by 20
38 more
  1. 2024State-Free Inference of State-Space Models: The Transfer Function Approachcited by 18
  2. 2025Learning In-context n-grams with Transformers: Sub-n-grams Are Near-stationary Pointscited by 15
  3. 2024Transformers Learn Low Sensitivity Functions: Investigations and Implicationscited by 13
  4. 2024Exploring the Robustness of In-Context Learning with Noisy Labelscited by 13
  5. 2024XLand-100B: A Large-Scale Multi-Task Dataset for In-Context Reinforcement Learningcited by 13
  6. 2024Vector-ICL: In-context Learning with Continuous Vector Representationscited by 13
  7. 2025Problem-Solving Logic Guided Curriculum In-Context Learning for LLMs Complex Reasoningcited by 12
  8. 2025Task Generalization With AutoRegressive Compositional Structure: Can Learning From D Tasks Generalize to DT Tasks?cited by 11
  9. 2025Compositional Generalization from Learned Skills via CoT Training: A Theoretical and Structural Analysis for Reasoningcited by 10
  10. 2025Beyond Induction Heads: In-Context Meta Learning Induces Multi-Phase Circuit Emergencecited by 10
  11. 2024On Limitation of Transformer for Learning HMMscited by 9
  12. 2025LLM Security: Vulnerabilities, Attacks, Defenses, and Countermeasurescited by 8
  13. 2025On the Role of Transformer Feed-Forward Layers in Nonlinear In-Context Learningcited by 7
  14. 2025Solving Empirical Bayes via Transformerscited by 7
  15. 2025Transformer learns the cross-task prior and regularization for in-context learningcited by 7
  16. 2026Efficient and Minimax Optimal In-context Nonparametric Regression with Transformerscited by 7
  17. 2025Analyzing limits for in-context learningcited by 6
  18. 2025Graph Diffusion Transformers are In-Context Molecular Designerscited by 6
  19. 2024DETAIL: Task DEmonsTration Attribution for Interpretable In-context Learningcited by 5
  20. 2024On Mesa-Optimization in Autoregressively Trained Transformers: Emergence and Capabilitycited by 5
  21. 2024Cognitive LLMs: Towards Integrating Cognitive Architectures and Large Language Models for Manufacturing Decision-makingcited by 5
  22. 2024Task Diversity Shortens the ICL Plateaucited by 5
  23. 2024Re-examining learning linear functions in contextcited by 5
  24. 2024Sub-SA: Strengthen In-context Learning via Submodular Selective Annotationcited by 4
  25. 2024Learning vs Retrieval: The Role of In-Context Examples in Regression with Large Language Modelscited by 4
  26. 2025On the Robustness of Transformers against Context Hijacking for Linear Classificationcited by 4
  27. 2025In-Context Occam's Razor: How Transformers Prefer Simpler Hypotheses on the Flycited by 4
  28. 2024From Unstructured Data to In-Context Learning: Exploring What Tasks Can Be Learned and Whencited by 3
  29. 2025Latent Concept Disentanglement in Transformer-based Language Modelscited by 3
  30. 2025The Initialization Determines Whether In-Context Learning Is Gradient Descentcited by 3
  31. 2024Identifying and Analyzing Performance-Critical Tokens in Large Language Modelscited by 2
  32. 2025From predictions to confidence intervals: an empirical study of conformal prediction methods for in-context learningcited by 2
  33. 2025Data Shifts Hurt CoT: A Theoretical Studycited by 2
  34. 2025Softmax ≥ Linear: Transformers may learn to classify in-context by kernel gradient descentcited by 2
  35. 2026Understanding Contextual Recall in Transformers: How Finetuning Enables In-Context Reasoning over Pretraining Knowledgecited by 2
  36. 2025Randomly Sampled Language Reasoning Problems Elucidate Limitations of In-Context Learningcited by 1
  37. 2025Assessing the Limits of In-Context Learning beyond Functions using Partially Ordered Relationcited by 1
  38. 2025SSA: Improving Performance With a Better Scoring Functioncited by 1

50 most cited of 62 All 62 (JSON)