TL;DR
This paper introduces a massive ~500x speedup and significant accuracy boost for creating and using "Function Vectors" (FVs)—latent task representations used to steer Large Language Models (LLMs). By replacing slow activation-based head selection with gradient-based Layer-wise Relevance Propagation (LRP) and applying FVs in a distributed manner rather than a single aggregated layer, the authors make model steering both highly efficient and more faithful to the model's internal mechanics.
What Problem Does This Paper Address?
When an LLM learns a task via in-context learning (ICL) using a few examples, it generates internal representations of that task within its attention heads. Recent research has shown we can extract these representations as "Function Vectors" (FVs) and inject them into the model to force it to execute specific tasks (like translating or finding antonyms) without needing explicit prompts or examples.
However, current methods face two major bottlenecks:
- Inefficient Extraction: Identifying which attention heads are responsible for a task typically relies on computing the Average Indirect Effect (AIE). This requires a massive number of forward passes, evaluating each head in isolation, which is computationally prohibitive for large models.
- Suboptimal Steering: Standard approaches aggregate the vectors from the top attention heads and inject them into a single, manually chosen "optimal" layer. This ignores the naturally distributed architecture of transformers.
Methods
The authors tackle these challenges by optimizing two degrees of freedom: head selection and vector patching.
- Head Selection via AttnLRP: Instead of using activation-based patching (AIE), the authors leverage AttnLRP (Attention-aware Layer-wise Relevance Propagation). This gradient-based attribution method traces relevance from the output back to the attention weights in a single backward pass. It focuses specifically on the "intensional frame"—the core task-defining tokens within an instruction (e.g., underlining "opposite" in "Provide a word that is the semantic opposite").
- Distributed Function Vectors (DFV): Instead of averaging the top-$K$ head activations and smashing them into a single residual stream layer, the authors introduce DFV. This technique reinjects each head's averaged representation exactly back into its original location (its specific layer and head index). This eliminates the need to search for an optimal injection layer hyperparameter.
Datasets
The authors evaluated their approach using the dataset framework from Davidson et al. (2025), which includes a diverse suite of textual instruction tasks. After filtering out classification tasks and low-performance outliers, they settled on 47 distinct tasks (encompassing operations like capitalization, translation, antonym generation, and sequence manipulation).
Experiments were validated across three distinct instruction-tuned model families: Llama-3.2-3B, Llama-3.1-8B, and Qwen3-4B.
Key Insights and Ideas
- Distributed Architecture Demands Distributed Steering: Smashing task representations into a single layer's residual stream is an unnatural intervention. Injecting FVs back into their native, distributed head locations preserves the model's natural compositional pathways, leading to cleaner task execution.
- Gradients Capture Interactions Better Than Isolation: AIE evaluates attention heads in isolation. LRP, by using rule-based backpropagation, successfully captures the complex, non-linear interactions between model components, yielding a more faithful map of task-essential heads.
- The "Middle Layer" Phenomenon: Interestingly, both AIE and LRP consistently identify attention heads located in the middle layers of the LLMs as the primary drivers of task processing, reinforcing previous mechanistic interpretability findings.
Key Results
The combination of LRP and DFV yields substantial improvements in both speed and performance:
- Massive Speedups: Extracting task heads with LRP achieved an average ~500x speedup over AIE. On an NVIDIA RTX 5090 GPU, processing throughput jumped from a crawl of ~3 samples per minute with AIE to over 1,339 samples per minute with LRP.
- Higher Accuracy: As shown in Figure 2, the distributed patching method (DFV) consistently outperformed standard single-layer injection across all models, boosting accuracy by up to 15.6 percentage points. LRP-selected heads also consistently beat AIE-selected heads.
- Effective Steering: In qualitative tests, the combined
LRP + DFVmethod successfully steered an English prompt to generate a correct continuation in Spanish, whereas the standardAIE + FVmethod failed and continued in English.
Limitations and Future Work
While the paper marks a major step forward for efficient model steering, a few limitations remain:
- Manual Token Selection: Identifying the "intensional frame" (the task-defining tokens) currently requires manual annotation for each instruction template. Automating this search is a primary open question.
- Alternative Attribution Methods: The authors suggest that future work could explore even more sophisticated attribution methods, such as Shapley values, to refine head selection further.
Summary updated