Unifying Attention Heads and Task Vectors via Hidden State Geometry in In-Context Learning
Not on the map. Why?
Abstract (arXiv)
The unusual properties of in-context learning (ICL) have prompted investigations into the internal mechanisms of large language models. Prior work typically focuses on either special attention heads or task vectors at specific layers, but lacks a unified framework linking these components to the evolution of hidden states across layers that ultimately produce the model's output. In this paper, we propose such a framework for ICL in classification tasks by analyzing two geometric factors that govern performance: the separability and alignment of query hidden states. A fine-grained analysis of layer-wise dynamics reveals a striking two-stage mechanism: separability emerges in early layers, while alignment develops in later layers. Ablation studies further show that Previous Token Heads drive separability, while Induction Heads and task vectors enhance alignment. Our findings thus bridge the gap between attention heads and task vectors, offering a unified account of ICL's underlying mechanisms.
Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). Builds on 17 of its 28 references that are in the map. First posted on arXiv 24 May 2025.
Builds on
17 of 28 references.
References · 17
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2013Efficient Estimation of Word Representations in Vector Spacecited by 4,346
- 2021What Makes Good In-Context Examples for GPT-3?cited by 1,184
- 2023The Geometry of Truth: Emergent Linear Structure in Large Language Model Representations of True/False Datasetscited by 673
- 2022Data Distributional Properties Drive Emergent In-Context Learning in Transformerscited by 303
- 2023In-Context Learning Creates Task Vectorscited by 302
- 2023Function Vectors in Large Language Modelscited by 292
- 2024A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and Toxicitycited by 179
- 2023The Truth is in There: Improving Reasoning in Language Models with Layer-Selective Rank Reductioncited by 120
- 2023The mechanistic basis of data dependence and abrupt learning in an in-context classification taskcited by 115
- 2024What needs to go right for an induction head? A mechanistic study of in-context learning circuits and their formationcited by 86
5 more
- 2023Overthinking the Truth: Understanding how Language Models Process False Demonstrationscited by 78
- 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformerscited by 28
- 2024Revisiting In-context Learning Inference Circuit in Large Language Modelscited by 16
- 2025The Geometry of Prompting: Unveiling Distinct Mechanisms of Task Adaptation in Language Modelscited by 14
- 2024Token-based Decision Criteria Are Suboptimal in In-context Learningcited by 9
Built on by
Citing papers per year: 2025: 3; 2026: 7.
10 papers.
- 2025CoT Vectors: Transferring and Probing the Reasoning Mechanisms of LLMscited by 4
- 2025Task Vectors, Learned Not Extracted: Performance Gains and Mechanistic Insightcited by 3
- 2026HIFICL: High-Fidelity In-Context Learning for Multimodal Taskscited by 1
- 2026The Geometric Price of Discrete Logic: Context-driven Manifold Dynamics of Number Representationscited by 1
- 2025Localizing Task Recognition and Task Learning in In-Context Learning via Attention Head Analysiscited by 0
- 2026Context-Gated Associative Retrieval: From Theory to Transformerscited by 0
- 2026Few-Shot Demonstrations Elicit the Use of In-Context World Representations in LLMscited by 0
- 2026Can Linguistic Reasoning Vectors Enhance Multimodal Reasoning Ability?cited by 0
- 2026Are In-Context Images Worth 10 Dimensions?cited by 0
- 2026Rules Amortize, Pairings Don't: Linguistic Structure Determines What Latent Task Representations Can Replace In-Context Learningcited by 0
- 2026Rules Amortize, Pairings Don't: Linguistic Structure Determines What Latent Task Representations Can Replace In-Context Learning30 Sep 2026
- 2026Are In-Context Images Worth 10 Dimensions?29 Sep 2026
- 2026Can Linguistic Reasoning Vectors Enhance Multimodal Reasoning Ability?25 Sep 2026
- 2026Few-Shot Demonstrations Elicit the Use of In-Context World Representations in LLMs21 Sep 2026
- 2026Context-Gated Associative Retrieval: From Theory to Transformers8 May 2026
- 2026The Geometric Price of Discrete Logic: Context-driven Manifold Dynamics of Number Representations24 Mar 2026
- 2026HIFICL: High-Fidelity In-Context Learning for Multimodal Tasks13 Mar 2026
- 2025CoT Vectors: Transferring and Probing the Reasoning Mechanisms of LLMs1 Oct 2025
- 2025Task Vectors, Learned Not Extracted: Performance Gains and Mechanistic Insight29 Sep 2025
- 2025Localizing Task Recognition and Task Learning in In-Context Learning via Attention Head Analysis29 Sep 2025