Adaptive Task Vectors for Large Language Models

Joonseong Kang, Soojeong Lee, Sumin Park, Subeen Park, Taero Kim, Jihee Kim, Ryunyi Lee, Kyungwoo Song · Submission to ICLR 2026 · Rejected

TL;DR

In-Context Learning (ICL) and static task vectors either waste context space on few-shot demonstrations or fail to adapt to query-level nuances. Adaptive Task Vectors (ATV) solves this by using a lightweight helper language model (like GPT-2) to generate a dynamic, query-conditioned task vector for every individual input. These vectors are linearly projected and injected directly into the hidden layers of a frozen target LLM, matching the expressivity of LoRA while outperforming prompt-based and static-vector baselines at high inference speed.

What Problem Does This Paper Address?

While Large Language Models (LLMs) excel at few-shot In-Context Learning (ICL), ICL has well-known bottlenecks: it consumes valuable context window space, slows down inference, and varies wildly depending on example selection and ordering.

To overcome this, prior work introduced task vectors—condensed continuous representations extracted from prompt demonstrations that are directly injected into an LLM's internal activations (e.g., residual streams). However, existing methods (such as ELICIT and I2CL) rely on static vectors: they compute a single fixed vector per task or retrieve one from a pre-indexed bank. If a query deviates from the demonstrations or falls into an unseen domain, static vectors cannot adapt, causing model steering to degrade or even fail catastrophically.

Methods

ATV introduces an external, parameter-efficient steering architecture that leaves the primary LLM completely frozen:

Input Query (x)
   │
   ├──────────────────────────────┐
   ▼                              ▼
Small LM (e.g., GPT-2 137M)    Large LLM (e.g., Llama-3-8B)
   │                              │
Last-Token Hidden State           │
   │                              │
Linear Expansion (fs → L × dl)    │
   │                              │
Layer-wise Vectors (v_ATV) ──────► Additive Injection (h~ = h + λ·v_ATV)
                                  │
                                  ▼
                             Output (y)
  1. Query-Conditioned Generation: A small language model ($M_{\text{small}}$, e.g., standard GPT-2 with 137M parameters) processes the input query $x$. The hidden state of the final token at the last layer is extracted as a semantic summary ($v_{\text{small}} \in \mathbb{R}^{d_s}$).
  2. Layer-wise Expansion: A learned linear projection maps $v_{\text{small}}$ to $\mathbb{R}^{L \times d_l}$, matching the depth $L$ and hidden dimension $d_l$ of the frozen target LLM ($M_{\text{large}}$).
  3. Internal Steering: At each layer $l$, the vector slice $v_{\text{ATV}}^l$ is additively injected into the LLM's last-token hidden state with scaling coefficient $\lambda$: $$\tilde{h}^l = h^l + \lambda v_{\text{ATV}}^l$$
  4. End-to-End Training: Only the small generator and the expansion layer are trained using supervised cross-entropy loss over target tokens. The primary LLM remains frozen throughout.
  5. Theoretical Expressivity: The authors prove that static ATV is functionally equivalent to LoRA under equal rank budgets ($F_{\text{ATV-static}}(r) = F_{\text{LoRA}}(r)$). Because ATV generates vectors dynamically per input query, its parameter update operator changes per instance, making dynamic ATV strictly more expressive than LoRA and Prefix-Tuning.

Datasets

The authors evaluated ATV using benchmarks identical to the ELICIT evaluation suite:

  • In-Domain (20 tasks across 5 categories):
  • Knowledge: CommonsenseQA, OpenBookQA, HellaSwag, BoolQ
  • Reasoning: Big-Bench Hard subsets (Boolean Expressions, Date Understanding, Colored Objects, Temporal Sequences), ARC-Challenge
  • Mathematics: MathQA, MMLU Pro-MATH
  • Safety: Crows-Pairs, BBQ-Age, Ethics-Commonsense, Ethics-Justice
  • NLU: GLUE (SST-2, QNLI, MNLI), SuperGLUE (WIC, RTE)
  • Unseen Generalization (5 held-out tasks): GLUE COLA, BBQ-Religion, Deepmind Mathematics, MMLU High School Psychology, and BBH Logical Deduction Five Objects.
  • Adversarial Evaluation: HANS (Heuristic Analysis for NLI Systems).
  • Multi-Step Reasoning: GSM8K.

