The Price of Choosing Examples: Context Overfitting in Adaptive In-Context Learning
Not on the map. Why?
Abstract (arXiv)
In-context learning is usually analyzed as if the examples in the prompt were sampled before the learner is chosen. In deployed systems they are not: examples are retrieved, filtered, re-ranked, edited, and repeatedly tested after seeing the query and the data store. We formalize this gap by treating prompt construction as adaptive data analysis through a conditional stochastic-kernel calculus. Our main quantity is the context capacity, the mutual information or approximate max-information between the data store and the final prompt transcript. For any frozen in-context learner and any adaptive context pipeline with capacity kappa, we prove a finite-sample context generalization bound of order √kappa/k, where k is the number of selected examples whose losses form the reported score. We prove a matching lower bound, whose constant is exact when log kllkappall k, and derive two PAC-Bayesian retrieval rules: a first-order Gibbs rule that charges data-dependent candidate gates their prior mass, and a self-normalized second-order rule. On Banking77 with 64 retrieval recipes and two model families, the certificates hold in all 24,000 resampled selection events, and from 64 (Qwen2.5-7B) or 128 (GPT-4.1-mini) reused validation queries the Gibbs rule certifies a risk below the zero-shot error in over 99% of validation draws. Finally, we instantiate the theory for Bayesian linear in-context regression, including an order-statistics analysis of query-aligned top-k Gaussian retrieval. The results separate context quality from context certification: longer or more relevant contexts improve risk only when the procedure used to choose them is stable enough for selected-context evidence to transfer.
Key facts. No citing papers in the map yet (data through 24 Nov 2026). Builds on 29 of its 48 references that are in the map. Submitted 16 Nov 2026.
Builds on
29 of 48 references.
References · 29
- 2017Attention Is All You Needcited by 62,125
- 2020Language Models are Few-Shot Learnerscited by 33,113
- 2023Efficient Memory Management for Large Language Model Serving with PagedAttentioncited by 6,685
- 2024Qwen2.5 Technical Reportcited by 5,525
- 2022Transformers learn in-context by gradient descentcited by 763
- 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 754
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 729
- 2023C-Pack: Packed Resources For General Chinese Embeddingscited by 701
- 2020Efficient Intent Detection with Dual Sentence Encoderscited by 478
- 2017Information-theoretic analysis of generalization capability of learning algorithmscited by 313
- 2018Time-uniform, nonparametric, nonasymptotic confidence sequencescited by 267
- 2020Estimating means of bounded random variables by bettingcited by 202
17 more
- 2020Reasoning About Generalization via Conditional Mutual Informationcited by 153
- 2019Tightening Mutual Information Based Bounds on Generalization Errorcited by 119
- 2013Exact post-selection inference, with application to the lassocited by 99
- 2015Algorithmic Stability for Adaptive Data Analysiscited by 94
- 2015Generalization in Adaptive Data Analysis and Holdout Reusecited by 88
- 2015The Ladder: A Reliable Leaderboard for Machine Learning Competitionscited by 81
- 2014Optimal Inference After Model Selectioncited by 77
- 2024Asymptotic theory of in-context learning by linear attentioncited by 68
- 2019PAC-Bayes Un-Expected Bernstein Inequalitycited by 38
- 2020Information-Theoretic Generalization Bounds for Meta-Learning and Applicationscited by 33
- 2017Calibrating Noise to Variance in Adaptive Data Analysiscited by 31
- 2016Max-Information, Differential Privacy, and Post-Selection Hypothesis Testingcited by 30
- 2025Theory of Scaling Laws for In-Context Regression: Depth, Width, Context and Timecited by 21
- 2025Pretrain-Test Task Alignment Governs Generalization in In-Context Learningcited by 12
- 2024Uniform Generalization Bounds on Data-Dependent Hypothesis Sets via PAC-Bayesian Theory on Random Setscited by 10
- 2025In-Context Linear Regression Demystified: Training Dynamics and Mechanistic Interpretability of Multi-Head Softmax Attentioncited by 10
- 2025Retrieval-Augmented Generation as Noisy In-Context Learning: A Unified Theory and Risk Boundscited by 5
Built on by
Not cited yet.