Steering Models with Contrastive Activation Vectors

241 concepts198 papers2 proposals

Deep neural networks represent information as coordinates in a high-dimensional vector space. A remarkable property of these spaces is their linearity: complex semantic concepts, behavioral traits, and cognitive modes are often aligned along specific directional axes within the model's internal layers. Instead of modifying millions of parameters via expensive fine-tuning, we can alter a model's behavior by identifying these latent directions and directly shifting internal activations during inference.

The Core Mechanism: Contrastive Extraction

How do we isolate a vector that represents an abstract concept like "refusal" or "systematic reasoning" without capturing irrelevant features like sentence structure or topic context? The answer lies in contrastive pairs.

To isolate a targeted behavior, we feed the model two sets of prompts that are structurally similar but opposite in the underlying attribute. For example, to find a reasoning direction, we might pair prompts that trigger deep, step-by-step deliberation with prompts that elicit immediate, rote answers. By extracting the hidden states (or residual stream activations) at a specific layer and computing the difference between their mathematical means, the shared background features cancel out. What remains is a clean directional vector representing the behavioral shift.

Positive Activations (e.g., Reasoning) ---------\
                                                 --> [Difference in Means] --> Steering Vector
Negative Activations (e.g., Memorization) -------/

This foundational approach, often termed Contrastive Activation Addition (CAA), was leveraged in Steering Llama 2 via Contrastive Activation Addition to precisely modulate attributes like truthfulness and sycophancy. Similarly, Andy Arditi et al. demonstrated in Refusal in Language Models Is Mediated by a Single Direction that the refusal mechanism in safety-aligned models is mediated by a single linear bottleneck, which can be cleanly isolated using this difference-in-means method.

Why It Works: Geometric Cancellation

To understand why a simple subtraction yields such precise control, consider an activation vector $h$ as a combination of multiple orthogonal feature vectors:

$$h = v_{\text{syntax}} + v_{\text{topic}} + v_{\text{behavior}} + \epsilon$$

When we process a positive prompt and a negative prompt that share the same structure and topic, $v_{\text{syntax}}$ and $v_{\text{topic}}$ remain largely invariant across both runs. Subtracting the negative activation from the positive activation mathematically eliminates these shared contextual subspaces:

$$\Delta h = h_{\text{pos}} - h_{\text{neg}} \approx v_{\text{behavior}}$$

This geometric property allows researchers to isolate highly abstract cognitive modes. For instance, Yihuai Hong et al. identified "Linear Reasoning Features" (LiReFs) in The Reasoning-Memorization Interplay in Language Models Is Mediated by a Single Direction, isolating the exact vector that toggles a model between systematic reasoning and rote memorization.

To control high-level character traits, Runjin Chen developed an automated pipeline in Persona Vectors: Monitoring and Controlling Character Traits in Language Models to extract vectors for traits like malice or sycophancy by comparing activations under opposing system instructions, demonstrating that complex personas project down onto simple linear axes.

Inference-Time Intervention

Once a contrastive vector $\vec{v}$ is extracted, it can be injected back into the model's forward pass at specific layers during inference:

$$h_{\text{steered}} = h + \alpha \vec{v}$$

Here, $\alpha$ acts as a continuous control knob. A positive $\alpha$ amplifies the behavior, while a negative $\alpha$ suppresses it.

This intervention bypasses the need for test-time optimization or iterative token-level adjustments. For example, Alessandro Stolfo et al. utilized this technique in Improving Instruction-Following in Language Models through Activation Steering to enforce strict formatting and length constraints by injecting pre-computed instruction vectors directly into the residual stream.

To optimize reasoning efficiency, Nathan Egbuna et al. introduced Amortized Latent Steering (ALS) in Amortized Latent Steering: Low-Cost Alternative to Test-Time Optimization, computing a global "success" vector offline from correct and incorrect reasoning trajectories to guide inference without per-query optimization overhead.

The Efficiency of Linear Baselines

While the mechanistic interpretability community has heavily invested in unsupervised dictionary learning methods like Sparse Autoencoders (SAEs) to find interpretable features, recent evaluations suggest that simple contrastive baselines are remarkably competitive for behavioral control.

In AxBench: Steering LLMs? Even Simple Baselines Outperform Sparse Autoencoders, Zhengxuan Wu et al. demonstrated that supervised concept direction learning—such as the difference-in-means vector—consistently outperforms SAEs at both detecting and steering targeted concepts. This highlights that for direct behavioral intervention, explicitly isolating the axis of variation via contrastive analysis provides a direct, computationally lightweight, and highly effective lever for model alignment and control.

History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_contrastive_activation_analysis_contrast_42a7f793,
  title = {contrastive activation analysis (contrastive activation extraction)},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/contrastive-activation-analysis-contrastive-activation-extraction/rdr_42a7f793c3204d049e4c6fdf13f9b5db},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-20},
}

This exact version (version 1, frozen text):

@misc{lacuna_contrastive_activation_analysis_contrast_42a7f793_v1,
  title = {contrastive activation analysis (contrastive activation extraction)},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/contrastive-activation-analysis-contrastive-activation-extraction/rdr_42a7f793c3204d049e4c6fdf13f9b5db/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-20},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake