Inferensys

Glossary

Circuits

Sparse, interpretable subgraphs of a neural network consisting of connected attention heads and MLP neurons that implement a specific, human-understandable algorithm.
Elegant overhead shot of a polished wooden communal table in a sun-drenched WeWork lounge, laptops and tablets displaying AI workflow dashboards, plants and pendant lights in background.
MECHANISTIC INTERPRETABILITY

What is Circuits?

In mechanistic interpretability, circuits are the fundamental functional units of a neural network, representing sparse, interpretable subgraphs of connected attention heads and MLP neurons that collectively implement a specific, human-understandable algorithm.

A circuit is a minimal, connected subgraph of a neural network's computational graph—comprising specific attention heads, MLP neurons, and their weight connections—that is causally responsible for performing a discrete, interpretable task. Unlike viewing a single neuron in isolation, a circuit captures the collaborative, multi-component algorithm that transforms an input into a specific feature or output, such as detecting indirect objects or completing a pattern. This concept treats a model not as a black box but as a compiled program that can be reverse-engineered into its constituent functions.

Circuits are discovered through a combination of causal interventions like activation patching and path patching, which isolate the direct effect of a computational path, and validated using causal scrubbing, which tests whether the hypothesized subgraph alone can reproduce the model's full behavior. The study of circuits, pioneered in transformer language models, has revealed specialized components like induction heads that perform in-context copying, demonstrating that complex model behaviors emerge from the precise interaction of simpler, interpretable algorithmic units.

MECHANISTIC INTERPRETABILITY

Key Characteristics of a Circuit

A circuit is a sparse, interpretable subgraph of a neural network consisting of connected attention heads and MLP neurons that implement a specific, human-understandable algorithm. The following properties define how circuits are identified, validated, and analyzed.

01

Minimality

A valid circuit must be sparse—it includes only the smallest set of model components (attention heads and MLP neurons) necessary to recover the original model's performance on a specific task. Extraneous components are excluded.

  • Causal Scrubbing is the primary validation method: all activations outside the hypothesized circuit are replaced with corrupted values.
  • If the model's performance is preserved, the circuit is considered complete.
  • If performance degrades, the circuit is missing critical components.
  • Contrast with the full model, which contains many redundant or task-irrelevant pathways.
02

Compositional Structure

Circuits are not flat collections of components; they exhibit hierarchical composition. Earlier layers extract low-level features that are combined by later layers into higher-level abstractions.

  • Attention heads route information between token positions, forming skip-trigram patterns.
  • MLP layers act as associative memory, amplifying or suppressing features.
  • The residual stream serves as the communication channel where each component reads from and writes to a shared state.
  • Example: In an Indirect Object Identification circuit, earlier heads duplicate the subject token, and later heads attend to the duplicated position to predict the indirect object.
03

Causal Falsifiability

Every hypothesized circuit must be causally testable. Correlation between a component's activation and a behavior is insufficient; the component must be shown to be necessary and sufficient.

  • Knockout analysis: Ablating a circuit component (zero ablation or mean ablation) must degrade task performance.
  • Knock-in analysis: Preserving only the circuit components while corrupting all others must restore performance.
  • Path Patching isolates the direct effect of a specific computational path between two components, ruling out indirect influences.
  • This distinguishes genuine mechanistic understanding from mere activation correlation.
04

Universality Across Models

Circuits exhibiting universality reappear with similar structure across different random initializations, architectures, and training runs when models are trained on similar data distributions.

  • Induction heads have been found consistently across transformer models of varying scales and architectures.
  • Universality suggests circuits are convergent solutions to computational subproblems imposed by the data.
  • Not all circuits are universal; some are idiosyncratic to a specific training run.
  • Detecting universal circuits provides evidence that the discovered algorithm is a natural solution rather than an artifact of analysis.
05

Feature Decomposition

Individual neurons in a circuit are often polysemantic—they respond to multiple unrelated concepts. Decomposing these into monosemantic features is critical for interpretability.

  • Sparse Autoencoders are trained on activations to produce a sparse overcomplete basis where each latent dimension corresponds to a single concept.
  • Dictionary Learning extracts a set of basis vectors that sparsely reconstruct activations.
  • In a circuit context, this decomposition reveals that what appears as one neuron may actually be implementing several distinct sub-computations.
  • This is essential for understanding circuits exhibiting superposition, where more features than dimensions are compressed into a layer.
06

End-to-End Verifiability

A fully understood circuit must be verifiable through end-to-end replication: the hypothesized algorithm, when implemented in code, should reproduce the model's behavior on all inputs.

  • Direct Logit Attribution decomposes the final output into additive contributions from each component, confirming the circuit accounts for the total effect.
  • The circuit's algorithm should generalize beyond the examples used to discover it.
  • Edge cases and failure modes of the circuit should be predictable from the hypothesized mechanism.
  • This standard distinguishes partial explanations from complete reverse engineering of the learned algorithm.
CIRCUITS IN MECHANISTIC INTERPRETABILITY

Frequently Asked Questions

Explore the core concepts behind reverse-engineering the sparse, human-understandable subgraphs that implement specific algorithms within neural networks.

A circuit is a sparse, interpretable subgraph of a neural network consisting of connected attention heads and MLP neurons that implement a specific, human-understandable algorithm. Unlike viewing the model as a monolithic black box, circuits decompose the computation into modular components that interact via the residual stream. For example, in a transformer language model, an induction head circuit copies previous-token patterns by attending to a token that followed a similar current token, enabling in-context sequence completion. Circuits are discovered through causal interventions like activation patching, which isolate the minimal set of components necessary and sufficient for a behavior. The goal is to reverse-engineer the learned algorithm into a clean, verifiable description.

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.