Lune

EMNLP Findings2023

In-Context Learning Creates Task Vectors

Roee Hendel, Mor Geva, Amir Globerson

Abstract

In-context learning (ICL) in Large Language Models (LLMs) has emerged as a powerful new learning paradigm. However, its underlying mechanism is still not well understood. In particular, it is challenging to map it to the "standard" machine learning framework, where one uses a training set S to find a best-fitting function f (x) in some hypothesis class. Here we make progress on this problem by showing that the functions learned by ICL often have a very simple structure: they correspond to the transformer LLM whose only inputs are the query x and a single "task vector" calculated from the training set. Thus, ICL can be seen as compressing S into a single task vector θ(S) and then using this task vector to modulate the transformer to produce the output. We support the above claim via comprehensive experiments across a range of models and tasks. 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.

97 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

  • Function Vectors in Large Language Models cites Locating and Editing Factual Associations in GPT
  • Function Vectors in Large Language Models cites In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering
  • Function Vectors in Large Language Models cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Function Vectors in Large Language Models cites Language Models are Few-Shot Learners
  • Function Vectors in Large Language Models cites What Can Transformers Learn In-Context? A Case Study of Simple Function Classes
  • Implicit In-context Learning cites In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering
  • Implicit In-context Learning cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • Implicit In-context Learning cites Language Models are Few-Shot Learners
  • Locating and Editing Factual Associations in GPT cites Language Models are Few-Shot Learners
  • Pythia: A Suite for Analyzing Large Language Models Across Training and Scaling cites Language Models are Few-Shot Learners
  • In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering cites Language Models are Few-Shot Learners
  • An Explanation of In-context Learning as Implicit Bayesian Inference cites Language Models are Few-Shot Learners
  • Patchscopes: A Unifying Framework for Inspecting Hidden Representations of Language Models cites Locating and Editing Factual Associations in GPT
  • Patchscopes: A Unifying Framework for Inspecting Hidden Representations of Language Models cites Pythia: A Suite for Analyzing Large Language Models Across Training and Scaling
  • A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and Toxicity cites Function Vectors in Large Language Models
  • A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and Toxicity cites Locating and Editing Factual Associations in GPT
  • A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and Toxicity cites Language Models are Few-Shot Learners
  • What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites An Explanation of In-context Learning as Implicit Bayesian Inference
  • What Can Transformers Learn In-Context? A Case Study of Simple Function Classes cites Language Models are Few-Shot Learners
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers97

  1. Implicit In-context LearningZhuowei Li, Zihao Xu, Ligong Han, Yunhe Gao et al.ICLR 2025 · 1,989 citations
  2. In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space SteeringSheng Liu, Haotian Ye, Lei Xing, James Y. ZouICML 2024 · 244 citations
  3. Function Vectors in Large Language ModelsEric Todd, Millicent L. Li, Arnab Sen Sharma, Aaron Mueller et al.ICLR 2024 · 229 citations
  4. Patchscopes: A Unifying Framework for Inspecting Hidden Representations of Language ModelsAsma Ghandeharioun, Avi Caciularu, Adam Pearce, Lucas Dixon et al.ICML 2024 · 197 citations
  5. A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and ToxicityAndrew Lee, Xiaoyan Bai, Itamar Pres, Martin Wattenberg et al.ICML 2024 · 177 citations

Builds on12

  1. Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
  2. Locating and Editing Factual Associations in GPTKevin Meng, David Bau, Alex Andonian, Yonatan BelinkovNeurIPS 2022 · 3,415 citations
  3. Pythia: A Suite for Analyzing Large Language Models Across Training and ScalingStella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley et al.ICML 2023 · 1,822 citations
  4. An Explanation of In-context Learning as Implicit Bayesian InferenceSang Michael Xie, Aditi Raghunathan, Percy Liang, Tengyu MaICLR 2022 · 1,030 citations
  5. What Can Transformers Learn In-Context? A Case Study of Simple Function ClassesShivam Garg, Dimitris Tsipras, Percy Liang, Gregory ValiantNeurIPS 2022 · 883 citations

Related papers

  1. Task Vectors, Learned Not Extracted: Performance Gains and Mechanistic InsightsHaolin Yang, Hakaze Cho, Kaize Ding, Naoya InoueICLR 2026
  2. Learning Task Representations from In-Context LearningBaturay Saglam, Xinyang Hu, Zhuoran Yang, Dionysis Kalogerias et al.ACL Findings 2025 · 1 citation
  3. How Do Transformers Learn In-Context Beyond Simple Functions? A Case Study on Learning with RepresentationsTianyu Guo, Wei Hu, Song Mei, Huan Wang et al.ICLR 2024 · 80 citations
  4. In-Context Learning through the Bayesian PrismMadhur Panwar, Kabir Ahuja, Navin GoyalICLR 2024 · 79 citations
  5. What Do Language Models Learn in Context? The Structured Task HypothesisJiaoda Li, Yifan Hou, Mrinmaya Sachan, Ryan CotterellACL 2024 · 5 citations
Dusk over the sea between two cliffs drawn in fine vertical lines