CAA steering vector construction (Mean Difference over multiple-choice contrast pairs)

Steering Llama 2 via Contrastive Activation Additionintroduced

The specific procedure for building a CAA steering vector: for a dataset of (prompt, positive completion, negative completion) triples, extract layer-L residual stream activations at the answer-letter token position for both completions and average their difference over the whole dataset (Equation 1).

A steering vector is only as good as the noise it cancels out. Take the activation difference from a single pair of prompts and you inherit whatever idiosyncrasies happened to distinguish that one pair; average the same difference over hundreds of matched pairs instead, and what's left is a cleaner signal for the behavior itself rather than the sentence that happened to carry it.

The mechanics get worked through here: a dataset of paired positive and negative completions turns into layer-by-layer activation differences at the exact token position of the answer letter, then those differences are averaged into the single vector CAA adds back into the model.

What gets fed into an existing formula

This concept is not a new extraction algorithm; it is a specific set of inputs to one that already existed. Mean Difference (MD) vector extraction was already in use elsewhere — Zou et al. and Li et al. had both applied it before this paper (contrastive-activation-addition, §"2 Related work", p. 2). What construction contributes is what gets fed into that shared machinery: a dataset $D$ of hundreds of Multiple-choice contrast-pair format triples $(p, c_p, c_n)$, a chosen layer $L$, and one fixed token position, the appended answer letter. Equation 1 assembles these: $v_{MD} = \frac{1}{|D|}\sum_{p,c_p,c_n \in D} a_L(p, c_p) - a_L(p, c_n)$ (contrastive-activation-addition, §"3 Method", p. 3) — for every pair, take the residual-stream activation at the answer-letter position under each completion, subtract, and average across the whole dataset. The paper states plainly that "this method of extracting the difference vector is called Mean Difference (MD)" (contrastive-activation-addition, §"3 Method", p. 3); the contribution here sits entirely in the dataset, layer, and token position chosen for Contrastive Activation Addition (CAA), not in new arithmetic.

Why the pairs have to differ by exactly one token

Multiple-choice contrast-pair format is what makes the averaged difference clean rather than noisy. Because the positive and negative prompts in a pair are identical up to the final answer letter, topic, phrasing, and question content contribute equally to both activations being subtracted, so "we isolate the internal representation most related to the target behavior while canceling out other confounding variables" (contrastive-activation-addition, §"3 Method", p. 3). Before any vector is actually built, PCA visualization of contrastive activations screens whether a dataset's activations even separate by the behavior at a candidate layer, described as useful "for determining whether a dataset will enable the generation of effective steering vectors" (contrastive-activation-addition, §"3.2 Visualizing activations for contrastive dataset analysis", p. 4) — a check that precedes construction rather than following it.

Refining a single pair into an average over hundreds

The recipe is explicitly modeled on Turner et al.'s Activation Addition (ActAdd) but changes three things at once: it averages over hundreds of contrast pairs per behavior instead of one, which "reduces noise in the steering vector, allowing for a more precise encoding of the behavior of interest"; it adds the result to every token position after the prompt rather than only the first; and it is validated across seven behaviors on RLHF-trained chat models rather than GPT-2-XL alone (contrastive-activation-addition, §"2 Related work", p. 2). Inter-layer steering vector similarity and transfer later shows this construction isolates something more general than a layer-13-specific artifact: vectors built at nearby layers resemble each other, and a layer-13 vector still steers behavior when applied elsewhere, up to a steep drop-off around layer 17.