Lune

ACL2024Top-tier venue

What Do Language Models Learn in Context? The Structured Task Hypothesis

Jiaoda Li, Yifan Hou, Mrinmaya Sachan, Ryan Cotterell

Abstract

Large language models (LLMs) exhibit an intriguing ability to learn a novel task from incontext examples presented in a demonstration, termed in-context learning (ICL). Understandably, a swath of research has been dedicated to uncovering the theories underpinning ICL. One popular hypothesis explains ICL by task selection. LLMs identify the task based on the demonstration and generalize it to the prompt. Another popular hypothesis is that ICL is a form of meta-learning, i.e., the models learn a learning algorithm at pre-training time and apply it to the demonstration. Finally, a third hypothesis argues that LLMs use the demonstration to select a composition of tasks learned during pre-training to perform ICL. In this paper, we empirically explore these three hypotheses that explain LLMs' ability to learn in context with a suite of experiments derived from common text classification tasks. We invalidate the first two hypotheses with counterexamples and provide evidence in support of the last hypothesis. Our results suggest an LLM could learn a novel task in context via composing tasks learned during pre-training.

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.

3 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Can LLMs Learn by Teaching for Better Reasoning? A Preliminary Study cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • The Learnability of In-Context Learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • The Learnability of In-Context Learning cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
  • The Learnability of In-Context Learning cites Transformers Learn In-Context by Gradient Descent
  • The Learnability of In-Context Learning cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • The Missing Alignment Link of In-context Learning on Sequences cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
  • The Missing Alignment Link of In-context Learning on Sequences cites Transformers Learn In-Context by Gradient Descent
  • The Missing Alignment Link of In-context Learning on Sequences cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Transformers Learn In-Context by Gradient Descent cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Mechanism of Task-oriented Information Removal in In-context Learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Mechanism of Task-oriented Information Removal in In-context Learning cites Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers3

  1. Can LLMs Learn by Teaching for Better Reasoning? A Preliminary StudyXuefei Ning, Zifu Wang, Shiyao Li, Zinan Lin et al.NeurIPS 2024 · 14 citations
  2. Mechanism of Task-oriented Information Removal in In-context LearningHakaze Cho, Haolin Yang, Gouki Minegishi, Naoya InoueICLR 2026 · 3 citations
  3. The Missing Alignment Link of In-context Learning on SequencesHarshvardhan Agarwal, Sunita SarawagiICML 2025

Builds on12

  1. An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 citations
  2. What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations
  3. Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
  4. 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
  5. The Learnability of In-Context LearningNoam Wies, Yoav Levine, Amnon ShashuaNeurIPS 2023 · 207 citations

Related papers

  1. Task Descriptors Help Transformers Learn Linear Models In-ContextRuomin Huang, Rong GeICLR 2025
  2. Meta-in-context learning in large language modelsJulian Coda-Forno, Marcel Binz, Zeynep Akata, Matt M. Botvinick et al.NeurIPS 2023 · 81 citations
  3. What In-Context Learning "Learns" In-Context: Disentangling Task Recognition and Task LearningJane Pan, Tianyu Gao, Howard Chen, Danqi ChenACL Findings 2023 · 29 citations
  4. Active Example Selection for In-Context LearningYiming Zhang, Shi Feng, Chenhao TanEMNLP 2022 · 84 citations
  5. In-Context Learning Learns Label Relationships but Is Not Conventional LearningJannik Kossen, Yarin Gal, Tom RainforthICLR 2024 · 61 citations
Dusk over the sea between two cliffs drawn in fine vertical lines