the logit lens
/ LOH-jit lenz /
A language model builds its answer in many layers, like a thought passing through many stages of a mind before it is spoken. Normally you only see the final word it outputs. The logit lens is a clever trick to peek at the half-formed thought at every intermediate stage: it asks, at each layer, 'if the model had to commit to a next word right now, what would it say?' — turning the model into a flip-book where you can watch the prediction take shape.
It works because a transformer keeps refining the same running representation layer by layer, and the model already owns a fixed procedure (the 'unembedding') for converting a representation into a guess over words, scored as numbers called logits. The logit lens simply applies that final-step procedure early, to the hidden state at layer 5, layer 10, and so on, instead of only at the end. Typically you see the model's guess start vague and sharpen: a few layers in it might be leaning toward a topic, and only in later layers does the exact answer word win out.
The logit lens is loved because it is almost free — no training, just reuse the model's own output map — and it gives an intuitive story of how a prediction forms. But its honest limits are real and instructive. The early layers were never meant to be read by the final unembedding, so the lens can give garbled or misleading readings, especially in some models or layers; refinements were invented partly to fix this. Treat it as a quick, suggestive sketch of the computation, not a faithful transcript — a vivid example of how an easy interpretability method can mislead if over-trusted.
Feed in 'The Eiffel Tower is in the city of ___'. Apply the logit lens layer by layer and you might watch the model's top guess drift from generic words, to 'France', and finally lock onto 'Paris' in the last few layers — a flip-book of the answer being decided.
The logit lens reuses the model's output map at intermediate layers to watch a prediction form.
Intermediate layers were not trained to be decoded directly, so logit-lens readings can be distorted or wrong; treat them as hints and corroborate with sturdier methods.