Path patching is a causal method that isolates the direct effect of a specific computational path between two model components by replacing activations along that path with values from a corrupted forward pass, while freezing all other indirect paths. This technique surgically measures how information flows through a neural network's computational graph, distinguishing direct causal influence from mediated or redundant effects.
Glossary
Path Patching

What is Path Patching?
Path patching is a precise causal intervention technique used in mechanistic interpretability to isolate the direct effect of a specific computational path between two model components.
Unlike standard activation patching, which replaces a single node's output, path patching targets a specific sender-receiver edge. By running multiple forward passes—one clean, one corrupted—and patching only the designated path, researchers can decompose a model's behavior into a sum of independent causal contributions. This is essential for validating hypothesized circuits and understanding how attention heads and MLP layers compose to implement algorithms.
Key Characteristics of Path Patching
Path patching is a precise causal intervention technique that isolates the direct effect of a specific computational route between two model components. By freezing all other pathways, it reveals the exact functional contribution of a targeted circuit.
Causal Specificity via Counterfactual Inputs
Path patching operates by running the model on two distinct inputs: a source prompt and a target prompt. The activation from the source prompt is copied along a specific path—such as from an attention head in layer 10 to the residual stream of layer 15—while all other activations are taken from the target prompt's forward pass. This isolates the direct effect of that single path, answering the counterfactual question: 'How would the model's output change if only this path processed different information?'
Distinction from Standard Activation Patching
Standard activation patching replaces an entire component's output at a single layer, which captures both the direct effect on the final logits and the indirect effect mediated through downstream components. Path patching is more surgical:
- It freezes all downstream mediators by using the target prompt's activations for them
- It isolates only the direct causal pathway between a sender and receiver
- This prevents double-counting effects that flow through multiple routes
- It enables the decomposition of a component's total effect into its constituent paths
Mathematical Formulation of the Intervention
The technique is formalized as a three-step intervention on the computational graph:
- Sender Hook: Capture the activation tensor from the source prompt at the sender component (e.g., an attention head's output)
- Receiver Hook: During the target prompt's forward pass, replace only the input that the receiver component reads from the sender with the captured source activation
- Freeze All Else: Ensure every other component's input comes from the target prompt's activations
The difference in logits between this patched run and the clean target run quantifies the path's direct causal contribution.
Applications in Circuit Discovery
Path patching is a cornerstone technique in automated circuit discovery and manual reverse engineering:
- Validating hypothesized circuits: After identifying a candidate subgraph, researchers patch through only the proposed path to verify it reproduces the full model's behavior
- Measuring path importance: By systematically patching every path between two layers, researchers rank which routes carry the most causally relevant information
- Decomposing attention head interactions: It reveals how induction heads compose with previous token heads to perform in-context learning
- Isolating MLP contributions: It separates the direct effect of an MLP layer on the residual stream from its effect mediated through subsequent attention layers
Relationship to Causal Scrubbing
Path patching and causal scrubbing are complementary evaluation strategies:
- Path patching is a constructive method: it tests whether a specific path is sufficient to transmit a causal effect by activating only that path with source information
- Causal scrubbing is a destructive method: it tests whether a hypothesized circuit is necessary by corrupting all activations outside the circuit and checking if performance is preserved
- Together, they provide necessity and sufficiency proofs for a circuit's functional role
- Both rely on the same underlying intervention machinery but apply it in opposite directions
Implementation Considerations
Practical path patching requires careful engineering:
- Hook placement: Incorrectly specifying the sender or receiver tensor can contaminate the experiment with unintended causal pathways
- Path granularity: Paths can be defined at the level of individual attention heads, entire layers, or specific weight matrices within an MLP
- Computational cost: Each path requires a separate forward pass, making exhaustive search over all paths expensive for large models
- Activation caching: Efficient implementations cache the source and target activations to avoid redundant computation
- Libraries: Frameworks like TransformerLens and nnsight provide built-in abstractions for defining and executing path patching experiments on models like GPT-2 and Pythia
Path Patching vs. Related Causal Techniques
A technical comparison of Path Patching with other causal intervention methods used to isolate specific computational subgraphs in neural networks.
| Feature | Path Patching | Activation Patching | Causal Scrubbing | Zero Ablation |
|---|---|---|---|---|
Granularity of Intervention | Specific path between two components | Single component at one position | All components outside a hypothesized circuit | Single neuron or head |
Preserves Indirect Effects | ||||
Freezes Non-Targeted Paths | ||||
Requires Corrupted Baseline Input | ||||
Typical Use Case | Isolating direct effect of head A on head B | Identifying function of a single head | Validating a complete circuit hypothesis | Measuring component importance |
Computational Cost | Moderate (two forward passes) | Low (two forward passes) | High (multiple forward passes) | Very Low (single forward pass) |
Risk of False Positives | Low | Moderate | Low | High |
Reveals Composition Structure |
Frequently Asked Questions
Clarifying the causal intervention technique used to isolate and validate specific computational pathways in neural networks.
Path patching is a causal intervention technique that isolates the direct effect of a specific computational path between two model components by patching activations along that path while freezing all other paths. It works by running two forward passes: one on a clean input and one on a corrupted input. The activations from the corrupted run are then selectively copied into the clean run only along the hypothesized path, effectively creating a counterfactual where only that path receives different information. By measuring the resulting change in the model's output, researchers can precisely quantify the causal contribution of that specific pathway, distinguishing it from indirect effects that flow through other routes in the network.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Path patching is a core causal intervention technique. Master these related concepts to fully reverse-engineer neural network computations.
Circuits
A circuit is a sparse, interpretable subgraph of connected attention heads and MLP neurons that implements a specific, human-understandable algorithm. Path patching is the primary tool for circuit discovery, as it allows researchers to test whether a hypothesized edge between two components is causally necessary. Key circuit families include:
- Induction heads: Copy patterns from previous occurrences
- Previous token heads: Attend to the immediately prior token
- Name mover heads: Copy entity names in factual recall tasks
Causal Scrubbing
A systematic evaluation methodology that tests a hypothesized circuit by replacing all activations outside the circuit with corrupted values and verifying that model performance is preserved. Path patching is used during the iterative refinement of circuits before they are validated with causal scrubbing. If a circuit passes causal scrubbing, it means the identified subgraph is sufficient to explain the behavior—all other components can be ablated without degrading performance on the target task.
Direct Logit Attribution
A linear decomposition technique that attributes the final logit output for a token directly to the individual contributions of each attention head and MLP layer. While path patching is a causal method requiring multiple forward passes, direct logit attribution is a correlational method computed in a single forward pass using the residual stream's linear structure. The two techniques are complementary: direct logit attribution generates hypotheses, and path patching validates them causally.
Residual Stream
The central information highway in a transformer architecture where each layer reads from and writes back to a shared, accumulating state vector. Path patching operates by intercepting the residual stream at specific points—freezing the direct path between a sender component's write to the stream and a receiver component's read from it. Understanding the residual stream's linear, additive structure is essential for designing valid path patching experiments.
Automated Circuit Discovery
Algorithmic methods that automatically identify the minimal subgraph of a neural network responsible for a specific behavior without manual human inspection. These methods—such as ACDC (Automatic Circuit DisCovery) and Subnetwork Probing—use path patching as their core causal scoring mechanism. They systematically test edges between components, using the patching results to greedily construct or prune circuits until a minimal, faithful subgraph is found.

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us