Introduction
A decoder transformer keeps a residual stream at every layer and position , and decodes only the last one, , through a final norm and the LM head. A lens asks what an earlier residual is disposed to make the model say. It transports into the final-layer basis and lets the model's own unembedding decode the result:
The question this task poses is what should be, given only a generic web-text corpus to fit on and the constraint that sees nothing but an anonymous residual and its layer index. Two properties are asked of it at once: the readout should surface latent content (concepts the model computes but has not yet said), and should predict faithfully how a change to the activation propagates to the final layer.
The field has three reference answers. The logit lens is the identity, ; it is free, and it reads late layers well and early layers poorly. The tuned lens [1] learns an affine translator per layer by matching the final next-token distribution; it is best at its own training objective, but the Jacobian lens paper reports that it skips ahead to the next token and misses intermediate content [2]. The Jacobian lens [2] uses the corpus-averaged Jacobian , which sums the effect of a source position on every later target position and so captures what the activation is disposed to make the model say later, not only next. That the averaged Jacobian is a good object is also suggested by the observation that much of a transformer's relation decoding is well approximated by a single linear map [3], and a recent mathematical analysis explains the Jacobian lens's readout in terms of short horizons and sparse concepts [4]. Other work reads internals by differencing logit lenses [5].
What makes the Jacobian hard to use well is statistical, not conceptual. A plain mean of per-position Jacobians is dominated by a few positions: a handful of tokens in a sequence carry activations far larger than the rest [6], and in our own diagnostics whole clusters of punctuation and sink positions produced Jacobians several times larger than typical and semantically incoherent. An exact Jacobian also costs cotangent rows per prompt, so it is estimated from relatively few prompts. Our method is built around making that estimate robust and then supplementing it with a cheap, low-variance estimator of the same cross-position effect.
Method
We call the method FJR (filtered Jacobian with forward regression). Its output is one affine map per source layer, , stored at fit time; transport is a single matrix product. The fit has four parts.
Relevance-propagated Jacobian rows
We take Jacobians through a modified backward graph rather than the stock one. Forward values are unchanged, but three sub-expressions are made constant for the backward pass: the normalising denominator of every RMSNorm or LayerNorm, the gate of the SiLU or GELU activation (writing ), and half of each gated product, . These are relevance-propagation (LRP) rules; their purpose is to stop high-curvature noise from compounding through depth, which hurts early layers most. The rules are installed as forward hooks, the norm kind is identified by matching candidate formulas against the module's actual output, and a sanity check compares the patched model's final residual with the stock one: if they differ by 5% or more in relative norm the rules are dropped.
def make_hook(mm, kk):
def hook(module, args, out):
if not args or not torch.is_tensor(args[0]):
return out
return ReadoutLens._norm_lrp(mm, args[0], kk)
return hook
handles.append(mod.register_forward_hook(make_hook(mod, kind)))
if all(hasattr(mod, a) for a in
("gate_proj", "up_proj", "down_proj", "act_fn")):
def mlp_hook(module, args, out):
if not args or not torch.is_tensor(args[0]):
return out
x = args[0]
z = module.gate_proj(x)
u = module.up_proj(x)
a = ReadoutLens._detached_gate_act(module.act_fn, z)
p = a * u
p = 0.5 * p + 0.5 * p.detach()
return module.down_proj(p)
handles.append(mod.register_forward_hook(mlp_hook))For each prompt we batch copies and, for a chunk of output coordinates at a time, place a one-hot cotangent at every valid target position simultaneously. The gradient that arrives at source position is then the row block of , summed over target positions as the Jacobian lens prescribes (causality makes only contribute).
Huber weights and cluster experts
Before the exact rows, one extra backward pass per prompt sends a random unit cotangent to all target positions. It returns for every source position, from which we form a randomised estimate of each position's Jacobian norm, of the Hutchinson kind [7], and a smooth Huber-like weight in :
where is the median of over the prompt's positions. A position with a typical norm gets weight about one half; a position ten times the median gets about one eleventh.
The same pass assigns each source position to one of up to clusters per layer: activations are normalised to unit length, centred, projected onto their top 64 principal directions, and clustered by k-means with k-means++ seeding. Each cluster accumulates its own weighted expert Jacobian,
# cluster memberships + Huber weights from one probe pass
memb, weights = [], []
v = torch.randn(dim_batch, d, generator=gen).to(tgt.device)
v = v / v.norm(dim=-1, keepdim=True)
cotp = torch.zeros_like(tgt)
cotp[:, pos, :] = v[:, None, :].to(tgt.dtype)
pgrads = torch.autograd.grad(
outputs=tgt, inputs=srcs, grad_outputs=cotp,
retain_graph=True)
for li, l in enumerate(sources):
if routers is not None:
a = self._assign(routers[l], srcs[li][0, pos].detach())
memb.append(torch.nn.functional.one_hot(a, E).float())
else:
memb.append(torch.ones(len(pos), E, device=tgt.device) / E)
gp = pgrads[li][:, pos.to(pgrads[li].device), :].float()
est = (gp.pow(2).sum(-1).mean(0) * d).sqrt()
med = est.median().clamp(min=1e-9)
hw = med / (med + est) # smooth Huber-like weight in (0,1)
weights.append(hw.detach())
wtsum[li] += (memb[-1] * hw[:, None].to(memb[-1].device)).sum(0).cpu()The experts are then recombined without any labelled data. Every tenth corpus text is held back (when the corpus has more than a hundred texts), and from it we take positions with their current token and the next eight tokens. For each layer and expert we decode the held-back activations through and score how often the top ten tokens contain the current token, or any of the upcoming ones, the latter counted twice:
The score is shrunk halfway toward the expert's mean over layers, , and the filtered Jacobian is
with experts that received no positions set to zero. The fourth power concentrates weight on coherent experts; the norm factor discards clusters whose Jacobians are large but incoherent.
if scores is not None:
glob = scores.mean(0)
shrunk = 0.5 * scores + 0.5 * glob[None, :]
else:
shrunk = None
out = {}
for li in range(L1):
if shrunk is not None:
s = shrunk[li]
sn = s / s.max().clamp(min=1e-12)
w = sn.pow(4) * (norms[li].median().clamp(min=1e-12)
/ norms[li].clamp(min=1e-12))
else:
w = wtsum[li].float() / norms[li].clamp(min=1e-12) ** 2
# zero-weight dead experts (no fitted positions)
w = w * (wtsum[li] > 1e-9).float()
if float(w.sum()) <= 0:
w = (wtsum[li] > 1e-9).float()
w = w / w.sum().clamp(min=1e-12)
W = sum(float(w[e]) * experts[li][e] for e in range(E))
out[li] = WForward regression onto the future residual
The second estimator needs no backward pass at all. From forward passes over the corpus we accumulate first and second moments of and of a target , and solve a ridge regression per layer,
The target is a mixed-horizon average of later final residuals: half the mean over the next (up to) four positions, half the mean over all strictly later positions,
If were Gaussian, Stein's lemma would give , so estimates a future-position-averaged Jacobian, the same kind of cross-position effect sums over, from second moments only. We fit a second regression in the same way onto the same-position final residual .
c = torch.cat([torch.zeros(1, d, device=dev), torch.cumsum(hf, 0)], 0)
idx = torch.arange(T - 1, device=dev)
end = (idx + 5).clamp(max=T - 1)
cnt = (end - (idx + 1)).clamp(min=1).float()[:, None]
y = (c[end] - c[idx + 1]) / cnt
y[-1] = hf[-1]
# mixed-horizon target: half next-4 mean, half mean over
# all strictly-future final positions
suf = torch.flip(torch.cumsum(
torch.flip(hf, [0]), 0), [0])
scnt = torch.arange(T - 1, 0, -1, device=dev).float()[:, None]
fut = (suf - hf) / (scnt - 1).clamp(min=1)
fut[-1] = hf[-1]
y = 0.5 * y + 0.5 * futThe blend, the depth schedule and the bias
The three maps have very different scales ( is ill-conditioned and large in early layers), so we match them by their action on typical activations rather than by their Frobenius norms. With the covariance of ,
and likewise , and blend
The weights follow the relative depth : in the first third, in the middle third and in the last, and from both are tapered linearly toward 30% of their value at . Early layers lean on the future regression, where it helps the readout most and the Jacobian's causal fidelity is poor anyway; late layers stay close to the Jacobian, which is near-exact there, and borrow mainly from the same-position regression.
sJ = float(torch.trace(Jm.to(dev) @ C @ Jm.to(dev).T))
sR = float(torch.trace(Rm.to(dev) @ C @ Rm.to(dev).T))
scale = (max(sJ, 1e-12) / max(sR, 1e-12)) ** 0.5
scale = min(max(scale, 0.05), 20.0)
# depth-varying blend: future regression helps readout most
# in early/mid layers (where causal fidelity is anyway poor),
# while late layers stay closer to the Jacobian (where its
# perturbation fidelity is high) with more same-position weight
frac = li / max(1, L - 1)
if frac < 1.0 / 3.0:
wn, ws = 0.55, 0.0
elif frac < 2.0 / 3.0:
wn, ws = 0.35, 0.15
else:
wn, ws = 0.15, 0.30
if frac >= 0.85:
# last layers: the Jacobian is already near-exact, so
# taper the regression contribution toward the top
tt = (frac - 0.85) / 0.15
wn *= (1.0 - 0.7 * tt)
ws *= (1.0 - 0.7 * tt)
if R_same is not None and li in R_same and float(R_same[li].norm()) > 0:
Rs = R_same[li]
sS = float(torch.trace(Rs.to(dev) @ C @ Rs.to(dev).T))
scale_s = (max(sJ, 1e-12) / max(sS, 1e-12)) ** 0.5
scale_s = min(max(scale_s, 0.05), 20.0)
W = (1.0 - wn - ws) * Jm + wn * scale * Rm + ws * scale_s * Rs
else:
W = (1.0 - wn) * Jm + wn * scale * Rm
nJ = float(Jm.norm())
nW = float(W.norm())
if nJ > 0 and nW > 0:
W = W * (nJ / nW)The bias has two parts. A small mean-matching term moves the transported mean a twentieth of the way toward the final-layer mean. The second is a junk-suppression direction. Tokens whose decoded text contains no letter or digit get target , all others , and we solve a ridge least-squares problem for the direction whose logit offsets through the effective unembedding (LM head times the final norm's gain) best match those targets, with ridge . The direction is normalised to unit RMS, kept only if junk tokens then end up at least one logit below content tokens on average, and added as , where is the RMS of the transported activation under the corpus statistics. Being constant, it moves no perturbation delta.
if mu_x is not None and mu_f is not None:
bvec = 0.05 * (mu_f.cpu() - W @ mu_x[li].cpu())
else:
bvec = torch.zeros(d)
Wlist.append(W)
blist.append(bvec.float().cpu())
# junk-suppression bias (constant: does not affect perturbation deltas)
try:
vj = self._junk_direction(model)
if vj is not None and stats is not None:
for li, l in enumerate(src):
Wm = Wlist[li].to(dev)
Sxx_raw = stats[2][li].to(dev)
# E||y||^2 for y = W h + b under the forward statistics
Ey2 = float(torch.trace(Wm @ Sxx_raw @ Wm.T)
+ 2.0 * (blist[li].to(dev) @ (Wm @ stats[1][li].to(dev)))
+ float(blist[li].pow(2).sum()))
rms_y = (max(Ey2, 0.0) / d) ** 0.5
blist[li] = (blist[li] + 0.25 * rms_y * vj).float().cpu()Every stage degrades to a simpler estimator on failure: without LRP the Jacobian is taken through the stock graph, without clusters it is a single Huber-weighted mean, without a Jacobian the regression is used alone, and without either the map is the identity. Corpus texts for each stage are spread evenly over the whole corpus rather than taken from its head, so that a corpus grouped by source is less likely to bias the fit or the held-back slice.
Results
| Method | ① | ② | ③ | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| pass@k AUC, prompt set 1 ↑ | pass@k AUC, prompt set 2 ↑ | pass@k AUC, prompt set 3 ↑ | Perturbation fidelity ↑ | pass@k AUC, prompt set 1 ↑ | pass@k AUC, prompt set 2 ↑ | pass@k AUC, prompt set 3 ↑ | pass@k AUC, prompt set 4 ↑ | Perturbation fidelity ↑ | pass@k AUC, prompt set 1 ↑ | pass@k AUC, prompt set 2 ↑ | pass@k AUC, prompt set 3 ↑ | pass@k AUC, prompt set 4 ↑ | Perturbation fidelity ↑ | |
| Muse Wonder Full | 48.87 | 50.95 | 11.63 | 73.00 | 8.940 | 42.55 | 48.06 | 14.71 | 66.91 | 20.23 | ||||
| Logit lens | 40.79 | 30.12 | 13.03 | 11.15 | 52.65 | 45.83 | 6.822 | 43.59 | 7.849 | 43.12 | 42.16 | 22.37 | 45.88 | 20.82 |
| Zero transport | 26.69 | 6.180 | 7.544 | 0 | 18.44 | 4.631 | 2.037 | 1.404 | 0 | 15.02 | 5.868 | 10.21 | 1.052 | 0 |
| Tuned lens | 39.56 | 39.27 | 12.52 | 11.24 | 34.94 | 36.17 | 4.006 | 30.79 | 7.847 | 37.67 | 40.93 | 11.27 | 39.95 | 20.86 |
| Tuned lens, float32 translators | 39.05 | 39.18 | 12.18 | 11.24 | 34.97 | 36.21 | 3.721 | 30.97 | 7.847 | 37.12 | 40.86 | 11.21 | 39.62 | 20.85 |
| Jacobian lens | 49.04 | 37.09 | 18.12 | 15.33 | 49.59 | 37.84 | 12.28 | 61.35 | 6.215 | 47.44 | 43.04 | 20.67 | 54.95 | 20.78 |
- ① Qwen3.5-4B · multi-hop / multilingual / order-of-operations
- ② Gemma-3-4B · typo / multi-hop / multilingual / order
- ③ OLMo-3-7B · typo / multi-hop / multilingual / order
FJR's gains are concentrated in two of the four readout probes. On readout probe 2 it is ahead of every baseline on both settings where we have results: 50.95 on Gemma3-4B against 45.83 for Logit lens, and 48.06 on OLMo3-7B against 43.04 (Jacobian lens [2]). On readout probe 4 the margin is larger: 73.00 against 61.35 (Jacobian lens [2]) on Gemma3-4B, and 66.91 against 54.95 (Jacobian lens [2]) on OLMo3-7B.
On the other two probes it does not lead. On readout probe 1 we reach 48.87 on Gemma3-4B, below the logit lens's 52.65 and the Jacobian lens's 49.59, and 42.55 on OLMo3-7B, below both again (43.12 and 47.44). On readout probe 3 we are slightly below the Jacobian lens on Gemma3-4B (11.63 against 12.28) and clearly below both the logit and the Jacobian lens on OLMo3-7B (14.71 against 22.37 and 20.67). On both of these probes we remain above the tuned lens on both settings.
Perturbation fidelity splits. On Gemma3-4B FJR has the highest fidelity in the table, 8.940 against 7.849 for Logit lens, and well above the Jacobian lens's 6.215. On OLMo3-7B it is 20.23, a little below every non-zero baseline, whose values lie between 20.78 and 20.86. We expected some loss of fidelity: the regression terms are fitted to predict, not to differentiate, and in our own development runs removing them raised perturbation cosine while costing much of the readout gain (see below).
The published results contain no Qwen3.5-4B value for FJR, so we can say nothing about that setting.
How we got here
We started from the literature rather than from the starter. The Jacobian lens paper [2] gave us the estimator, its readout evaluation and its ablations; two recent follow-ups we read but cannot cite here supplied the first two ingredients. One computes the Jacobian through LRP backward rules and reports gains that grow with model size; the other clusters activations into expert Jacobians and recombines them with weights learned on labelled readout items. The labelled items are exactly what this task withholds, which is why our recombination uses an unsupervised coherence score instead. The analysis of the J-lens readout [4] pointed us to the Stein-lemma link between the averaged Jacobian and a regression.
All the development figures below are the agent's own measurements on latent-concept prompts it wrote itself (76 at first, 252 from the second round on), scored by pass@k AUC over layers, with a same-position perturbation cosine as its fidelity check; most are on a 0.5B and a 1.5B model.
- Forward regression was nearly as good and far cheaper. In the first comparison (76 prompts, the 0.5B model), the Jacobian lens reached an AUC of 0.442 against 0.243 for the logit lens, and a same-position regression already reached 0.395; the forward statistics over 200 prompts took 3.4 s, against 112 s for a Jacobian over 100 prompts. Blending the Jacobian with a regression onto later positions was the first large gain: on the 252 prompts, a half-and-half blend took the 1.5B model to 0.690.
- The gain is not free in fidelity. Regression onto future positions alone had a same-position perturbation cosine of only 0.15, against 0.42 to 0.45 for the Jacobian, because it predicts rather than differentiates. Every later decision traded along this axis. In the final ablations, removing the regression from the full system dropped the AUC to 0.572 and raised the perturbation cosine to about 0.43.
- A secant (finite-difference) estimator of the Jacobian was too noisy to replace exact rows: its cosine with the exact Jacobian was 0.33 to 0.66 depending on the step and sample size.
- Experts differ widely, and their split-half reliability did not predict quality. Single experts ranged from about 0.33 to 0.55 AUC on the 0.5B model. Of the unsupervised scores we tried, recall of upcoming corpus tokens tracked development AUC best (a Pearson correlation of 0.646), which is why the coherence score counts upcoming tokens twice. A diagnosis of the expert matrices showed why the plain mean fails: on the 0.5B model one cluster, of punctuation and sink positions, had a mean Jacobian norm of 114 against 28 to 49 for the others. Penalising by norm and Huber-weighting positions both came from that observation. On the 1.5B model, the filtered Jacobian alone reached 0.669 against 0.510 for the pooled one.
- Matching scales by action, not by Frobenius norm. On a 3B model the action-matched blend reached 0.658 against 0.605 for the norm-matched one.
- The first assembled version (LRP, Huber weights, filtered experts, action-matched regression blend) reached 0.650 on the 0.5B model against 0.467 for the Jacobian lens, with a perturbation cosine of 0.383 against 0.44, and 0.708 against 0.510 on the 1.5B model. On a fresh set of prompts built afterwards with new entities, a later version gave 0.716 against 0.522 for the Jacobian lens, which we took as evidence that the gain was not an artefact of tuning on our own prompts.
- Things that improved a proxy and worsened the readout. A low-rank refinement trained toward future tokens (0.705 against 0.708) and a nonlinear MLP regressor, whose held-out squared error was less than half the linear one's while its pass@10 fell at two of the three layers probed and rose only slightly at the third, both reproduced the tuned lens's trap of fitting the prediction and losing the latent content. Choosing the blend weight by the coherence proxy anti-correlated with the readout (0.669 against 0.743 for the fixed weight). The transport therefore stays linear and its blend weights fixed.
- Rejected structural variants. A penultimate-layer target (0.436 against 0.467), freezing the attention-score path in the backward pass (0.502 against 0.510), 16 experts instead of 8 (no change), a chained product of per-block Jacobians (0.376 against 0.467), saturating or clipping nonlinearities on the output (readout unchanged, perturbation cosine no better, and lower with saturation), whitening of the source or the output and a spectral shrinkage of the transported output (all lowered the AUC), shrinking or truncating the map's singular values, in the spirit of singular-value shrinkage [8] (a minor effect), and learning the expert weights by gradient descent (neutral end to end).
- Later additions came from the fidelity side. Adding the same-position regression as a third term gave up 0.009 AUC on the 0.5B model for 0.026 more perturbation cosine. With the other components held fixed, the depth schedule beat a uniform split on both measures on both models (on the 1.5B model, 0.728 against 0.725 AUC and 0.257 against 0.246 perturbation cosine across probed layers); refitted end to end on the 0.5B model it was roughly neutral (0.009 lower AUC, 0.008 higher cosine), and the late taper was a small further gain in fidelity at the top layers. A larger mean-matching bias (0.25) had helped the plain Jacobian early on but hurt inside the blend, so the final coefficient is 0.05.
- The junk direction. On the 1.5B model, tokens with no letter or digit were about 6.8% of the vocabulary but filled roughly 40% of readout top-10 slots; removing them by hand raised the development AUC from 0.688 to 0.720. A fixed-size bias was fragile across models, so it is scaled to each layer's transported RMS; the scaled version gained 0.018 on the 0.5B model and 0.032 on the 1.5B model at no perturbation cost.
Our own ablations also say something less flattering. On the 0.5B model, removing LRP raised the AUC (0.676 against 0.655), and removing the cluster experts, the coherence proxy or the Huber weights left it essentially unchanged (0.656, 0.660 and 0.654); on the 1.5B model LRP added only 0.009 and the pooled variant matched the full system. We kept LRP because the work it comes from reports larger effects at larger scale and the Huber weights because they were cheap, not because our measurements showed either earning its place; the cluster experts we kept because a separate test on the 1.5B model, shrinking the filtered Jacobian toward the pooled one inside the blend, favoured no shrinkage (0.729 against 0.686 fully pooled).
Limitations
- No Qwen3.5-4B result. The published table has no value for FJR on Qwen3.5-4B, so the method is evaluated on two settings only.
- The gain is probe-specific. FJR leads clearly on readout probes 2 and 4 and trails the Jacobian lens on probes 1 and 3 on both settings, on probe 3 of OLMo3-7B by a wide margin. The robust Jacobian and the regression evidently help some kinds of latent content and cost others; we did not identify which, because our development prompts did not separate them in the same way.
- Fidelity is traded, not gained. The regression terms predict rather than differentiate. The lead on Gemma3-4B fidelity is real, but on OLMo3-7B FJR is below every non-zero baseline, and on our development models its perturbation cosine was below the plain Jacobian's wherever we compared them.
- Much of the machinery is unproven by our own data. In our end-to-end ablations (on the 0.5B and 1.5B models), LRP, the expert recombination and the Huber weights were individually redundant given the regression blend, and LRP was slightly harmful on the 0.5B model. LRP is kept on an expectation about scale that we did not verify.
- Hand-set constants. The blend weights, the depth thresholds, the taper, the fourth power, the bias coefficients and the junk targets were chosen on a few hundred prompts we wrote ourselves, on small models, by trading readout against a perturbation measure of our own. The Stein-lemma reading of the regression assumes Gaussian activations, which residual streams are not; the justification is heuristic and the regression is best read as a well-conditioned predictor.
- The junk rule depends on the tokenizer. Which tokens count as junk is decided by whether their decoded text contains a letter or digit, which can misclassify tokens in scripts or formats the heuristic does not anticipate; the direction is dropped when the junk fraction falls outside 0.5% to 50% of the vocabulary.
References
- Nora Belrose, Igor Ostrovsky, Lev McKinney et al. (2023). Eliciting Latent Predictions from Transformers with the Tuned Lens.
- Wes Gurnee, Nicholas Sofroniew, Adam Pearce et al. (2026). Verbalizable Representations Form a Global Workspace in Language Models.
- Evan Hernandez, Arnab Sen Sharma, Tal Haklay et al. (2024). Linearity of Relation Decoding in Transformer Language Models. ICLR.
- Shi-Qi Yan, Kai-Xuan Ding, Chao-Hong Tan et al. (2026). Short Horizons and Sparse Concepts: a Mathematical View of the Readout in the J-lens.
- Olli Tuomi (2026). Contrastive Projection: Reading Transformer Internals by Differencing Logit Lenses.
- Mingjie Sun, Xinlei Chen, J. Zico Kolter et al. (2024). Massive Activations in Large Language Models. COLM.
- Prathamesh Dharangutte, Christopher Musco (2022). A Tight Analysis of Hutchinson's Diagonal Estimator.
- Matan Gavish, David L. Donoho (2014). Optimal Shrinkage of Singular Values.