Qwen/Qwen3.5-9BA Jacobian lens (Anthropic, Verbalizable Representations Form a Global Workspace
in Language Models, https://transformer-circuits.pub/2026/workspace, reference code
https://github.com/anthropics/jacobian-lens) for the instruct model
Qwen/Qwen3.5-9B: one [4096, 4096] matrix per layer (31 source layers, 0..30)
that transports the residual stream at that layer into the final-layer basis, to be
decoded with the model's own unembedding: lens_l(h) = unembed(J_l h),
J_l = E[d h_final / d h_l] over positions and prompts of a pretraining-like corpus.
(Neuronpedia's neuronpedia/jacobian-lens hosts the lens of Qwen3.5-9B-Base; this
repo hosts the instruct one.)
| file | prompts | sha256 | use |
|---|---|---|---|
lens_n1000.pt |
1000 (the paper's default) | 25f7c003432b44f01b94a45a32322a4994186aad9110060a463392806a6525ba |
recommended |
lens.pt |
500 (records 0-499 of the same corpus stream) | e43657d75a67b760608a729c65af603cbb79dcd5728fe7ae556f0122004c019f |
earlier lens, indistinguishable on the evals below |
Fit recipe (the paper's, as run by Neuronpedia for the Base model): Salesforce/wikitext
wikitext-103-raw-v1 train, records of >= 600 chars truncated to 2000 chars and 128 tokens,
first 16 positions skipped, target = final layer, mean over positions then prompts, fp16
storage. Fitted in 8 + 16 B200 shards on Modal and merged n-weighted with
JacobianLens.merge; per-shard run_meta.json, config.yaml and convergence.csv are
under shards/ (records 0-499) and shards_n1000/ (records 500-999). Code:
src/experiments/jlens_fit.py and jlens_merge_publish.py of
https://github.com/cywinski/midtraining-generalisation.
pip install 'jlens @ git+https://github.com/anthropics/jacobian-lens@581d398613e5602a5af361e1c34d3a92ea82ba8e' 'transformers==5.5.4' accelerate
import jlens, torch, transformers
hf = transformers.AutoModelForImageTextToText.from_pretrained("Qwen/Qwen3.5-9B", dtype=torch.bfloat16, device_map="cuda")
tok = transformers.AutoTokenizer.from_pretrained("Qwen/Qwen3.5-9B")
model = jlens.from_hf(hf, tok)
lens = jlens.JacobianLens.from_pretrained("bcywinski/jacobian-lens-qwen3.5-9b", filename="lens_n1000.pt")
prompt = "Fact: The currency used in the country shaped like a boot is"
lens_logits, model_logits, _ = lens.apply(model, prompt, positions=[-2]) # read at " boot"
for layer, logits in sorted(lens_logits.items()):
print(layer, [tok.decode([t]) for t in logits[0].topk(5).indices]) # " Italy" from layer ~12
lens.apply(..., use_jacobian=False) is the logit lens on the same positions;
lens.transport(h.float(), layer) is the bare J_l h for residuals you already hold.
Layer indices are zero-based, positions index the raw prompt tokens, no chat template.
Merged LoRA adapters can be read out with this lens (an approximation that holds while
the adapter perturbs the Jacobian little).
lens_n1000.pt (2026-09-22)Three of the paper's lens-quality evals ("Quantitative Methodological Comparisons"),
each against the logit lens (J = I) on Qwen/Qwen3.5-9B, one fit, 95% item-bootstrap
CIs. Full numbers under evaluation_n1000/.
lens.pt scores 0.481, and
Neuronpedia's Base-model lens applied to the instruct model 0.497.The two sections below are the earlier evaluations of the 500-prompt lens.pt
(pass@10 with English labels, then with English + Chinese labels).
Bilingual update (2026-09-11): the original pooled advantage disappears when English + Chinese concept labels are accepted. See the bilingual evaluation below; the fitted lens weights are unchanged.
Overall pass@10: 36.8% vs 32.9%, +4.0 pp (paired 95% CI +0.9 to +7.0).
The overall pass@1 and pass@5 differences include zero in their confidence intervals. The logit lens has higher arithmetic and typo pass@10 means; typo pass@1 is significantly worse with the Jacobian lens. Poetry and association scores remain low for both methods. This is evidence for better top-10 concept readout on this benchmark, not universal superiority or improved answer accuracy.
542 of 551 input items are scored, with 925 labels; 12 labels with no complete single-token form are explicitly excluded (9 entire multihop items). Confidence intervals resample items 1,000 times from a single 500-prompt fit; they do not cover corpus/fit variability. Prompts are raw text completions and both methods scan layers 0–30.
| Set | Jacobian lens @10 (%) | Logit lens @10 (%) | Difference (pp), paired 95% CI |
|---|---|---|---|
| all | 36.8 | 32.9 | +4.0 [+0.9, +7.0] |
| multihop | 61.3 | 42.9 | +18.5 [+9.5, +28.0] |
| multilingual | 46.4 | 38.5 | +7.9 [+4.9, +11.4] |
| order-ops | 64.5 | 72.7 | -8.2 [-18.2, +1.8] |
| poetry | 4.1 | 2.0 | +2.0 [+0.0, +5.1] |
| association | 5.9 | 0.0 | +5.9 [+2.0, +10.8] |
| typo | 55.2 | 61.5 | -6.2 [-17.7, +6.2] |
Jacobian vs logit lens on the six upstream evaluation sets, using exact single-token labels. Mean per-item pass@10; bars show 95% item-bootstrap intervals from one fit. Strongest gains: multihop and multilingual.
Per-layer pass@10 with the same item weighting. The Jacobian lens improves middle/late semantic readout; the logit lens is stronger for early-layer typo readout. One fit; layer curves have no uncertainty bands.
VERIFIED: nine CPU tests pass; all eight shard checksums match; indices 0–499 are covered once; 320 prompts were restored and 180 added; 49 recomputed prompt diagnostics match their original logs; the public Hub LFS checksum matches the merged lens; all 42 aggregate means were independently reproduced from 925 per-label rows; the full H100 evaluation loaded the pinned public artifact and passed finite-logit checks.
Full report, summary JSON, config, run metadata. Evaluation code commit: 5aaad6ad98f28360cb3858cdc0a7e646daa19884.
On the same 542 items and 925 eligible labels, bilingual @10 is 37.58% for J-lens versus 38.42% for logit lens: paired difference −0.85 pp (95% CI [−4.24, +2.26]). Chinese aliases add 0.74 pp to J-lens and 5.55 pp to logit lens. Additional English aliases change neither @10 mean. The previous pooled advantage is therefore sensitive to accepted language; this does not establish overall logit-lens superiority.
| Set | J-lens @10 (%) | Logit lens @10 (%) | J−LL, pp (95% CI) |
|---|---|---|---|
| all | 37.58 | 38.42 | -0.85 [-4.24, +2.26] |
| multihop | 62.50 | 47.62 | +14.88 [+4.76, +25.60] |
| multilingual | 46.88 | 46.03 | +0.86 [-2.88, +4.52] |
| order-ops | 65.45 | 78.18 | -12.73 [-22.73, -3.61] |
| poetry | 4.08 | 5.10 | -1.02 [-4.08, +2.04] |
| association | 5.88 | 2.94 | +2.94 [-2.94, +8.82] |
| typo | 57.29 | 70.83 | -13.54 [-26.04, -1.04] |
Multihop retains a clear J-lens advantage; multilingual does not. Excluding poetry and typo, bilingual recovery is 41.57% versus 38.86% on 348 items, difference +2.71 pp [−0.98, +6.35]. Translated labels on poetry/typo measure semantic rather than rhyme/spelling recovery.
For each supplied intermediate concept, a hit means any accepted complete single token reaches rank ≤k at any layer 0–30. Average within item, then across items. This is vocabulary recovery, not k sampled answers. Rank is 1 + the number of strictly higher logits; all boundary ties count.
Aliases were generated contextually, independently reviewed and frozen before scoring. Of 925 eligible labels, 835 have a complete Chinese token. The lens remains fitted on English WikiText. This English–Chinese sensitivity test neither covers every language nor proves an internal reasoning language; extra aliases create extra matching opportunities.
VERIFIED: all 57,350 original per-layer ranks reproduce the prior evaluation; all 126 scoring-mode means independently recomputed; 15 CPU tests pass. A separate H100 evidence rerun reproduced every rank trajectory on 77 selected items, including boundary ties. The H200-upgraded attempt failed exact equality and was discarded.
Full bilingual report, summary, audit, aliases and provenance, config, run metadata.
lens_n1000.pt 992 MiBlens.pt 992 MiB