Transformers Meet In-Context Learning: A Universal Approximation Theory
Not on the map. Why?
Abstract (arXiv)
Large language models are capable of in-context learning, the ability to perform new tasks at test time using a handful of input-output examples, without parameter updates. We develop a universal approximation theory to elucidate how transformers enable in-context learning. For a general class of functions (each representing a distinct task), we demonstrate how to construct a transformer that, without any further weight updates, can predict based on a few noisy in-context examples with vanishingly small risk. Unlike prior work that frames transformers as approximators of optimization algorithms (e.g., gradient descent) for statistical learning tasks, we integrate Barron's universal function approximation theory with the algorithm approximator viewpoint. Our approach yields approximation guarantees that are not constrained by the effectiveness of the optimization algorithms being mimicked, extending far beyond convex problems like linear regression. The key is to show that (i) any target function can be nearly linearly represented, with small ℓ1-norm, over a set of universal features, and (ii) a transformer can be constructed to find the linear representation -- akin to solving Lasso -- at test time.
Key facts. Cited by 6 papers in the map (data through 14 Oct 2026). Builds on 53 of its 71 references that are in the map. First posted on arXiv 5 Jun 2025.
Builds on
53 of 71 references.
References · 53
- 2017Attention Is All You Needcited by 60,361
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2021On the Opportunities and Risks of Foundation Modelscited by 4,033
- 2021Transformers in Vision: A Surveycited by 1,013
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
- 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
- 2021A Survey of Transformerscited by 401
- 2023Trained Transformers Learn Linear Models In-Contextcited by 337
- 2014Breaking the Curse of Dimensionality with Convex Neural Networkscited by 331
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
38 more
- 2023Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspectivecited by 294
- 2019Theoretical Limitations of Self-Attention in Neural Sequence Modelscited by 288
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
- 2022Transformers Learn Shortcuts to Automatacited by 268
- 2024Chain of Thought Empowers Transformers to Solve Inherently Serial Problemscited by 260
- 2022Transformers in Medical Imaging: A Surveycited by 245
- 2023Looped Transformers as Programmable Computerscited by 237
- 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 222
- 2024Repeat After Me: Transformers are Better than State Space Models at Copyingcited by 216
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
- 2023Representational Strengths and Limitations of Transformerscited by 133
- 2019On the Turing Completeness of Modern Neural Network Architecturescited by 129
- 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 118
- 2024How Transformers Learn Causal Structure with Gradient Descentcited by 118
- 2023In-Context Convergence of Transformerscited by 115
- 2021Self-Attention Networks Can Process Bounded Hierarchical Languagescited by 105
- 2023Uncovering mesa-optimization algorithms in Transformerscited by 100
- 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
- 2023In-Context Learning through the Bayesian Prismcited by 83
- 2024Transformers, parallel computation, and logarithmic depthcited by 79
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 75
- 2024Training Dynamics of Multi-Head Softmax Attention for In-Context Learning: Emergence, Convergence, and Optimalitycited by 74
- 2024RNNs are not Transformers (Yet): The Key Bottleneck on In-context Retrievalcited by 64
- 2023Transformers Implement Functional Gradient Descent to Learn Non-Linear Functions In Contextcited by 63
- 2024On Limitations of the Transformer Architecturecited by 63
- 2023Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear Regressioncited by 49
- 2021On the Expressive Power of Self-Attention Matricescited by 47
- 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 46
- 2024Theoretical limitations of multi-layer Transformercited by 45
- 2024Transformers are Universal In-context Learnerscited by 43
- 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 38
- 2019Neural tangent kernels, transportation mappings, and universal approximationcited by 30
- 2023Transformers are uninterpretable with myopic methods: a case study with bounded Dyck grammarscited by 30
- 2024Linear Transformers are Versatile In-Context Learnerscited by 28
- 2017On the ability of neural nets to express distributionscited by 26
- 2024How Well Can Transformers Emulate In-context Newton's Method?cited by 25
- 2024Provably learning a multi-head attention layercited by 21
50 most cited of 53 All 53 (JSON)
Built on by
Citing papers per year: 2025: 2; 2026: 4.
6 papers.
- 2025Provable Low-Frequency Bias of In-Context Learning of Representationscited by 3
- 2025Stability of In-Context Learning: A Spectral Coverage Perspectivecited by 2
- 2026Beyond the Prompt in Large Language Models: Comprehension, In-Context Learning, and Chain-of-Thoughtcited by 1
- 2026Adaptivity Under Realizability Constraints: Comparing In-Context and Agentic Learningcited by 1
- 2026Transformers as Cross-Task Learners: Shared Structure Drives Sample Efficiency in In-Context Learningcited by 1
- 2026Generalization of Transformer-Based Neural Quantum States via In-Context Learningcited by 0
- 2026Generalization of Transformer-Based Neural Quantum States via In-Context Learning2 Oct 2026
- 2026Transformers as Cross-Task Learners: Shared Structure Drives Sample Efficiency in In-Context Learning24 Sep 2026
- 2026Adaptivity Under Realizability Constraints: Comparing In-Context and Agentic Learning6 May 2026
- 2026Beyond the Prompt in Large Language Models: Comprehension, In-Context Learning, and Chain-of-Thought16 Feb 2026
- 2025Stability of In-Context Learning: A Spectral Coverage Perspective25 Sep 2025
- 2025Provable Low-Frequency Bias of In-Context Learning of Representations17 Jul 2025