Towards the Effect of Examples on In-Context Learning: A Theoretical Case Study
Not on the map. Why?
Abstract (arXiv)
In-context learning (ICL) has emerged as a powerful capability for large language models (LLMs) to adapt to downstream tasks by leveraging a few (demonstration) examples. Despite its effectiveness, the mechanism behind ICL remains underexplored. To better understand how ICL integrates the examples with the knowledge learned by the LLM during pre-training (i.e., pre-training knowledge) and how the examples impact ICL, this paper conducts a theoretical study in binary classification tasks. In particular, we introduce a probabilistic model extending from the Gaussian mixture model to exactly quantify the impact of pre-training knowledge, label frequency, and label noise on the prediction accuracy. Based on our analysis, when the pre-training knowledge contradicts the knowledge in the examples, whether ICL prediction relies more on the pre-training knowledge or the examples depends on the number of examples. In addition, the label frequency and label noise of the examples both affect the accuracy of the ICL prediction, where the minor class has a lower accuracy, and how the label noise impacts the accuracy is determined by the specific noise level of the two classes. Extensive simulations are conducted to verify the correctness of the theoretical results, and real-data experiments also align with the theoretical insights. Our work reveals the role of pre-training knowledge and examples in ICL, offering a deeper understanding of LLMs' behaviors in classification tasks.
Key facts. Cited by 2 papers in the map (data through 7 Oct 2026). Builds on 34 of its 46 references that are in the map. First posted on arXiv 12 Oct 2024.
Builds on
34 of 46 references.
References · 34
- 2017Attention Is All You Needcited by 59,932
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023Llama 2: Open Foundation and Fine-Tuned Chat Modelscited by 12,865
- 2022Chain-of-Thought Prompting Elicits Reasoning in Large Language Modelscited by 12,302
- 2018GLUE: A Multi-Task Benchmark and Analysis Platform for Natural Language Understandingcited by 4,854
- 2023Retrieval-Augmented Generation for Large Language Models: A Surveycited by 2,185
- 2022Large Language Models Encode Clinical Knowledgecited by 1,807
- 2023Pythia: A Suite for Analyzing Large Language Models Across Training and Scalingcited by 1,734
- 2023The Rise and Potential of Large Language Model Based Agents: A Surveycited by 1,422
- 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,413
- 2021Calibrate Before Use: Improving Few-Shot Performance of Language Modelscited by 1,371
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
22 more
- 2021Fantastically Ordered Prompts and Where to Find Them: Overcoming Few-Shot Prompt Order Sensitivitycited by 1,122
- 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
- 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 671
- 2023Trained Transformers Learn Linear Models In-Contextcited by 331
- 2023In-Context Learning Creates Task Vectorscited by 302
- 2023Function Vectors in Large Language Modelscited by 292
- 2023Poisoning Web-Scale Training Datasets is Practicalcited by 276
- 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 274
- 2022Why Can GPT Learn In-Context? Language Models Implicitly Perform Gradient Descent as Meta-Optimizerscited by 204
- 2022Active Example Selection for In-Context Learningcited by 195
- 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 168
- 2022Self-Adaptive In-Context Learning: An Information Compression Perspective for In-Context Example Selection and Orderingcited by 158
- 2023Large Language Models Are Latent Variable Models: Explaining and Finding Good Demonstrations for In-Context Learningcited by 149
- 2022Ground-Truth Labels Matter: A Deeper Look into Input-Label Demonstrationscited by 116
- 2023In-Context Convergence of Transformerscited by 112
- 2024Dual Operating Modes of In-Context Learningcited by 42
- 2024An Information-Theoretic Analysis of In-Context Learningcited by 39
- 2020Sharp Statistical Guarantees for Adversarially Robust Gaussian Classificationcited by 27
- 2023Understanding Emergent In-Context Learning from a Kernel Regression Perspectivecited by 23
- 2024Data Poisoning for In-context Learningcited by 21
Built on by
Citing papers per year: 2024: 1; 2025: 0; 2026: 1.
2 papers.