Introduction
A readout lens must turn a residual-stream vector from layer into the basis expected by the final normalization and unembedding. The direct logit lens uses unchanged. That is attractive because it requires no fit, but it treats an intermediate residual as though the nonlinear stack between layer and the output were absent. A corpus-average Jacobian captures the local transport, yet a single average can be noisy, can mix causal time horizons, and can be distorted by large activation norms or gated value paths.
We address the problem under the interface constraint that fitting may inspect only generic web text while transport receives only a residual batch and a layer index. We therefore fit one deterministic, row-wise affine map per source layer and save only tensors needed by transport. The map is built from causal derivatives of the final residual, then corrected using the model's own unembedding on reserved corpus rows. This lets us use output-space evidence without putting prompts or model execution inside transport.
Our central idea is to treat propagation as a family of causal resolvents rather than one undifferentiated Jacobian. We combine a short horizon that emphasizes nearby positions with a long horizon that preserves broad causal influence, denoise independent estimates, and let unembedding-space perturbation tests choose their mixture and scale. A quasi-null direction of the unembedding supplies missing confidence while active-subspace calibration suppresses a static offset. The resulting readout is a row-wise affine transport with an optional deterministic correction at inference time.
Method
Causal Jacobian resolvents
Let be the final residual at position and let be the source residual. Causality makes the local transport
zero when . We estimate a discounted causal sum
We obtain the derivatives with reverse-mode autograd in dimension batches and split prompt rows into two accumulators, and , before normalizing them. For , we realize the temporal factor as around a midpoint ; this is algebraically the same discount while allowing one batched cotangent construction.
def _estimate_resolvent_sums(
self,
model,
prompt_ids: torch.Tensor,
in_dev: torch.device,
*,
skip_first: int,
prompt_batch: int,
dim_batch: int,
rho: float,
gamma_gate: float,
input_sph_weight: bool,
) -> tuple[dict[int, torch.Tensor], dict[int, torch.Tensor], int, int]: if rho >= 0.9999:
t_weight = None
s_weight = None
else:
t_weight = (rho ** (pos_t.float() - mid)).to(tgt.dtype)
s_weight = (rho ** (mid - pos_cpu.to(in_dev).float()))[None, None, :, None]
cot = torch.zeros(P, cur_db, T, d, dtype=tgt.dtype, device=t_dev)
b_idx = torch.arange(cur_db, device=t_dev)
for k, d0 in enumerate(range(0, d, cur_db)):
n = min(cur_db, d - d0)
cot.zero_()
if t_weight is None:
cot[:, b_idx[:n, None], pos_t[None, :], (d0 + b_idx[:n])[:, None]] = 1.0
else:
cot[:, b_idx[:n, None], pos_t[None, :], (d0 + b_idx[:n])[:, None]] = t_weight[
None, None, :
]
grads = torch.autograd.grad(
outputs=tgt,
inputs=srcs,
grad_outputs=cot.view(P * cur_db, T, d),
retain_graph=(k < n_passes - 1),
)
for l, g in zip(sources, grads):
gp = g.view(P, cur_db, T, d)[:, :n, pos_cpu.to(g.device), :].to(
device=in_dev, dtype=torch.float32
)
if s_weight is not None:
gp = gp * s_weight
m = (gp * w_pos[l][:, None, :, None]).mean(dim=2)
if P >= 2:
JA[l][d0 : d0 + n] += m[0::2].sum(dim=0)
JB[l][d0 : d0 + n] += m[1::2].sum(dim=0)We use an undiscounted long estimate unless a corpus pilot selects a discounted long horizon. We use for the short estimate. When gated modules are present, we compare a full gate path () with a degree-one value path () using clean and perturbed unembedding KL. We choose only when its aggregate KL is strictly smaller; ties retain . We use for the long estimate only when the selected degree-one path is still worse than the identity under that pilot, and otherwise use .
# 2. Corpus-calibrated gate attribution pilot (reusing winning pilot sums!) + Causal Resolvents
if self._has_bilinear_gated_mlp(model.layers):
P_pil = min(8, int(fit_ids.shape[0]))
sA_1, sB_1, cA_1, cB_1 = self._estimate_resolvent_sums(
model,
fit_ids[:P_pil],
in_dev,
skip_first=skip_first,
prompt_batch=pb,
dim_batch=db,
rho=1.0,
gamma_gate=1.0,
input_sph_weight=True,
)
sA_0, sB_0, cA_0, cB_0 = self._estimate_resolvent_sums(
model,
fit_ids[:P_pil],
in_dev,
skip_first=skip_first,
prompt_batch=pb,
dim_batch=db,
rho=1.0,
gamma_gate=0.0,
input_sph_weight=True,
)
with torch.no_grad():
eval_ls = list(range(max(0, L // 5), L - 1)) or [0]
sc_1, sc_0, sc_id = 0.0, 0.0, 0.0
for l in eval_ls:
W1 = ((sA_1[l] + sB_1[l]) / max(cA_1 + cB_1, 1)).to(in_dev)
W0 = ((sA_0[l] + sB_0[l]) / max(cA_0 + cB_0, 1)).to(in_dev)
sc_1 += self._eval_op_kl_pair(model, W1, clean_H[l], cal_dl[l], cal_dZ[l], clean_p, cal_pert_p[l])[1]
sc_0 += self._eval_op_kl_pair(model, W0, clean_H[l], cal_dl[l], cal_dZ[l], clean_p, cal_pert_p[l])[1]
sc_id += self._eval_op_kl_pair(model, None, clean_H[l], cal_dl[l], cal_dZ[l], clean_p, cal_pert_p[l])[1]
gamma_star = 0.0 if sc_0 < sc_1 else 1.0
rho_long = 0.965 if (gamma_star == 0.0 and sc_0 > sc_id) else 1.0Robust estimation and split denoising
Before estimating transport, we compute a robust layer centroid and covariance from corpus activations. Norms are compared with a per-sequence median. Long-horizon derivative rows use a radial weight with a floor at , proportional to the norm ratio up to and then decaying as ; short-horizon rows use a downweighting form. These weights reduce the influence of activation sinks while retaining directional variation. The covariance is formed after subtracting the robust centroid.
The two split estimates provide a data-driven noise reference. We whiten each estimate with the eigendecomposition of the trimmed covariance, take an SVD of one whitened split, and estimate how much of each singular direction agrees with the other split. Negative agreement is discarded. A shrinkage weight combines the agreed signal with the disagreement variance, the two directional estimates are averaged, and the result is unwhitened.
def _wiener_denoise(
JA_dict: dict[int, torch.Tensor],
JB_dict: dict[int, torch.Tensor],
cov_dict: dict[int, torch.Tensor],
dev: torch.device,
) -> dict[int, torch.Tensor]:
out = {}
for l, JA_cpu in JA_dict.items():
JA = JA_cpu.to(dev).float()
JB = JB_dict[l].to(dev).float()
S = cov_dict[l].to(dev).float()
evals, evecs = torch.linalg.eigh(S)
reg = 1e-4 * evals.clamp_min(0.0).mean().clamp_min(1e-8)
s_half = evecs @ torch.diag((evals.clamp_min(0.0) + reg).sqrt()) @ evecs.T
s_inv_half = evecs @ torch.diag((evals.clamp_min(0.0) + reg).rsqrt()) @ evecs.T
MA = JA @ s_half
MB = JB @ s_half
def _shrink(X: torch.Tensor, Y: torch.Tensor) -> torch.Tensor:
U, Sv, Vh = torch.linalg.svd(X, full_matrices=False)
c_pos = (U * (Y @ Vh.T)).sum(dim=0).clamp_min(0.0)
n_var = 0.5 * (Sv - c_pos).clamp_min(0.0) ** 2
s_var = c_pos ** 2
w = s_var / (s_var + n_var + 1e-12)
s_clean = w * (0.5 * (Sv + c_pos))
return (U * s_clean.unsqueeze(0)) @ Vh
M_clean = 0.5 * (_shrink(MA, MB) + _shrink(MB, MA))
out[l] = (M_clean @ s_inv_half).cpu()
return outWe obtain a cleaned short operator and long operator for every source layer. The procedure is deterministic for a fixed corpus and model, and it stores only fit-state tensors.
Output-calibrated synthesis
We reserve clean rows and two kinds of intervention for calibration: an isotropic displacement with scale and a shuffled-row displacement scaled by . We patch one source layer with hooks, and use the resulting final-residual and unembedding changes as targets for the fitted map.
For each layer we evaluate the identity, the short operator, and the long operator by KL on both clean and perturbed output distributions. We set
and penalize excess broadcast error with . The short weight is
where is when the long horizon is discounted and otherwise. We first normalize each operator by its median output norm, blend them with this weight, and restore the weighted median scale. An empirical gain
then matches the predicted final-residual change to the interventional change, giving .
ckl_id, _ = self._eval_op_kl_pair(model, None, hl, dl, dZ_true, clean_p, cal_pert_p[l])
ckl_s, kl_s = self._eval_op_kl_pair(model, Rs_l, hl, dl, dZ_true, clean_p, cal_pert_p[l])
ckl_b, kl_b = self._eval_op_kl_pair(model, Rl_l, hl, dl, dZ_true, clean_p, cal_pert_p[l])
d_loc = max(0.0, min(ckl_id, ckl_b) - ckl_s)
d_bc = max(0.0, kl_s - kl_b)
w_l = max(0.06, min(0.55, 0.17 + 0.36 * math.tanh(d_loc / 2.0) - bc_coef * math.tanh(d_bc / 1.5)))
ns = max(float((hl @ Rs_l.T).norm(dim=-1).median().item()), 1e-8)
nb = max(float((hl @ Rl_l.T).norm(dim=-1).median().item()), 1e-8)
n_ref = w_l * ns + (1.0 - w_l) * nb
W_raw = n_ref * (w_l * (Rs_l / ns) + (1.0 - w_l) * (Rl_l / nb))
Wd = dl @ W_raw.T
g_emp = max(
0.20, min(2.20, float((dZ_true * Wd).sum().item()) / max(float((Wd * Wd).sum().item()), 1e-12))
)
Wl = g_emp * W_raw
# Conservative active-subspace common-mode de-biasing (0.18-nat acceptance margin)
mul = mu_trim[l].to(in_dev).float()
w_mu = Wl @ mul
w_mu_act = w_mu - (w_mu @ v0_dev) * v0_dev
if not use_full_space:
w_mu_act = w_mu_act - w_mu_act.mean()
yc_b = (hl @ Wl.T)[None] - bt_t[:, None, None] * w_mu_act[None, None, :]
yp_b = ((hl + dl) @ Wl.T)[None] - bt_t[:, None, None] * w_mu_act[None, None, :]
lpc_b = model.unembed(yc_b.reshape(len(bts) * M, d)).float().view(len(bts), M, -1).log_softmax(dim=-1)
lpp_b = model.unembed(yp_b.reshape(len(bts) * M, d)).float().view(len(bts), M, -1).log_softmax(dim=-1)
cp_t = clean_p.unsqueeze(0)
pp_t = cal_pert_p[l].unsqueeze(0)
kl_b_vec = 0.5 * (
(cp_t * (cp_t.clamp_min(1e-12).log() - lpc_b)).sum(dim=-1).mean(dim=-1)
+ (pp_t * (pp_t.clamp_min(1e-12).log() - lpp_b)).sum(dim=-1).mean(dim=-1)
)
base_kl = float(kl_b_vec[0].item())
best_idx = int(kl_b_vec.argmin().item())
chosen_bt = bts[best_idx] if (best_idx > 0 and float(kl_b_vec[best_idx].item()) < base_kl - 0.18) else 0.0
b_act = -chosen_bt * w_mu_actThe translated centroid can create a common-mode drift. We project it away from the chosen quasi-null direction and, when the model is not using the full space, away from the mean direction. We test multipliers and use a nonzero correction only when the best joint clean-and-perturbed KL is more than below the uncorrected value. The accepted affine offset is .
Quasi-null confidence and row-wise transport
The unembedding at zero reveals whether a static output offset is present. We probe directions in either the full space or a mean-zero subspace, form their Gram matrix, and retain up to six of the smallest singular directions using the threshold . A vector in this quasi-null subspace is oriented toward the robust final-layer centroid, with weaker singular directions receiving larger alignment weight. In a bias-free case we may probe the full space; otherwise we work in a mean-zero subspace and center .
If a static offset is detected, its active-subspace preimage is accepted only when its reconstructed unembedding direction has cosine at least and its scale is at most . For each layer we search a fixed list of confidence amplitudes, beginning at zero. The candidate with the best objective combines perturbation cosine, a clipped relative-squared-error term weighted by , and clean/perturbed probability KL weighted by . A top-rank overlap guard keeps only candidates with overlap at least when bias de-intrusion is active, or otherwise; the zero-amplitude candidate is always valid.
dL_true = cal_dL[l]
dL_true_nrm = dL_true.norm(dim=-1).clamp_min(1e-6)
dL_hat = L_p - L_c
dL_hat = dL_hat - dL_hat.mean(dim=-1, keepdim=True)
cos_km = (
(dL_hat * dL_true.unsqueeze(0)).sum(dim=-1)
/ (dL_hat.norm(dim=-1).clamp_min(1e-8) * dL_true_nrm.unsqueeze(0))
).mean(dim=-1)
err2 = ((dL_hat - dL_true.unsqueeze(0)) ** 2).sum(dim=-1)
r2_km = (1.0 - err2 / (dL_true_nrm.unsqueeze(0) ** 2)).clamp(min=-2.5).mean(dim=-1)
lp_p = L_p.log_softmax(dim=-1)
lp_c = L_c.log_softmax(dim=-1)
pkl_km = (pp_t * (pp_t.clamp_min(1e-12).log() - lp_p)).sum(dim=-1).mean(dim=-1)
ckl_km = (cp_t * (cp_t.clamp_min(1e-12).log() - lp_c)).sum(dim=-1).mean(dim=-1)
obj = cos_km + 0.35 * r2_km - 0.08 * 0.5 * (ckl_km + pkl_km)
valid = ov >= ov_thr
valid[0] = True
kb = int(torch.where(valid, obj, torch.full_like(obj, -1e8)).argmax().item())
chosen_tau = float(cand_taus[kb])For an input row , transport applies the selected affine map in float32,
adds the selected amplitude, and, when enabled, subtracts the row-wise static-bias term
Our transport path is row-wise, caches the layer tensors on the target device, guards non-finite values, and restores the input floating dtype.
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 ↑ | |
| Gemini 4 Carbon | 49.16 | 40.02 | 21.17 | 2.756 | 51.44 | 43.47 | 10.11 | 52.42 | 14.00 | 46.95 | 45.19 | 17.16 | 55.81 | 24.67 |
| 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 Qwen3.5-4B, our readout values are 49.16, 40.02, and 21.17 for probes 1, 2, and 3. Each is above the strongest corresponding baseline, whose values are 49.04, 39.27, and 18.12 from Jacobian lens [2], Tuned lens [1], and Jacobian lens [2]. Fidelity is 2.756, below the strongest baseline value 15.33 from Jacobian lens [2].
On Gemma3-4B, our four readout values are 51.44, 43.47, 10.11, and 52.42. The corresponding strongest baseline values are 52.65, 45.83, 12.28, and 61.35. We are below the strongest baseline on each readout probe; fidelity is 14.00, above the strongest baseline value 7.849.
On OLMo3-7B, our readout values are 46.95, 45.19, 17.16, and 55.81. We are below the strongest baseline on probe 1, above it on probes 2 and 4, and below it on probe 3. Fidelity is 24.67, above the strongest baseline value 20.86. These mixed results fit the method's aim: the calibration is designed to improve propagation and rank stability together, so a readout gain can coexist with a fidelity loss on a particular setting.
How we got here
Our trace records a progression from a plain Jacobian transport to the submitted operator. The first useful correction was geometric: subtracting the source centroid from the transported vector damaged the causal image, so we kept uncentered and reserved correction for an active component and the quasi-null direction. The trace then records a version that restored a vertical, self-position pathway and improved readout and perturbation behavior together. These observations led us to preserve the causal image while calibrating only directions that output-space evidence supported.
A second line of work isolated the value side of gated modules. The trace reports that a degree-one value-path operator could outperform full gate attribution on some models and lose on others, so we replaced a fixed choice with the corpus KL pilot. This is why the final code compares and rather than hard-coding one architecture assumption.
The trace also records a noisy resolvent attempt. We replaced it with the deterministic factorized Laplace construction after an exactness check, then added a short horizon because local propagation and broad propagation did not agree uniformly. Split estimates and singular shrinkage were then retained to attenuate disagreement between the splits.
Limitations
- The transport is affine and row-wise. It cannot represent input-dependent changes in the downstream nonlinear stack beyond what the corpus-average Jacobians and the calibration perturbations capture.
- The method is expensive to fit: it records activations, differentiates through the residual stack for multiple dimensions, forms covariance eigendecompositions, and probes the unembedding. Its inference path is cheap, but the fitting cost may be unsuitable for very large widths or small fitting budgets.
- Horizon selection and gate attribution are discrete pilot decisions. The gate branch chooses only or , and the long discount has only the code's two possibilities, so a corpus that sits between these regimes can be misrepresented.
- The quasi-null correction depends on a stable low-sensitivity subspace and on the unembedding's normalization geometry. If the bias reconstruction or rank-overlap test fails, the confidence amplitude can remain zero and the method falls back to the affine map.
- Degenerate inputs are handled conservatively: with at most one residual layer, or with fewer than two packed tokens, fitting returns an empty or identity state instead of a learned transport.
- The results show a real trade-off. Qwen3.5-4B has fidelity 2.756 versus 15.33 for its strongest baseline even while its first three readout probes lead. Gemma3-4B leads fidelity at 14.00 but does not lead every readout probe. OLMo3-7B leads fidelity at 24.67 and two readout probes while trailing on the other two.
- Fitting uses generic web text, so a domain shift can change the robust centroids, covariance, gate decision, and KL calibration. The lens has no way to identify that shift at transport time.
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.