What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalization
Not on the map. Why?
Abstract (arXiv)
In this paper, we conduct a comprehensive study of In-Context Learning (ICL) by addressing several open questions: (a) What type of ICL estimator is learned by large language models? (b) What is a proper performance metric for ICL and what is the error rate? (c) How does the transformer architecture enable ICL? To answer these questions, we adopt a Bayesian view and formulate ICL as a problem of predicting the response corresponding to the current covariate, given a number of examples drawn from a latent variable model. To answer (a), we show that, without updating the neural network parameters, ICL implicitly implements the Bayesian model averaging algorithm, which is proven to be approximately parameterized by the attention mechanism. For (b), we analyze the ICL performance from an online learning perspective and establish a O(1/T) regret bound for perfectly pretrained ICL, where T is the number of examples in the prompt. To answer (c), we show that, in addition to encoding Bayesian model averaging via attention, the transformer architecture also enables a fine-grained statistical analysis of pretraining under realistic assumptions. In particular, we prove that the error of pretrained model is bounded by a sum of an approximation error and a generalization error, where the former decays to zero exponentially as the depth grows, and the latter decays to zero sublinearly with the number of tokens in the pretraining dataset. Our results provide a unified understanding of the transformer and its ICL ability with bounds on ICL regret, approximation, and generalization, which deepens our knowledge of these essential aspects of modern language models.
Key facts. Cited by 112 papers in the map (data through 7 Oct 2026). Builds on 54 of its 76 references that are in the map. First posted on arXiv 30 May 2023.
Builds on
54 of 76 references.
References · 54
- 2017Attention Is All You Needcited by 59,932
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2021Learning Transferable Visual Models From Natural Language Supervisioncited by 33,456
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2022Large Language Models are Zero-Shot Reasonerscited by 4,323
- 2021Finetuned Language Models Are Zero-Shot Learnerscited by 3,747
- 2022Self-Instruct: Aligning Language Models with Self-Generated Instructionscited by 2,674
- 2022Emergent Abilities of Large Language Modelscited by 2,483
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,222
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
38 more
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2017Deep Setscited by 1,394
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
- 2019TinyBERT: Distilling BERT for Natural Language Understandingcited by 1,153
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
- 2022Large Language Models Are Human-Level Prompt Engineerscited by 1,020
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
- 2019Are Sixteen Heads Really Better than One?cited by 803
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2022Automatic Chain of Thought Prompting in Large Language Modelscited by 684
- 2017Spectrally-normalized margin bounds for neural networkscited by 681
- 2018MINE: Mutual Information Neural Estimationcited by 680
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
- 2019Unified Language Model Pre-training for Natural Language Understanding and Generationcited by 668
- 2021Learning To Retrieve Prompts for In-Context Learningcited by 641
- 2016Error bounds for approximations with deep ReLU networkscited by 567
- 2021MetaICL: Learning to Learn In Contextcited by 450
- 2019Are Transformers universal approximators of sequence-to-sequence functions?cited by 404
- 2017A PAC-Bayesian Approach to Spectrally-Normalized Margin Bounds for Neural Networkscited by 309
- 2023Towards Revealing the Mystery behind Chain of Thought: A Theoretical Perspectivecited by 293
- 2022OPT-IML: Scaling Language Model Instruction Meta Learning through the Lens of Generalizationcited by 235
- 2020FLAMBE: Structural Complexity and Representation Learning of Low Rank MDPscited by 232
- 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 220
- 2020Rethinking Positional Encoding in Language Pre-trainingcited by 197
- 2022Instruction Induction: From Few Examples to Natural Language Task Descriptionscited by 152
- 2021Inductive Biases and Variable Creation in Self-Attention Mechanismscited by 144
- 2020Tensor Programs II: Neural Tangent Kernel for Any Architecturecited by 139
- 2022Signal Propagation in Transformers: Theoretical Perspectives and the Role of Rank Collapsecited by 136
- 2023The Learnability of In-Context Learningcited by 126
- 2022A Kernel-Based View of Language Model Fine-Tuningcited by 118
- 2020Infinite attention: NNGP and NTK for deep attention networkscited by 117
- 2021Statistically Meaningful Approximation: a Case Study on Approximating Turing Machines with Transformerscited by 101
- 2019Deep Neural Network Approximation Theorycited by 92
- 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
- 2020A PAC-Bayesian Approach to Generalization Bounds for Graph Neural Networkscited by 84
- 2022Self-Generated In-Context Learning: Leveraging Auto-regressive Language Models as a Demonstration Generatorcited by 68
- 2020A Mathematical Theory of Attentioncited by 43
50 most cited of 54 All 54 (JSON)
Built on by
Citing papers per year: 2023: 16; 2024: 37; 2025: 31; 2026: 28.
112 papers.
Sort:
By area:
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2023Function Vectors in Large Language Modelscited by 292
- 2023In-Context Convergence of Transformerscited by 112
- 2023Are Emergent Abilities in Large Language Models just In-Context Learning?cited by 109
- 2025A Survey of Frontiers in LLM Reasoning: Inference Scaling, Learning to Reason, and Agentic Systemscited by 108
- 2023Should we be going MAD? A Look at Multi-Agent Debate Strategies for LLMscited by 103
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2024Position: Graph Foundation Models are Already Herecited by 84
- 2024Can large language models explore in-context?cited by 75
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 72
- 2025Test-time regression: a unifying framework for designing sequence models with associative memorycited by 63
- 2024Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspectivecited by 51
38 more
- 2023Let Models Speak Ciphers: Multiagent Debate through Embeddingscited by 49
- 2023In-Context Learning Learns Label Relationships but Is Not Conventional Learningcited by 48
- 2023Reason for Future, Act for Now: A Principled Framework for Autonomous LLM Agents with Provable Sample Efficiencycited by 46
- 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 43
- 2024A Theoretical Understanding of Self-Correction through In-context Alignmentcited by 43
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 39
- 2024In-Context Learning with Representations: Contextual Generalization of Trained Transformerscited by 36
- 2023The Mystery of In-Context Learning: A Comprehensive Survey on Interpretation and Analysiscited by 34
- 2024Do LLM Agents Have Regret? A Case Study in Online Learning and Gamescited by 33
- 2024Large Language Models as Markov Chainscited by 33
- 2024Pretrained transformer efficiently learns low-dimensional target functions in-contextcited by 29
- 2024Deciphering the Factors Influencing the Efficacy of Chain-of-Thought: Probability, Memorization, and Noisy Reasoningcited by 27
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methodscited by 27
- 2024Mind the Inconspicuous: Revealing the Hidden Weakness in Aligned LLMs' Refusal Boundariescited by 26
- 2025From Debate to Equilibrium: Belief-Driven Multi-Agent LLM Reasoning via Bayesian Nash Equilibriumcited by 24
- 2025Belief Dynamics Reveal the Dual Nature of In-Context Learning and Activation Steeringcited by 24
- 2024Can In-context Learning Really Generalize to Out-of-distribution Tasks?cited by 23
- 2025AURORA:Automated Training Framework of Universal Process Reward Models via Ensemble Prompting and Reverse Verificationcited by 22
- 2024Estimating the Hallucination Rate of Generative AIcited by 20
- 2025LongSpec: Long-Context Lossless Speculative Decoding with Efficient Drafting and Verificationcited by 19
- 2025Enough Coin Flips Can Make LLMs Act Bayesiancited by 19
- 2024Bayesian scaling laws for in-context learningcited by 18
- 2023Trainable Transformer in Transformercited by 17
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learningcited by 17
- 2024LLMs as Models for Analogical Reasoningcited by 16
- 2023Towards Understanding How Transformers Learn In-context Through a Representation Learning Lenscited by 15
- 2024On the Training Convergence of Transformers for In-Context Classification of Gaussian Mixturescited by 15
- 2025A Theoretical Perspective: How to Prevent Model Collapse in Self-consuming Training Loopscited by 15
- 2025Toward Efficient Exploration by Large Language Model Agentscited by 15
- 2023In-Context Learning Dynamics with Random Binary Sequencescited by 13
- 2024Everything Everywhere All at Once: LLMs can In-Context Learn Multiple Tasks in Superpositioncited by 13
- 2024A Survey to Recent Progress Towards Understanding In-Context Learningcited by 12
- 2024LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptationcited by 11
- 2025Learning Task Representations from In-Context Learningcited by 11
- 2024Dissecting the Interplay of Attention Paths in a Statistical Mechanics Theory of Transformerscited by 9
- 2024Training Dynamics of Transformers to Recognize Word Co-occurrence via Gradient Flow Analysiscited by 8
- 2023Gen-Z: Generative Zero-Shot Text Classification with Contextualized Label Descriptionscited by 7
- 2024Rectifying Demonstration Shortcut in In-Context Learningcited by 7
50 most cited of 112 All 112 (JSON)
- 2026What can linear attention learn from nonlinear teachers in-context?7 Oct 2026
- 2026Bayesian Fine-tuning Yields Language Models that are as Bayesian as their Beliefs Allow30 Sep 2026
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026ALICE: In-context, Zero-shot, Mutual Information Estimation28 Sep 2026
- 2026Transformers as In-Context Samplers: From Closed-Form Diffusion to Estimation-Free Sampling8 Sep 2026
- 2026EvoHarness-RL: Learning Self-Evolving Runtime Harness for Long-Horizon LLM Agents5 Aug 2026
- 2026An Auto-Scaling Approach for Serverless Environments Based on a Multi-Expert Consensus Mechanism16 Jul 2026
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatch4 Jul 2026
- 2026Induction Heads Interpolate N-Grams2 Jul 2026
- 2026From Drift to Coherence: Stabilizing Beliefs in LLMs16 Jun 2026
- 2026OpenRFM: Dissecting Relational In-Context Learning3 Jun 2026
- 2026Why Do Time Series Models Need Long Context Windows?1 Jun 2026
38 more
- 2026Distributional Alignment as a Criterion for Designing Task Vectors in In-Context Learning20 May 2026
- 2026TabQL: In-Context Q-Learning with Tabular Foundation Models18 May 2026
- 2026Ensembling Tabular Foundation Models - A Diversity Ceiling And A Calibration Trap18 May 2026
- 2026Hypothesis generation and updating in large language models7 May 2026
- 2026In-Context Learning Under Regime Change18 Apr 2026
- 2026A Bayesian Perspective on the Role of Epistemic Uncertainty for Delayed Generalization in In-Context Learning14 Apr 2026
- 2026Symmetry Reveals Layerwise Dynamics: How Transformers Perform In-Context Classification13 Apr 2026
- 2026Transformers Learn Latent Mixture Models In-Context via Mirror Descent12 Apr 2026
- 2026Reasonably reasoning AI agents can avoid game-theoretic failures in zero-shot, provably19 Mar 2026
- 2026Reconciling In-Context and In-Weight Learning via Dual Representation Space Encoding13 Mar 2026
- 2026Meta-Sel: Efficient Demonstration Selection for In-Context Learning via Supervised Meta-Learning12 Feb 2026
- 2026In-Context Function Learning in Large Language Models12 Feb 2026
- 2026Learning to Remember, Learn, and Forget in Attention-Based Models9 Feb 2026
- 2026Reasoning aligns language models to human cognition9 Feb 2026
- 2026Why Self-Rewarding Works: Theoretical Guarantees for Iterative Alignment of Language Models30 Jan 2026
- 2026MicLog: Towards Accurate and Efficient LLM-based Log Parsing via Progressive Meta In-Context Learning11 Jan 2026
- 2025Token Sample Complexity of Attention11 Dec 2025
- 2025On the Limits of Test-Time Compute: Sequential Reward Filtering for Better Inference4 Dec 2025
- 2025Belief Dynamics Reveal the Dual Nature of In-Context Learning and Activation Steering1 Nov 2025
- 2025Optimal In-context Adaptivity and Distributional Robustness of Transformers27 Oct 2025
- 2025A Framework for Quantifying How Pre-Training and Context Benefit In-Context Learning26 Oct 2025
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning13 Oct 2025
- 2025Pretrain-Test Task Alignment Governs Generalization in In-Context Learning30 Sep 2025
- 2025Provable In-Context Learning of Nonlinear Regression with Transformers28 Jul 2025
- 2025Learning-to-Context Slope: Evaluating In-Context Learning Effectiveness Beyond Performance Illusions29 Jun 2025
- 2025Brewing Knowledge in Context: Distillation Perspectives on In-Context Learning13 Jun 2025
- 2025From Debate to Equilibrium: Belief-Driven Multi-Agent LLM Reasoning via Bayesian Nash Equilibrium9 Jun 2025
- 2025Transformers Meet In-Context Learning: A Universal Approximation Theory5 Jun 2025
- 2025Neither Stochastic Parroting nor AGI: LLMs Solve Tasks through Context-Directed Extrapolation from Training Data Priors29 May 2025
- 2025The Role of Diversity in In-Context Learning for Large Language Models26 May 2025
- 2025Adversarially Pretrained Transformers May Be Universally Robust In-Context Learners20 May 2025
- 2025Toward Efficient Exploration by Large Language Model Agents29 Apr 2025
- 2025A Theoretical Framework for OOD Robustness in Transformers using Gevrey Classes17 Apr 2025
- 2025Reasoning without Regret14 Apr 2025
- 2025A Survey of Frontiers in LLM Reasoning: Inference Scaling, Learning to Reason, and Agentic Systems12 Apr 2025
- 2025Enough Coin Flips Can Make LLMs Act Bayesian6 Mar 2025
- 2025A Theoretical Perspective: How to Prevent Model Collapse in Self-consuming Training Loops26 Feb 2025
- 2025LongSpec: Long-Context Lossless Speculative Decoding with Efficient Drafting and Verification24 Feb 2025
50 newest of 112 All 112 (JSON)
- 2025A Survey of Frontiers in LLM Reasoning: Inference Scaling, Learning to Reason, and Agentic Systemscited by 108
- 2023Let Models Speak Ciphers: Multiagent Debate through Embeddingscited by 49
- 2024A Theoretical Understanding of Self-Correction through In-context Alignmentcited by 43
- 2024Deciphering the Factors Influencing the Efficacy of Chain-of-Thought: Probability, Memorization, and Noisy Reasoningcited by 27
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methodscited by 27
- 2025From Debate to Equilibrium: Belief-Driven Multi-Agent LLM Reasoning via Bayesian Nash Equilibriumcited by 24
- 2025AURORA:Automated Training Framework of Universal Process Reward Models via Ensemble Prompting and Reverse Verificationcited by 22
- 2024LLMs as Models for Analogical Reasoningcited by 16
- 2024LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptationcited by 11
- 2025On the Limits of Test-Time Compute: Sequential Reward Filtering for Better Inferencecited by 6
- 2026Reasoning aligns language models to human cognitioncited by 2
- 2026Reasonably reasoning AI agents can avoid game-theoretic failures in zero-shot, provablycited by 1
12 most cited of 15 All 15 (JSON)
- 2026Reasonably reasoning AI agents can avoid game-theoretic failures in zero-shot, provably19 Mar 2026
- 2026Reasoning aligns language models to human cognition9 Feb 2026
- 2025On the Limits of Test-Time Compute: Sequential Reward Filtering for Better Inference4 Dec 2025
- 2025From Debate to Equilibrium: Belief-Driven Multi-Agent LLM Reasoning via Bayesian Nash Equilibrium9 Jun 2025
- 2025Neither Stochastic Parroting nor AGI: LLMs Solve Tasks through Context-Directed Extrapolation from Training Data Priors29 May 2025
- 2025Reasoning without Regret14 Apr 2025
- 2025A Survey of Frontiers in LLM Reasoning: Inference Scaling, Learning to Reason, and Agentic Systems12 Apr 2025
- 2025AURORA:Automated Training Framework of Universal Process Reward Models via Ensemble Prompting and Reverse Verification17 Feb 2025
- 2024Rethinking Associative Memory Mechanism in Induction Head16 Dec 2024
- 2024LightTransfer: Your Long-Context LLM is Secretly a Hybrid Model with Effortless Adaptation17 Oct 2024
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methods25 Aug 2024
- 2024Deciphering the Factors Influencing the Efficacy of Chain-of-Thought: Probability, Memorization, and Noisy Reasoning1 Jul 2024
12 newest of 15 All 15 (JSON)
- 2023Should we be going MAD? A Look at Multi-Agent Debate Strategies for LLMscited by 103
- 2024Do LLM Agents Have Regret? A Case Study in Online Learning and Gamescited by 33
- 2025LongSpec: Long-Context Lossless Speculative Decoding with Efficient Drafting and Verificationcited by 19
- 2025Toward Efficient Exploration by Large Language Model Agentscited by 15
- 2026EvoHarness-RL: Learning Self-Evolving Runtime Harness for Long-Horizon LLM Agentscited by 1
- 2026EvoHarness-RL: Learning Self-Evolving Runtime Harness for Long-Horizon LLM Agents5 Aug 2026
- 2025Toward Efficient Exploration by Large Language Model Agents29 Apr 2025
- 2025LongSpec: Long-Context Lossless Speculative Decoding with Efficient Drafting and Verification24 Feb 2025
- 2024Do LLM Agents Have Regret? A Case Study in Online Learning and Games25 Mar 2024
- 2023Should we be going MAD? A Look at Multi-Agent Debate Strategies for LLMs29 Nov 2023
- 2024Bayesian scaling laws for in-context learningcited by 18
- 2024Bayesian scaling laws for in-context learning21 Oct 2024
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2023Function Vectors in Large Language Modelscited by 292
- 2023In-Context Convergence of Transformerscited by 112
- 2023Are Emergent Abilities in Large Language Models just In-Context Learning?cited by 109
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2024Position: Graph Foundation Models are Already Herecited by 84
- 2024Can large language models explore in-context?cited by 75
- 2023How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with Representationscited by 72
- 2025Test-time regression: a unifying framework for designing sequence models with associative memorycited by 63
- 2024Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspectivecited by 51
- 2023In-Context Learning Learns Label Relationships but Is Not Conventional Learningcited by 48
- 2024Transformers Learn Nonlinear Features In Context: Nonconvex Mean-field Dynamics on the Attention Landscapecited by 43
12 most cited of 86 All 86 (JSON)
- 2026What can linear attention learn from nonlinear teachers in-context?7 Oct 2026
- 2026Bayesian Fine-tuning Yields Language Models that are as Bayesian as their Beliefs Allow30 Sep 2026
- 2026Theory on Attention Dynamics for Out-of-Distribution In-Context Learning29 Sep 2026
- 2026ALICE: In-context, Zero-shot, Mutual Information Estimation28 Sep 2026
- 2026Transformers as In-Context Samplers: From Closed-Form Diffusion to Estimation-Free Sampling8 Sep 2026
- 2026An Auto-Scaling Approach for Serverless Environments Based on a Multi-Expert Consensus Mechanism16 Jul 2026
- 2026Sequential Correlations Change In-Context Learning: Effective Context Length and Architectural Mismatch4 Jul 2026
- 2026Induction Heads Interpolate N-Grams2 Jul 2026
- 2026From Drift to Coherence: Stabilizing Beliefs in LLMs16 Jun 2026
- 2026OpenRFM: Dissecting Relational In-Context Learning3 Jun 2026
- 2026Why Do Time Series Models Need Long Context Windows?1 Jun 2026
- 2026Distributional Alignment as a Criterion for Designing Task Vectors in In-Context Learning20 May 2026
12 newest of 86 All 86 (JSON)