| name | causal-attribution |
| description | Causal Attribution methods constitute the gold standard for localization in Mechanism Interpretability. Unlike correlation-based analyses, these techniques identify which internal objects are causally responsible for a specific model behavior by systematically measuring the effect of controlled interventions |
Advantage
Unlike Magnitude Analysis, which only establish correlation, Causal Attribution provides definitive evidence that a component is a functional driver of the model’s output. This allows researchers to distinguish essential mechanisms from features that are highly activated but causally irrelevant to the specific behavior.
Limitation
This rigor incurs a significant computational overhead. Verifying causality typically requires intervening on objects individually and performing a separate forward pass for each intervention. Consequently, the cost scales linearly with the number of objects analyzed, making it prohibitively expensive for dense, sweeping searches over large models. This inefficiency often necessitates the use of Gradient Detection, which utilizes gradients to rapidly approximate these causal effects, enabling efficient screening before performing expensive, fine-grained interventions.
Submethods
The intervention typically takes three forms: Patching, Ablation, or Attribution Patching.
-
Patching:
This approach replaces an object computed from the original input with one computed from a counterfactual input to isolate specific information pathways. By systematically patching across layers and positions, one can localize exactly where task-specific information (e.g., factual knowledge) is introduced or transformed.
You can find a demo for this method in ./patching. This demo illustrates the way to edit factual knowledge in large language models like GPT-2 or GPT-J, perform causal tracing to understand model behavior, or implement Rank-One Model Editing (ROME) to modify specific factual associations without retraining.
-
Ablation:
Alternatively, ablation-based attribution explicitly “zeros out” or removes objects, and measures the resulting performance drop to determine their causal necessity.
You can find a demo for this method in ./ablation. This demo shows dissecting-factual-predictions: Analyze and dissect factual recall in auto-regressive language models using attention knockout, hidden state analysis, and intervention techniques on GPT-2 and GPT-J models
-
Attribution Patching:
Attribution Patching is an efficient first-order approximation of full Patching: instead of swapping an activation $x$ with a counterfactual $x'$ and re-running the model to measure the change in output $F(x)$, it uses a single backward pass to estimate that change via the inner product $\nabla_x F(x)^\top (x' - x)$. This Taylor expansion preserves the causal-attribution interpretation — each score predicts the effect of intervening on a specific component — while reducing the cost from $O(n)$ forward passes to a few backward passes, enabling fast, sweeping circuit discovery and edge-attribution analyses across attention heads, MLP layers, and individual edges that would be prohibitively expensive under exact patching.
You can find a demo for this method in ./attribution-patching. This demo shows how to analyze neural network circuits, performing attribution patching, automated circuit discovery, or investigating model interpretability through edge attribution methods in transformer models.