Which Attention Heads Matter for In-Context Learning?
Kayo Yin, Jacob Steinhardt
摘要
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 .
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
已有 23 篇顶会 Paper 引用了它。别等审稿人问起,先弄清它们发现了什么。
脉络
- The Atlas of In-Context Learning: How Attention Heads Shape In-Context Retrieval Augmentation 引用了 Language Models are Few-Shot Learners
- The Atlas of In-Context Learning: How Attention Heads Shape In-Context Retrieval Augmentation 引用了 Transformers Learn In-Context by Gradient Descent
- Pythia: A Suite for Analyzing Large Language Models Across Training and Scaling 引用了 Language Models are Few-Shot Learners
- A Survey on In-context Learning 引用了 Language Models are Few-Shot Learners
- A Survey on In-context Learning 引用了 Transformers Learn In-Context by Gradient Descent
- A Implies B: Circuit Analysis in LLMs for Propositional Logical Reasoning 引用了 Towards Best Practices of Activation Patching in Language Models: Metrics and Methods
- A Implies B: Circuit Analysis in LLMs for Propositional Logical Reasoning 引用了 Language Models are Few-Shot Learners
- In-Context Learning Strategies Emerge Rationally 引用了 Language Models are Few-Shot Learners
- In-Context Learning Strategies Emerge Rationally 引用了 Transformers Learn In-Context by Gradient Descent
- Transformers Learn In-Context by Gradient Descent 引用了 Language Models are Few-Shot Learners
引用它的顶会 Paper23
- In-Context Learning Strategies Emerge RationallyDaniel Wurgaft, Ekdeep Singh Lubana, Core Francisco Park, Hidenori Tanaka 等NeurIPS 2025 · 19 次引用
- A Implies B: Circuit Analysis in LLMs for Propositional Logical ReasoningGuanzhe Hong, Nishanth Dikkala, Enming Luo, Cyrus Rashtchian 等NeurIPS 2025 · 17 次引用
- The Atlas of In-Context Learning: How Attention Heads Shape In-Context Retrieval AugmentationPatrick Kahardipraja, Reduan Achtibat, Thomas Wiegand, Wojciech Samek 等NeurIPS 2025 · 13 次引用
- Delta Attention: Fast and Accurate Sparse Attention Inference by Delta CorrectionJeffrey Willette, Heejun Lee, Sung Ju HwangNeurIPS 2025 · 9 次引用
- Causality ≠ Invariance: Function and Concept Vectors in LLMsGustaw Opielka, Hannes Rosenbusch, Claire E. StevensonICLR 2026 · 7 次引用
它引用的 Paper14
- Language Models are Few-Shot LearnersTom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah 等NeurIPS 2020 · 64,255 次引用
- Pythia: A Suite for Analyzing Large Language Models Across Training and ScalingStella Biderman, Hailey Schoelkopf, Quentin Gregory Anthony, Herbie Bradley 等ICML 2023 · 1,822 次引用
- Transformers Learn In-Context by Gradient DescentJohannes von Oswald, Eyvind Niklasson, Ettore Randazzo, João Sacramento 等ICML 2023 · 729 次引用
- A Survey on In-context LearningQingxiu Dong, Lei Li, Damai Dai, Ce Zheng 等EMNLP 2024 · 479 次引用
- Towards Best Practices of Activation Patching in Language Models: Metrics and MethodsFred Zhang, Neel NandaICLR 2024 · 233 次引用
相关 Paper
- Do different prompting methods yield a common task representation in language models?Guy Davidson, Todd M. Gureckis, Brenden M. Lake, Adina WilliamsNeurIPS 2025 · 11 次引用
- 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 次引用
- Revisiting In-context Learning Inference Circuit in Large Language ModelsHakaze Cho, Mariko Kato, Yoshihiro Sakai, Naoya InoueICLR 2025
