DeCoVec: Building Decoding Space based Task Vector for Large Language Models via In-Context Learning

arXiv cs.CL / 4/14/2026

💬 OpinionSignals & Early TrendsIdeas & Deep AnalysisModels & Research

Key Points

  • DeCoVec introduces a training-free, non-invasive method to steer large language models by constructing “task vectors” in the decoding space using in-context learning.
  • It derives the task vector as the difference between output logit distributions from few-shot versus zero-shot prompts, then injects this vector during generation to influence decoding.
  • Experiments on seven LLMs (0.5B–9B) across TruthfulQA, Math-500, and AQUA-RAT show consistent improvements over standard few-shot baselines, with reported gains up to +5.50 average accuracy.
  • The approach also reduces issues like generation degeneration and logical flaws and remains robust to demonstration ordering, while adding no extra input token costs.
  • By avoiding weight updates and auxiliary models, DeCoVec aims to make LLM steering more flexible and scalable than prior task-vector approaches that require fine-tuning or invasive state manipulation.

Abstract

Task vectors, representing directions in model or activation spaces that encode task-specific behaviors, have emerged as a promising tool for steering large language models (LLMs). However, existing approaches typically require fine-tuning or invasive manipulation of internal states, limiting their flexibility and scalability. We propose \textsc{DeCoVec} (Decoding Space based Task Vector), a training-free and non-invasive framework that constructs task vectors directly in the \textit{decoding space} by leveraging in-context learning (ICL). Specifically, \textsc{DeCoVec} captures the task essence as the difference between the output logit distributions of few-shot and zero-shot prompts, then steers generation by injecting this vector into the decoding process. Experiments across seven LLMs (0.5B--9B) on TruthfulQA, Math-500, and AQUA-RAT show that \textsc{DeCoVec} consistently outperforms standard few-shot baselines, with gains up to +5.50 average accuracy. Further analysis demonstrates that \textsc{DeCoVec} effectively suppresses generation degeneration and logical flaws while exhibiting strong robustness to demonstration ordering, all without incurring additional input token costs. Our method offers a training-free and non-invasive solution for LLM steering without requiring weight updates or auxiliary models.