Understanding Task Vectors in In-Context Learning: Emergence, Functionality, and Limitations

Yuxin Dong, Jiachen Jiang, Zhihui Zhu, Xia Ning
6/10/2025
cs.LG

No confident code implementation found for this paper.

Abstract

Task vectors offer a compelling mechanism for accelerating inference in in-context learning (ICL) by distilling task-specific information into a single, reusable representation. Despite their empirical success, the underlying principles governing their emergence and functionality remain unclear. This work proposes the Linear Combination Conjecture, positing that task vectors act as single in-context demonstrations formed through linear combinations of the original ones. We provide both theoretical and empirical support for this conjecture. First, we show that task vectors naturally emerge in linear transformers trained on triplet-formatted prompts through loss landscape analysis. Next, we predict the failure of task vectors on representing high-rank mappings and confirm this on practical LLMs. Our findings are further validated through saliency analyses and parameter visualization, suggesting an enhancement of task vectors by injecting multiple ones into few-shot prompts. Together, our results advance the understanding of task vectors and shed light on the mechanisms underlying ICL in transformer-based models.

View on arXivView PDF

Code Implementations

No confident code match yet

We couldn't find an author-owned or strongly-evidenced community implementation for this paper. Any repos shown below are weak matches — verify before relying on them.

No code implementations found yet.

Know of an implementation? Let us know in the comments below!

Similar Papers

Cite this paper

@article{dong2025understanding,
  title  = {Understanding Task Vectors in In-Context Learning: Emergence, Functionality, and Limitations},
  author = {Yuxin Dong and Jiachen Jiang and Zhihui Zhu and Xia Ning},
  year   = {2025},
  eprint = {2506.09048},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.09048v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.09048.svg)](https://codeofpaper.com/paper/2506.09048)

Discussion