Activation Patching › Path Patching
Language AI HandbookAll chapters Activation Patching › Path PatchingOne section · Sections in this chapter5 / 11 ↓
Reading tools Definitions & inline links
Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.
Article links
Make inline references clickable
Standard activation patching tells you which (layer, position) sites are causally important for a behavior. Path patching is a more precise variant that identifies specific computational paths between components, moving from "where" to "how information flows between where."
The Concept
To understand why path patching is necessary, consider a simplified three-stage scenario: component A computes something, component B reads A's output and processes it, and component C reads B's output to produce the final answer. Standard patching might identify B as important because patching B's output changes the answer. But this doesn't tell you whether B is important because it reads from A specifically, or because it processes information that arrived through some other path, perhaps directly from the input embeddings or from a parallel attention head.
Path patching isolates specific edges in the computation graph. In the example, you would patch the output of A only as it feeds into B, while keeping everything else running from the corrupted input. If this recovers the clean behavior, you have demonstrated that the path A to B is causally important. If patching A's output globally has the same effect, then B isn't doing anything special with A's output: it's just passing A's output through unchanged. If patching A only into B is necessary, B is specifically processing A's output in an important way.
This distinction matters critically when you want to understand circuits: specific subnetworks of components that collaborate to implement a behavior. Path patching lets you verify whether a proposed circuit is complete (patching all edges in the circuit is sufficient to restore behavior) and minimal (removing any single edge breaks the restoration). These two properties, completeness and minimality, are the standard criteria for a circuit explanation to be considered a good account of the behavior.
Formal Definition
Let be the computation graph of a transformer. Nodes are components (attention heads, MLP layers) and edges connect components whose outputs feed into others' inputs through the residual stream. For an edge from component to component , path patching proceeds as follows:
- Run a corrupted forward pass with all activations from .
- At the point where 's output would feed into 's computation, substitute 's output from the clean run instead.
- Run the rest of the forward pass using corrupted values for all other inputs to and for all other edges in the graph.
The key difference from standard patching is that the clean activation of is substituted specifically for 's input, not for any other downstream consumer of 's output. Component , which also reads from , still sees the corrupted version of 's output. This tests the specific edge rather than 's contribution globally.
Implementing path patching correctly requires more careful hook management than standard patching. You need hooks both at the output of (to capture the clean value) and at the input aggregation point of (to substitute only for 's specific read of ). In transformer implementations where the residual stream is the shared communication channel, this means carefully tracking which additions to the residual stream came from which components, which requires either custom forward implementations or careful hook orchestration.
Applications in Circuit Discovery
Path patching has been most extensively applied in circuit discovery work, where the goal is to identify the complete set of components and information flows that implement a specific capability. The Indirect Object Identification circuit study by Wang et al. used path patching to verify that the proposed circuit structure was both complete and minimal. The researchers identified candidate components through coarse activation patching, proposed a circuit hypothesis, then used path patching to test each edge in the proposed circuit individually.
The circuit for Indirect Object Identification involves several types of attention heads working in sequence. Duplicate token heads detect that a name appears twice in the input. Induction heads recognize the repeated-token pattern. S-inhibition heads receive information from the duplicate token detection and use it to suppress the output of name mover heads for the repeated name. Name mover heads then copy the remaining, non-suppressed name to the output. Each information flow, from duplicate token heads to S-inhibition heads, from S-inhibition heads to the suppression of name mover heads, was tested with path patching to verify that the specific edge (rather than only the destination component) is causally necessary.