A Unified Framework for In-Context Learning with Causal and Masked Language Models
Not on the map. Why?
Abstract (arXiv)
In-context learning (ICL) has emerged as a central capability of pretrained language models, yet its theoretical analysis has focused primarily on causal language models trained by left-to-right autoregressive prediction, such as GPT-style models. Masked language models instead recover masked tokens from bidirectional context, and their role in ICL remains less understood. We develop a statistical learning framework that represents the context examples by their empirical measure and models prediction as a function of the context and the query. This formulation places autoregressive and masked pretraining objectives within a common excess-risk analysis. Under Wasserstein-type regularity conditions, we relate pretraining with T tasks and N samples per task to k-shot excess risk at inference, obtaining same-order upper bounds for masked and autoregressive objectives. We also study task-distribution shift, where pretraining tasks are sampled from P and inference tasks from Q; the resulting bound contains an additional term controlled by the lifted Wasserstein distance between P and Q. The bounds further imply an order-optimal allocation under a fixed pretraining data budget and refined rates under intrinsic low-dimensional structure. Experiments on controlled function-learning tasks show that the Masked Pair Encoder (MPE) can achieve performance comparable to GPT-2-style causal Transformers, suggesting that ICL behavior is not specific to causal language models.
Key facts. No citing papers in the map yet (data through 7 Oct 2026). Builds on 41 of its 61 references that are in the map. First posted on arXiv 5 Jul 2026.
Builds on
41 of 61 references.
References · 41
- 2018BERT: Pre-training of Deep Bidirectional Transformers for Language Understandingcited by 40,204
- 2022Training Compute-Optimal Large Language Modelscited by 2,927
- 2020DeBERTa: Decoding-enhanced BERT with Disentangled Attentioncited by 2,157
- 2018Reconciling modern machine learning practice and the bias-variance trade-offcited by 919
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 700
- 2021Transformers Can Do Bayesian Inferencecited by 338
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2021The Intrinsic Dimension of Images and Its Impact on Learningcited by 307
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 291
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
29 more
- 2023Looped Transformers as Programmable Computerscited by 224
- 2023Transformers as Algorithms: Generalization and Stability in In-context Learningcited by 220
- 2015The Benefit of Multitask Representation Learningcited by 194
- 2023Pretraining task diversity and the emergence of non-Bayesian in-context learning for regressioncited by 138
- 2021Sinkformers: Transformers with Doubly Stochastic Attentioncited by 136
- 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
- 2014Learning Theory for Distribution Regressioncited by 48
- 2023Transformers Learn to Achieve Second-Order Convergence Rates for In-Context Linear Regressioncited by 47
- 2024Transformers are Minimax Optimal Nonparametric In-Context Learnerscited by 36
- 2024Can In-context Learning Really Generalize to Out-of-distribution Tasks?cited by 23
- 2013Distribution-Free Distribution Regressioncited by 21
- 2021Intrinsic Dimension Estimation Using Wasserstein Distancescited by 20
- 2023Data Management For Training Large Language Models: A Surveycited by 17
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learningcited by 17
- 2023A survey and taxonomy of loss functions in machine learningcited by 15
- 2025When can in-context learning generalize out of task distribution?cited by 13
- 2024BERTs are Generative In-Context Learnerscited by 11
- 2024On the Statistical Properties of Generative Adversarial Models for Low Intrinsic Data Dimensioncited by 10
- 2021On the Regularity of Attentioncited by 9
- 2021How to distribute data across tasks for meta-learning?cited by 7
- 2024Automatic Domain Adaptation by Transformers in In-Context Learningcited by 7
- 2026Efficient and Minimax Optimal In-context Nonparametric Regression with Transformerscited by 7
- 2024Context-Scaling versus Task-Scaling in In-Context Learningcited by 6
- 2025Out-of-Distribution Generalization of In-Context Learning: A Low-Dimensional Subspace Perspectivecited by 5
- 2026Approximation Theory for Lipschitz Continuous Transformerscited by 5
- 2026Transformers as Measure-Theoretic Associative Memory: A Statistical Perspective and Minimax Optimalitycited by 3
- 2025In-Context Learning as Nonparametric Conditional Probability Estimation: Risk Bounds and Optimalitycited by 2
- 2026Beyond the Prompt in Large Language Models: Comprehension, In-Context Learning, and Chain-of-Thoughtcited by 1
Built on by
Not cited yet.