Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learning
Not on the map. Why?
Abstract (arXiv)
In recent years, pre-trained large language models (LLMs) have demonstrated remarkable efficiency in achieving an inference-time few-shot learning capability known as in-context learning. However, existing literature has highlighted the sensitivity of this capability to the selection of few-shot demonstrations. Current understandings of the underlying mechanisms by which this capability arises from regular language model pretraining objectives remain disconnected from the real-world LLMs. This study aims to examine the in-context learning phenomenon through a Bayesian lens, viewing real-world LLMs as latent variable models. On this premise, we propose an algorithm to select optimal demonstrations from a set of annotated data with a small LM, and then directly generalize the selected demonstrations to larger LMs. We demonstrate significant improvement over baselines, averaged over eight GPT models on eight real-world text classification datasets. We also demonstrate the real-world usefulness of our algorithm on GSM8K, a math word problem dataset. Our empirical findings support our hypothesis that LLMs implicitly infer a latent variable containing task information.
Key facts. Cited by 149 papers in the map (data through 7 Oct 2026). Builds on 34 of its 52 references that are in the map. First posted on arXiv 27 Jan 2023.
Builds on
34 of 52 references.
References · 34
- 2017Attention Is All You Needcited by 59,932
- 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
- 2021Training Verifiers to Solve Math Word Problemscited by 9,743
- 2019Sentence-BERT: Sentence Embeddings using Siamese BERT-Networkscited by 9,049
- 2022Self-Consistency Improves Chain of Thought Reasoning in Language Modelscited by 5,601
- 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,854
- 2021The Power of Scale for Parameter-Efficient Prompt Tuningcited by 3,769
- 2022OPT: Open Pre-trained Transformer Language Modelscited by 3,464
- 2020Learning to summarize from human feedbackcited by 2,562
- 2015Character-level Convolutional Networks for Text Classificationcited by 2,293
22 more
- 2019HuggingFace's Transformers: State-of-the-art Natural Language Processingcited by 2,201
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2022Least-to-Most Prompting Enables Complex Reasoning in Large Language Modelscited by 1,397
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
- 2022Program of Thoughts Prompting: Disentangling Computation from Reasoning for Numerical Reasoning Taskscited by 1,057
- 2018Neural Network Acceptability Judgmentscited by 952
- 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 915
- 2022Transformers learn in-context by gradient descentcited by 714
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
- 2021Learning To Retrieve Prompts for In-Context Learningcited by 641
- 2021MetaICL: Learning to Learn In Contextcited by 450
- 2021True Few-Shot Learning with Language Modelscited by 343
- 2013Good Debt or Bad Debt: Detecting Semantic Orientations in Economic Textscited by 310
- 2022Selective Annotation Makes Language Models Better Few-Shot Learnerscited by 242
- 2021Noisy Channel Language Model Prompting for Few-Shot Text Classificationcited by 163
- 2015Neural Variational Inference for Text Processingcited by 111
- 2021Why Do Pretrained Language Models Help in Downstream Tasks? An Analysis of Head and Prompt Tuningcited by 82
- 2017Discovering Discrete Latent Topics with Neural Variational Inferencecited by 79
- 2020A Mathematical Exploration of Why Language Models Help Solve Downstream Taskscited by 71
- 2022Rethinking the Role of Scale for In-Context Learning: An Interpretability-based Case Study at 66 Billion Scalecited by 64
- 2022Evaluating Distributional Distortion in Neural Language Modelingcited by 18
Built on by
Citing papers per year: 2023: 20; 2024: 58; 2025: 49; 2026: 22.
149 papers.
Sort:
By area:
- 2024LESS: Selecting Influential Data for Targeted Instruction Tuningcited by 514
- 2023A Survey on Model Compression for Large Language Modelscited by 263
- 2024Many-Shot In-Context Learningcited by 203
- 2023Efficient Large Language Models: A Surveycited by 183
- 2023In-Context Convergence of Transformerscited by 112
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2024Self-Introspective Decoding: Alleviating Hallucinations for Large Vision-Language Modelscited by 90
- 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
- 2024Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to Pretraining Datacited by 83
- 2024Retrieval Augmented Generation (RAG) and Beyond: A Comprehensive Survey on How to Make your LLMs use External Data More Wiselycited by 65
- 2024Inference Scaling for Long-Context Retrieval Augmented Generationcited by 65
- 2023Evaluating the Zero-shot Robustness of Instruction-tuned Language Modelscited by 63
38 more
- 2024Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspectivecited by 51
- 2023Reason for Future, Act for Now: A Principled Framework for Autonomous LLM Agents with Provable Sample Efficiencycited by 46
- 2024MRAG-Bench: Vision-Centric Evaluation for Retrieval-Augmented Multimodal Modelscited by 41
- 2025A Survey of Test-Time Compute: From Intuitive Inference to Deliberate Reasoningcited by 40
- 2024Do Large Language Models Have Compositional Ability? An Investigation into Limitations and Scalabilitycited by 39
- 2024Prompt Optimization with EASE? Efficient Ordering-aware Automated Selection of Exemplarscited by 37
- 2023The Mystery of In-Context Learning: A Comprehensive Survey on Interpretation and Analysiscited by 34
- 2023How are Prompts Different in Terms of Sensitivity?cited by 34
- 2023In-Context Learning for Attention Scheme: from Single Softmax Regression to Multiple Softmax Regression via a Tensor Trickcited by 32
- 2024Efficient Reinforcement Learning with Large Language Model Priorscited by 30
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methodscited by 27
- 2024Recent Advances in Hate Speech Moderation: Multimodality and the Role of Large Modelscited by 26
- 2024MECD: Unlocking Multi-Event Causal Discovery in Video Reasoningcited by 23
- 2024Sequential Large Language Model-Based Hyper-parameter Optimizationcited by 23
- 2024In-Context Learning with Transformers: Softmax Attention Adapts to Function Lipschitznesscited by 22
- 2023Auto-Instruct: Automatic Instruction Generation and Ranking for Black-Box Language Modelscited by 21
- 2023Generative Calibration for In-context Learningcited by 20
- 2024Position: Understanding LLMs Requires More Than Statistical Generalizationcited by 20
- 2024Are Large Language Models Moral Hypocrites? A Study Based on Moral Foundationscited by 19
- 2025Enough Coin Flips Can Make LLMs Act Bayesiancited by 19
- 2024Assistive Large Language Model Agents for Socially-Aware Negotiation Dialoguescited by 18
- 2024From Words to Actions: Unveiling the Theoretical Underpinnings of LLM-Driven Autonomous Systemscited by 17
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learningcited by 17
- 2024On the Intrinsic Self-Correction Capability of LLMs: Uncertainty and Latent Conceptcited by 16
- 2025Unlocking the Power of Function Vectors for Characterizing and Mitigating Catastrophic Forgetting in Continual Instruction Tuningcited by 16
- 2023Iterative Forward Tuning Boosts In-Context Learning in Language Modelscited by 15
- 2023Towards Understanding How Transformers Learn In-context Through a Representation Learning Lenscited by 15
- 2024On the Noise Robustness of In-Context Learning for Text Generationcited by 15
- 2024AutoElicit: Using Large Language Models for Expert Prior Elicitation in Predictive Modellingcited by 15
- 2024RAEmoLLM: Retrieval Augmented LLMs for Cross-Domain Misinformation Detection Using In-Context Learning Based on Emotional Informationcited by 14
- 2025The Geometry of Prompting: Unveiling Distinct Mechanisms of Task Adaptation in Language Modelscited by 14
- 2025Enabling Self-Improving Agents to Learn at Test Time With Human-In-The-Loop Guidancecited by 14
- 2024The Impact of Demonstrations on Multilingual In-Context Learning: A Multidimensional Analysiscited by 13
- 2025MAPLE: Many-Shot Adaptive Pseudo-Labeling for In-Context Learningcited by 13
- 2024A Survey to Recent Progress Towards Understanding In-Context Learningcited by 12
- 2024CoPS: Empowering LLM Agents with Provable Cross-Task Experience Sharingcited by 12
- 2025Action Tokenizer Matters in In-Context Imitation Learningcited by 12
- 2024BERTs are Generative In-Context Learnerscited by 11
50 most cited of 149 All 149 (JSON)
- 2026Efficient Task Adaptation in Large Language Models: A Survey of Weight-Based, Prompt-Based, and Embedding-Based Adaptations1 Oct 2026
- 2026Understanding In-Context Multimodal Jailbreaks via Posterior Reweighting8 Sep 2026
- 2026Attention Sensitivity Is Not Enough: Dissociating Attention-Level and Behavioural In-Context Learning under Fine-Tuning30 Aug 2026
- 2026Prompt-Driven Exploration: Language as an Exploration Space for VLA Reinforcement Learning9 Jul 2026
- 2026GRAG: Generic Response-Augmented Generation Framework for Personalized Conversational Systems19 Jun 2026
- 2026From Drift to Coherence: Stabilizing Beliefs in LLMs16 Jun 2026
- 2026Taming Visual Neglect: A Variational Information Bottleneck Framework for Adaptive Attention in Multimodal In-Context Learning14 Jun 2026
- 2026The Assistant as a Privileged Persona: A canonical reference in cross-persona self-recognition30 May 2026
- 2026Self-Attention as a Covariance Readout: A Unified View of In-Context Learning and Repetition11 May 2026
- 2026One for All: A Non-Linear Transformer can Enable Cross-Domain Generalization for In-Context Reinforcement Learning10 May 2026
- 2026Quantifying Aleatoric Uncertainty of In-Context Learning for Robust Measure of LLM Prediction Confidence28 Apr 2026
- 2026A Hierarchical Spatiotemporal Action Tokenizer for In-Context Imitation Learning in Robotics16 Apr 2026
38 more
- 2026Experience Transfer for Multimodal LLM Agents in Minecraft Game7 Apr 2026
- 2026PLR: Plackett-Luce for Reordering In-Context Learning Examples22 Mar 2026
- 2026Regime-aware financial volatility forecasting via in-context learning11 Mar 2026
- 2026On Emergences of Non-Classical Statistical Characteristics in Classical Neural Networks27 Feb 2026
- 2026Improving Topic Modeling by Distilling Soft Labels from Language Models20 Feb 2026
- 2026Influence-Preserving Proxies for Gradient-Based Data Selection in LLM Fine-tuning19 Feb 2026
- 2026Meta-Sel: Efficient Demonstration Selection for In-Context Learning via Supervised Meta-Learning12 Feb 2026
- 2026Predicting Startup Success Using Large Language Models: A Novel In-Context Learning Approach23 Jan 2026
- 2026Geometry-Aware Hallucination Detection in Large Language Models8 Jan 2026
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classification3 Jan 2026
- 2025Improving Fairness of Large Language Model-Based ICU Mortality Prediction via Case-Based Prompting17 Dec 2025
- 2025Few-Shot Inference of Human Perceptions of Robot Performance in Social Navigation Scenarios17 Dec 2025
- 2025How Prompts Move Language Model Behavior: Frames, Salience, and Construal as Semantic Control14 Dec 2025
- 2025Label Forensics: Interpreting Hard Labels in Black-Box Text Classifier1 Dec 2025
- 2025T2T-VICL: Cross-Task Visual In-Context Learning via Implicit Text-Driven VLMs20 Nov 2025
- 2025Genomic Next-Token Predictors are In-Context Learners16 Nov 2025
- 2025Vocabulary In-Context Learning in Transformers: Benefits of Positional Encoding9 Nov 2025
- 2025From Cross-Task Examples to In-Task Prompts: A Graph-Based Pseudo-Labeling Framework for In-context Learning28 Oct 2025
- 2025Optimal In-context Adaptivity and Distributional Robustness of Transformers27 Oct 2025
- 2025Can Language Models Compose Skills In-Context?27 Oct 2025
- 2025A Framework for Quantifying How Pre-Training and Context Benefit In-Context Learning26 Oct 2025
- 2025Foundation of Intelligence: Review of Math Word Problems from Human Cognition Perspective24 Oct 2025
- 2025In-Context Learning Is Provably Bayesian Inference: A Generalization Theory for Meta-Learning13 Oct 2025
- 2025Fine-Grained Emotion Recognition via In-Context Learning8 Oct 2025
- 2025ContextNav: Towards Agentic Multimodal In-Context Learning6 Oct 2025
- 2025Multimodal Function Vectors for Visual Relations2 Oct 2025
- 2025SPECTRA: Revealing the Full Spectrum of User Preferences via Distributional LLM Inference29 Sep 2025
- 2025Protocode: Prototype-Driven Interpretability for Code Generation in LLMs27 Sep 2025
- 2025KITE: Kernelized and Information Theoretic Exemplars for In-Context Learning19 Sep 2025
- 2025Is In-Context Learning Learning?12 Sep 2025
- 2025Prosocial Behavior Detection in Player Game Chat: From Aligning Human-AI Definitions to Efficient Annotation at Scale8 Aug 2025
- 2025Enabling Self-Improving Agents to Learn at Test Time With Human-In-The-Loop Guidance23 Jul 2025
- 2025Semantic-Augmented Latent Topic Modeling with LLM-in-the-Loop11 Jul 2025
- 2025ICLShield: Exploring and Mitigating In-Context Learning Backdoor Attacks2 Jul 2025
- 2025Learning-to-Context Slope: Evaluating In-Context Learning Effectiveness Beyond Performance Illusions29 Jun 2025
- 2025Automatic Demonstration Selection for LLM-based Tabular Data Classification25 Jun 2025
- 2025Next-Token Prediction Should be Ambiguity-Sensitive: A Meta-Learning Perspective19 Jun 2025
- 2025Surprise Calibration for Better In-Context Learning15 Jun 2025
50 newest of 149 All 149 (JSON)
- 2025A Survey of Test-Time Compute: From Intuitive Inference to Deliberate Reasoningcited by 40
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methodscited by 27
- 2024MECD: Unlocking Multi-Event Causal Discovery in Video Reasoningcited by 23
- 2024CoPS: Empowering LLM Agents with Provable Cross-Task Experience Sharingcited by 12
- 2023LaRS: Latent Reasoning Skills for Chain-of-Thought Reasoningcited by 8
- 2024Does In-Context Learning Really Learn? Rethinking How Large Language Models Respond and Solve Tasks via In-Context Learningcited by 8
- 2024In-Context Learning May Not Elicit Trustworthy Reasoning: A-Not-B Errors in Pretrained Language Modelscited by 8
- 2024Does Few-Shot Learning Help LLM Performance in Code Synthesis?cited by 6
- 2025MECD+: Unlocking Event-Level Causal Graph Discovery for Video Reasoningcited by 5
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classificationcited by 0
- 2026The Alchemy of Thought: Understanding In-Context Learning Through Supervised Classification3 Jan 2026
- 2025MECD+: Unlocking Event-Level Causal Graph Discovery for Video Reasoning13 Jan 2025
- 2025A Survey of Test-Time Compute: From Intuitive Inference to Deliberate Reasoning5 Jan 2025
- 2024Does Few-Shot Learning Help LLM Performance in Code Synthesis?3 Dec 2024
- 2024CoPS: Empowering LLM Agents with Provable Cross-Task Experience Sharing22 Oct 2024
- 2024MECD: Unlocking Multi-Event Causal Discovery in Video Reasoning26 Sep 2024
- 2024In-Context Learning May Not Elicit Trustworthy Reasoning: A-Not-B Errors in Pretrained Language Models23 Sep 2024
- 2024Unveiling the Statistical Foundations of Chain-of-Thought Prompting Methods25 Aug 2024
- 2024Does In-Context Learning Really Learn? Rethinking How Large Language Models Respond and Solve Tasks via In-Context Learning11 Apr 2024
- 2023LaRS: Latent Reasoning Skills for Chain-of-Thought Reasoning7 Dec 2023
- 2024Self-Introspective Decoding: Alleviating Hallucinations for Large Vision-Language Modelscited by 90
- 2025ContextNav: Towards Agentic Multimodal In-Context Learningcited by 9
- 2023Lever LM: Configuring In-Context Sequence to Lever Large Vision Language Modelscited by 6
- 2026Experience Transfer for Multimodal LLM Agents in Minecraft Gamecited by 4
- 2025Incomplete In-context Learningcited by 2
- 2025Multimodal Function Vectors for Visual Relationscited by 0
- 2026Taming Visual Neglect: A Variational Information Bottleneck Framework for Adaptive Attention in Multimodal In-Context Learningcited by 0
- 2026Understanding In-Context Multimodal Jailbreaks via Posterior Reweightingcited by 0
- 2026Understanding In-Context Multimodal Jailbreaks via Posterior Reweighting8 Sep 2026
- 2026Taming Visual Neglect: A Variational Information Bottleneck Framework for Adaptive Attention in Multimodal In-Context Learning14 Jun 2026
- 2026Experience Transfer for Multimodal LLM Agents in Minecraft Game7 Apr 2026
- 2025ContextNav: Towards Agentic Multimodal In-Context Learning6 Oct 2025
- 2025Multimodal Function Vectors for Visual Relations2 Oct 2025
- 2025Incomplete In-context Learning12 May 2025
- 2024Self-Introspective Decoding: Alleviating Hallucinations for Large Vision-Language Models4 Aug 2024
- 2023Lever LM: Configuring In-Context Sequence to Lever Large Vision Language Models15 Dec 2023
- 2024Retrieval Augmented Generation (RAG) and Beyond: A Comprehensive Survey on How to Make your LLMs use External Data More Wiselycited by 65
- 2024Inference Scaling for Long-Context Retrieval Augmented Generationcited by 65
- 2024MRAG-Bench: Vision-Centric Evaluation for Retrieval-Augmented Multimodal Modelscited by 41
- 2024RAEmoLLM: Retrieval Augmented LLMs for Cross-Domain Misinformation Detection Using In-Context Learning Based on Emotional Informationcited by 14
- 2024Awakening Augmented Generation: Learning to Awaken Internal Knowledge of Large Language Models for Question Answeringcited by 7
- 2024A Theory for Token-Level Harmonization in Retrieval-Augmented Generationcited by 7
- 2024RARe: Retrieval Augmented Retrieval with In-Context Examplescited by 2
- 2024RARe: Retrieval Augmented Retrieval with In-Context Examples26 Oct 2024
- 2024MRAG-Bench: Vision-Centric Evaluation for Retrieval-Augmented Multimodal Models10 Oct 2024
- 2024Inference Scaling for Long-Context Retrieval Augmented Generation6 Oct 2024
- 2024Retrieval Augmented Generation (RAG) and Beyond: A Comprehensive Survey on How to Make your LLMs use External Data More Wisely23 Sep 2024
- 2024RAEmoLLM: Retrieval Augmented LLMs for Cross-Domain Misinformation Detection Using In-Context Learning Based on Emotional Information16 Jun 2024
- 2024A Theory for Token-Level Harmonization in Retrieval-Augmented Generation3 Jun 2024
- 2024Awakening Augmented Generation: Learning to Awaken Internal Knowledge of Large Language Models for Question Answering22 Mar 2024
- 2024LESS: Selecting Influential Data for Targeted Instruction Tuningcited by 514
- 2023A Survey on Model Compression for Large Language Modelscited by 263
- 2024Many-Shot In-Context Learningcited by 203
- 2023Efficient Large Language Models: A Surveycited by 183
- 2023In-Context Convergence of Transformerscited by 112
- 2023How Many Pretraining Tasks Are Needed for In-Context Learning of Linear Regression?cited by 93
- 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
- 2024Generalization v.s. Memorization: Tracing Language Models' Capabilities Back to Pretraining Datacited by 83
- 2023Evaluating the Zero-shot Robustness of Instruction-tuned Language Modelscited by 63
- 2024Is In-Context Learning in Large Language Models Bayesian? A Martingale Perspectivecited by 51
- 2024Do Large Language Models Have Compositional Ability? An Investigation into Limitations and Scalabilitycited by 39
- 2024Prompt Optimization with EASE? Efficient Ordering-aware Automated Selection of Exemplarscited by 37
12 most cited of 115 All 115 (JSON)
- 2026Efficient Task Adaptation in Large Language Models: A Survey of Weight-Based, Prompt-Based, and Embedding-Based Adaptations1 Oct 2026
- 2026Attention Sensitivity Is Not Enough: Dissociating Attention-Level and Behavioural In-Context Learning under Fine-Tuning30 Aug 2026
- 2026Prompt-Driven Exploration: Language as an Exploration Space for VLA Reinforcement Learning9 Jul 2026
- 2026GRAG: Generic Response-Augmented Generation Framework for Personalized Conversational Systems19 Jun 2026
- 2026From Drift to Coherence: Stabilizing Beliefs in LLMs16 Jun 2026
- 2026The Assistant as a Privileged Persona: A canonical reference in cross-persona self-recognition30 May 2026
- 2026Self-Attention as a Covariance Readout: A Unified View of In-Context Learning and Repetition11 May 2026
- 2026One for All: A Non-Linear Transformer can Enable Cross-Domain Generalization for In-Context Reinforcement Learning10 May 2026
- 2026Quantifying Aleatoric Uncertainty of In-Context Learning for Robust Measure of LLM Prediction Confidence28 Apr 2026
- 2026PLR: Plackett-Luce for Reordering In-Context Learning Examples22 Mar 2026
- 2026Regime-aware financial volatility forecasting via in-context learning11 Mar 2026
- 2026On Emergences of Non-Classical Statistical Characteristics in Classical Neural Networks27 Feb 2026
12 newest of 115 All 115 (JSON)