In-Context Learning Creates Task Vectors

Roee Hendel, Mor Geva, Amir Globerson
10/24/2023
cs.CL

No official code found. Best implementation: roeehendel/icl_task_vectors (106 stars, last commit 2023-10-30).

Abstract

In-context learning (ICL) in Large Language Models (LLMs) has emerged as a powerful new learning paradigm. However, its underlying mechanism is still not well understood. In particular, it is challenging to map it to the "standard" machine learning framework, where one uses a training set $S$ to find a best-fitting function $f(x)$ in some hypothesis class. Here we make progress on this problem by showing that the functions learned by ICL often have a very simple structure: they correspond to the transformer LLM whose only inputs are the query $x$ and a single "task vector" calculated from the training set. Thus, ICL can be seen as compressing $S$ into a single task vector $\boldsymbolθ(S)$ and then using this task vector to modulate the transformer to produce the output. We support the above claim via comprehensive experiments across a range of models and tasks.

View on arXivView PDF

Code Implementations(1)

10626TeX, ShellOct 28, 20232 years ago

Similar Papers

Cite this paper

@article{hendel2023incontext,
  title  = {In-Context Learning Creates Task Vectors},
  author = {Roee Hendel and Mor Geva and Amir Globerson},
  year   = {2023},
  eprint = {2310.15916},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2310.15916v1}
}

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/2310.15916.svg)](https://codeofpaper.com/paper/2310.15916)

Discussion