Which Attention Heads Matter for In-Context Learning?
Kayo Yin, Jacob Steinhardt
Abstract
Large language models (LLMs) exhibit impressive in-context learning (ICL) capability, enabling them to perform new tasks using only a few demonstrations in the prompt. Two different mechanisms have been proposed to explain ICL: induction heads that find and copy relevant tokens, and function vector (FV) heads whose activations compute a latent encoding of the ICL task. To better understand which of the two distinct mechanisms drives ICL, we study and compare induction heads and FV heads in 12 language models. Through detailed ablations, we discover that fewshot ICL performance depends primarily on FV heads, especially in larger models. In addition, we uncover that FV and induction heads are connected: many FV heads start as induction heads during training before transitioning to the FV mechanism. This leads us to speculate that induction facilitates learning the more complex FV mechanism that ultimately drives ICL 2 .
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 67ae0fb0-e7d4-498a-8ced-e7d9b9f43f80Cited by top-tier papers23
- In-Context Learning Strategies Emerge RationallyDaniel Wurgaft, Ekdeep Singh Lubana, Core Francisco Park, Hidenori Tanaka et al.NeurIPS 2025 · 19 citations
- A Implies B: Circuit Analysis in LLMs for Propositional Logical ReasoningGuanzhe Hong, Nishanth Dikkala, Enming Luo, Cyrus Rashtchian et al.NeurIPS 2025 · 17 citations
- The Atlas of In-Context Learning: How Attention Heads Shape In-Context Retrieval AugmentationPatrick Kahardipraja, Reduan Achtibat, Thomas Wiegand, Wojciech Samek et al.NeurIPS 2025 · 13 citations
- Delta Attention: Fast and Accurate Sparse Attention Inference by Delta CorrectionJeffrey Willette, Heejun Lee, Sung Ju HwangNeurIPS 2025 · 9 citations
- Causality ≠ Invariance: Function and Concept Vectors in LLMsGustaw Opielka, Hannes Rosenbusch, Claire E. StevensonICLR 2026 · 7 citations
Builds on13
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah et al.NeurIPS 2020 · 64,255 citations
- 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
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento et al.ICML 2023 · 729 citations
- A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng et al.EMNLP 2024 · 479 citations
- Towards Best Practices of Activation Patching in Language Models: Metrics and MethodsFred Zhang, Neel NandaICLR 2024 · 233 citations
Related papers
- Do different prompting methods yield a common task representation in language models?Guy Davidson, Todd M. Gureckis, Brenden M. Lake, Adina WilliamsNeurIPS 2025 · 11 citations
- Task Vectors, Learned Not Extracted: Performance Gains and Mechanistic InsightsHaolin Yang, Hakaze Cho, Kaize Ding, Naoya InoueICLR 2026
- KV Shifting Attention Enhances Language ModelingMingyu Xu, Bingning Wang, Weipeng ChenICML 2025
- Unifying Attention Heads and Task Vectors via Hidden State Geometry in In-Context LearningHaolin Yang, Hakaze Cho, Yiqiao Zhong, Naoya InoueNeurIPS 2025 · 11 citations
- Revisiting In-context Learning Inference Circuit in Large Language ModelsHakaze Cho, Mariko Kato, Yoshihiro Sakai, Naoya InoueICLR 2025
