Eliciting Latent Predictions from Transformers with the Tuned Lens
TL;DR. The logit lens, an informal 2020 LessWrong technique, decodes an intermediate hidden state by applying the final layer norm and unembedding to it. That works poorly on many models. The tuned lens learns one affine “translator” per layer and trains it to match the model’s own final distribution. The result is a cleaner, more reliable picture of how the prediction forms layer by layer.
Key idea
Section titled “Key idea”Here is the rest of the network. The bias stands in for the expected sum of later residual updates, which the logit lens implicitly sets to zero. The matrix corrects for representational drift, where the hidden-state covariance changes with depth (§3).
Key results
Section titled “Key results”The paper shows that intermediate layers already contain a smoothly sharpening prediction once you translate their basis. Lenses also transfer: a lens trained on LLaMA 13B works on its fine-tuned descendant Vicuna 13B with little increase in KL (§5, App. A). The causal basis test finds no direction that is influential for the lens but not for the model (§4.1).
Connections
Section titled “Connections”- Probing Classifiers: the tuned lens is a probe trained against the model’s own outputs, which sidesteps the control-task concern.
- A Mathematical Framework for Transformer Circuits: the residual stream as a sum of layer outputs is what justifies decoding it at any depth.
- Mor Geva (job talk): related work on reading predictions from the vocabulary space of feed-forward layers.
- Chain-of-thought monitorability: internal-trajectory monitors are an alternative to reading the model’s stated reasoning.
Questions to think through
These questions have no single right answer. Write or say your answer before you open the hints. Mark a question once you could defend your answer in a reading group.
- Derive / compute
Starting from the residual-stream identity h_L = h_ℓ + Σ over later layers of their outputs F_ℓ′(h_ℓ′), derive the logit lens as "set the remaining residual updates to zero", then show step by step how the debiased lens and the tuned lens (A_ℓ h_ℓ + b_ℓ) relax that assumption. Why is KL to the final layer, rather than cross-entropy to the true next token, the right training target?
What a strong answer covers
- Logit lens: LogitLens(h_ℓ) = LayerNorm(h_ℓ) W_U, which equals the final readout if all later residual updates sum to zero.
- If later layers add a nonzero average residual, zero is an arbitrary replacement; the debiased lens adds a learned constant b_ℓ standing in for that expected sum.
- Hidden-state covariance drifts across layers (including rogue high-variance dimensions), so a learned change of basis A_ℓ maps layer ℓ's space into the final layer's input space.
- Training minimises KL(final-layer distribution ‖ lens distribution), a distillation target; using true labels would let the probe learn information the model itself does not use at that layer (the Hewitt & Liang concern).
- Mechanism
The paper checks that the tuned lens is causally faithful with "causal basis extraction": it finds directions that matter for the lens and erases them from the model. Explain what this test measures and why a Spearman ρ of 0.89 between lens influence and model influence (Pythia 410M, layer 18) is evidence that the lens reads features the model actually uses.
What a strong answer covers
- For each extracted direction, erase it from the hidden state and measure the change in the lens output (influence on the lens) and in the model's final output (influence on the model).
- A faithful lens should depend on the same directions as the model; a high rank correlation means directions that matter to one matter to the other.
- The paper reports no features that are influential for the lens but not for the model, which would indicate the lens relies on directions the model ignores.
- Limit: correlation over a set of extracted directions is evidence of alignment, not proof that every lens readout reflects the model's computation.
- Design
The authors detect prompt injections by running an anomaly detector on tuned-lens prediction trajectories. Design a similar trajectory-based monitor for a RAG system that flags when a retrieved passage overrides the model's parametric answer.
What a strong answer covers
- Record per-layer tuned-lens distributions for the answer tokens, with and without the retrieved passage in context.
- Features: the layer at which the top prediction changes, KL between consecutive layers, and the late-layer divergence between the with-context and without-context trajectories.
- Train an anomaly detector or classifier on labelled cases (passage agrees, passage conflicts, injected instruction) and evaluate with AUROC on held-out passages.
- Caveat: the lens is trained on pretraining-style text and may need retraining on the chat or RAG distribution; validate that trajectories differ for the right reason with patching.