Introduction
In-Context Learning (ICL) has become the standard paradigm for steering Large Language Models (LLMs) toward specific tasks without weight updates. However, ICL faces significant challenges: sensitivity to example ordering, consumption of limited context windows, and high computational overhead for long prompts. Recent "task vector" methods attempt to mitigate these issues by compressing task information into a single vector. Yet, these methods typically rely on a fixed vector for an entire task, failing to account for nuances in individual input queries.
Methodology: Adaptive Task Vectors (ATV)
To address the limitations of static task vectors, we introduce Adaptive Task Vectors (ATV). This framework employs a small auxiliary language model to generate query-specific steering signals for a frozen target LLM.
The ATV framework consists of two primary components:
- ATV Generation: A small, lightweight language model (e.g., GPT-2 137M) processes the input query $x$ to produce a compact vector representation from its final hidden state.
- ATV Expansion: A linear projection layer transforms this compact vector into a set of layer-wise steering signals tailored to the target LLM’s architecture (e.g., Llama 3 or Mistral 7B).
During the training phase, the auxiliary modules are optimized using cross-entropy loss to minimize the target LLM's prediction error. At inference, the system generates a unique task vector for every query, enabling per-instance adaptation.
Experimental Evaluation
We evaluated ATV across 20 in-domain tasks and 5 unseen tasks, spanning knowledge retrieval, reasoning, mathematics, safety, and natural language understanding (NLU).
Key Results
- Performance Gains: On Llama 3-8B, ATV achieved an average in-domain accuracy of 62.1%, significantly outperforming 16-shot ICL (55.2%) and previous state-of-the-art vector methods like ELICIT (43.5%).
- Generalization: ATV demonstrated robust generalization to unseen tasks, maintaining an average accuracy of 63.4% on Llama 3, suggesting it learns a generalized steering capability rather than simple task memorization.
- Efficiency: ATV operates with the token efficiency of zero-shot prompting, avoiding the "prompt tax" associated with many-shot ICL.
Discussion and Insights
A key finding of this work is the effectiveness of bottom-up steering. Analysis of layer-wise norms reveals that ATV is most effective when injected into the lower layers of the transformer. This contrasts with previous retrieval-based methods like ELICIT, which tend to rely more on upper-layer reasoning. This suggests that modulating low-level lexical and syntactic representations is crucial for effective task steering.
Furthermore, the authors provide theoretical evidence that ATV is expressively equivalent to Low-Rank Adaptation (LoRA) under equal rank budgets and strictly more expressive than Prefix-Tuning, grounding its empirical success in formal theory.
Conclusion and Future Work
Adaptive Task Vectors offer a dynamic, efficient, and high-performance alternative to traditional ICL and static task vectors. While ATV shows a slight performance gap in complex mathematics compared to retrieval-based ICL, its superior performance in NLU and reasoning makes it a compelling tool for LLM adaptation. Future work will explore more sophisticated expansion modules and the application of ATV to larger frontier models.
Summary updated