Task Vectors, Learned Not Extracted: Performance Gains and Mechanistic Insight
Not on the map. Why?
Abstract (arXiv)
Large Language Models (LLMs) can perform new tasks from in-context demonstrations, a phenomenon known as in-context learning (ICL). Recent work suggests that these demonstrations are compressed into task vectors (TVs), compact task representations that LLMs exploit for predictions. However, prior studies typically extract TVs from model outputs or hidden states using cumbersome and opaque methods, and they rarely elucidate the mechanisms by which TVs influence computation. In this work, we address both limitations. First, we propose directly training Learned Task Vectors (LTVs), which surpass extracted TVs in accuracy and exhibit superior flexibility-acting effectively at arbitrary layers, positions, and even with ICL prompts. Second, through systematic analysis, we investigate the mechanistic role of TVs, showing that at the low level they steer predictions primarily through attention-head OV circuits, with a small subset of "key heads" most decisive. At a higher level, we find that despite Transformer nonlinearities, TV propagation is largely linear: early TVs are rotated toward task-relevant subspaces to improve logits of relevant labels, while later TVs are predominantly scaled in magnitude. Taken together, LTVs not only provide a practical approach for obtaining effective TVs but also offer a principled lens into the mechanistic foundations of ICL.
Key facts. Cited by 3 papers in the map (data through 14 Oct 2026). Builds on 49 of its 61 references that are in the map. First posted on arXiv 29 Sep 2025.
Builds on
49 of 61 references.
References · 49
- 2015Deep Residual Learning for Image Recognitioncited by 52,096
- 2020Language Models are Few-Shot Learnerscited by 32,419
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 14,132
- 2013Efficient Estimation of Word Representations in Vector Spacecited by 4,375
- 2021Pre-train, Prompt, and Predict: A Systematic Survey of Prompting Methods in Natural Language Processingcited by 2,234
- 2023Efficient Streaming Language Models with Attention Sinkscited by 2,186
- 2016Understanding deep learning requires rethinking generalizationcited by 1,674
- 2023Inference-Time Intervention: Eliciting Truthful Answers from a Language Modelcited by 1,302
- 2023Steering Llama 2 via Contrastive Activation Additioncited by 1,085
- 2023Steering Language Models With Activation Engineeringcited by 922
- 2019Are Sixteen Heads Really Better than One?cited by 816
- 2024Yi: Open Foundation Models by 01.AIcited by 719
37 more
- 2023The Linear Representation Hypothesis and the Geometry of Large Language Modelscited by 716
- 2023The Geometry of Truth: Emergent Linear Structure in Large Language Model Representations of True/False Datasetscited by 712
- 2023In-Context Learning Creates Task Vectorscited by 312
- 2025Layer by Layer: Uncovering Hidden Representations in Language Modelscited by 311
- 2024Massive Activations in Large Language Modelscited by 294
- 2019A Multiscale Visualization of Attention in the Transformer Modelcited by 292
- 2019Analyzing the Structure of Attention in a Transformer Language Modelcited by 243
- 2022Extracting Latent Steering Vectors from Pretrained Language Modelscited by 225
- 2024A Mechanistic Understanding of Alignment Algorithms: A Case Study on DPO and Toxicitycited by 185
- 2024Personalized Steering of Large Language Models: Versatile Steering Vectors Through Bi-directional Preference Optimizationcited by 118
- 2023Language Models Implement Simple Word2Vec-style Vector Arithmeticcited by 98
- 2024Cutting Off the Head Ends the Conflict: A Mechanism for Interpreting and Mitigating Knowledge Conflicts in Language Modelscited by 91
- 2023Agent Attention: On the Integration of Softmax and Linear Attentioncited by 90
- 2023Copy Suppression: Comprehensively Understanding an Attention Headcited by 76
- 2024Attention Heads of Large Language Models: A Surveycited by 67
- 2022Rethinking the Role of Scale for In-Context Learning: An Interpretability-based Case Study at 66 Billion Scalecited by 64
- 2025Which Attention Heads Matter for In-Context Learning?cited by 61
- 2025Steering Large Language Model Activations in Sparse Spacescited by 58
- 2025Do Language Models Use Their Depth Efficiently?cited by 50
- 2024Identifying Semantic Induction Heads to Understand In-Context Learningcited by 47
- 2025One-shot Optimized Steering Vectors Mediate Safety-relevant Behaviors in LLMscited by 29
- 2024Out-of-distribution generalization via composition: a lens through induction heads in Transformerscited by 28
- 2024Beyond Single Concept Vector: Modeling Concept Subspace in LLMs with Gaussian Distributioncited by 27
- 2024Your Transformer is Secretly Linearcited by 23
- 2020Linear Attention Mechanism: An Efficient Attention for Semantic Segmentationcited by 21
- 2025Task Vectors in In-Context Learning: Emergence, Formation, and Benefitcited by 20
- 2025The Geometry of Prompting: Unveiling Distinct Mechanisms of Task Adaptation in Language Modelscited by 18
- 2024Revisiting In-context Learning Inference Circuit in Large Language Modelscited by 17
- 2025Unlocking the Power of Function Vectors for Characterizing and Mitigating Catastrophic Forgetting in Continual Instruction Tuningcited by 16
- 2025The Atlas of In-Context Learning: How Attention Heads Shape In-Context Retrieval Augmentationcited by 11
- 2025Unifying Attention Heads and Task Vectors via Hidden State Geometry in In-Context Learningcited by 10
- 2024Emergence and Effectiveness of Task Vectors in In-Context Learning: An Encoder Decoder Perspectivecited by 9
- 2025Understanding Task Vectors in In-Context Learning: Emergence, Functionality, and Limitationscited by 9
- 2025Provable In-Context Vector Arithmetic via Retrieving Task Conceptscited by 8
- 2025From Compression to Expression: A Layerwise Analysis of In-Context Learningcited by 6
- 2025Beyond Demonstrations: Dynamic Vector Construction from Latent Representationscited by 4
- 2025REAL: Reading Out Transformer Activations for Precise Localization in Language Model Steeringcited by 3
Built on by
Citing papers per year: 2026: 3.
3 papers.