Logit Lens is a decoding technique that applies the unembedding matrix directly to the intermediate states of a transformer's residual stream, converting hidden representations into vocabulary probability distributions at every layer. This allows researchers to inspect the model's evolving "belief" about the next token throughout the forward pass, rather than only at the final output.
Glossary
Logit Lens

What is Logit Lens?
A model probing method that applies the unembedding matrix directly to intermediate residual stream states to reveal a transformer's iterative token predictions before the final layer.
By revealing how predictions are iteratively refined, Logit Lens helps diagnose where specific knowledge is computed and how attention heads and MLP layers contribute to the final output. It is a foundational tool in mechanistic interpretability, often used alongside causal tracing and activation patching to localize factual recall and reasoning circuits.
Key Characteristics of the Logit Lens
The Logit Lens is a diagnostic tool that applies the final unembedding matrix directly to intermediate residual stream states, revealing a model's evolving token predictions layer by layer.
Direct Residual Stream Decoding
The technique operates by taking the hidden state from a specific layer's output and multiplying it by the unembedding matrix (the final linear projection). This bypasses all subsequent layers, producing a probability distribution over the vocabulary as if the model stopped at that point. The core insight is that the residual stream is a linear space where the unembedding matrix can be meaningfully applied at any depth, not just the final layer.
Iterative Prediction Refinement
Applying the Logit Lens at successive layers reveals a model's progressive refinement of its final prediction. Early layers often show nonsensical or low-confidence tokens, while middle layers begin to surface semantically related candidates. The final layers typically perform confidence calibration, sharpening the probability distribution. This provides a window into the model's step-by-step construction of an answer before it is formally output.
Zero-Training Diagnostic
Unlike linear probing, the Logit Lens requires no auxiliary classifier training. It reuses the model's native unembedding matrix, making it a lightweight, immediate diagnostic. This eliminates the risk of the probe itself learning a task the model hasn't, providing a more faithful readout of the model's current belief state. It is a purely inference-time intervention that leaves all model weights frozen.
Early Exit Signal Analysis
By examining the top predicted tokens at each layer, researchers can identify the exact point where a model 'locks in' on a fact or a grammatical structure. For example, in a factual recall task, the correct answer token often first appears in the top predictions of middle layers, long before the final output. This helps localize where specific computations, such as entity binding or relation extraction, occur in the network.
Limitations and Norm Asymmetry
The Logit Lens assumes the residual stream's norm and geometry are consistent with the final layer's expectations, which is not guaranteed. Early layer representations often have a different L2 norm scale, leading to underconfident probability distributions. A common mitigation is to apply a learned temperature scalar or a norm correction factor to calibrate the logits before the softmax, improving the interpretability of early-layer predictions.
Contrast with Tuned Lens
The standard Logit Lens uses the same unembedding matrix for all layers, while the Tuned Lens variant addresses the norm mismatch by learning a separate, layer-specific affine transformation. This learned correction is trained via distillation to match the final layer's output distribution, providing a more calibrated view of intermediate states. The choice between them involves a trade-off between the Logit Lens's simplicity and the Tuned Lens's accuracy.
Frequently Asked Questions
Direct answers to the most common technical questions about applying the unembedding matrix to intermediate residual stream states for early-exit interpretability.
A Logit Lens is an interpretability technique that applies a language model's final unembedding matrix directly to the intermediate hidden states of the residual stream, bypassing the final transformer layers. This allows researchers to decode the model's iterative token predictions at every layer, revealing how the probability distribution over the vocabulary evolves step-by-step. The mechanism works because the residual stream is a linear space where the unembedding matrix can project any intermediate state onto the vocabulary space, even if the model wasn't explicitly trained for early-exit predictions. By reading these 'early logits,' you can see that a model often settles on the correct answer many layers before the final output, providing a window into the model's internal reasoning timeline.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Explore the core techniques used to dissect and interpret the internal representations of transformer models, forming the foundation of mechanistic interpretability.
Linear Probing
A diagnostic technique that trains a simple linear classifier on top of a frozen model's internal representations. This tests whether specific information, like part-of-speech or sentiment, is linearly separable at a given layer. Unlike the Logit Lens, which uses the model's own unembedding matrix, a probe learns a new, task-specific mapping to quantify encoded knowledge.
Residual Stream
The core data pathway in a transformer where each layer performs a read-modify-write operation. Instead of replacing the previous state, layers add additive updates to a running hidden state. The Logit Lens operates directly on this stream, decoding the model's iterative token predictions by applying the unembedding matrix to the residual state at intermediate layers.
Unembedding Matrix
The final linear layer of a language model that maps the high-dimensional residual stream state to a probability distribution over the vocabulary. The Logit Lens technique hijacks this matrix, applying it prematurely to intermediate residual states to reveal the model's evolving 'belief' about the next token before the final layer.
Causal Tracing
A method for identifying the specific hidden states causally responsible for recalling a fact. It works by corrupting a forward pass with noise and then systematically restoring clean activations from a clean run. This localizes where knowledge is stored, complementing the Logit Lens by distinguishing correlation from true causation in the model's computations.
Activation Patching
A causal intervention that replaces a model's internal activation at a specific location with a cached activation from a different input. This allows researchers to localize where a specific computation occurs. While the Logit Lens passively observes predictions, activation patching actively modifies the residual stream to test functional hypotheses about model components.
Contrastive Decoding
An inference-time search heuristic that maximizes the probability difference between an expert model and an amateur model. By subtracting the logits of a weaker model from a stronger one, it generates more factual text. This shares a conceptual link with the Logit Lens, which also contrasts the predictions of early and late layers to understand knowledge refinement.

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us