Bayesian scaling laws for in-context learning
On the map: LLM safety and security → Jailbreaking
Abstract (arXiv)
In-context learning (ICL) is a powerful technique for getting language models to perform complex tasks with no training updates. Prior work has established strong correlations between the number of in-context examples provided and the accuracy of the model's predictions. In this paper, we seek to explain this correlation by showing that ICL approximates a Bayesian learner. This perspective gives rise to a novel Bayesian scaling law for ICL. In experiments with mboxGPT-2 models of different sizes, our scaling law matches existing scaling laws in accuracy while also offering interpretable terms for task priors, learning efficiency, and per-example probabilities. To illustrate the analytic power that such interpretable scaling laws provide, we report on controlled synthetic dataset experiments designed to inform real-world studies of safety alignment. In our experimental protocol, we use SFT or DPO to suppress an unwanted existing model capability and then use ICL to try to bring that capability back (many-shot jailbreaking). We then study ICL on real-world instruction-tuned LLMs using capabilities benchmarks as well as a new many-shot jailbreaking dataset. In all cases, Bayesian scaling laws accurately predict the conditions under which ICL will cause suppressed behaviors to reemerge, which sheds light on the ineffectiveness of post-training at increasing LLM safety.
Key facts. Cited by 19 papers in the map (data through 14 Oct 2026). Placed in Jailbreaking, one of 12 directions in LLM safety and security. Builds on 41 of its 49 references that are in the map. First posted on arXiv 21 Oct 2024.
Builds on
41 of 49 references.
Closest ancestors · 5
Same direction, newest first
- 2024Latent Adversarial Training Improves Robustness to Persistent Harmful Behaviors in LLMs22 Jul
- 2024Coercing LLMs to do and reveal (almost) anything21 Feb
- 2024Soft Prompt Threats: Attacking Safety Alignment and Unlearning in Open-Source LLMs through the Embedding Space14 Feb
- 2023Jailbreak and Guard Aligned Language Models with Only Few In-Context Demonstrations10 Oct
- 2023Universal and Transferable Adversarial Attacks on Aligned Language Models27 Jul
Other references · 36
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2019PyTorch: An Imperative Style, High-Performance Deep Learning Librarycited by 20,305
- 2023Direct Preference Optimization: Your Language Model is Secretly a Reward Modelcited by 8,065
- 2020Scaling Laws for Neural Language Modelscited by 6,586
- 2022Training Compute-Optimal Large Language Modelscited by 3,019
- 2024HarmBench: A Standardized Evaluation Framework for Automated Red Teaming and Robust Refusalcited by 1,429
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
- 2022Discovering Language Model Behaviors with Model-Written Evaluationscited by 836
- 2022Transformers learn in-context by gradient descentcited by 732
- 2023Extracting Training Data from Diffusion Modelscited 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
24 more
- 2024Safety Alignment Should Be Made More Than Just a Few Tokens Deepcited by 472
- 2023Transformers as Statisticians: Provable In-Context Learning with In-Context Algorithm Selectioncited by 298
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
- 2023Jailbreak in pieces: Compositional Adversarial Attacks on Multi-Modal Language Modelscited by 273
- 2024Smaug: Fixing Failure Modes of Preference Optimisation with DPO-Positivecited by 241
- 2024Assessing the Brittleness of Safety Alignment via Pruning and Low-Rank Modificationscited by 231
- 2020Retrieve, Program, Repeat: Complex Knowledge Base Question Answering via Alternate Meta-learningcited by 216
- 2024Many-Shot In-Context Learningcited by 206
- 2024A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and Toxicitycited by 185
- 2024Fine-Tuning Enhances Existing Mechanisms: A Case Study on Entity Trackingcited by 149
- 2022Revisiting Neural Scaling Laws in Language and Visioncited by 132
- 2023The Learnability of In-Context Learningcited by 127
- 2023What and How does In-Context Learning Learn? Bayesian Model Averaging, Parameterization, and Generalizationcited by 118
- 2023Mechanistically analyzing the effects of fine-tuning on procedurally defined taskscited by 115
- 2022Broken Neural Scaling Lawscited by 109
- 2021CREAK: A Dataset for Commonsense Reasoning over Entity Knowledgecited by 88
- 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
- 2024Chinchilla Scaling: A replication attemptcited by 72
- 2024Towards Analyzing and Understanding the Limitations of DPO: A Theoretical Perspectivecited by 69
- 2024Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspectivecited by 57
- 2024Anchored Preference Optimization and Contrastive Revisions: Addressing Underspecification in Alignmentcited by 46
- 2023A Latent Space Theory for Emergent Abilities in Large Language Modelscited by 43
- 2024LLMs learn governing principles of dynamical systems, revealing an in-context neural scaling lawcited by 32
- 2024gzip Predicts Data-dependent Scaling Lawscited by 16
Built on by
Citing papers per year: 2024: 1; 2025: 12; 2026: 6.
19 papers.
Sort:
By area:
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMscited by 64
- 2025How Do Large Language Monkeys Get Their Power (Laws)?cited by 43
- 2025Belief Dynamics Reveal the Dual Nature of In-Context Learning and Activation Steeringcited by 29
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learningcited by 22
- 2024A Implies B: Circuit Analysis in LLMs for Propositional Logical Reasoningcited by 15
- 2025ContextNav: Towards Agentic Multimodal In-Context Learningcited by 10
- 2025Transformer learns the cross-task prior and regularization for in-context learningcited by 7
- 2025Next-token pretraining implies in-context learningcited by 5
- 2025Why is prompting hard? Understanding prompts on binary sequence predictorscited by 4
- 2025Transformers Don't In-Context Learn Least Squares Regressioncited by 3
- 2026Stories in Space: In-Context Learning Trajectories in Conceptual Belief Spacecited by 3
- 2025Evaluating the Robustness of Chinchilla Compute-Optimal Scalingcited by 2
7 more
- 2026Learning to Remember, Learn, and Forget in Attention-Based Modelscited by 2
- 2026Item Response Scaling Laws: A Measurement Theory Approach for Efficient and Generalizable Neural Scaling Estimationcited by 2
- 2025On the Relationship Between the Choice of Representation and In-Context Learningcited by 1
- 2025Aligning Probabilistic Beliefs under Informative Missingness: LLM Steerability in Clinical Reasoningcited by 0
- 2026Limits of Reliability and Scaling in Language Modelscited by 0
- 2026You Are What You Read: Misalignment via In-Context Persona Inductioncited by 0
- 2026Linear RNN Scaling Laws: When Longer Sequences Beat More Sequencescited by 0
- 2026You Are What You Read: Misalignment via In-Context Persona Induction6 Sep 2026
- 2026Linear RNN Scaling Laws: When Longer Sequences Beat More Sequences23 Aug 2026
- 2026Item Response Scaling Laws: A Measurement Theory Approach for Efficient and Generalizable Neural Scaling Estimation29 May 2026
- 2026Stories in Space: In-Context Learning Trajectories in Conceptual Belief Space12 May 2026
- 2026Limits of Reliability and Scaling in Language Models8 May 2026
- 2026Learning to Remember, Learn, and Forget in Attention-Based Models9 Feb 2026
- 2025Aligning Probabilistic Beliefs under Informative Missingness: LLM Steerability in Clinical Reasoning29 Nov 2025
- 2025Belief Dynamics Reveal the Dual Nature of In-Context Learning and Activation Steering1 Nov 2025
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning13 Oct 2025
- 2025On the Relationship Between the Choice of Representation and In-Context Learning9 Oct 2025
- 2025ContextNav: Towards Agentic Multimodal In-Context Learning6 Oct 2025
- 2025Evaluating the Robustness of Chinchilla Compute-Optimal Scaling28 Sep 2025
7 more
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMs11 Sep 2025
- 2025Transformers Don't In-Context Learn Least Squares Regression13 Jul 2025
- 2025Next-token pretraining implies in-context learning23 May 2025
- 2025Transformer learns the cross-task prior and regularization for in-context learning17 May 2025
- 2025How Do Large Language Monkeys Get Their Power (Laws)?24 Feb 2025
- 2025Why is prompting hard? Understanding prompts on binary sequence predictors15 Feb 2025
- 2024A Implies B: Circuit Analysis in LLMs for Propositional Logical Reasoning6 Nov 2024
- 2025ContextNav: Towards Agentic Multimodal In-Context Learningcited by 10
- 2025How Do Large Language Monkeys Get Their Power (Laws)?cited by 43
- 2025How Do Large Language Monkeys Get Their Power (Laws)?24 Feb 2025
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMscited by 64
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learningcited by 22
- 2025Transformer learns the cross-task prior and regularization for in-context learningcited by 7
- 2025Next-token pretraining implies in-context learningcited by 5
- 2025Why is prompting hard? Understanding prompts on binary sequence predictorscited by 4
- 2025Transformers Don't In-Context Learn Least Squares Regressioncited by 3
- 2026Stories in Space: In-Context Learning Trajectories in Conceptual Belief Spacecited by 3
- 2025Evaluating the Robustness of Chinchilla Compute-Optimal Scalingcited by 2
- 2026Learning to Remember, Learn, and Forget in Attention-Based Modelscited by 2
- 2026Item Response Scaling Laws: A Measurement Theory Approach for Efficient and Generalizable Neural Scaling Estimationcited by 2
- 2025On the Relationship Between the Choice of Representation and In-Context Learningcited by 1
- 2026Limits of Reliability and Scaling in Language Modelscited by 0
12 most cited of 14 All 14 (JSON)
- 2026You Are What You Read: Misalignment via In-Context Persona Induction6 Sep 2026
- 2026Linear RNN Scaling Laws: When Longer Sequences Beat More Sequences23 Aug 2026
- 2026Item Response Scaling Laws: A Measurement Theory Approach for Efficient and Generalizable Neural Scaling Estimation29 May 2026
- 2026Stories in Space: In-Context Learning Trajectories in Conceptual Belief Space12 May 2026
- 2026Limits of Reliability and Scaling in Language Models8 May 2026
- 2026Learning to Remember, Learn, and Forget in Attention-Based Models9 Feb 2026
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning13 Oct 2025
- 2025On the Relationship Between the Choice of Representation and In-Context Learning9 Oct 2025
- 2025Evaluating the Robustness of Chinchilla Compute-Optimal Scaling28 Sep 2025
- 2025The Illusion of Diminishing Returns: Measuring Long Horizon Execution in LLMs11 Sep 2025
- 2025Transformers Don't In-Context Learn Least Squares Regression13 Jul 2025
- 2025Next-token pretraining implies in-context learning23 May 2025
12 newest of 14 All 14 (JSON)
Similar, not cited
Close in wording, no citation either way
- 2023The Mystery of In-Context Learning: A Comprehensive Survey on Interpretation and Analysis
- 2024Does In-Context Learning Really Learn? Rethinking How Large Language Models Respond and Solve Tasks via In-Context Learning
- 2025Illusion or Algorithm? Investigating Memorization, Emergence, and Symbolic Processing in In-Context Learning
- 2023Concept-aware Training Improves In-context Learning Ability of Language Models
- 2024Concept-aware Data Construction Improves In-context Learning of Language Models
- 2025Probing In-Context Learning: Impact of Task Complexity and Model Architecture on Generalization and Efficiency
- 2025MachineLearningLM: Scaling Many-shot In-context Learning via Continued Pretraining
- 2023Is attention required for ICL? Exploring the Relationship Between Model Architecture and In-Context Learning Ability