Repository navigation
Conversation
Add transformer_lens.tools.analysis.interchange: an intervention that sets a base input's activation inside an orthonormal subspace to its value on a source input, at one hook point and optionally one position per example. It comes with difference-of-means, probe and random bases to intervene on and a norm-matched random-subspace placebo, plus unit tests, GPT-2 integration tests and a docs page. Part of TransformerLensOrg#1879.
8 tasks done
Collaborator
1 task done
run_with_intervention now raises unless the hook fires exactly once in the forward pass, as collect_activations already did. With positions, the activation must be [batch, pos, d_model] and positions must hold one index per example; other shapes raise instead of slicing the wrong axis. Add intervened_logits, which evaluates an intervention in batches without gradients and returns CPU logits, so memory is bounded by batch_size. The position tests now use a different position per row.
Add fit_das and LearnedSubspace to tools.analysis.interchange: DAS trains an orthonormal basis so that interchanging it makes the model produce the outputs a high-level causal model predicts for each base/source pair. The model is frozen during training and restored afterwards, and batches can be split to save memory. Includes unit tests on a planted direction, a GPT-2 test on held-out nouns, and a docs section. Part of TransformerLensOrg#1879.
dipo101
force-pushed
the
distributed-alignment-search
branch
2 times, most recently
from
October 13, 2026 20:48
a625238 to
15dddc6
Compare
8 tasks done
Collaborator
|
Hi @dipo101, please rebase this onto |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Part 2 of 3 for #1879. Stacked on #1892; only the last commit is new.
Adds
fit_dasandLearnedSubspace: distributed alignment search trains an orthonormal basis so that interchanging it makes the model produce the outputs a high-level causal model predicts for each base/source pair. Tested on a planted direction and on GPT-2 subject number with held-out nouns; docs section added.Type of change
Checklist: