ACL Findings2023
What In-Context Learning "Learns" In-Context: Disentangling Task Recognition and Task Learning
Jane Pan, Tianyu Gao, Howard Chen, Danqi Chen
Abstract
Large language models (LLMs) exploit incontext learning (ICL) to solve tasks with only a few demonstrations, but its mechanisms are not yet well-understood. Some works suggest that LLMs only recall already learned concepts from pre-training, while others hint that ICL performs implicit learning over demonstrations. We characterize two ways through which ICL leverages demonstrations. Task recognition (TR) captures the extent to which LLMs can recognize a task through demonstrations -even without ground-truth labels -and apply their pre-trained priors, whereas task learning (TL) is the ability to capture new input-label mappings unseen in pre-training. Using a wide range of classification datasets and three LLM families (GPT-3, LLaMA and OPT), we design controlled experiments to disentangle the roles of TR and TL in ICL. We show that (1) models can achieve non-trivial performance with only TR, and TR does not further improve with larger models or more demonstrations; (2) LLMs acquire TL as the model scales, and TL's performance consistently improves with more demonstrations in context. Our findings unravel two different forces behind ICL and we advocate for discriminating them in future ICL research due to their distinct nature. 1
Ask Lune
Know this paper in minutes, not an afternoon.
Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.
57 top-tier papers have cited it since. Know what they found before your reviewers do.
Lune can draw on
the full paper · the top-tier papers that cite it · related work
Free to start. No credit card required.
Lineage
- Function Vectors in Large Language Models cites An Explanation of In-context Learning as Implicit Bayesian Inference
- Function Vectors in Large Language Models cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- Function Vectors in Large Language Models cites Transformers Learn In-Context by Gradient Descent
- Data Distributional Properties Drive Emergent In-Context Learning in Transformers cites An Explanation of In-context Learning as Implicit Bayesian Inference
- Data Distributional Properties Drive Emergent In-Context Learning in Transformers cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- Understanding Catastrophic Forgetting in Language Models via Implicit Inference cites Data Distributional Properties Drive Emergent In-Context Learning in Transformers
- Understanding Catastrophic Forgetting in Language Models via Implicit Inference cites An Explanation of In-context Learning as Implicit Bayesian Inference
- Understanding Catastrophic Forgetting in Language Models via Implicit Inference cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- Understanding Catastrophic Forgetting in Language Models via Implicit Inference cites Transformers Learn In-Context by Gradient Descent
- Impact of Pretraining Term Frequencies on Few-Shot Numerical Reasoning cites Data Distributional Properties Drive Emergent In-Context Learning in Transformers
- A Survey on In-context Learning cites Data Distributional Properties Drive Emergent In-Context Learning in Transformers
- A Survey on In-context Learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
- A Survey on In-context Learning cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- A Survey on In-context Learning cites Transformers Learn In-Context by Gradient Descent
- A Survey on In-context Learning cites Many-Shot In-Context Learning
- Transformers Learn In-Context by Gradient Descent cites Data Distributional Properties Drive Emergent In-Context Learning in Transformers
- Many-Shot In-Context Learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
- Many-Shot In-Context Learning cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
- Many-Shot In-Context Learning cites Transformers Learn In-Context by Gradient Descent
Cited by top-tier papers57
- A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng et al.EMNLP 2024 · 479 citations
- Large Language Models Are Not Robust Multiple Choice SelectorsChujie Zheng, Hao Zhou, Fandong Meng, Jie Zhou et al.ICLR 2024 · 424 citations
- Many-Shot In-Context LearningRishabh Agarwal, Avi Singh, Lei Zhang, Bernd Bohnet et al.NeurIPS 2024 · 271 citations
- Function Vectors in Large Language ModelsEric Todd, Millicent L. Li, Arnab Sen Sharma, Aaron Mueller et al.ICLR 2024 · 229 citations
- Understanding Catastrophic Forgetting in Language Models via Implicit InferenceSuhas Kotha, Jacob Mitchell Springer, Aditi RaghunathanICLR 2024 · 131 citations
Builds on8
- An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 citations
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
- Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?Sewon Min, Xinxi Lyu, Ari Holtzman, Mikel Artetxe et al.EMNLP 2022 · 634 citations
- Data Distributional Properties Drive Emergent In-Context Learning in TransformersStephanie C. Y. Chan, Adam Santoro, Andrew K. Lampinen, Jane X. Wang et al.NeurIPS 2022 · 407 citations
- Impact of Pretraining Term Frequencies on Few-Shot Numerical ReasoningYasaman Razeghi, Robert L. Logan IV, Matt Gardner, Sameer SinghEMNLP Findings 2022 · 89 citations
Related papers
- What Do Language Models Learn in Context? The Structured Task HypothesisJiaoda Li, Yifan Hou, Mrinmaya Sachan, Ryan CotterellACL 2024 · 5 citations
- Unveiling In-Context Learning: A Coordinate System to Understand Its Working MechanismAnhao Zhao, Fanghua Ye, Jinlan Fu, Xiaoyu ShenEMNLP 2024 · 2 citations
- Prior Forgetting and In-Context OverfittingSungyoon LeeNeurIPS 2025 · 1 citation
- Localizing Task Recognition and Task Learning in In-Context Learning via Attention Head AnalysisHaolin Yang, Hakaze Cho, Naoya InoueICLR 2026 · 2 citations
- Which Attention Heads Matter for In-Context Learning?Kayo Yin, Jacob SteinhardtICML 2025
