Mechanistic interpretability experiments often follow a branching pattern. Researchers run a language model once on a "clean" prompt. Then they run thousands of variants, each of which overwrites a small piece of the model's internal state, such as one attention head at one token position, and measures what changes. This is called activation patching: swapping an internal value from one run into another to test whether it matters. Every variant shares almost all of its internal state with the clean run. Today's modular experiment tools still store each variant's state independently. The authors of the cleanest such tool, MURANO, name two limits themselves. Their central store of intermediate results becomes "memory-intensive, especially for large models," and pipelines "run steps one after another" with no support for branching.
Parsers for unification grammars faced the same situation in the late 1980s and 1990s. Unification is the operation that merges two structured descriptions of a phrase, and the parsers built very large such structures while exploring many alternative analyses. Copying everything before each tentative merge was the main cost. The fix was lazy structure sharing: keep structures immutable, let branches point into shared parts, and copy only the pieces a branch actually changes. This proposal carries that design into a results store for interpretability pipelines. The store has three features. Each branch records only the activation slices it modifies, tagged with a generation number, so a branch can be abandoned simply by resetting a counter. Activations downstream of a patch are not computed until some step reads them. And a dependency record prevents one branch from silently reading another branch's modified state. The claim is narrow and testable. On workloads that branch and backtrack, such as path patching and greedy circuit pruning, this store should need peak memory that grows with the number of modified slices rather than with the number of branches. It should also beat the simpler engineering fixes a reviewer would propose, not just the naive store.
Core Claim
Interventions in transformer interpretability have the same structure as tentative merges in a unification parser. Patching head $h$ at layer $\ell$ is a local destructive update. It invalidates exactly the activations downstream of $(\ell, h)$ and leaves everything upstream reusable. This mirrors the "path copying problem" in lazy unification, run in the opposite direction. In Lazy Unification, updating a leaf forces copies of all its ancestors, and the paper's remedy was to make the copied node's children suspended computations ("thunks") that are evaluated only when someone reads them. The analogous remedy here is to make downstream activations thunks. A step that only reads a layer-7 receiver head, as in path patching, then never pays for layers 8 through 12.
Lazy Incremental Copying, from Unification with Lazy Non-Redundant Copying, supplies the version mechanism. Every stored node carries a generation stamp. A node is updated in place if it belongs to the current generation, redirected to the current version if it does not, and copied only when neither version is current. Backtracking costs one counter decrement. Emele reports a 60–70% reduction in total processing time from this design in grammar processing. Memory-Efficient and Thread-Safe Quasi-Destructive Graph Unification moves the per-run bookkeeping into external scratch tables so that shared structure stays strictly read-only. We reuse that separation so that several branch workers can read one clean activation cache without locks.
Two papers constrain the design rather than supply it. Structure Sharing Problem and Its Solution in Graph Unification and Quasi-Destructive Graph Unification with Structure-Sharing both show that naive sharing produces false co-references when shared parts are later modified by operations other than the one the sharing scheme was designed around. The interpretability analogue is a real bug class. In path patching, the sender's patched output must reach the receiver, while every other path must see clean values. A store that shares the "clean" residual stream too eagerly gives silently wrong effects. Kogure's dependency records (lcopy, rcopy, deps) were never benchmarked. We adapt them as a per-slice provenance check, so correctness is an explicit property of the store and not an accident of how the script is written.
If the expected scaling holds, peak memory for $B$ branches each touching $k$ slices of size $s$ is
$$M \approx M_{\text{clean}} + \sum_{b=1}^{B_{\text{live}}} \big(k\,s + D_b\big),$$
where $M_{\text{clean}}$ is the one shared clean cache, $B_{\text{live}}$ is the number of branches alive at once (small under depth-first search with backtracking), and $D_b$ is the downstream activations branch $b$ has actually been forced to compute. This contrasts with roughly $B \cdot M_{\text{clean}}$ for an eager store. The form follows from counting allocations under the three merge cases of Lazy Incremental Copying.
Research Program
We would build the store as a drop-in replacement for MURANO's results container. That keeps its step contracts and its canonical node addressing (names like L5.self_attn.h3.Q@p-1), which give us a natural key for slices. This modular boundary matters: the store changes how artifacts are held, not what any step computes. Existing pipelines can therefore be run unmodified against both the old and new store.
Three pieces of work follow. The first is a generation-stamped slice table at head-by-position granularity, with scratch metadata kept outside the tensors. The second is lazy downstream evaluation: reading an invalidated slice triggers a forward pass that starts at the earliest modified layer and stops at the requested node. The third is a branch API (fork, commit, revert) exposed to steps, plus a provenance checker that, in debug mode, verifies each read against an eager reference.
The main risk is overhead per access. The unification literature flags that generation checks and multi-hop copy links add a constant cost to every traversal. For that reason, slice granularity becomes an experimental variable, compared across layer, head, and head-by-position.
Baselines
The naive reference point is MURANO's current eager store, in which every intervention step writes its full activation set. We run MURANO's own IOI head sweep and path-patching pipelines unchanged. We found no reported result on Lacuna for MURANO's memory or runtime. MURANO does report that a head sweep took 17 logical statements versus 35 in raw nnsight, and that it recovered the same name-mover heads as the original study. We treat those as the code-size and fidelity bars our store must not regress.
The strongest existing competitor is a hand-optimized script that caches the clean run once and re-executes each variant forward from the patched layer. This is the standard trick interpretability practitioners write by hand. We implement it in nnsight on the same GPU, with the same batch sizes and the same prompts. It is strong because it already captures upstream reuse.
The second strong competitor is tensor-level copy-on-write with reference counting. Each branch holds references to clean tensors and clones a tensor the first time it writes to it, with no generations, no thunks, and no dependency tracking.
Both competitors receive the same tuning effort we spend on our store, which is a fixed budget of engineer-days for batching and memory tuning. Beating them means at least a 2× reduction in peak memory or wall-clock time on the branching workloads, with bitwise-identical effect estimates. A gain on the flat sweep alone does not count.
Ablations isolate the key ingredients. The first removes generations and replaces revert with snapshot-and-restore. The second removes lazy downstream thunks and forces each variant to run to the logits. The third coarsens slices to whole layers. The fourth disables provenance checking and counts how often false sharing would occur in path patching.
Why not just…?
Why not just use copy-on-write tensors? This is the real threat. On a flat head sweep, where every branch is created once, measured, and thrown away, tensor-level copy-on-write should capture most of the memory savings, and we expect it to roughly tie our store there. Our claim rests on the other workloads. Under greedy circuit pruning with reverts, snapshot-based copy-on-write must hold or rebuild every intermediate state. Under path patching, nothing in copy-on-write stops a branch from reading a shared clean tensor where the patched version was required. The tie-or-win result on the pruning and path-patching workloads decides the question. If copy-on-write matches us there within about 10% in both memory and time, we drop the generation machinery and publish only the provenance checker.
Why not just re-run from the patched layer? This removes upstream redundancy, but it still computes every downstream layer for every variant. It also has no way to share the patched prefix among nested interventions that build on one another. The unification evidence is suggestive, but it comes from a different domain. On ATR sentence 10, Quasi-Destructive Graph Unification with Structure-Sharing reports 8.80 s and 2,737 copies with sharing, against 40.15 s and 20,323 copies for Wroblewski's incremental copying. The lazy-downstream ablation measures directly how much of our gain survives without thunks.
Why not just use gradient-based approximations instead of exact patching? Attribution methods replace thousands of forward passes with one backward pass. RelP shows that the quality of these approximations varies widely. On GPT-2 Large MLP outputs, it reports a Pearson correlation with exact patching of 0.006 for attribution patching and 0.956 for its own method. Those correlations are measured against exact patching, which remains the reference that approximations are validated against. We therefore position our store as making that validation cheap, not as competing with approximation. One experiment checks the claim: we time exact verification of a RelP-ranked candidate set under each store.
Proposed Experiments
The workloads come from the file's benchmarks. The first is the IOI task on GPT-2 Small, using prompts generated from the 15 templates of Interpretability in the Wild. On it we run three experiments: a full head-by-position patching sweep, the paper's path-patching analysis, and a greedy pruning search that removes heads one at a time and reverts whenever faithfulness drops. The reference targets for that search are the paper's 28-head circuit and its reported 94% faithfulness. The second workload is the Truth Directions reproduction on LLaMA-2-13B, where memory pressure is real and the target is MURANO's normalized indirect effect within 0.03 of the original. The third is a qualitative branching-steering case on Gemma 2 2B using Gemma Scope sparse autoencoders, for which no quantitative result was found on Lacuna.
We measure four things: peak GPU and host memory, wall-clock time, layer-forward computations performed, and exact agreement of every effect estimate with an eager reference run. That last measure uses fixed seeds and deterministic kernels, following DeepDIVA. That paper also reports that cuDNN determinism tests failed in its setting, so we check agreement bitwise and report any nondeterminism separately.
The decisive checks are as follows. Peak memory on the pruning search should stay flat as search depth grows, while every baseline's memory grows. Path patching under our store should show zero provenance violations, while the no-provenance ablation shows nonzero violations. The comparison against copy-on-write on the pruning and path-patching workloads settles whether lazy incremental copying, rather than ordinary sharing, is what earns its keep.
References
- MURANO: Design, Run, and Reproduce Mechanistic Interpretability Experiments as Composable Pipelines
- Lazy Unification
- Unification with Lazy Non-Redundant Copying
- Memory-Efficient and Thread-Safe Quasi-Destructive Graph Unification
- Structure Sharing Problem and Its Solution in Graph Unification
- Quasi-Destructive Graph Unification with Structure-Sharing
- RelP: Faithful and Efficient Circuit Discovery in Language Models via Relevance Patching
- Interpretability in the Wild: a Circuit for Indirect Object Identification in GPT-2 Small
- DeepDIVA: A Highly-Functional Python Framework for Reproducible Experiments