TL;DR
UNPACK is a new non-interventional interpretability method that unifies attention and MLP layers into a single key-value lookup framework ($\phi(S)U$). From just a single forward pass, it uses a recursive backward walk to simultaneously extract component interaction strengths, branch-specific composition paths (K/Q/V), and faithful per-token attributions without needing gradients, interventions, or extra training.
What Problem Does This Paper Address?
Mechanistic interpretability aims to reverse-engineer transformer models to understand the precise computational pathways that lead to a prediction. Currently, researchers have to use a fragmented toolkit to answer different questions: direct logit attribution for component importance, gradient or relevance propagation for token attribution, and path patching for circuit discovery.
Many of these existing techniques are computationally expensive—often requiring thousands of interventional forward passes—or treat attention and MLPs as completely separate entities. This paper introduces a unified framework that maps out the entire computational graph all at once, revealing not just which components matter, but exactly how they communicate and compose through specific attention branches (Query, Key, or Value).
Methods
The core insight of the paper is that both multi-head self-attention and MLP sublayers share a common mathematical structure: a key-value template of the form $\phi(S)U$. In attention, this is the standard softmax over query-key products multiplied by values. For MLPs, the up-projection columns act as keys, the activation function acts as the selection mechanism ($\phi$), and the down-projection rows act as values.
By exploiting this unified view and the linear nature of the transformer's residual stream, the authors introduce UNPACK (Unified Path Attribution through Component Keys). The algorithm operates in a single forward pass to cache activations, followed by a recursive backward walk from the target logit using two main stages:
- Stage 1 (Credit to Entries): Distributes credit to individual key-value entries (source positions for attention, neurons for MLPs) based on how their realized outputs project onto the current credit direction.
- Stage 2 (Credit to Components): Distributes an entry's credit back to the upstream components that built its score and value. Crucially, for attention, this splits into distinct Key, Query, and Value branches.
To prevent numerical instability and unbounded credit amplification when positive and negative terms cancel out during deep recursion, the authors introduce a soft-flooring denominator mechanism called SAFEDENOM.
Datasets
The authors evaluated UNPACK using several datasets and benchmarks:
- The Pile: 1,000 sentences were used to compute baseline importance scores, 200 held-out sentences (7,967 tokens) were used for causal knockout validation, and 300 sentences were used for token perturbation faithfulness checks.
- Indirect Object Identification (IOI) Prompts: 100 synthetic prompts designed to evaluate the method against a well-documented 26-head linguistic circuit in GPT-2 small.
- Greater-Than Circuit Prompts: 100 prompts based on a separate mathematical ordering circuit template ("The {noun} lasted from the year XXYY to the year XX") to test a differently shaped circuit structure.
Key Insights and Ideas
- MLPs as Key-Value Memories: Treating MLPs symmetrically to attention heads allows a single backward recursion algorithm to seamlessly trace information flow across both sublayer types without architectural ad-hoc modifications.
- Output-Aligned Dispatch: Instead of splitting credit purely by attention weights (gate-only), projecting credit onto the realized output naturally suppresses "attention sinks" (like the BOS token) without requiring manual filtering.
- Mechanism Over Identity: UNPACK tracks functional roles rather than surface token identities. For example, in duplicate name detection, the second occurrence of a name receives radically different credit than the first because it uniquely triggers the circuit's duplicate-suppression mechanism.
- Contribution vs. Necessity: The authors clarify that UNPACK measures contribution (the actual computation performed) rather than counterfactual necessity (what happens if you break the model). This makes it an excellent complement to, rather than a replacement for, interventional circuit discovery.
Key Results
- Causally Grounded Scores: UNPACK’s interaction scores strongly predict actual causal ablation effects. Across five models in the Pythia family (160M to 6.9B parameters), the score highly correlates with the perplexity increase ($\Delta$ppl) when a component's communication channel is knocked out, yielding a within-layer Spearman $\rho$ between 0.72 and 0.96.
- High Faithfulness: On the 300-sentence input-flipping benchmark, UNPACK achieved an area-between-the-curves score ($\Delta A$) of +0.085, outperforming or matching dedicated attribution methods like AttnLRP (+0.066) and IFR (+0.084).
- Branch-Specific Circuit Verification: When rerooted at Name Mover heads within the IOI circuit, UNPACK correctly identified that S-Inhibition heads provide the strongest input through the Query branch (Rank 1, 100% found) but drop significantly to Rank 10 on the Key branch—perfectly matching human-discovered interventional ground truth.
Limitations and Future Work
- Pre-Norm Architecture Dependency: The current marginal LayerNorm decomposition assumes a pre-norm architecture (e.g., GPT-2, Pythia). Post-norm models (like the original BERT) would require a different mathematical formulation and were not tested.
- Computational Complexity: The key-side decomposition scales as $O(L^2Hn)$ where $L$ is layers, $H$ is heads, and $n$ is sequence length. This makes the preparation time grow sharply with model depth and hidden dimension size.
- Combinatorial Path Explosion: Enumerating every single path becomes combinatorial with depth. While a pruning threshold ($\tau$) keeps it tractable, it risks missing low-magnitude routes that might collectively matter in very deep models.
- Future Directions: The authors suggest exploring whether complete, novel circuits can be discovered purely from UNPACK's contribution data without relying on counterfactual interventions.
Summary updated