Inferensys

Glossary

Inference-Time Intervention

A class of techniques that modify a model's internal activations during the forward pass to alter its behavior without updating the original weights.
Developer testing AI inference on mobile phone in hand, laptop with optimization code visible, casual tech review moment.
ACTIVATION ENGINEERING

What is Inference-Time Intervention?

A general class of techniques that modify a model's internal activations during the forward pass to alter its behavior without updating the original weights.

Inference-Time Intervention (ITI) is a technique for altering a neural network's behavior during the forward pass by directly modifying its internal activations without retraining or fine-tuning the original weights. By identifying directions in the residual stream corresponding to specific concepts—such as truthfulness or sentiment—practitioners can add a steering vector to guide the model's output toward a desired behavioral state.

Unlike parameter updates, ITI operates dynamically, allowing for context-dependent control. A common method, Contrastive Activation Addition, computes a steering vector by subtracting mean activations from a negative-prompt dataset from those of a positive-prompt dataset. This vector is then injected at a specific layer, providing a lightweight mechanism for real-time model alignment and behavioral auditing.

CONTROL PARADIGMS

Key Inference-Time Intervention Techniques

A taxonomy of methods that modify a model's internal activations during the forward pass to steer behavior without updating the original weights.

01

Activation Addition

A lightweight control method that adds a pre-computed bias vector to the residual stream at a specific layer to induce a desired behavior.

  • The steering vector is computed offline from a contrastive dataset (e.g., positive vs. negative sentiment prompts)
  • Addition occurs at a single targeted layer, typically identified through causal tracing
  • Induces behaviors such as refusal suppression, truthfulness enhancement, or sentiment control
  • Does not require retraining or fine-tuning; purely an inference-time operation
  • Related to Contrastive Activation Addition (CAA), which computes the vector as the difference between mean activations of two prompt sets
02

Activation Patching

A causal intervention method that replaces a model's internal activation at a specific location with a cached activation from a different input.

  • Used to localize where a computation occurs within the network
  • Three variants: clean patching (restoring clean activations into a corrupted run), corrupted patching (injecting noise into a clean run), and cross-input patching (swapping activations between two different inputs)
  • Critical for circuit discovery — identifying the minimal subgraph of components responsible for a behavior
  • Operates on residual stream states, attention head outputs, or MLP layer outputs
  • Forms the experimental backbone of mechanistic interpretability research
03

Contrastive Decoding

An inference-time search heuristic that maximizes the probability difference between an expert model and an amateur model to generate more factual and coherent text.

  • The amateur model is typically a smaller or earlier-checkpoint version of the expert
  • Logits are combined as: logit_expert − α × logit_amateur before softmax
  • Suppresses common but uninformative tokens (e.g., generic continuations) that both models assign high probability
  • DoLa Decoding is a self-contained variant that contrasts later transformer layers against earlier layers within the same model
  • Reduces hallucinations and improves factuality without external knowledge retrieval
04

Steering Vectors

A direction in a model's activation space that, when added to the residual stream during inference, reliably modifies the model's high-level behavior.

  • Discovered through Representation Engineering, a top-down paradigm for reading and writing cognitive vectors
  • A single vector can encode complex behaviors: truthfulness, refusal, corrigibility, or power-seeking tendency
  • Applied by adding the scaled vector to the residual stream at every token position across one or more layers
  • The scaling coefficient controls the intervention strength — higher values produce stronger behavioral shifts
  • Enables real-time monitoring and control of model internals without weight modification
05

Causal Tracing

A method for identifying the specific hidden states within a transformer that are causally responsible for recalling a fact.

  • Procedure: corrupt the input (e.g., add noise to the subject token), then systematically restore clean activations from the uncorrupted forward pass at each layer and token position
  • Measures the indirect effect — how much each restored state increases the probability of the correct factual answer
  • Revealed that factual recall in LLMs is localized to a small set of MLP layers at the last subject token position
  • Foundational technique behind the ROME (Rank-One Model Editing) method for precise weight updates
  • Distinguishes between states that merely encode information versus those that propagate it causally
06

Logit Lens

A decoding technique that applies the unembedding matrix directly to intermediate residual stream states, allowing researchers to inspect a model's iterative token predictions before the final layer.

  • Bypasses all subsequent layers to reveal what the model "believes" at each processing stage
  • Early layers typically produce nonsensical tokens; intermediate layers reveal gradual refinement toward the final answer
  • Used to study how predictions evolve through the network and where specific knowledge emerges
  • A variant called the tuned lens learns an affine transformation per layer to improve intermediate decoding fidelity
  • Provides a window into the progressive computation occurring across transformer depth
INFERENCE-TIME INTERVENTION

Frequently Asked Questions

Concise answers to the most common technical questions about modifying model behavior during the forward pass without retraining.

Inference-time intervention is a class of techniques that modify a model's internal activations during the forward pass to alter its behavior without updating the original weights. Unlike fine-tuning, which permanently changes parameters, these methods operate transiently on the residual stream or attention outputs. The core mechanism involves computing a steering vector—a direction in activation space—and adding it to the hidden state at a specific layer. This vector is typically derived by contrasting activations from a positive-prompt dataset (e.g., truthful responses) against a negative-prompt dataset (e.g., hallucinated responses). The intervention shifts the model's internal representations toward the desired behavioral manifold, effectively acting as a runtime control knob for high-level cognitive properties like honesty, harmlessness, or sentiment.

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.