HyperDAS: Toward automatic mechanistic interpretability with hypernetworksHyperDAS: Towards Automating Mechanistic Interpretability with Hypernetworks
HyperDAS automatically locates concepts on RAVEL with Llama3-8B, with an asymmetric average Disentangle of 84.7.
- DAS can use counterfactual supervision to find features that mediate concepts, but requires exhaustive search over layers and tokens. The authors believe model scale makes this search a bottleneck, and the heuristic of the entity's last token does not always hold.
- HyperDAS uses a hypernetwork to read the natural language description of the concept, cross-attends to the target model's hidden states on base and counterfactual, automatically selects tokens, uses Householder transformations to obtain an orthogonal subspace, and then intervenes. At evaluation, soft alignment is collapsed to one-to-one.
- On RAVEL with Llama3-8B, the authors state that per-domain asymmetric HyperDAS achieves SOTA: Table 3a average Disentangle is 84.7, versus 76.0 for MDAS. When symmetric and sharing one model across all domains, that average is 54.8.
- In Limitations, the authors write: concepts must be mediated by linear features, and existing work has raised the possibility of nonlinear mediation; supervised explanations may yield false positives, and future work should continue the trade-off to identify causal structure and the risks of model steering. The tested model is Llama3-8B, and the main results take the best layer among layers 10 to 15.
- Evaluated models
- Llama3-8B
- Benchmarks
- RAVEL
- Metrics
- CauseIsoDisentangle
HyperDAS is a Transformer-based hypernetwork architecture that automatically locates the token positions where concepts are implemented in the residual stream and constructs features for these residual stream vectors, thereby eliminating DAS's brute-force search over feature locations. The paper reports state-of-the-art performance on the hidden-state concept disentanglement task of the RAVEL benchmark on Llama3-8B. The authors also review the design trade-offs made to mitigate the concern that HyperDAS might inject new information into the target model rather than faithfully explain it.
Paper analysis
What problem does this paper attempt to solve?
DAS requires exhaustive search over feature positions; HyperDAS uses a hypernetwork to automatically select tokens and construct concept subspaces.
How to automatically locate, in the residual stream of a target language model, the token positions and linear features that mediate a given concept, without enumerating all layers and tokens.
- Setting: the authors argue that mechanistic interpretability needs to find hidden features that mediate concepts (such as a person's birth year) and use interchange interventions for predictable manipulation; as models grow, this must be automated. The authors state that this paper is an initial step toward automatically identifying such features.
- Limitations of existing work: distributed alignment search (DAS) learns concept features with counterfactual supervision but assumes that candidate positions can be enumerated. The authors state that in practice this often fixes entity information at the last entity token, which does not hold for all entities.
- Approach: propose HyperDAS. A transformer hypernetwork reads a natural language description of a concept, automatically selects base and counterfactual tokens at a fixed layer of the target model, constructs an orthogonal linear subspace, and performs a distributed interchange intervention.
- Evaluation: on RAVEL, disentangle different attributes of the same entity type, for example a Nobel laureate's birth year and research field. The selected attribute should change, and unselected attributes should remain unchanged.
What related research exists?
Related work is divided into automated interpretation, causal mediation, and RAVEL; this paper adds automatic search for intervention locations.
In the introduction and Background, the paper divides related work into automated pipelines, causal mediation, and evaluation benchmarks, and places the gap in automatically searching for intervention positions.
Automated interpretability workflows
- Circuits: Conmy et al. (2023), Marks et al. (2024), Rajaram et al. (2024), Ferrando and Voita (2024) automatically discover circuits.
- Unsupervised features: Huben et al. (2024) and Braun et al. (2024) do end-to-end sparse dictionary and other unsupervised feature learning.
- Natural language annotation: Mu and Andreas (2021), Hernandez et al. (2022), Bills et al. (2023), Huang et al. (2023), Shaham et al. (2024) describe neurons or features in natural language. The paper lists these together as automation directions without comparing them one by one.
Features mediating concepts
- Interchange intervention: Vig et al. (2020), Geiger et al. (2020), Finlayson et al. (2021), Stolfo et al. (2023) use counterfactual replacement to test whether hidden representations mediate high-level concepts.
- Subspaces: Geiger et al. (2024b) and Wu et al. (2024) extend interventions to subspaces of hidden vectors. The paper states that these methods still require enumerating all layers and tokens, and in practice therefore rely on token heuristics.
- Last-token assumption: Meng et al. (2022; 2023), Hernandez et al. (2024), Geva et al. (2023), Ghandeharioun et al. (2024) often place entity information at the last entity token in knowledge editing and model inspection. The paper states this does not hold for all entities, citing Meng et al. (2022).
Benchmarks, baselines, and faithfulness
- RAVEL (Huang et al., 2024): uses causal interventions to evaluate whether a method can locate and disentangle entity attributes. Samples contain a base prompt querying one attribute, a counterfactual prompt for another entity of the same type, a target attribute, and a counterfactual label.
- Baseline methods: MDAS uses a multi-task objective to satisfy multiple high-level causal criteria simultaneously, but intervention tokens must be specified by hand; in this paper's experiments it is fixed to the last entity token. The appendix additionally uses SAE under the setting of Huang et al. (2024) as a feature-space comparison. DAS (Geiger et al., 2024b) only learns a rotation matrix R, with the target model frozen. The dataset is RAVEL.
- Editing concerns: the authors cite Meng et al. (2022) and Ghandeharioun et al. (2024), worrying that overly strong supervised tools inject information, steer, or edit the model rather than finding existing causal structure.
The authors position HyperDAS as: using end-to-end optimization to select intervention positions across all tokens by concept, thereby removing enumeration; and using architectural, training, and evaluation constraints to reduce false positives.
How does the paper address this problem?
The hypernetwork encodes the concept and cross-attends to hidden states, then selects tokens and rotates out a subspace with Householder transforms.
HyperDAS is a transformer hypernetwork: it reads a natural language description of a concept, cross-attends to the target model's hidden states on base and counterfactual inputs, simultaneously selects token alignments and an orthogonal subspace, and then applies a weighted distributed interchange intervention to a fixed layer of the target model. The selection is soft during training and is discretized to a one-to-one mapping at evaluation.
Setting and success criteria
- A RAVEL sample contains a base input, a counterfactual input for another entity of the same type, a concept description, and a label. When the target attribute matches the attribute asked in the base, the label takes that attribute of the counterfactual entity; otherwise it takes the attribute of the base entity.
- Features are the columns of a low-rank orthogonal matrix R. For each base token, the layer-l intervention is Hb ← h̄b + R⊤(R(h̃b) − R(h̄b)) . The tilde h is the counterfactual hidden state mixed by alignment weights; this formula replaces only within the subspace spanned by the columns of R.
- Cause is the proportion of interventions that successfully change the target attribute, Iso is the proportion that successfully leave non-target attributes unchanged, and Disentangle is the average of the two.
Encoding concepts and selecting tokens
- Concept text is encoded with the target model's embedding, then passed through N decoder layers. Each layer has, in addition to self-attention and MLP, two cross-attention heads that can attend to all layers of the target model processing base and counterfactual. The vector of the last token of the last layer is used both to select positions and to determine the subspace.
- The intervention score matrix G has size B×(C+1). Each entry is the alignment between a base token and a counterfactual token; the extra column indicates no intervention, denoted [SELF] in the figure.
- Alignment first concatenates the two layer-l residual streams and linearly projects, then uses the concept encoding as the query in multi-head dot-product attention, followed by a column-wise softmax. During training, G is used for weighted mixing. The main experiment uses 8 decoder blocks, with 32 heads for pairwise token attention.
Determining the subspace with Householder transforms
- DAS has a fixed low-rank orthogonal matrix R. The concept encoding goes through an MLP to obtain a nonzero vector v, and the Householder transform is H = I − 2(vv⊤)/(v⊤v) . H is orthogonal, so multiplying R by H keeps the columns orthogonal, thereby changing the subspace with the concept.
- The main experiment uses a subspace dimension of 128. The authors tried between 32 and 2048, with a target hidden dimension of 4096.
Training, discrete evaluation, and shortcut prevention
- The loss is L_RAVEL plus λ times L_sparse. The former is the cross-entropy of the post-intervention output against the label. The latter penalizes the sum of weights when a counterfactual token's weights over multiple base tokens sum to more than 1, pushing toward one-to-one. In the main experiment, λ increases linearly from 0 to 1.5 starting at 50% of total steps.
- The main text writes that the learning rate is chosen per dataset, with magnitudes stated as 10 to the 4th and 5th powers; the extracted text did not preserve the negative sign. The full-domain experiments in Appendix A.1 state learning rates of 2×10^{-5} to 5×10^{-4}, with λ from 0.75 to 1.5, also starting after 50% of steps. Table 1 notes that each setting is trained for 5 epochs on the full data, with training and test prompts disjoint.
- At evaluation, G is discretized by row- and column-wise argmax: a cell is set to 1 only if it is the maximum in both its row and column, and [SELF] is reset accordingly.
- To avoid shortcuts, an attention mask is applied from the attribute mention in the base prompt so the hypernetwork cannot see whether the target attribute equals the attribute asked in the base. A symmetric variant randomly swaps the concatenation order of base and counterfactual hidden states, so that reading and writing the concept use the same position.
- The authors tried initializing the hypernetwork with pretrained parameters (except cross-attention and pairwise heads, copied from Llama3-8B), and state that this gave no advantage on this task.
What experiments did the paper conduct?
On RAVEL with Llama3-8B, asymmetric HyperDAS has an average Disentangle of 84.7, versus 76.0 for MDAS.
Experimental Setup
- Target model: Only Llama3-8B. The hypernetwork is trained separately; the main text says initializing with Llama3-8B parameters provides no advantage.
- Data: RAVEL five domains: cities, Nobel laureates, occupations, physical objects, verbs. Cause train/test are: city 34899/7016, Nobel laureate 39771/6754, occupation 54444/1582, physical object 49114/4659, verb 70003/3806 (Table 1). Training and test prompts are disjoint, and each setting is trained for 5 epochs.
- Variants: Either train one model per domain, or share one model across five domains; token selection is either symmetric or asymmetric. The main experiment uses subspace dimension 128.
- Baselines: MDAS, with intervention location fixed to the last token of the entity. The appendix adds an SAE comparison following the setup of Huang et al. (2024).
- Metrics and criteria: Cause, Iso, Disentangle (the average of the first two). Training uses cross-entropy on counterfactual labels. The paper does not use a separate evaluation model and does not report the number of repetitions.
- Layers: The note to Table 3a says each method takes the best layer among layers 10 to 15; the main text says the table is the result at layer 15. Figure 3b evaluates every 2 layers starting from the embedding, for 16 layers total, and examines layers 7, 15, and 29 in detail. Scores in the table are quoted from the original source without percent signs; Figure 7 writes the same Disentangle Score as ≈94.0%.
Main Results
| Method (Table 3a) | City Cause/Iso | Nobel Cause/Iso | Occupation Cause/Iso | Verb Cause/Iso | Average Disentangle | | MDAS | 55.8/77.9 | 56.0/93.5 | 50.7/88.1 | 74.3/79.6 | 76.0 | | Asymmetric | 70.8/93.9 | 55.4/95.1 | 50.4/99.1 | 93.0/98.9 | 84.7 | | Asymmetric All Domains | 58.8/90.5 | 47.6/92.0 | 75.7/82.1 | 86.9/95.8 | 80.7 | | Symmetric | 76.9/90.9 | 59.2/88.4 | 47.1/89.1 | 42.3/82.9 | 76.9 | | Symmetric All Domains | 16.8/94.7 | 2.0/98.8 | 6.1/97.3 | 13.6/97.8 | 54.8 |
The table omits Physical Object. Its Cause/Iso is: MDAS 85.0/97.9, Asymmetric 92.7/97.2, Asymmetric All Domains 92.9/94.5, Symmetric 94.8/97.5, Symmetric All Domains 21.6/99.3 (Table 3a).
- The authors claim HyperDAS achieves state-of-the-art in attribute disentanglement. In the table, the asymmetric Cause for Nobel and Occupation is lower than MDAS in the same column, with higher Iso; the symmetric all-domains row has very low Cause and very high Iso, with average Disentangle lower than MDAS.
- The authors claim per-domain training gives larger gains. Appendix A.1 says the all-domains model is 4.0% lower than per-entity training, and says city and Nobel are worse, occupation is better, and physical object and verb are roughly comparable; the authors do not state which row in the table the 4.0% corresponds to.
- The authors claim that on the city split, the Disentangle peaks for both MDAS and the two HyperDAS variants are near layer 15, and HyperDAS outperforms MDAS at all layers (Figure 3b). The figure does not contain precise scores readable per layer. The main text and table note disagree on the layer used for the main table; see Experimental Setup.
Intervention Location Varies by Layer
- This measures, on the city split and layers 7/15/29, the types of base and counterfactual tokens selected by HyperDAS (Figure 4, Section 4.1).
- The authors claim that on the counterfactual side, all layers point to entity tokens; on the base side, shallow layers select random positions or even BOS, middle layers shift to entity tokens, and deep layers intervene on positions such as JSON syntax tokens. The "is" after the entity is in the Others class, with 36% for shallow-layer base and 29% for deep-layer base.
- Figure 4 bars are labeled with 83.5%, 97.7%, 98.7%, 89.8%; after text extraction it cannot be determined which group each percentage corresponds to, so none are assigned here.
Token Alignment and Symmetry
- Figure 8 compares symmetric and asymmetric variants on three-token entities in the city domain. The asymmetric variant takes the attribute from the last entity token on ≥95% of counterfactual prompts and intervenes on the second-to-last entity token on the base. The symmetric variant favors the last entity token on both sides, and the paper does not give the percentage for that side.
- The paper claims its state-of-the-art HyperDAS selects multiple tokens 53% of the time; MDAS uses one token each on base and source. The 53% does not specify the variant or domain.
- Appendix A.3, Figure 9: if the base's attribute token is not masked, the model learns to put all quality into [SELF] on isolate samples and does not intervene. The authors call this a shortcut that does not search for the true concept subspace.
Householder Vector Geometry
- Householder vectors are collected for each attribute in the city domain. The main text says 1,000 samples are randomly drawn per attribute to compute average cosine similarity; the Figure 6 caption says 100,000 samples per attribute. The two numbers are inconsistent.
- In Figure 6, the same-attribute cosine similarity for the six city attributes is 0.97 to 1.00; Country and Longitude is 0.69, and Longitude and Latitude is 0.87. The authors claim Longitude and Latitude learn highly similar subspaces, and same-attribute clusters are tighter, which may explain why different attributes are assigned to different subspaces.
- The authors claim that in the PCA of Figure 5, each attribute forms a distinct cluster. The extracted text does not show point positions, so it cannot be used to describe how clusters separate.
Other Ablations and Analyses
- No cross-attention: Cause 68.2, Iso 83.9, Disentangle 76.1; the domain and layer are not stated in the paper, and the HyperDAS row 70.8/93.9 matches the Cause/Iso of the city asymmetric row in Table 3a.
- No rotation matrix, intervening on the entire hidden vector: Cause 0.8, Iso 97.4, Disentangle 49.1 (same appendix table).
- Using a vector lookup table instead of hypernetwork encoding: Cause 15.1, Iso 46.9, Disentangle 31.0 (same appendix table).
- Figure 7, Occupation, three sparse losses and weighted intervention all have Disentangle ≈94.0%; no sparse loss and overly strong sparse loss fail in one-to-one evaluation.
- City domain country attribute, one epoch: HyperDAS 468,923 TeraFLOPs, MDAS 193,833; the authors claim about 2.4 times.
- The paper writes that with 23 attributes, MDAS is 110.3GB and HyperDAS is 68GB; the target Llama model is 16GB, HyperDAS adds another 52GB, and MDAS adds 4.1GB per attribute.
What are some points that can be further explored?
The authors state that success depends on linear mediation and worry that supervised interpretation brings false positives.
Limitations and Future Directions Noted by the Authors
- HyperDAS only succeeds when the target concept is mediated by linear features (Limitations).
- The authors write that existing evidence suggests nonlinear mediation is possible, citing Csordás et al. (2024) and Engels et al. (2024) (Limitations).
- Using supervised machine learning for interpretability may yield false positives (Limitations).
- The authors claim to have taken measures to maintain faithfulness to the underlying model structure, and future work should continue to weigh "finding underlying causal relationships" against "model steering risk" (Limitations).
Experimental Coverage
- The tested model is Llama3-8B. The main table takes the best layer among layers 10 to 15 per the table note, while the main text says the table is layer 15; additionally, 16 layers are evaluated every 2 layers from the embedding, with layers 7, 15, and 29 examined in detail.
- The data is the five entity domains of RAVEL, with attributes and train/test sizes in Table 1; training and test prompts are disjoint, and each setting is trained for 5 epochs.
- Comparisons include MDAS with the entity last token fixed, and SAE in the appendix; variants include symmetric/asymmetric and per-domain training/shared model across five domains. At evaluation, soft alignment is collapsed to one-to-one.
- The paper reports TeraFLOPs for one epoch on the country attribute in the city domain, and memory estimated for 23 attributes.
- The paper does not report the number of repetitions. Householder similarity is written as 1,000 samples per attribute in one place, and 100,000 samples in the Figure 6 caption.
Summarize the main content of the paper
The hypernetwork automatically selects intervention positions and subspaces; on RAVEL the asymmetric average Disentangle is 84.7.
HyperDAS uses a hypernetwork to automatically do causal interpretability: at a fixed layer of the target language model, it finds the token positions and linear subspace that mediate a concept.
- Problem: DAS can learn concept features from counterfactual data, but requires exhaustive search over positions; the practice of fixing entity information to the last entity token, the authors claim, does not always hold.
- Method: The hypernetwork encodes the natural language description of the concept, cross-attends to the target model's hidden states when running base and counterfactual; uses attention for token alignment, rotates a fixed orthogonal subspace with Householder transformations, then performs interchange intervention. A sparse loss and bidirectional argmax at evaluation time collapse alignment to one-to-one; the attribute token in the base is masked to avoid learning "no intervention when attributes are inconsistent."
- Results: On RAVEL with Llama3-8B, the per-domain asymmetric variant in Table 3a has an average Disentangle of 84.7, MDAS is 76.0, and the five-domain shared asymmetric model is 80.7. With the symmetric and all-domains shared model, the average Disentangle is 54.8, with Nobel Cause at 2.0. In Figure 8, on three-token entities in the city domain, the asymmetric variant takes the attribute from the last entity token in ≥95% of counterfactual prompts.
- Authors' conclusion: The authors claim this achieves state-of-the-art on RAVEL and believe that dynamically selecting hidden representations and learning linear features that mediate concepts helps explain complex language models. The authors also state: the method only succeeds when concepts are mediated by linear features, and supervised interpretation may also produce false positives.