In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning
Not on the map. Why?
Abstract (arXiv)
This paper develops a finite-sample statistical theory for in-context learning (ICL), analyzed within a meta-learning framework that accommodates mixtures of diverse task types. We introduce a principled risk decomposition that separates the total ICL risk into two orthogonal components: Bayes Gap and Posterior Variance. The Bayes Gap quantifies how well the trained model approximates the Bayes-optimal in-context predictor. For a uniform-attention Transformer, we derive a non-asymptotic upper bound on this gap, which explicitly clarifies the dependence on the number of pretraining prompts and their context length. The Posterior Variance is a model-independent risk representing the intrinsic task uncertainty. Our key finding is that this term is determined solely by the difficulty of the true underlying task, while the uncertainty arising from the task mixture vanishes exponentially fast with only a few in-context examples. Together, these results provide a unified view of ICL: the Transformer selects the optimal meta-algorithm during pretraining and rapidly converges to the optimal algorithm for the true task at test time.
Key facts. Cited by 17 papers in the map (data through 7 Oct 2026). Builds on 36 of its 73 references that are in the map. First posted on arXiv 13 Oct 2025.
Builds on
36 of 73 references.
References · 36
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,160
- 2021Prefix-Tuning: Optimizing Continuous Prompts for Generationcited by 3,878
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
- 2023RT-2: Vision-Language-Action Models Transfer Web Knowledge to Robotic Controlcited by 2,993
- 2024OpenVLA: An Open-Source Vision-Language-Action Modelcited by 2,777
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
- 2023Large Language Modelscited by 774
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
24 more
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
- 2023A Comprehensive Overview of Large Language Modelscited by 639
- 2016Error bounds for approximations with deep ReLU networkscited by 567
- 2023Text-to-SQL Empowered by Large Language Models: A Benchmark Evaluationcited by 378
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2017Nearly-tight VC-dimension and pseudodimension bounds for piecewise linear neural networkscited by 304
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 220
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
- 2023Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learningcited by 149
- 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 112
- 2022General-Purpose In-Context Learning by Meta-Learning Transformerscited by 102
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2023In-Context Learning through the Bayesian Prismcited by 78
- 2024A Survey on Employing Large Language Models for Text-to-SQL Taskscited by 67
- 2023Meta-in-context learning in large language modelscited by 59
- 2024Dual Operating Modes of In-Context Learningcited by 42
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 39
- 2024Transformers are Minimax Optimal Nonparametric In-Context Learnerscited by 36
- 2025Can Transformers Learn Full Bayesian Inference in Context?cited by 30
- 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 29
- 2024Bayesian scaling laws for in-context learningcited by 18
- 2021Majorizing Measures, Sequential Complexities, and Online Learningcited by 17
- 2022Understanding the bias-variance tradeoff of Bregman divergencescited by 10
Built on by
Citing papers per year: 2025: 3; 2026: 14.
17 papers.
Sort:
By area:
- 2026Efficient and Minimax Optimal In-context Nonparametric Regression with Transformerscited by 7
- 2026Verbalizing LLM's Higher-order Uncertainty via Imprecise Probabilitiescited by 4
- 2026Bifrost: Steering Strategic Trajectories to Bridge Contextual Gaps for Self-Improving Agentscited by 2
- 2026Propagation of Chaos in Contextual Flow Mapscited by 2
- 2025Optimal In-context Adaptivity and Distributional Robustness of Transformerscited by 1
- 2025Scaling Laws and In-Context Learning: A Unified Theoretical Frameworkcited by 1
- 2026Bayesian Optimality of In-Context Learning with Selective State Spacescited by 1
- 2026Reasonably reasoning AI agents can avoid game-theoretic failures in zero-shot, provablycited by 1
- 2025Aligning Probabilistic Beliefs under Informative Missingness: LLM Steerability in Clinical Reasoningcited by 0
- 2026Universal priors: solving empirical Bayes via Bayesian inference and pretrainingcited by 0
- 2026Bigger Is Safer: Provable Robustness in In-Context Learning Scales with Capacitycited by 0
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adaptcited by 0
5 more
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Modelscited by 0
- 2026The Illusion of Replacement: Rethinking Specialized Machine Learning Models in the Foundation Model Eracited by 0
- 2026Unifying ICL, SFT, KL-Regularized RL Through a Bayesian Lenscited by 0
- 2026Recursive Reasoning or Statistical Extrapolation? In-Context Learning in Multi-Agent Interdependent Decision-Makingcited by 0
- 2026Understanding Generalization Requires Universal Inductioncited by 0
- 2026Understanding Generalization Requires Universal Induction28 Sep 2026
- 2026Recursive Reasoning or Statistical Extrapolation? In-Context Learning in Multi-Agent Interdependent Decision-Making16 Sep 2026
- 2026Unifying ICL, SFT, KL-Regularized RL Through a Bayesian Lens4 Sep 2026
- 2026The Illusion of Replacement: Rethinking Specialized Machine Learning Models in the Foundation Model Era29 Aug 2026
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Models5 Jul 2026
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adapt14 Jun 2026
- 2026Propagation of Chaos in Contextual Flow Maps16 May 2026
- 2026Reasonably reasoning AI agents can avoid game-theoretic failures in zero-shot, provably19 Mar 2026
- 2026Verbalizing LLM's Higher-order Uncertainty via Imprecise Probabilities11 Mar 2026
- 2026Bayesian Optimality of In-Context Learning with Selective State Spaces19 Feb 2026
- 2026Bigger Is Safer: Provable Robustness in In-Context Learning Scales with Capacity19 Feb 2026
- 2026Universal priors: solving empirical Bayes via Bayesian inference and pretraining16 Feb 2026
5 more
- 2026Bifrost: Steering Strategic Trajectories to Bridge Contextual Gaps for Self-Improving Agents5 Feb 2026
- 2026Efficient and Minimax Optimal In-context Nonparametric Regression with Transformers21 Jan 2026
- 2025Aligning Probabilistic Beliefs under Informative Missingness: LLM Steerability in Clinical Reasoning29 Nov 2025
- 2025Scaling Laws and In-Context Learning: A Unified Theoretical Framework9 Nov 2025
- 2025Optimal In-context Adaptivity and Distributional Robustness of Transformers27 Oct 2025
- 2026Reasonably reasoning AI agents can avoid game-theoretic failures in zero-shot, provablycited by 1
- 2025Aligning Probabilistic Beliefs under Informative Missingness: LLM Steerability in Clinical Reasoningcited by 0
- 2026Recursive Reasoning or Statistical Extrapolation? In-Context Learning in Multi-Agent Interdependent Decision-Makingcited by 0
- 2026Recursive Reasoning or Statistical Extrapolation? In-Context Learning in Multi-Agent Interdependent Decision-Making16 Sep 2026
- 2026Reasonably reasoning AI agents can avoid game-theoretic failures in zero-shot, provably19 Mar 2026
- 2025Aligning Probabilistic Beliefs under Informative Missingness: LLM Steerability in Clinical Reasoning29 Nov 2025
- 2026Efficient and Minimax Optimal In-context Nonparametric Regression with Transformerscited by 7
- 2026Verbalizing LLM's Higher-order Uncertainty via Imprecise Probabilitiescited by 4
- 2026Propagation of Chaos in Contextual Flow Mapscited by 2
- 2025Optimal In-context Adaptivity and Distributional Robustness of Transformerscited by 1
- 2025Scaling Laws and In-Context Learning: A Unified Theoretical Frameworkcited by 1
- 2026Universal priors: solving empirical Bayes via Bayesian inference and pretrainingcited by 0
- 2026Bigger Is Safer: Provable Robustness in In-Context Learning Scales with Capacitycited by 0
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adaptcited by 0
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Modelscited by 0
- 2026The Illusion of Replacement: Rethinking Specialized Machine Learning Models in the Foundation Model Eracited by 0
- 2026Understanding Generalization Requires Universal Inductioncited by 0
- 2026Understanding Generalization Requires Universal Induction28 Sep 2026
- 2026The Illusion of Replacement: Rethinking Specialized Machine Learning Models in the Foundation Model Era29 Aug 2026
- 2026A Unified Framework for In-Context Learning with Causal and Masked Language Models5 Jul 2026
- 2026A Decision-Theoretic View of Test-Time Training: When, How Far, and Which Directions to Adapt14 Jun 2026
- 2026Propagation of Chaos in Contextual Flow Maps16 May 2026
- 2026Verbalizing LLM's Higher-order Uncertainty via Imprecise Probabilities11 Mar 2026
- 2026Bigger Is Safer: Provable Robustness in In-Context Learning Scales with Capacity19 Feb 2026
- 2026Universal priors: solving empirical Bayes via Bayesian inference and pretraining16 Feb 2026
- 2026Efficient and Minimax Optimal In-context Nonparametric Regression with Transformers21 Jan 2026
- 2025Scaling Laws and In-Context Learning: A Unified Theoretical Framework9 Nov 2025
- 2025Optimal In-context Adaptivity and Distributional Robustness of Transformers27 Oct 2025