What are the logit lens and the tuned lens?
Author: Mehdi Sadriu, independent educator. Last reviewed: 25 November 2026. How we check claims: methodology.
The logit lens asks: if we decoded this layer's residual stream with the model's own unembedding, which token would be in the lead? nostalgebraist (2020) introduced that cheap view. Belrose et al. (2023) fit an extra affine map per layer because the unembedding was trained on the final stream, not on layer 6. Both are first looks, not circuits.
In one paragraph. Logit lens: logits_ℓ = Unembed(x_ℓ). Tuned lens: logits_ℓ = Unembed(A_ℓ x_ℓ + b_ℓ) with A_ℓ, b_ℓ trained to predict final logits.
| Layer | Top token under unembedding | Note |
|---|---|---|
| 0 | the | still near the embedding |
| 4 | cat | subject information has arrived |
| 8 | sat | a verb is in the lead, then revised |
| 11 (final) | on | the real next-token prediction |
Early layers can be misleading because the unembedding was trained on the final stream (nostalgebraist, 2020; Belrose et al., 2023). Patch before you believe a mid-layer 'prediction'.
What do you see in plain language?
A film of the model's mind changing its guess. Early frames are vague. Later frames sharpen. Sometimes a token leads in the middle and then loses. That is a clue about when information arrived — not a proof of the path that produced the final answer.
Why can the raw lens mislead?
The unembedding matrix is a decoder for the last residual, after every later write. Applying it early is like reading a draft with the published book's index. Belrose et al. (2023) train translators so each layer speaks 'final-logit'. Even then, a token that looks likely at layer 6 may be ignored by the real circuit.
What should you do next?
Use the lens to pick a layer and a token, then patch. Direct logit attribution — how much a component's write moves the final logits through the unembedding — is a related first-order tool.
What is the math?
ℓ_final = Unembed(x_L) = W_U x_L
ℓ_lens(ℓ) = W_U x_ℓ ℓ_tuned(ℓ) = W_U (A_ℓ x_ℓ + b_ℓ)
A_ℓ is trained so ℓ_tuned(ℓ) matches ℓ_final on a corpus, typically with a KL or similar loss (Belrose et al., 2023). mej7.com does not include a tuned lens.
Worked example
Prompt ending in 'The cat sat on the'. Layer 0's lens may say 'the' because that is near the embedding. Layer 8 may briefly prefer 'sat' before the final layer settles on 'mat' or 'floor'. If layer 8's favourite is never used, patching will show it. The residual-stream toy on this site animates a vector climbing; it does not decode vocabulary.
Check your understanding
Five questions. Answers are in the disclosure under each item, so this page still works if JavaScript is off.
Further reading
- Interpreting GPT: the logit lens — nostalgebraist (2020). LessWrong.
- Eliciting Latent Predictions from Transformers with the Tuned Lens — Belrose et al. (2023). arXiv.
- A Mathematical Framework for Transformer Circuits — Elhage et al. (2021). Transformer Circuits (Anthropic).
- Transformer Feed-Forward Layers Build Predictions by Promoting Concepts in the Vocabulary Space — Geva et al. (2022). EMNLP.