Steering Language Models With Activation Engineering
TL;DR. Run the model on two contrasting prompts (for example “Love” and “Hate”), take the difference of their residual-stream activations at one layer, scale it, and add it to the residual stream while the model processes any other prompt. The output shifts toward the concept. ActAdd needs two forward passes to build the vector, no gradients and no labelled data.
Why it matters now. Activation addition is the simplest causal write operation on a model’s representations. It underlies refusal ablation, persona and honesty vectors, and many “steer an agent” demos. It is also a cheap test of the linear representation hypothesis: if adding a direction changes behaviour in a targeted way, the concept is at least partly linear there. For IR people, the same move could push a generator toward grounding in retrieved context, or push an embedding model’s query vectors toward a facet.
Key idea
Section titled “Key idea”For a prompt pair , injection layer and coefficient :
added position by position starting at position (the paper uses ), over the length of the contrast prompts. The shorter of and is right-padded with whitespace so the two line up (Algorithm 1, App. C).
The running example in GPT-2 XL (residual width 1600) is the wedding vector: “weddings”, a run of spaces. Algorithm-level choices:
- Layer. Steering works from the first layer, is strongest in early-middle layers, and fades in late ones.
- Coefficient. Typical values are . Large makes the vector dominate the stream: at the Anger−Calm vector has about 10 times the residual norm (App. F). The paper’s reading that “around 90%” of the stream is then the steering vector is a heuristic that ignores destructive interference.
- Position. Later positions within the prompt steer more strongly, but adding to the very last position tends to break syntax (App. C).
Key results
Section titled “Key results”- Topic steering (§4.1). The wedding vector lowers GPT-2 XL perplexity on wedding-related OpenWebText sentences while leaving unrelated sentences roughly unchanged. In the layer sweep, completions mention weddings in over 90% of cases at the best layer (around 6), vs about 2% unsteered (Figure 3).
- Toxicity (Table 3, RealToxicityPrompts, n = 1000). ActAdd on OPT-6.7B reduces toxicity from .134 (unsteered) to .112, with disfluency 8.9 → 13.8; prompting gives .200 with disfluency 54.3. The paper reports ActAdd-OPT is 8% less toxic than the second-best method, PREADD-D, and gives a 5% drop on LLaMA-3-8B.
- Sentiment (Table 4, IMDb). Negative-to-positive steering succeeds 0.669 of the time for LLaMA-3 (baseline 0.417) and 0.564 for OPT (baseline 0.445), with 1.5× to 3× worse disfluency.
- Checks (App. G, H). A random vector of equal norm changes the output distribution in a less targeted way than the steering vector. Adding the first dimensions (c = +4, layer 6) gives smoothly increasing effects; for one prompt the first 1120 dimensions steer more than all 1600.
Limitations & open questions
Section titled “Limitations & open questions”- Three free hyperparameters (layer, coefficient, alignment) are found by hand per concept; the paper itself says this makes ActAdd less user-friendly.
- One contrast pair is a noisy estimate of a direction. Later methods average over many pairs (representation engineering, refusal direction).
- It is not clear which concepts are linear enough to steer; the linear representation hypothesis page shows that the inner product used to compare directions matters.
- Evaluation relies on automatic judges (GPT-3.5 topic scoring, toxicity classifiers), which have their own biases.
Connections
Section titled “Connections”- Activation patching reads the same activation differences to localise behaviour; ActAdd writes them to change it.
- Refusal direction applies difference-in-means steering and ablation to safety behaviour across 13 chat models.
- Task arithmetic does the analogous addition in weight space instead of activation space.
- Natural language autoencoders build steering vectors by editing a text explanation of an activation and reconstructing it.
- Sycophancy is a common target for steering-based mitigation.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Toy residual stream of width 3. At layer l the contrast prompts give h₊ = (2, 1, 0) and h₋ = (1, 1, 1). (a) Build the ActAdd vector with c = 3 and add it to a user-prompt state h = (0.5, 2, 1). (b) The paper notes that Anger−Calm at c = +10 has about 10 times the norm of the residual stream. How large can the resulting stream norm be, in what sense does the steering vector dominate it, and what does that imply about fluency?
What a strong answer covers
- (a) h_A = h₊ − h₋ = (1, 0, −1); c·h_A = (3, 0, −3); h + c·h_A = (3.5, 2, −2).
- (b) With ‖s‖ = 10‖h‖ for s = c·h_A, ‖h + s‖/‖h‖ = √(101 + 20 cos θ), so the resulting norm lies between 9‖h‖ and 11‖h‖ depending on the angle θ. The steering vector dominates in scale, but its "share of the norm" is not uniquely defined: vector norms do not split into additive percentages.
- The paper's "around 90% of the residual stream is the steering vector" is an explicit heuristic that ignores destructive interference (App. F), not an angle-independent identity.
- The original prompt information is a small fraction of the state at that layer, so later layers mostly see the concept; large c buys strong steering at the cost of coherence.
- This is why the paper typically keeps |c| below about 15 and reports disfluency alongside success.
- Mechanism
ActAdd uses the difference h₊ − h₋ of a contrast pair, not h₊ alone, and recommends a run of spaces as p₋ for single-concept steering. Explain what the subtraction removes and why the choice of p₋ matters.
What a strong answer covers
- h₊ alone contains everything about the prompt: position, syntax, start-of-text features and the concept. Adding it injects all of that.
- Subtracting h₋ from a matched prompt cancels the shared components, leaving mostly the direction that distinguishes the concept (e.g. Love vs Hate).
- Spaces work as a neutral p₋ because they share length and position but carry little content; the end-of-text token works poorly as p₋ (App. C).
- The shorter prompt is right-padded with whitespace so positions line up, since the vector is added position by position from a = 1.
- What if…
The paper sweeps the injection layer, compares against random vectors of equal norm, and adds only the first n of 1600 residual dimensions. Summarise what each experiment shows about whether ActAdd works through a meaningful direction.
What a strong answer covers
- Layer sweep (wedding vector, GPT-2 XL): steering already works at layer 1, peaks around layer 6 with over 90% of completions mentioning weddings vs about 2% unsteered, then declines.
- Random vectors with the same norm change the next-token distribution in a less targeted way; the anger vector changes it less than a random vector does (App. G), so the effect is not just a large perturbation.
- Adding only the first n dimensions (c = +4, layer 6) increases the effect smoothly with n, and in one prompt 1120 dimensions beat all 1600 (App. H), so the effect is spread across many dimensions.
- Together these argue for a distributed linear direction rather than a few special neurons or a norm effect.
- Critique
On RealToxicityPrompts, ActAdd-OPT lowers toxicity from .134 to .112 while disfluency rises from 8.9 to 13.8. Critique whether this shows a better trade-off than prompting, and design a test that could falsify the claim that the vector targets toxicity specifically.
What a strong answer covers
- Prompting in the same table gives toxicity .200 with disfluency 54.3, so ActAdd is better on both axes there; the fluency penalty is real but smaller.
- The comparison uses one coefficient and layer; a fair test sweeps c and plots the toxicity–disfluency frontier for both methods.
- Falsifier: apply the same vector to non-toxic prompts and measure off-target changes (topic drift, sentiment, task accuracy); large changes there mean the vector is not toxicity-specific.
- Also compare to a random vector of equal norm and to the h₊-only vector at matched disfluency.
- Design
You want a RAG answerer to stay grounded in the retrieved passages instead of its parametric memory, without fine-tuning. Hypothetical exercise constraints: one 24 GB GPU, an 8B-parameter open model, at most 30 (layer, coefficient) configurations in the sweep, and a held-out set of 300 questions you may touch only once. Design an ActAdd experiment (contrast pairs, which configurations to spend the budget on, evaluation) and say when you would ship the steering vector instead of a prompting-only fix.
What a strong answer covers
- Contrast pairs: the same question answered "According to the passage, …" vs "From what I know, …", or prompts with and without an instruction to quote the context; average differences over many pairs to reduce noise.
- Sweep layers (early-middle first, as in the paper) and c, and inject from the first position as ActAdd does.
- Evaluate faithfulness to context (e.g. answer-support by a judge or nugget recall), accuracy on counterfactual passages where context and memory disagree, and disfluency.
- Controls: random vector of equal norm, prompting-only baseline, and a check that retrieval-free questions are not damaged.
- Budget: spend the 30 configurations on a coarse layer grid (for example 5 layers by 6 coefficients) chosen on a separate development split, then evaluate only the chosen configuration on the held-out 300.
- Trade-off: ship the vector only if it beats a well-tuned grounding instruction on faithfulness at comparable fluency and latency; otherwise prompting is cheaper to maintain.