TL;DR
Gradient-based methods for "circuit localization"—finding the specific neurons and connections responsible for model behaviors—often fail because they assume model components act independently. This paper introduces Gradient Interaction Modifications (GIM), a technique that accounts for feature interactions like "attention self-repair" to provide more faithful mechanistic explanations, achieving state-of-the-art results on the Mechanistic Interpretability Benchmark.
What Problem Does This Paper Address?
Mechanistic interpretability aims to crack open the "black box" of Large Language Models (LLMs) by identifying the specific subgraphs, or "circuits," that perform tasks like addition or grammatical reasoning. Most current tools estimate a component's importance by perturbing it in isolation.
However, neural networks are highly redundant. The authors identify a specific phenomenon called attention self-repair: if a model has two similar ways to move information, ablating one causes the softmax function to simply redistribute weight to the other. To a standard gradient-based tool, the first component looks unimportant because the output barely changed. This is essentially a logical "OR-gate" behavior that causes gradients to vanish, leading researchers to systematically underestimate the importance of critical model parts.
Methods
The authors propose Gradient Interaction Modifications (GIM), which consists of three targeted modifications to the standard backpropagation process:
- Temperature-adjusted Softmax Gradients (TSG): To combat self-repair, GIM recomputes the softmax with an elevated temperature ($T > 1$) during the backward pass. This flattens the distribution, preventing the "winner-take-all" redistribution that kills gradients and allowing the signal from influential but redundant scores to survive.
- Layernorm Freeze: Layer normalization creates a zero-sum dynamic where increasing one component's magnitude downweights others. GIM treats the normalization factor as a constant during backprop to measure a component's direct contribution before this rescaling occurs.
- Gradient Norm: Multiplicative operations (like $Q \cdot K^T$) can cause gradients to "double-count" the contribution of an input. GIM applies a "uniform rule," dividing gradients by the number of multiplicative inputs (typically 2) at key locations in the transformer block.
Datasets
The authors evaluated GIM across two primary tracks:
- Circuit Localization: Using the Mechanistic Interpretability Benchmark (MIB), which includes tasks like Indirect Object Identification (IOI), Arithmetic, Multiple-Choice Question Answering (MCQA), and the AI2 Reasoning Challenge (ARC).
- Feature Attribution: Testing on six diverse datasets including BoolQ (QA), FEVER and SciFact (fact verification), Twitter Sentiment and Movie Reviews (sentiment analysis), and HateXplain (hate speech detection).
Models tested ranged from GPT-2 (120M) to Llama-3.1 (8B) and Qwen-2.5 (3B).
Key Insights and Ideas
- The Firing Squad Analogy: The authors use Judea Pearl’s "firing squad" analogy to explain self-repair: if two soldiers fire at a prisoner, preventing one from firing doesn't save the prisoner. Therefore, looking at them individually suggests neither is "causally important," even though they are both responsible. GIM attempts to estimate the "joint effect" of perturbations.
- Vanishing Gradients are a Feature, not a Bug, of Softmax: The paper provides a mathematical proof showing that under "self-repair" conditions (where redundant positions have similar values), the gradient of the output with respect to an attention score becomes near zero, even if the component is highly influential.
- Synergy is Secret Sauce: An ablation study revealed that GIM’s three components work synergistically. Removing one modification significantly degrades performance, but adding them one-by-one to a baseline doesn't yield the same gains as the full suite.
Key Results
- SOTA Circuit Localization: GIM achieved the highest average Circuit Performance Ratio (CPR) across all model sizes in the MIB, significantly outperforming standard Edge Attribution Patching (EAP) and even computationally expensive methods like Integrated Gradients.
- Superior Feature Attribution: In head-to-head comparisons on faithfulness metrics (Comprehensiveness and Sufficiency), GIM outperformed traditional methods like DeepLIFT and GradientXInput in nearly all cases.
- Scalability: The improvements were most pronounced on complex, multi-step reasoning tasks (like Arithmetic and ARC) and remained consistent as model size increased from 120M to 8B parameters.
Limitations and Future Work
The authors acknowledge that Gradient Norm is a simplification; it assumes all multiplicative inputs depend equally on the variable being perturbed, which isn't always true. Furthermore, while TSG is an effective heuristic for the self-repair problem, it assumes perturbations always impact all interacting attention scores.
Future work could involve developing more sophisticated methods to determine exactly when to estimate joint vs. individual effects, especially as causal paths grow exponentially complex in deeper layers of the network.
GIM is available as a Python package at https://github.com/corticph/gim.
Summary updated