Quantify Jacobian Lens causal-swap success rate - #1545
Merged
jlarson4 merged 1 commit intoJul 28, 2026
Merged
Conversation
emerardd
marked this pull request as ready for review
July 26, 2026 15:14
10 tasks
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
Quantifies Jacobian Lens causal-swap success on an open-weights model in the
existing executable demo.
google/gemma-2-2bmodel, matching published lens artifact, andcompanion country configuration to exact revisions.
(48 trials per alpha), applying each swap at every token position across
layers 10-24.
alpha=1andalpha=2separately, including baseline/swapped top-1tokens, target-answer ranks, and the France to China slice.
success, plus swap success conditioned on a correct baseline.
visualization cells. A grouped bar chart compares baseline and swap rates,
while two heatmaps show every target-answer rank.
the swapped next-token logits, retains all failures, and reports exact
maximum ties separately.
assertions rejecting duplicate, missing, or alpha-mismatched trial matrices.
The measured base-model results are:
11/16 unique function-source prompts.
alpha=1: 16/48 successes (33.33%).alpha=1, conditioned on a correct baseline: 13/33 successes (39.39%).alpha=2: 0/48 successes; the country token itself becomes top-1 in everytrial, consistent with double-strength overshoot.
alpha=1: 1/4 successes unconditionally and 1/3 amongbaseline-correct trials (language only).
alpha=2: 0/4 successes.This uses
TransformerBridgewith raw Hugging Face weights. It does not use thedeprecated
HookedTransformerpath, adds no dependency, and keeps the pinnedreal-model evaluation in the demo rather than adding a separate slow test.
Addresses the causal swap success-rate item in #1539.
Type of change
Screenshots
Not attached separately. The executed notebook contains the aggregate chart,
per-trial rank heatmaps, a compact summary table, and a collapsible full result
matrix.
Checklist:
The unit-test checklist is not applicable to this notebook-only change. The
notebook-specific CI-equivalent check passes locally.
Local verification
uv run pytest --nbval-sanitize-with demos/doc_sanitize.cfg demos/Jacobian_Lens_Demo.ipynbgit diff --check