Inferensys

Glossary

Contrastive Activation Addition

A method for computing a steering vector by subtracting the mean activations of a negative-prompt dataset from a positive-prompt dataset and adding the difference during inference.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
STEERING VECTOR COMPUTATION

What is Contrastive Activation Addition?

A method for computing a steering vector by subtracting the mean activations of a negative-prompt dataset from a positive-prompt dataset and adding the difference during inference.

Contrastive Activation Addition is an inference-time intervention technique that computes a steering vector by subtracting the mean residual stream activations of a negative-prompt dataset from those of a positive-prompt dataset. This difference vector captures a high-level behavioral direction, such as honesty or sentiment, and is added to the model's forward pass to reliably induce the target behavior without weight modification.

The method operates by caching activations at a chosen layer for paired contrastive prompts, then injecting the scaled difference vector during subsequent generations. As a form of representation engineering, it provides a lightweight, top-down control mechanism that directly manipulates a model's cognitive state, enabling researchers to steer outputs toward desired attributes while preserving the original model weights.

STEERING VECTOR MECHANICS

Key Characteristics of Contrastive Activation Addition

Contrastive Activation Addition (CAA) is a lightweight, inference-time control method that computes a steering vector by subtracting the mean activations of a negative-prompt dataset from a positive-prompt dataset. This difference vector is then added to the model's residual stream to reliably induce a desired high-level behavior without retraining.

01

Contrastive Vector Computation

The steering vector is derived from a contrastive pair of datasets. The process involves:

  • Positive Dataset: Prompts eliciting the target behavior (e.g., honest answers).
  • Negative Dataset: Prompts eliciting the opposite behavior (e.g., deceptive answers).
  • Subtraction: The final vector is calculated as v_steer = mean(act_pos) - mean(act_neg). This isolates the directional difference in activation space corresponding to the behavioral shift.
02

Inference-Time Intervention

CAA is applied purely during the forward pass, leaving model weights untouched. The computed steering vector is multiplied by a scaling coefficient and added directly to the residual stream at a specific layer and token position. This allows for dynamic, context-dependent control without the compute cost of fine-tuning. The intervention is typically applied to all layers simultaneously for a robust effect.

03

Behavioral Modification Scope

CAA can steer a wide range of high-level, abstract behaviors by targeting the appropriate contrastive pair. Documented use cases include:

  • Honesty: Steering models away from sycophancy toward truthful responses.
  • Sentiment: Inducing positive or negative emotional tone in generated text.
  • Refusal: Modulating a model's tendency to reject harmful or sensitive requests.
  • Power-Seeking: Reducing the expression of instrumental convergence tendencies.
04

Relationship to Representation Engineering

CAA is a core technique within the broader Representation Engineering (RepE) paradigm. RepE posits that high-level cognitive functions are encoded as linear directions in activation space. CAA provides the 'write' operation for this framework, enabling top-down control. It contrasts with bottom-up probing methods by actively manipulating the discovered representations to causally verify their function.

05

Comparison to Activation Patching

While both are causal intervention methods, they differ fundamentally:

  • Activation Patching: Replaces an activation from one input with a cached activation from a different specific input to localize a computation.
  • Contrastive Activation Addition: Adds a pre-computed, generalized direction vector derived from a statistical contrast between two datasets, representing a behavioral delta rather than a specific memory.
06

Advantages Over Fine-Tuning

CAA offers distinct operational benefits for behavior modification:

  • Weight Preservation: The base model's knowledge and capabilities remain fully intact.
  • Dynamic Control: The steering coefficient can be adjusted or zeroed out in real-time.
  • Compute Efficiency: Requires only a forward pass of the target model on contrastive datasets to compute the vector, avoiding gradient-based optimization.
  • Composability: Multiple steering vectors for different behaviors can theoretically be combined.
CONTRASTIVE ACTIVATION ADDITION

Frequently Asked Questions

Clear, technical answers to the most common questions about computing and applying steering vectors using the Contrastive Activation Addition method.

Contrastive Activation Addition (CAA) is an inference-time intervention technique that computes a steering vector by subtracting the mean residual stream activations of a negative-prompt dataset from the mean activations of a positive-prompt dataset. This difference vector captures a high-level behavioral direction, such as 'truthfulness' or 'refusal.' During the forward pass, the vector is multiplied by a scalar coefficient and added to the residual stream at a specific layer, effectively shifting the model's internal representations to induce the desired behavior without updating the original model weights. The core mechanism relies on the linear representation hypothesis, which posits that high-level concepts are encoded as linear directions in activation space.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.