Inferensys

Glossary

Circuit Analysis

The process of identifying and validating the minimal subgraph of a neural network's computational graph that is necessary and sufficient to perform a specific behavior or task.
Product manager reviewing autonomous task execution dashboard on laptop, completed tasks visible, casual work session.
MECHANISTIC INTERPRETABILITY

What is Circuit Analysis?

Circuit analysis identifies the minimal, causally sufficient subgraph of a neural network's computational graph responsible for a specific behavior.

Circuit analysis is the process of identifying and validating the minimal subgraph of a neural network's computational graph that is necessary and sufficient to perform a specific behavior or task. It reverse-engineers the learned algorithms encoded in weights by isolating the precise attention heads and MLP layers that compose to produce a model output.

This methodology relies on causal intervention techniques like activation patching and causal scrubbing to verify that the proposed subgraph faithfully replicates the full model's behavior. By decomposing complex computations into interpretable QK and OV circuits, engineers can audit internal reasoning, debug failures, and validate alignment in transformer architectures.

COMPUTATIONAL GRAPH DECOMPOSITION

Core Characteristics of Circuit Analysis

Circuit analysis isolates the minimal subgraph of a neural network's computational graph that is both necessary and sufficient to perform a specific behavior. This reverse-engineering discipline moves beyond input attribution to identify the precise weights, attention heads, and MLP neurons that implement discrete algorithms.

01

Minimality Constraint

A valid circuit must satisfy the minimality criterion: it contains no redundant components. This is verified through ablations—if removing a node does not degrade the target behavior, it is not part of the circuit. Researchers systematically prune the computational graph by zero-ablating attention heads and MLP neurons, then measuring the change in output. The minimal subgraph that preserves performance is the hypothesized circuit. This distinguishes true functional components from correlated but causally irrelevant activations.

02

Causal Intervention Methods

Circuit analysis relies on causal interventions rather than correlational methods. Key techniques include:

  • Activation Patching: Replacing a model's internal activation at a specific layer and token position with a cached activation from a different forward pass to isolate functional pathways
  • Knockout Analysis: Zero-ablating specific attention heads or neurons and measuring the degradation in task performance
  • Path Patching: A refined technique that routes activations along specific paths between two layers, isolating the direct effect of one component on another without confounding influences from intermediate layers
03

Sufficiency Testing

Beyond necessity, a circuit must be sufficient to reproduce the behavior in isolation. Researchers test this by freezing all model components outside the hypothesized circuit to their mean activations or by running the model with only the circuit's nodes active. If the circuit alone can replicate the full model's performance on the target task, it passes the sufficiency test. This is formalized in Causal Scrubbing, a hypothesis-testing framework that systematically resamples activations to verify if the proposed circuit faithfully explains the model's behavior under all relevant input distributions.

04

Functional Decomposition

Circuits are decomposed into functional modules that map to interpretable algorithmic primitives:

  • Induction Heads: Attention heads that perform in-context copying by attending to the token following a previous occurrence of the current token, implementing a primitive lookup table
  • Previous Token Heads: Heads that simply attend to the immediately preceding token, acting as information conduits
  • Suppression Heads: Heads that actively reduce the probability of specific tokens, implementing inhibitory control
  • Name Mover Heads: Heads that copy entity attributes from source to target positions in factual recall tasks Each module's role is validated through targeted ablation and activation patching experiments.
05

QK and OV Circuit Partitioning

Attention heads are analyzed by decomposing them into two independent computational pathways:

  • QK Circuit: The query-key interaction determines which previous tokens the head attends to. The QK circuit computes attention scores using the query and key projection matrices, with positional encodings like Rotary Position Embedding (RoPE) ensuring relative distance sensitivity
  • OV Circuit: The output-value interaction determines what information is copied from the attended token. The OV circuit transforms the value vectors through the output projection matrix This decomposition reveals that a single head can simultaneously implement a copying mechanism (OV) and a content-based routing mechanism (QK).
06

Superposition and Polysemanticity

Circuit analysis must contend with the Superposition Hypothesis: neural networks represent more independent features than they have dimensions by encoding them in nearly-orthogonal directions. This means individual neurons are often polysemantic—activating for multiple unrelated concepts. To address this, researchers apply Sparse Autoencoders (SAEs) to decompose dense activations into a sparse set of monosemantic features before circuit analysis. This dictionary learning approach reveals that what appears as a single neuron may actually be a superposition of 10-50 distinct features, each participating in different circuits.

CIRCUIT ANALYSIS

Frequently Asked Questions

Targeted answers to the most common technical questions about identifying and validating minimal computational subgraphs in neural networks.

Circuit analysis is the process of identifying and validating the minimal subgraph of a neural network's computational graph that is necessary and sufficient to perform a specific behavior or task. Rather than analyzing individual neurons in isolation, circuit analysis treats the network as a wiring diagram of interconnected components—primarily attention heads and MLP layers—and seeks to isolate the subset of edges and nodes that implement a particular algorithm. The goal is to reverse-engineer the learned computation into a human-understandable mechanism. A circuit is considered valid if it satisfies two criteria: faithfulness, meaning it reproduces the full model's behavior on the target task, and completeness, meaning it captures all components that causally contribute. This methodology was pioneered on vision models but has become central to transformer interpretability, where researchers have discovered circuits for indirect object identification, greater-than operations, and in-context learning.

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.