The ideaSearch a hierarchy, not the graph
Mechanistic interpretability tries to explain a model behavior as a small circuit: a set of interpretable features and the causal edges between them. Sparse dictionaries (transcoders) make the features readable and attribution graphs give the edges. The step that does not scale is the search itself. Methods like ACDC patch edges one at a time across every layer, and exhaustive search over feature subsets grows as 2n.
HAGD borrows the coarse-to-fine idea from graph partitioning. Features that attribute strongly to each other are clustered into supernodes, the clusters are clustered again, and the search starts at the top. At each level only the most promising branches are opened, so most of the graph is never touched.
What is newCoarse-to-fine search with the checks built in
| Flat search | HAGD | |
|---|---|---|
| What is searched | Every edge or feature subset of the full graph | A multi-resolution hierarchy of supernodes, expanded from the top |
| Worst-case cost | O(2n) subsets, or one patching pass per edge across all layers | O(n2 log n), with O(n log n) to build the hierarchy |
| What decides where to look | A fixed threshold on each edge’s effect | A graph attention network trained on real ablation outcomes |
| Directed edges | Clustering methods usually need a symmetric graph | Clusters are built on a symmetric magnitude skeleton; search and patching keep the true edge direction |
| When a circuit counts | Often judged by its size or by attribution scores | Only after necessity and sufficiency tests on held-out prompts, behind hard gates |
How it worksFour stages, each with a stopping rule
1 · Cross-layer transcoders
For each analyzed layer, a transcoder maps the residual stream hℓ to a sparse, overcomplete code and back. The decoder bias starts at the dataset’s mean activation, so features describe departures from a typical state rather than the state itself.
Training balances reconstruction, a cross-layer term (a small predictor Pℓ maps this layer’s code to the next layer’s) and sparsity:
2 · Attribution graph
An edge from feature i to a downstream feature j is weighted by gradient × activation, which needs one backward pass per example:
Path-integrated Integrated Gradients needs one backward pass per integration step. On the released run the two orderings agree closely: correlation 0.970 over 366 shared edges against 20-step IG. Keeping each feature’s strongest 16 outgoing edges holds the graph at |E| = O(n).
3 · Spectral hierarchy
The normalized graph Laplacian needs a symmetric matrix, and attribution graphs are directed. HAGD separates the two jobs. Clustering runs on a symmetric magnitude skeleton, while the original directed edges are kept for search and patching:
The smallest eigenvectors of L embed the features, k-means groups them into supernodes, and the process repeats on the coarsened graph to give levels G(0) … G(R) with branching factor 4. With sparse (Lanczos) eigensolvers each level costs O(|E|), so the hierarchy costs O(n log n).
4 · Guided search and causal tests
A two-layer graph attention network, trained on necessity labels from real ablations, scores the features. Each supernode’s score is the mean over its members, and the search keeps only the top 2 supernodes per level on its way down. The surviving region then faces two tests on held-out prompts. For necessity, each feature is ablated alone and kept only if the task loss rises by at least ε. For sufficiency, every feature outside the circuit is replaced by its mean and the remaining behavior is measured:
The worst-case cost of the search is O(n2 log n). Hierarchy construction is O(n log n), and patching is restricted to candidate features.
Released resultsWhat the public code shows
The released notebooks run the whole pipeline on GPT-2 Small (124M parameters) fine-tuned for a + b mod 23, on a single Tesla T4. The fine-tuned model reaches 83.8% exact-match accuracy on 105 held-out prompts, none of which appear in the 3,000 training prompts. Transcoders on layers 3–6 leave 0.1–0.3% of held-out variance unexplained on the task and 1.8–2.5% on generic English text.
The search narrows 413 active features to a 10-node circuit
The 10-node circuit preserves no more behavior than the controls
| Stage | Time | Output |
|---|---|---|
| Fine-tune GPT-2 Small on a + b mod 23 | 969 s | 83.8% held-out exact match |
| Cache activations, layers 3–6 | 13.6 s | 10,656 training positions |
| Train transcoders | 151 s | ≤ 0.3% unexplained variance on the task |
| Build attribution graph | 4.5 s | 15,362 edges, 4,752 after top-16 pruning |
| Spectral coarsening | 0.14 s | 4 levels, 413 features to 2 supernodes |
| Ablation labels for the GNN | 199 s | 57 of 160 candidates necessary |
| Train the graph attention network | 1.7 s | held-out AUROC 0.71 |
| Hierarchical search | 0.09 s | 48 connected candidates |
| Causal validation | 20.9 s | 10-node circuit, φ = 0.23 |
| Total | 1,360 s | 22.7 minutes end to end |
The search itself is the cheap part: 0.09 s, against 969 s to fine-tune the model and 199 s of ablations to label training data for the graph network. The pipeline is also deterministic. Running seed 0 twice in the verification suite reproduced every preservation value exactly.
| Seed | Held-out accuracy | Accuracy gate | φ all positions | φ generation steps | φ first step |
|---|---|---|---|---|---|
| 0 | 83.8% | pass | 0.000 | 0.273 | 0.330 |
| 1 | 67.6% | fail | — | — | — |
| 2 | 59.0% | fail | — | — | — |
| 3 | 59.0% | fail | — | — | — |
| 4 | 46.7% | fail | — | — | — |
Why it falls shortThe released notebook locates the problem
The extraction notebook does not stop at “φ is low”. It runs a series of diagnostic tests, each designed to rule an explanation in or out. Four findings stand out.
The traversal misses most useful features, and restricting more layers compounds the loss
(a) Share of the top-N most necessary features the traversal reaches
(b) φ when the circuit is enforced only in some layers
Behavior returns only when most of each activation is let through
- Candidate generation is the bottleneck. Traversal recall is 20–31% across budgets. Adding the missed features back without re-filtering does not help on its own (φ = 0.23 for a 60-feature union).
- Necessity scores carry little signal here. The 10 least necessary features preserve as much (0.273) as the circuit (0.227). Necessity-ranked sets from 5 to 80 features fall within the random-draw range at 5 of 7 sizes.
- The first answer token carries the work. Restricting only the first generated token gives φ = 0.30, against 0.23 when every generation step is restricted. The biggest jump in the depth sweep comes between one and two restricted steps.
- Features act together. In the greedy trace, some features add more accuracy alongside others than they do alone, so ranking features one at a time undersells them.
- Preservation depends on the prompt. φ differs by 0.133 between sums that wrap past 23 and sums that do not.
About the arXiv numbersWhat this page does and does not report
arXiv v2 (June 2026) also reports runs on Pythia and Llama models up to 70B parameters, 91% (±2.3%) behavioral preservation with 49–347-node circuits, and cross-architecture transfer coefficients of 0.38–0.82. The released code does not contain those runs, and the repository’s own automated claim audit (manuscript_claim_audit.json) marks them unsupported. This page reports only numbers that the released notebooks produce.
| Claim in the manuscript | Audit | What the released code shows |
|---|---|---|
| 91% (±2.3%) behavioral preservation | unsupported | φ = 0.00 at all positions, 0.27 at generation steps |
| Modulus-113 task | unsupported | the notebooks use a + b mod 23 |
| 49–347-node circuits across models | unsupported | one 10-node circuit, GPT-2 Small only |
| 52–82% cross-architecture transfer | unsupported | transfer code exists but was never run |
| Symmetrization ½(A + A⊤) | corrected | the code uses ½(|A| + |A|⊤) |
| Integrated Gradients attribution | corrected | gradient × activation is primary; IG is a check |
Next stepsWhat the diagnostics point to
- Fix recall before anything else. The hierarchy currently discards most of the features that matter, so better candidates should come before better scoring.
- Measure sufficiency where the computation happens. Score circuits at generation steps, or at the first answer token, rather than at every position.
- Restrict the deepest layer first. Restriction costs compound through earlier layers.
- Select features jointly. The synergy result argues for interaction-aware selection over independent ranking.
- Get more seeds past the accuracy gate with a larger fine-tuning budget, then run the untouched second-task (parity) and transfer experiments that the code already contains.
CitationCite this work
@article{uddin2026hagd,
title = {Hierarchical Sparse Circuit Extraction from Billion-Parameter
Language Models through Scalable Attribution Graph Decomposition},
author = {Uddin, Mohammed Mudassir and Alam, Shahnawaz
and Pasha, Mohammed Kaif},
journal = {arXiv preprint arXiv:2601.12879},
year = {2026}
}