Views
No views yet
lens_l(h) = unembed( J_l @ h ), J_l = E[∂h_final / ∂h_l]| file | fit corpus | note |
|---|---|---|
lens.pt | 1000 WikiText-103 prompts | paper setting; use this one |
lens-100prompt.pt | 100 WikiText-103 prompts | matches lens.pt within noise (quality saturates fast, §9.3) |
d_model=2048,
stored fp16 (~330 MB).1import transformers, jlens
2
3hf = transformers.AutoModelForCausalLM.from_pretrained(
4 "Qwen/Qwen3.6-35B-A3B", dtype="bfloat16", device_map="cuda")
5tok = transformers.AutoTokenizer.from_pretrained("Qwen/Qwen3.6-35B-A3B")
6model = jlens.from_hf(hf, tok)
7
8lens = jlens.JacobianLens.from_pretrained("stanleytheli/qwen3.6-35B-A3B-jlens")
9lens_logits, model_logits, _ = lens.apply(
10 model, "Fact: The currency used in the country shaped like a boot is",
11 positions=[-1])
12for layer, logits in sorted(lens_logits.items()):
13 print(layer, [tok.decode([t]) for t in logits[0].topk(5).indices])d_model/dim_batch backward passes per
prompt with all parameters frozen.dim_batch=16, ~101 GiB peak each, ~55–80 s/prompt), shards merged by
prompt-count-weighted mean.| layer | J-lens (WikiText) | logit lens (WikiText) | J-lens (multihop) | logit lens (multihop) |
|---|---|---|---|---|
| 8 | 182 | 11,793 | 15,691 | 73,541 |
| 16 | 106 | 42,247 | 162 | 166,944 |
| 24 | 61 | 28,634 | 127 | 225,956 |
| 32 | 47 | 672 | 443 | 143,817 |