mlsanityData to 14 Oct 2026

Contextualize-then-Aggregate: Circuits for In-Context Learning in Gemma-2 2B

arXiv 2504.00132 ↗First posted 31 Mar 2025cs.CL cs.LGcited by 10

Not on the map. Why?

Abstract (arXiv)

In-Context Learning (ICL) is an intriguing ability of large language models (LLMs). Despite a substantial amount of work on its behavioral aspects and how it emerges in miniature setups, it remains unclear which mechanism assembles task information from the individual examples in a fewshot prompt. We use causal interventions to identify information flow in Gemma-2 2B for five naturalistic ICL tasks. We find that the model infers task information using a two-step strategy we call contextualize-then-aggregate: In the lower layers, the model builds up representations of individual fewshot examples, which are contextualized by preceding examples through connections between fewshot input and output tokens across the sequence. In the higher layers, these representations are aggregated to identify the task and prepare prediction of the next output. The importance of the contextualization step differs between tasks, and it may become more important in the presence of ambiguous examples. Overall, by providing rigorous causal analysis, our results shed light on the mechanisms through which ICL happens in language models.

Key facts. Cited by 10 papers in the map (data through 14 Oct 2026). Builds on 25 of its 37 references that are in the map. First posted on arXiv 31 Mar 2025.

Builds on

25 of 37 references.

References · 25

  1. 2020Language Models are Few-Shot Learnerscited by 32,419
  2. 2022Locating and Editing Factual Associations in GPTcited by 2,691
  3. 2024Gemma 2: Improving Open Language Models at a Practical Sizecited by 1,998
  4. 2022Rethinking the Role of Demonstrations: What Makes In-Context Learning Work?cited by 1,434
  5. 2022Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 smallcited by 1,165
  6. 2021An Explanation of In-context Learning as Implicit Bayesian Inferencecited by 938
  7. 2019Are Sixteen Heads Really Better than One?cited by 816
  8. 2022Transformers learn in-context by gradient descentcited by 732
  9. 2023Towards Automated Circuit Discovery for Mechanistic Interpretabilitycited by 724
  10. 2022What Can Transformers Learn In-Context? A Case Study of Simple Function Classescited by 715
  11. 2022What learning algorithm is in-context learning? Investigations with linear modelscited by 684
  12. 2021Causal Abstractions of Neural Networkscited by 422
13 more
  1. 2023In-Context Learning Creates Task Vectorscited by 312
  2. 2023Transformers learn to implement preconditioned gradient descent for in-context learningcited by 279
  3. 2023Label Words are Anchors: An Information Flow Perspective for Understanding In-Context Learningcited by 236
  4. 2023Attribution Patching Outperforms Automated Circuit Discoverycited by 209
  5. 2023One Step of Gradient Descent is Provably the Optimal In-Context Learner with One Layer of Linear Self-Attentioncited by 170
  6. 2024Have Faith in Faithfulness: Going Beyond Circuit Overlap When Finding Model Mechanismscited by 149
  7. 2023The Learnability of In-Context Learningcited by 127
  8. 2024Information Flow Routes: Automatically Interpreting Language Models at Scalecited by 95
  9. 2023A Theory of Emergent In-Context Learning as Implicit Structure Inductioncited by 86
  10. 2022Rethinking the Role of Scale for In-Context Learning: An Interpretability-based Case Study at 66 Billion Scalecited by 64
  11. 2024Induction Heads as an Essential Mechanism for Pattern Matching in In-context Learningcited by 46
  12. 2024Linear Transformers are Versatile In-Context Learnerscited by 28
  13. 2024How Transformers Utilize Multi-Head Attention in In-Context Learning? A Case Study on Sparse Linear Regressioncited by 14

Built on by

Cited by year (2026 to 14 Oct)

Citing papers per year: 2025: 6; 2026: 4.

10 papers.