From Engineered to Natural Directions

So far, every steering vector we have encountered has been engineered: we chose contrasting prompts, ran them through the model, and computed the difference. Addition steering uses contrast pairs. CAA averages over many pairs. The refusal direction used harmful versus harmless prompts. In every case, a human designed the contrastive stimuli.

Can a model's own in-context-learning computation produce a reusable task signal? Todd et al. (2024) used causal mediation analysis to extract directions associated with tasks such as translation and antonym generation [1]Function Vectors in Large Language Models
Todd, E., Li, M. L., Sharma, A. S., et al.
ICLR, 2024
. The key test is intervention: inserting the extracted signal can recover some task behavior in a new context.

Function Vector: An activation direction extracted from in-context-learning examples that can induce aspects of the demonstrated task when inserted elsewhere. Researchers still choose the task, examples, heads, and extraction method; “function” describes the vector's tested effect, not an exhaustive decoding of its contents.

What Function Vectors Are

Todd et al. applied causal mediation analysis to in-context learning (ICL). When a model processes few-shot examples like:

cat -> gato
dog -> perro
house -> ???

the examples demonstrate English-to-Spanish translation. But where does the model carry information about that task?Induction heads explain one pattern-copying mechanism that can support in-context learning. Function-vector experiments ask a different question: whether a reusable task-related signal is transported by a small set of heads. Neither result alone explains all in-context learning.

The analysis revealed:

  • A small number of attention heads transport a compact representation of the demonstrated task.
  • This representation is a function vector, a direction that encodes what to do (translate, capitalize, find antonyms), not just what is present (sentiment, topic, language).
Overview of function vectors. A function vector is extracted from in-context learning examples of antonym generation or English-to-Spanish translation, then inserted into an unrelated natural text generation context to induce the learned task.
A function vector extracted from in-context learning examples (a, b) transfers to an unrelated zero-shot context (c, d), causing the model to perform the demonstrated task without any examples present. From Todd et al., Function Vectors in Large Language Models.[2]Function Vectors in Large Language Models
Todd, E., Li, M. L., Sharma, A. S., et al.
ICLR, 2024

Examples of tasks encoded as function vectors: "translate English to French," "convert uppercase to lowercase," "return the antonym," "extract the first letter."

Robustness

Function vectors can transfer across some inputs and contexts.

Extract a function vector from in-context examples, such as several English-to-Spanish translation pairs. Then inject it into a prompt with no demonstrations and measure task performance. In the reported settings, the intervention recovers part of the demonstrated behavior on held-out inputs.For example, a vector extracted from pairs such as cat/gato and dog/perro can affect new translation items. Transfer beyond the extraction examples is evidence for task-level information, but performance and specificity determine how strong that claim should be.

Transfer to held-out inputs is evidence that the vector carries more than a lookup of the demonstration tokens. Its success rate and scope still depend on the task, model, layer, and target prompt.

Pause and think: What function vectors tell us

Engineered steering vectors encode concepts that humans chose. Function vectors encode tasks that the model learned to represent through in-context learning. What does the existence of function vectors tell us about how transformers organize information internally? And how does this connect to the linear representation hypothesis?

Function vectors suggest that residual-stream directions can carry information used to select a task, not only information about the input. That extends the linear representation hypothesis in a testable way: a task-related direction should transfer across examples and causally change task performance when added or removed.

Composability

Function vectors can be summed to create new composite tasks:

  • "Translate to French" + "convert to uppercase" = "translate to French in uppercase"

This vector arithmetic for tasks is analogous to the semantic vector arithmetic that made word embeddings famous (king - man + woman = queen), but operating at a much higher level. Instead of composing word meanings, we are composing computations.

Composability of function vectors. Panel (a) shows four list-oriented tasks (First-Copy, First-Capital, Last-Copy, Last-Capital) with their expected outputs. Panel (b) shows the parallelogram arrangement: adding the First-Capital and Last-Copy vectors and subtracting the First-Copy vector yields the Last-Capital vector.
Function vector algebra. Three task vectors (First-Copy, First-Capital, Last-Copy) compose via addition and subtraction to produce a fourth (Last-Capital), forming a parallelogram in activation space. From Todd et al., Function Vectors in Large Language Models.[3]Function Vectors in Large Language Models
Todd, E., Li, M. L., Sharma, A. S., et al.
ICLR, 2024

Successful examples show that linear combination can be meaningful when the component tasks are compatible. Failed or interfering combinations are just as important for determining how far this geometric picture extends.

Pause and think: Limits of composability

Function vectors for "translate to French" and "convert to uppercase" can be summed to get "translate to French in uppercase." But can you think of two tasks whose function vectors probably would not compose well? What properties of tasks make them composable or non-composable?

Tasks that make incompatible demands are plausible failure cases. “Translate to French” and “translate to German” both determine the output language, while “summarize” and “elaborate” push length in opposite directions. Compatible tasks such as translation and capitalization are easier candidates. Calling their representations orthogonal would require measuring the vectors and their effects rather than inferring geometry from the task labels.

The discovery of function vectors was not isolated. Hendel et al. [4]In-Context Learning Creates Task Vectors
Hendel, R., Geva, M., Globerson, A.
EMNLP Findings, 2023
extracted reusable task vectors during in-context learning. Liu et al. [5]In-context Vectors: Making In Context Learning More Effective and Controllable Through Latent Space Steering
Liu, Z., Kitouni, A., Nolte, N., et al.
ICML 2024, 2023
developed in-context vectors, a related method based on latent-space shifts, and tested vector arithmetic on task combinations. These results make task-related linear directions a recurring empirical finding rather than an artifact of one extraction method. They do not imply that every task, model, or in-context-learning strategy reduces to one vector.

The Connection to Steering

Function vectors extend the steering paradigm in an important way:

  • Addition steering vectors: Engineered directions that modify behavior. The researcher chose the concept and designed the contrast pairs.
  • Function vectors: Naturally occurring directions that encode tasks. The model learned them during in-context learning.

Both are directions in activation space. The difference is where they come from: human-specified contrast pairs versus the model's own learning mechanism.

Together, these results suggest that some task-selection information is linearly accessible in the residual stream. They extend the linear representation hypothesis from labeled properties toward task signals, while leaving open whether one direction captures the whole computation.

Together with probing methods and steering techniques, function vectors broaden the questions we can ask of the residual stream: not only “what property is represented?” but also “what task signal is being carried, and does intervening on it change the computation?”

But all the methods so far, including function vectors, require the researcher to specify what to look for. Unsupervised steering vectors take a different approach: discover what latent behaviors a model harbors without specifying the target in advance.