No new datasets were introduced; established benchmarks were adapted to test out-of-domain robustness.

Key Insights and Ideas

  • Intra-Task Vector Diversity Matters: t-SNE visualizations showed that task vectors generated by ATV vary widely across queries within the same task. Assuming a task can be distilled into a single static point misses critical query-level nuance.
  • Small Generators Are Sufficient: Scaling the generator from GPT-2 (137M) to GPT-2-XL (1.61B) only improved average accuracy marginally (62.1% vs. 62.2%). A lightweight helper model is fully capable of steering a large model.
  • Architectural Harmony: Decoder-based generators (GPT-2) outperformed encoder-based generators (BERT, Sentence-Transformer) when steering decoder LLMs, indicating that matching inductive biases reduces cross-space embedding mismatch.
  • Early Layer Modulation vs. Late Layer Steering: While prior static retrieval methods (like ELICIT) peak in utility when injected into the top third of layers, ATV performs best when injected across all layers or into the bottom third, allowing modifications to propagate naturally through the transformer stack.
  • Catastrophic Retrieval Collapse on Adversarial Data: On the HANS adversarial benchmark, retrieval-based (BM25) and static vector approaches (ELICIT, I2CL) collapsed to $<1\%$ accuracy because they retrieved structurally mismatched vectors. ATV dynamically synthesized valid representations on the fly, scoring 59.6%.

Key Results

  • In-Domain Superiority: On Llama-3-8B, ATV reached 62.1% average accuracy, outperforming Zero-shot (31.2%), 16-shot ICL (55.2%), BM25 retrieval-ICL (55.8%), ELICIT (43.5%), and I2CL (43.3%). On Mistral-7B, ATV attained 58.3% vs. 55.5% for BM25.
  • Token and Latency Efficiency: ATV achieved this accuracy without prepending context tokens (using ~108 tokens per prompt vs. ~2,350 tokens for BM25 16-shot), resulting in an inference time (~0.045s) comparable to LoRA (~0.032s) and substantially faster than ELICIT (~0.075s).
  • Unseen Task Generalization: On tasks held out during training, ATV scored 63.4% on Llama-3 (BM25: 56.4%, ELICIT: 45.6%) and 59.4% on Mistral-7B (BM25: 49.2%).
  • Multi-Token Steering: On GSM8K, extending the task-vector injection across all decoding steps rather than just the prompt's final token boosted accuracy from 35.3% to 47.0%.

Limitations and Future Work

  • Procedural/Algorithmic Tasks: In the general multi-task setup, ATV initially trailed BM25 on math tasks (25.8% vs. 28.0%), likely because symbolic and procedural alignment benefits more from exact demonstration templates than semantic steering. However, domain-specific training on math datasets narrowed this gap (improving ATV to 28.9%).
  • Multi-Step Decoding Overhead: While injecting vectors across all generated tokens significantly boosts complex chain-of-thought reasoning (e.g., on GSM8K), continuing injection across long autoregressive generations increases implementation complexity relative to standard prompt-time injection.
  • Training Requirement: Unlike pure zero-shot or plug-and-play retrieval ICL methods, ATV requires an initial training stage to optimize the generator and projection matrix on supervised data.

Summary updated

BibTeX
@inproceedings{kang2025adaptive,
  author = {Joonseong Kang and Soojeong Lee and Sumin Park and Subeen Park and Taero Kim and Jihee Kim and Ryunyi LEE and Kyungwoo Song},
  title = {{Adaptive Task Vectors for Large Language Models}},
  booktitle = {MechInterp @ NeurIPS},
  year = {2025},
  url = {https://openreview.net/forum?id=HaAW356Htr},
}
Figure