Introduction
A lens asks what an internal activation of a decoder transformer is disposed to make the model say. It transports a residual at layer into the final-layer residual basis and decodes the result with the model's own unembedding (final normalisation and LM head),
and the research question is the transport . It must surface latent content that the model has computed but not yet said, it must predict how a change to the activation propagates to the final layer, and it must work from a residual and its layer index alone, after fitting on generic web text.
The starting point, the logit lens, is the identity: . It is informative late in the network and much less so early on, because a mid-layer residual is not yet expressed in the basis that the unembedding reads. The tuned lens learns one affine translator per layer, trained so that its decoded distribution matches the model's final output [1]. The Jacobian lens transports by the input-output Jacobian of the final residual with respect to the layer- residual, averaged over a corpus and summed over the present and later target positions [2]: it reads out what the activation causes the model to write.
Two things make the problem hard. The first is a tension between the two metrics. A map fitted to predict the final residual from the layer- residual, a regression, reads out much of what the activation indicates, including content that only correlates with it. But in directions where natural activations hardly vary, the inverse covariance makes its gain enormous, and a perturbation in such a direction is predicted to have a huge effect that the network does not produce. The Jacobian has the right gain for small perturbations and reads out less. The second is that a single linear map per layer has to serve every kind of latent content at once: whatever it emphasises, it masks something else.
Method
Our transport has four parts: a causal map and a correlational map, added in final-residual units; a trust region that restricts both to the natural range of activations; a per-layer output scale calibrated on real interventions; and a schedule that assigns layers to complementary views of these maps, two of which add an output prior.
The causal map
is the corpus-averaged Jacobian of the final residual with respect to the layer- residual. For each fit sequence we place a one-hot cotangent on one output coordinate at every valid target position, backpropagate, and read the gradient at each source position ; that gradient row is , the present plus every later target. Rows are then averaged over source positions and over up to 16 prompts of 128 tokens, skipping the first 16 positions.
The average over source positions is not uniform. A source position whose token carries no letter or digit gets weight zero: what such positions pass on is mostly layout, and their Jacobians blur the content directions. And the average is winsorised: a position whose Jacobian norm (estimated from one probe pass over evenly spread output coordinates) exceeds times the prompt's median is weighted down to that level,
weights = []
for g in grads:
nrm = g[:, pos].float().pow(2).sum((0, 2)).sqrt()
cap = self.POS_CLIP * nrm.median()
w = torch.where(nrm > cap, cap / nrm.clamp_min(1e-30), torch.ones_like(nrm))
w = torch.nan_to_num(w, nan=0.0, posinf=0.0) * keep
weights.append(w / w.sum().clamp_min(1e-30))
del grads
starts = list(range(0, d, B))
for k, d0 in enumerate(starts):
n = min(B, d - d0)
cot.zero_()
cot[b[:n, None], pos[None, :], d0 + b[:n, None]] = 1.0
grads = torch.autograd.grad(outputs=tgt, inputs=srcs, grad_outputs=cot,
retain_graph=(k < len(starts) - 1))
for l, g in enumerate(grads):
Jp[l, d0:d0 + n] = (g[:n, pos].float() * weights[l][None, :, None]).sum(dim=1)The correlational map
is a centred ridge regression of the final residual on the layer- residual. With the mean residual, its covariance and the cross-covariance with the final residual at the same position, the same-position map is . A second map regresses the sum of the final residuals at all later positions on the same input, and the two are added with the later part rescaled to the same natural response energy,
so that the share of the future does not depend on how many positions follow. The ridge is , relative to the mean eigenvalue and larger when samples are scarce. Centring matters: the regression reads the deviation from the average activation, so the always-present component never enters its readout.
def _regression(self, mom, l):
"""Centred ridge regression map (present + balanced share of later positions),
mean and covariance for source layer l, float64."""
d = self.d_model
n = mom["n"]
mu = mom["m1"][l] / n
muL = mom["m1"][self.n_layers - 1] / n
S = mom["m2"][l] / n - torch.outer(mu, mu)
C0 = mom["x0"][l] / n - torch.outer(mom["y0"] / n, mu)
Cf = mom["xf"][l] / n - torch.outer(muL, mom["mc"][l] / n) \
- torch.outer(mom["yf"] / n - mom["cmean"] * muL, mu)
ridge = self.RIDGE * max(1.0, 300.0 * d / max(n, 1)) # more shrinkage when samples are scarce
lam = ridge * S.diagonal().mean().clamp_min(1e-12)
K = S + lam * torch.eye(d, device=S.device, dtype=S.dtype)
X = torch.linalg.solve(K, torch.cat([C0.T, Cf.T], dim=1))
A0, Af = X[:, :d].T, X[:, d:].T
e0 = (A0 @ S * A0).sum().clamp_min(0).sqrt() # natural response energy
ef = (Af @ S * Af).sum().clamp_min(0).sqrt()
ratio = float(e0 / ef.clamp_min(1e-12)) if float(ef) > 0 else 0.0
return (A0 + self.FUT * ratio * Af), mu, SThe trust region
Both maps are fitted on natural activations and know nothing about inputs far from them; there the only structural prior is the residual connection. We therefore split the deviation into its coordinates on the top principal directions of , with natural standard deviations , and a remainder . The part we call in range is
where is the natural energy of the remainder (the trace of minus its top-64 eigenvalues). Coordinates are clipped at six natural standard deviations, and the remainder is shrunk once its energy exceeds four times the natural level. The fitted map acts only on ; the rest, , passes through unchanged.
def _inside(self, x, U, sd, tau):
"""Part of the deviation x that lies within the natural range of activations."""
z = (x @ U) / sd # leading coordinates, natural units
top = (z * sd) @ U.T
rest = x - top
e = rest.pow(2).sum(-1, keepdim=True) / tau
g = (self.KAPPA / e.clamp_min(1e-30)).clamp(max=1.0)
return (z.clamp(-self.CLIP, self.CLIP) * sd) @ U.T + g * restViews, the mean direction and the constant offsets
For a non-skip view the map is with (causal emphasis) or (correlational emphasis). The mean direction is then forced to the identity, : normalisation layers make the network largely insensitive to it, and the regression has never seen it vary. There are five views:
| view | map on | constant |
|---|---|---|
| 0 | (the Jacobian part uncentred) | |
| 1 | none | |
| 2 (skip) | (the raw residual) | |
| 3 | frequency prior and content direction | |
| 4 | frequency prior |
A centred view transports a deviation, and a deviation read alone ranks tokens by how much more likely than usual they are, which over-ranks rare tokens. Views 3 and 4 restore the form of a real final residual, a mean plus a deviation, with a tempered prior
where is the mean final residual and the root-mean-square size of its deviation, so that prior and evidence stand in half their natural proportion. View 3 adds a second constant, , along the unit direction that separates, at the final layer, the mean residual at positions followed by a token carrying a letter or digit from the mean at positions followed by punctuation or formatting; it is computed only if both classes have at least 64 positions. A readout is asked for concepts, and this shift ranks word tokens ahead of formatting tokens. Both offsets are constants per layer: they change which tokens are ranked first and cancel in every predicted change.
Layers are assigned to views by a golden-ratio sequence: layer takes slot of the schedule , with and the fractional part, so that the views are spread evenly along depth. The skip view is used only from the depth at which the raw residual is readable in the output basis, which we measure on the corpus: the first layer such that, there and at every later layer, the model's own top next-token prediction is among the top 10 tokens of the raw residual's readout at a share of at least of positions. A lower layer that falls on a skip slot takes view 1.
Jl = J[l] if nj > 0 else eye
view = self._view(l)
u = mu.float()
if view == 2: # skip view: the residual itself
M = eye.clone()
offs.append(u)
else:
causal = view in (0, 3)
M = (Jl + (self.MIX_LO if causal else self.MIX_HI) * A).float()
off = Jl @ u if view == 0 else torch.zeros(d, device=dev) # uncentred Jacobian in view 0
u = u / u.norm().clamp_min(1e-12)
M = M - torch.outer((M - eye) @ u, u) # mean direction: identity
if view >= 3 and S is not None and sigL > 0: # output prior, in proportion to the evidence
Md = M.double()
e = float(((Md @ S) * Md).sum().clamp_min(0).sqrt())
off = (self.PRIOR * e / sigL) * muL.float()
if view == 3 and cdir is not None:
off = off + (self.CONTENT * e) * cdir
del Md
offs.append(off)
del S
maps.append(M)
mus.append(mu.float())
pcs.append(pc)Calibration and the transport
The linear maps under-state or over-state finite responses, so each layer gets one output scale , fitted by least squares on real interventions at one random position: isotropic noise at and of the residual's norm, and replacement by another sequence's residual, half and full. The perturbed residual is pushed through the model, the part of the input change that the trust region passes through is subtracted from the true final-layer change , and
with the map's predicted change and the passed-through part. The weights put every intervention on the same footing regardless of its size.
true = y - yL
x0, x1 = h - mus[l], hp.float() - mus[l]
if pcs[l] is not None:
in0, in1 = self._inside(x0, *pcs[l]), self._inside(x1, *pcs[l])
else:
in0, in1 = x0, x1
passed = (x1 - in1) - (x0 - in0) # part handled by the skip connection
pred = (in1 - in0) @ maps[l].T # part handled by the fitted map
resid = true - passed
w = 1.0 / true.pow(2).sum(-1).clamp_min(1e-12)
ok = torch.isfinite(true).all(-1) & torch.isfinite(pred).all(-1) & (true.pow(2).sum(-1) > 0)
num[l] += (w * (pred * resid).sum(-1))[ok].sum().double()
den[l] += (w * pred.pow(2).sum(-1))[ok].sum().double()
beta = (num / den.clamp_min(1e-30)).float()
beta = torch.where(torch.isfinite(beta) & (den > 0), beta, torch.ones_like(beta))
return beta.clamp(0.02, 2.0)The transport that ships is then
def transport(self, H: torch.Tensor, layer: int) -> torch.Tensor:
if layer not in self.maps:
return H
c = self._cache
if c is None or c[0] != layer or c[1].device != H.device:
dev = H.device
W = self.maps[layer].to(dev, torch.float32) * self.scale[layer]
U = self.basis[layer].to(dev, torch.float32) if layer in self.basis else None
sd = self.sdev[layer].to(dev, torch.float32) if layer in self.basis else None
c = (layer, W, self.mean[layer].to(dev, torch.float32), self.offset[layer].to(dev, torch.float32), U, sd)
self._cache = c
_, W, mu, off, U, sd = c
x = H.to(torch.float32) - mu
inside = x if U is None else self._inside(x, U, sd, self.tau[layer])
return (x - inside) + inside @ W.T + offEverything the transport needs is stored at fit time: one float16 map per layer with a scale, the mean, the offset, and the trust region's basis and natural scales. The fit degrades gracefully: short texts are packed or shortened, the Jacobian-only lens is used if the regression's corpus moments cannot be computed, and with almost no corpus the lens falls back to the identity.
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 ↑ | |
| Claude Fable 5.2 | 51.25 | 46.48 | 15.23 | 17.23 | 52.63 | 52.95 | 8.113 | 77.88 | 11.46 | 44.70 | 50.99 | 17.53 | 75.44 | 22.29 |
| 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
Perturbation fidelity. Our lens has the highest fidelity of every lens in the table on all three settings: 17.23 on Qwen3.5-4B against 15.33 for the strongest baseline, Jacobian lens [2]; 11.46 on Gemma3-4B against 7.849 (Logit lens); and 22.29 on OLMo3-7B against 20.86 (Tuned lens [1]). The margin is widest on Gemma3-4B and narrowest on OLMo3-7B.
Readout, probe sets 2 and 4. These are our clearest readout gains. On probe set 2 we reach 46.48, 52.95 and 50.99 against best baselines of 39.27, 45.83 and 43.04. Probe set 4 is measured on Gemma3-4B and OLMo3-7B only: there we reach 77.88 and 75.44, against 61.35 and 54.95 for the best baseline, Jacobian lens [2].
Readout, probe set 1. Mixed. On Qwen3.5-4B we lead, 51.25 against 49.04 (Jacobian lens [2]). On Gemma3-4B we are level with the logit lens, the starter: 52.63 against 52.65, a hair below it. On OLMo3-7B we reach 44.70, ahead of the logit lens's 43.12 but behind the Jacobian lens's 47.44.
Readout, probe set 3. This is where our lens is weakest. The Jacobian lens beats it on every setting: 18.12, 12.28 and 20.67 against our 15.23, 8.113 and 17.53. On OLMo3-7B the logit lens, at 22.37, is ahead of us as well. We still lead both tuned-lens variants on probe set 3 on every setting.
In sum, the lens wins on fidelity and on two of the four probe sets, but its gain is not uniform across kinds of latent content. Probe set 3 in particular is better served by the plain Jacobian transport than by our blend.
How we got here
Our development used our own stand-ins for the evaluation: prompt sets we wrote ourselves, with known intermediate tokens, and perturbation tests on natural text. All figures in this section are those development measurements. The models were downloaded open-weights decoders; we do not connect any figure here to a Setting.
- The future part of the Jacobian carries the readout; the present part carries the perturbation response. Early on, on one development model, a same-position Jacobian read out worse than the logit lens (.353 against .399) while being the better predictor of a same-position perturbation; the summed Jacobian read out at .437. This is why sums over later targets.
- A regression reads out more but extrapolates badly. A centred regression onto the final residual was strongest for replacing one activation with another, but it over-predicted the response to isotropic noise, because the inverse covariance blows up low-variance directions. Our note at the time was "Jacobian prior off-manifold, regression on-manifold". That note became the sum , and later the trust region. The trust region and the forcing of the mean direction to the identity were added together in our second installed version. A per-row radial identity that we tried at the same time broke readout on two models; the mean-direction identity did not.
- The output scale came from stacking. The literature we surveyed had noted that a mean Jacobian under-states finite changes [3]. When we fitted the predicted change as a least-squares combination of the Jacobian and regression predictions on interventions, the optimal output scale differed widely between kinds of perturbation. A single calibrated scalar per layer cost nothing for readout, which led to .
- One blend per layer masks things; interleaving views helps. Replacing a uniform blend by two alternating views (causal and correlational emphasis) raised our mean development readout from between .454 and .500 to between .483 and .520 across the three development models, at a fidelity cost of about .01. A later probe explained why. Rotating different subsets of prompts across layers in the Jacobian beat a pooled Jacobian, while a fixed subset was worse, so the gain comes from diversity across depth rather than from any expert being better. Inside the two-view blend, a Jacobian that rotated across layers then added nothing: the views already supply the diversity.
- The skip view had to be the raw residual, and only where it is readable. Adding the identity as a third view helped readout on two development models and was neutral on the third. A same-position Jacobian in its place did not reproduce the gain. Restricting the skip view to the depth where the raw residual already decodes the model's own top prediction, rather than a fixed upper half, recovered some fidelity on one model and left the others unchanged.
- Uncentred priors fail; tempered ones work. Adding the raw mean final residual as a bias to a centred Jacobian lens collapsed our development readout (.350 against .444): every readout was pulled toward frequent tokens. Scaling the prior to the natural size of the transported deviation, at half the natural proportion, and keeping it on only half of the fitted slots, raised readout in most of our development comparisons (on one model and one prompt set it fell slightly), at no fidelity cost.
- The content direction came from looking at what outranks the target. Punctuation and formatting tokens were among the tokens ranked above the intended intermediates. Our response was a shift along the word-versus-formatting direction. We first installed it at weight and then at ; on the held-out prompt set written afterwards, it was the change that held up best. In our final ablation, removing it cost .014 to .042 of mean readout across the three development models. Removing both priors cost .023 to .025, and removing every constant offset cost .036 to .049. Fidelity was untouched by construction. Adding the same offsets to a plain Jacobian lens raised its development readout from about .42 to .45 to about .50, so the offsets are not specific to our blend.
- A held-out check. On a third prompt set written after every design decision, the final lens read out between .504 and .579 across the three development models, against between .424 and .482 for the Jacobian lens.
We abandoned or rejected several ideas along the way:
- A Jacobian with frozen normalisation denominators [4] did not help.
- Restricting the Jacobian average to the highest-energy positions [5] gained a little readout and cost fidelity.
- Dropping the top principal directions of the input [6] from the regression part was tested and not adopted.
- Cluster-wise centring in the output space left net readout flat or lower.
- Restricting the regression to within-token variation read out worse than the pooled regression (.411 against .477 on one development model); a within-context variant was not adopted either.
- A backward "context" view, regressing on the final residuals of preceding positions, carried a real readout signal. An intervention cannot change earlier positions, though, so it is pure noise for fidelity, and on top of the final lens it added only .006 to .016.
- A content direction taken from the gradient of the unembedding gave mixed signs across models.
We made our trade-off explicitly: once readout was well above every reference and small-noise fidelity was at or slightly below the Jacobian lens's, we stopped buying readout with fidelity.
In the last hour, after following work on frequency and confidence-regulation neurons [7], we identified, but did not ship, a calibrated radial term for one development model. On that model a large share of the true final-layer change lies along the mean final residual, and the lens predicts it poorly. An offline replica suggested a sizeable fidelity gain for large perturbations, but it was never run end to end.
Limitations
- Probe set 3 is not improved. On probe set 3 the Jacobian lens beats us on every setting, and on OLMo3-7B the logit lens does too. We have not established why; one possibility is that our blend dilutes whatever the plain Jacobian transport reads out for that content. On Gemma3-4B we are level with the logit lens on probe set 1, and on OLMo3-7B we trail the Jacobian lens there too.
- The method is a composition. Two maps, a trust region, a calibration, five views and constant offsets: each part was justified by a development measurement, but the whole carries many constants (among them , , , , , , , , ). We chose them on prompt sets we wrote ourselves. Our grids over several of them were flat, which is reassuring, but they are tuned, not derived.
- One schedule for every model. Our own ablation found that the regression-heavy views were dispensable on one development model and worth up to .025 of readout on the others. None of the corpus statistics or depth rules we examined gave a rule that helped on all three, so the schedule is a compromise.
- The content direction depends on the tokenizer and on the fit corpus containing both classes of token. Without a tokenizer it is dropped. On a corpus with all punctuation removed, our stress test showed only a small loss from it, but it is computed there from an unrepresentative class.
- The fidelity regime we know is weakest. In development, small isotropic noise was the regime where our lens was at or below the Jacobian lens. The evaluated fidelity was nonetheless the highest in the table on every setting; we cannot explain that from our development tests.
- Fit cost. The exact Jacobian and the corpus moments take minutes of GPU time per model, far more than the logit lens, which needs none.
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.
- János Kramár, Tom Lieberum, Rohin Shah et al. (2024). AtP*: An efficient and scalable method for localizing LLM behaviour to components.
- 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.
- Jiaqi Mu, Suma Bhat, Pramod Viswanath (2017). All-but-the-Top: Simple and Effective Postprocessing for Word Representations.
- Alessandro Stolfo, Ben Wu, Wes Gurnee et al. (2024). Confidence Regulation Neurons in Language Models. NeurIPS.