Introduction
A decoder transformer writes into a residual stream, and only the last layer's residual is ever decoded: the final normalisation and the language-model head turn it into logits. A lens asks what an earlier residual is disposed to make the model say, by transporting it into the final-layer basis and decoding it with the model's own unembedding,
The simplest transport is the identity, the logit lens. The tuned lens learns an affine translator per layer, trained so that the readout matches the model's final distribution [1], and the Jacobian lens uses the model's own derivative from layer to the last layer to carry a residual forward [2]. That linear maps can decode a good deal of what a transformer computes is also known from relation decoding [3].
The task asks for a transport that serves two masters at once. Its readout should rank the words the activation is disposed to produce, which is measured as a pass@k AUC on held-out probe sets; and it should be faithful, predicting how a change to propagates to the final layer. Several properties of the problem make this hard. The final normalisation divides by the residual's scale, so the readout depends on the direction of the transported vector and, through the temperature of the logits, on its radius, and these two respond very differently to an intervention. Residual scale itself varies strongly with depth and position, and a few coordinates can dominate it [4]. The transport sees only an anonymous residual and its layer index, never the prompt or position, and it may not run the model's layers at readout time. And it must be fitted on generic web text alone, for any open-weights decoder, without knowing whether the model normalises with a centring LayerNorm or an uncentred RMS norm.
Method
Our method, ICT (intervention-calibrated transport), is a linear transport refined by a sequence of small corrections. Each correction is fitted to what the model actually does when one residual is changed, and each must earn its place on a held-out fold. All of the model's computation happens during fitting; at readout the transport is a fixed function of the residual and its layer.
Throughout, , is the normalised source, and is the final-layer residual at the same position. During fitting, we test whether the unembedding is invariant to adding a constant to every coordinate; if it is, the model's final norm centres its input, and the unit output directions of the later stages are taken after removing the mean coordinate. This one test lets the same code serve both kinds of normalisation.
A linear transport with the model's Jacobian as its prior
The first stage is, per source layer, an affine map from the normalised source to a normalised target. The target is not the final residual at the same position alone. With and the average over the current and the next three positions, we regress onto
so a source whose scale is already close to the final residual's is asked for the immediate output, and a small, early residual is asked for a smoothed forecast of what comes next.
The regression is regularised toward the model's own local derivative. On the same forward passes we draw a Rademacher vector at the final layer, project it onto the tangent space of the final normalisation, and back-propagate it to every source layer in the group: one vector-Jacobian product per batch gives a random probe of the Jacobian of the normalised target with respect to the normalised source, in the manner of Hutchinson-type estimators [5]. Removing the cotangent itself removes the identity carried by the residual highway, so what is estimated is the part of the Jacobian that the blocks add.
noise = torch.empty_like(y).bernoulli_(0.5, generator=gen).mul_(2).sub_(1)
# VJP of the normalized target, before its learned affine norm.
cot = (noise - (noise * uy).mean(-1, keepdim=True) * uy) / ry
inputs = [rec.activations[l] for l in layers]
grads = torch.autograd.grad(y_tensor, inputs, grad_outputs=cot.to(y_tensor))
span = min(4, length)
start = min(2, max(0, length - span))
stop = max(start + 1, length - span + 1)
idx = slice(start, stop)
u = uy[:, idx].flatten(0, 1)
future = sum(uy[:, start + k:stop + k] for k in range(span)) / span
future = future.flatten(0, 1)
p = noise[:, idx].flatten(0, 1)
probe_gram.addmm_(p.T, p)
count += len(p)
if space is not None:
keep=(torch.arange(len(ids),device=dev)+bi*batch)%5<3
target_codes=self._window_codes(ids,start,stop,y,space)[keep].flatten(0,1)
word_count+=len(target_codes)
word_totals+=target_codes.sum(0)
for j, (x_tensor, grad) in enumerate(zip(inputs, grads)):
x = x_tensor.detach()[:, idx].float()
rx = self._radius(x)
z = (x / rx).flatten(0, 1)
ratio = (rx / ry[:, idx]).flatten().clamp(max=1)
target = future + ratio[:, None] * (u - future)
a = ((grad.detach()[:, idx].float() - cot[:, idx]) * rx).flatten(0, 1)
an = self._radius(a)
a = a * (4 * an.median() / an.clamp_min(1e-12)).clamp(max=1)With and from those probes, the prior and the ridge solution are
where and are the centred covariance of and its cross-covariance with , is the mean diagonal of , and is the mean of at layer . With no data the map falls back to the Jacobian plus a scaled identity; with data it moves toward what the corpus shows. The intercept mixes the source and target means with a weight that again follows : , with .
for j, layer in enumerate(layers):
mx, my = sums[j] / count
sx, sy, skip = scales[j] / count
c = cov[j].div_(count).addr_(mx, mx, alpha=-1)
r = cross[j].div_(count).addr_(mx, my, alpha=-1)
prior = torch.cholesky_solve((response[j] / count).T, factor).T
prior.diagonal().add_(skip)
penalty = c.diagonal().mean().clamp_min(1e-6)
if space is not None:
guide_mean=word_totals/max(1,word_count)
rhs=words_cross[j]/max(1,word_count)-mx[:,None]*guide_mean[None]
coef=torch.cholesky_solve(rhs,self._factor(c,0.18))
guides.append((mx.cpu(),guide_mean.cpu(),coef.half().cpu()))
c.diagonal().add_(penalty)
w = torch.linalg.solve(c, r + penalty * prior)
# A predictable immediate output carries its ordinary language bias.
# Center the forecast of longer-range effects at the residual highway.
immediate = 0.25 + 0.75 * skip
bias = (1 - immediate) * skip * mx + immediate * my
w, bias = self._reconcile(planes, j, c, w, mx, bias, penalty)Reconciling the map with measured word decisions
A least-squares fit to the target spends its capacity on whatever dominates the residual's variance, which is not necessarily what decides the next word. We therefore measure the directions that do decide it. We pair two web-text windows, in part two that share their second-to-last token but continue differently and otherwise two chosen at random, interpolate the first layer's residual of one into the other's in direction and in log-radius, and locate by three regula-falsi steps the point at which the model is indifferent between a word favoured by one context and a word favoured by the other. At that switching point we back-propagate the logit margin to every source layer.
def probe(t, with_graph):
interp = t[:, None, None]
z = u0 + interp * (u1 - u0)
h = (z / self._radius(z) * r0 * (interp * loga).exp()).to(x0)
def set_root(mod, args, output):
return (h, *output[1:]) if isinstance(output, tuple) else h
handle = model.layers[root].register_forward_hook(set_root)
try:
with ActivationRecorder(model.layers, at=take if with_graph else [last],
start_graph_at=root if with_graph else None) as trace:
model.forward(docs[:n])
finally:
handle.remove()
score = model.unembed(trace.activations[last][:, -1]).float()
return score[ar, w] - score[ar, v], trace.activations
with torch.no_grad():
for _ in range(3):
t = lb + (ub - lb) * (-fl / (fh - fl).clamp_min(1e-7)).clamp(0.16, 0.84)
val, _ = probe(t, False)
above = val > 0
ub, fh = torch.where(above, t, ub), torch.where(above, val, fh)
lb, fl = torch.where(above, lb, t), torch.where(above, fl, val)
t = lb + (ub - lb) * (-fl / (fh - fl).clamp_min(1e-7)).clamp(0.05, 0.95)
with torch.enable_grad():
margin, trace = probe(t, True)
sources = [trace[l] for l in [*layers, last]]
grads = torch.autograd.grad(margin.sum(), sources)The gradient at the final layer, with the normalisation's tangent projection undone, is the word pair's covector in the final basis; the gradients at the source layers, weighted by how much each position contributed to the switch, give the source-side field that moves along . Accumulated over many pairs, the covectors define a metric on the final basis whose eigenvectors are the directions in which word decisions are actually taken. The ridge map is then re-solved in that eigenbasis so that, along each decision direction, it reproduces the measured source-to-decision field at the scale the existing map already has, and the intercept is moved toward the observed switching points. The correction is damped along source directions where the covariance carries much energy.
The radius is a separate prediction
The affine map fixes a direction; the readout's temperature depends on the radius. We model the transported vector as
where is the unit direction from the affine map, and are small sets of scalar features of the source radius relative to its typical value (a bounded coordinate and its powers, a radius difference), adds to such features the log-radius of the affine output and the centred source direction, is the typical final radius, and , and are fitted. The second term lets part of the source pass straight through, as the residual highway does, and the third gives a radius-dependent vector offset. All three are fitted to finite interventions: at the last position of short and long web-text prefixes we replace the source residual by a dilated copy, a noisy copy, a mixture with another position's residual, a copy with part of its largest principal component removed, a rotated copy, or a uniformly shifted copy, run the model on, and record the change at the final layer. Because the fit uses differences of the prediction at the two endpoints, it is exact for finite moves rather than linearised. A multiplicative scale on top of this, a polynomial in the source and prediction radii and their alignment, is fitted the same way and clamped to ; how far to move from a constant scale to the full polynomial is chosen by cross-fitting on two folds. A second, richer gain on the radius, the envelope, adds a few learned axes, some unsupervised and some where the radius error is largest, and is clamped to .
def _base_prediction(self, H, layer):
if not 0 <= layer < len(self.maps):
return H
x = H.float()
w, b, sx, sy = [t.to(x.device, torch.float32) for t in self.maps[layer]]
direction = (x / self._radius(x)) @ w + b
mx, gain, highway, radial = [t.to(x.device) for t in self.gains[layer]]
q, a, p, u, z = self._frame(x, direction, (mx,), sx, sy)
prediction = sy * (u * (q @ gain).clamp_min(0.003) + z * (a @ highway) + p @ radial)
features = self._coordinates(x, prediction, sx, sy)
scale = (1 + features @ self.adjustments[layer].to(x.device)).clamp(0.055, 4.0)
return prediction * scale
def _calibrated(self, H: torch.Tensor, layer: int) -> torch.Tensor:
p = self._base_prediction(H, layer)
if not 0 <= layer < len(self.envelopes):
return p
x = H.float()
sx, sy = [v.to(x.device) for v in self.maps[layer][2:]]
centered, mx, P, b, coef, shift = self.envelopes[layer]
y = p / sy
design = self._envelope_design(x, y, sx, centered, mx.to(x.device),
P.to(x.device, torch.float32), b.to(x.device))
u, r, mu = self._unit_output(y, centered)
g = (1 + design @ coef.to(x.device)).clamp(0.07, 4.2)
if centered:
mu = mu + torch.cat((design, x.mean(1, keepdim=True)/sy, mu), 1) @ shift.to(x.device)
return sy * (u * (r*g) + mu)Corrections toward a learned recipient context
A residual in a real context is not decoded in isolation, and a readout that treats it as if it were the last layer's state is biased toward the generic continuation. We learn a short recipient context instead: two short web-text prefixes whose first-layer state is offset by a learned vector, and in whose later positions the inserted residual is blended in through learned, depth-smooth gates. Its parameters are trained with Adam so that a residual installed in it makes the model predict the words that actually surround it in the corpus, against the other words of the batch and corrected for frequency, and so that the change in the recipient's final output matches the measured of an intervention. The recipient is a teacher only: it is run during fitting, never at readout.
On top of the calibrated prediction we then add two corrections in a low-dimensional output subspace fitted to the teacher's residual error. The first is a kernel regression on a low-dimensional key of the source, with radial features around centres found by -means in a few charts, fitted jointly to the teacher's direction, the intervention responses, and the teacher's derivative along sampled directions. The second is a local memory: a product-quantised table of corpus keys and their teacher corrections, read at a query by a weighted neighbourhood of up to 72 entries with a local linear tilt, and gated by statistics of how dense and how consistent that neighbourhood is. Both corrections are scaled by the radius of the prediction they modify, and each is shrunk toward zero by a step chosen on held-out documents.
A word-rank field and the final normalisation
Two further corrections target the readout directly. A rank field is fitted in a shared word space , built from the gradients of single-word logit margins at natural final residuals. It moves the prediction so that the ranks of nearby corpus words improve while the measured intervention responses are still reproduced. An orbit correction then models the two degrees of freedom that the final normalisation leaves, a log-scale and, for a centring norm, a common offset:
where are standardised features of the source and prediction (radius ratios, alignment, the coordinate concentration that marks attention-sink-like states, the kernel and memory keys, and a linear estimate of how far into its context the residual sits), and and are fitted by a few Gauss-Newton steps on all pairs of endpoints of measured interventions. The fit is accepted only if a merit that combines its cross-fold gains in the error and in the alignment of the predicted response exceeds a small threshold.
def _orbit_apply(self, x, p, layer, state):
if state is None:
return p
fm,fs,log_scale,bias=(t.to(x.device,torch.float32) for t in state)
sy = self.maps[layer][3].to(x.device)
f,u,r,m=self._orbit_features(x.float(),p,layer)
f=((f-fm)/fs).clamp(-7,7)
mean=m*sy
return (p-mean)*(f@log_scale[:,None]).clamp(-1.65,1.65).exp()+mean+sy*(f@bias[:,None])
def _transport_layer(self, H: torch.Tensor, layer: int) -> torch.Tensor:
p=self._before_orbit(H,layer)
if 0<=layer<len(self.orbits):
return self._orbit_apply(H,p,layer,self.orbits[layer])
return pThe transport at readout
At readout a layer's stored state is unpacked and the stages are applied in order. Two wrappers sit around them, both fitted only if a check on the model passes. A section shift removes a predictable common offset of all coordinates before the transport and adds it back afterwards, which is used only where a uniform shift is measured to pass through the remaining blocks with roughly unit gain. A support limit evaluates the learned part of the transport at a radius inside the range seen in the corpus and passes the excess radius through unchanged, which is used only if pushing an activation to a large radius is measured to propagate along the residual highway. Finally a constant translation, chosen among a few candidates and strengths by held-out word ranks and held-out intervention responses, is added.
def transport(self, H: torch.Tensor, layer: int) -> torch.Tensor:
if getattr(self,'compact_maps',None) is not None:
if not 0<=layer<self.n_layers-1:
return H
w,b,sy=(v[layer].to(H.device,torch.float32) for v in self.compact_maps)
x=H.float()
return (x/self._radius(x)@w+b)*sy
if not self.packed_layers:
return self._transport_layer(H,layer)
if not 0<=layer<len(self.packed_layers):
return H
state=self._unpack_layer(self.packed_layers[layer],H.device)
lens=ReadoutLens(2,self.d_model)
(lens.maps,lens.gains,lens.adjustments,lens.envelopes,lens.jets,lens.memories,
lens.rank_fields,lens.age_maps,lens.orbits)=state[:9]
if len(state)>9:
lens.translations=state[9]
if self.rank_axes is not None:
lens.rank_axes=self.rank_axes.to(H.device,torch.float32)
src=H
if len(state)>10 and state[10] and state[10][0] is not None:
move=self._section_shift(H,state[10][0])
src=H.float()-move
if len(state)>11 and state[11] and state[11][0] is not None:
limited=self._supported_row(src,state[11][0])
u=lens._transport_layer(limited,0)+(src-limited)
else:
u=lens._transport_layer(src,0)
if src is not H:
u=u+move
if lens.translations and lens.translations[0] is not None:
u=u+lens.translations[0].to(u)
return uThe later stages return nothing, or are shrunk to zero, when their data are too few or their held-out test fails, so on a small or unusual model ICT degrades toward the affine map. The memory is quantised, and it is the first part cut when the stored lens is too large: it is truncated or dropped layer by layer, and as a last resort the lens keeps only the per-layer affine maps.
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 ↑ | |
| GPT-6.2 Astra | 53.72 | 44.77 | 7.397 | 92.95 | 8.203 | 39.77 | 44.73 | 11.33 | 78.07 | 22.56 | ||||
| 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
On Gemma3-4B and OLMo3-7B ICT is ahead of every published baseline on two measures. On the fourth probe set it reaches a readout AUC of 92.95 on Gemma3-4B against 61.35 for Jacobian lens [2], and 78.07 on OLMo3-7B against 54.95 for Jacobian lens [2]; these are the largest margins in the table. Its perturbation fidelity is also the highest on both settings, though by small margins: 8.203 against 7.849 (Logit lens) on Gemma3-4B, and 22.56 against 20.86 (Tuned lens [1]) on OLMo3-7B.
On the first two probe sets the picture is mixed. On Gemma3-4B ICT leads on the first probe set, 53.72 against 52.65 (Logit lens), but is just below the logit lens on the second, 44.77 against 45.83. On OLMo3-7B the order reverses: ICT leads on the second probe set, 44.73 against 43.04 (Jacobian lens [2]), and is behind both the logit lens and the Jacobian lens on the first, 39.77 against 43.12 and 47.44.
The third probe set is ICT's weakest. On Gemma3-4B it reaches 7.397, above the logit lens's 6.822 but well below the Jacobian lens's 12.28. On OLMo3-7B it reaches 11.33, about half of the logit lens's 22.37 and close to the tuned lens's 11.27. The identity transport, which our stages refine rather than start from, is the stronger readout on this probe set there.
The run has no measurement on Qwen3.5-4B, so we cannot say how ICT compares on it.
How we got here
- The starting point was the logit lens. The starter transport is the identity. ICT replaces it entirely, but its readout falls back toward a linear map when later stages are rejected, and the last-resort storage fallback keeps only the per-layer affine maps.
- Every correction is gated on held-out evidence. Nearly every stage ends by comparing a few candidate strengths, usually a fraction between zero and the full fit, on a fold of documents or of interventions that the fit did not see, and returns nothing if none improves on doing nothing. The code's comment on the final translation describes this as letting the "held-out endpoint risks" choose "the amount". The design accepts many weak corrections and relies on these tests to keep the harmful ones out.
- Structural assumptions are tested on the model rather than assumed. The code checks whether the unembedding ignores a uniform shift before treating the final norm as centring; it checks that a uniform shift propagates with unit gain before fitting the section shift; and its comment on the support limit says it must "verify that the high-radius residual highway actually exists in this model", since "some post-normalized blocks have a bounded output". These checks are what lets one code path serve different model families.
- Quantisation comes before fitting. Several projections are rounded to half precision before the coefficients that use them are fitted, which the comments explain as making "the two processes use exactly the same feature directions": the stored lens and the lens used during fitting then compute the same thing.
- Finite moves instead of linearisation. The comments repeatedly prefer exact finite differences of the prediction at both ends of an intervention over a derivative at one end ("a difference of a product is the sum of the change of either factor times the midpoint of the other. This is exact even for finite moves"), which is why the radius, envelope, kernel and orbit stages are all fitted on pairs of endpoints.
Limitations
- No result on Qwen3.5-4B. The run has no evaluation mean on Qwen3.5-4B, and nothing in our inputs says why. Whatever ICT achieves, it is shown on two settings only.
- The third probe set is the weakest. On OLMo3-7B ICT reaches about half of the logit lens's readout AUC on the third probe set, and on Gemma3-4B it stays well below the Jacobian lens there. The stages are fitted to forecasts and intervention responses on web text, and on OLMo3-7B they move the readout on this probe set away from what the identity already gets right. The held-out gates test on web text, not on the probe sets.
- Fidelity gains are small. ICT is the most faithful lens on both settings, but by margins small next to its readout gains on the fourth probe set; most of the gain is in readout, not in fidelity.
- The method is large and tuned by hand. The submitted file grows from 78 lines to over 3,000, with a dozen fitted stages and many hand-set constants (mixing weights, clamps, ridge strengths, numbers of neighbours). The constants are chosen, not derived, and a reviewer should not assume they transfer unchanged to models far from those seen during development.
- Fitting is expensive. The fit runs the model many times per layer: forward and backward passes for the Jacobian probes and decision planes, several families of interventions at every source layer, and an optimised recipient context.
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.
- 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.