Tuned lens

On this page 7

The tuned lens is an interpretability technique for transformer language models that reads out the prediction a model would make at each intermediate layer by passing the hidden state through a small learned affine translator and then through the model’s own final normalization and unembedding. In Explainable AI, it is used to observe how a prediction forms and sharpens layer by layer, turning the residual stream of a network into a sequence of inspectable probability distributions over the vocabulary.

The method was introduced in 2023 as a refinement of the logit lens, which decodes intermediate states directly without any training. By learning one translator per layer, the tuned lens corrects for the fact that hidden representations drift in basis as they move through the network, which makes early-layer readouts far more reliable.

How the tuned lens decodes hidden states

A decoder-only transformer maintains a residual stream: each layer adds its output to a running hidden vector, and only the final vector is normally converted into logits. The tuned lens takes the hidden state h at layer l and computes `A_l h + b_l`, where A_l is a square matrix and b_l a bias vector. The result is fed through the final layer norm and unembedding matrix, which remain frozen, to produce a distribution over tokens.

Each translator is trained to minimize the KL divergence between the lens distribution at layer l and the model’s actual final output distribution on the same input. The translators are typically initialized to the identity, so training begins from the logit lens and learns only the correction needed. The underlying model weights are never modified.

The table below lists the main elements of the method and their role.

ElementRoleTrained
Hidden stateResidual stream vector at a given layerNo
Affine translatorMaps the hidden state into the final-layer basisYes, one per layer
Final layer normNormalizes the translated vectorNo, reused from the model
Unembedding matrixProjects the vector onto vocabulary logitsNo, reused from the model
Distillation lossKL divergence to the final output distributionDefines the training target
Components of a tuned lens

Tuned lens versus logit lens and probing

The tuned lens sits between the training-free logit lens and general probing classifiers. It is more accurate than the logit lens but far more constrained than an arbitrary probe, because it must map into the model’s own output space and predict the model’s own behavior rather than an external label.

MethodTraining requiredMain strengthMain weakness
Logit lensNoneSimple and fully faithful to model weightsUnreliable in early layers and some model families
Tuned lensOne affine map per layerLower perplexity and less bias across layersTranslator may add its own structure
Probing classifierSeparate classifier per propertyTests for any chosen conceptCan learn the task itself, not the model
Activation patchingNone, but many forward passesEstablishes causal effectsCostly and narrower in scope
Comparison of layer-decoding approaches

The original study reported that the logit lens performs poorly on several model families, such as BLOOM and GPT-Neo, where early-layer readouts are nearly meaningless, while the tuned lens produces coherent predictions at every depth. The learned translators were also found to depend causally on similar features to those the model itself uses, which supports their use as a faithful view rather than a separate model.

What the tuned lens reveals about a model

The core output is a trajectory of predictions across layers for every token position. Researchers read these trajectories to measure prediction depth, the earliest layer at which the lens agrees with the final answer, and to locate where facts, syntax or task instructions start to influence the output.

The following table summarizes typical analyses and what each shows.

AnalysisWhat is measuredTypical insight
Prediction depthFirst layer matching the final top tokenEasy tokens resolve early, hard ones late
Per-layer perplexityCross-entropy of lens outputs on textHow quickly the model converges
Trajectory anomaly detectionUnusual paths of predictionsFlags some prompt injection attempts
Feature importance per layerEffect of removing directions on lens outputWhich subspaces carry the prediction
Cross-model comparisonLens behavior across sizes or checkpointsHow depth usage changes with scale
Analyses built on tuned lens outputs

Because the computation is cheap after training, the tuned lens is well suited to large-scale screening of many prompts, after which more expensive methods such as circuit analysis can focus on the interesting cases.

Training and applying a tuned lens in practice

Practitioners train a tuned lens on a general text corpus similar to the model’s pretraining distribution while keeping the model frozen. The number of added parameters per layer equals roughly the square of the hidden dimension, which is small compared with the model but not negligible for very wide networks. An open-source library maintained by the original research group provides pretrained lenses for several public models.

SituationRecommended choiceReason
Pretrained lens exists for the modelReuse it directlyAvoids training cost and variance
Fine-tuned derivative of a base modelStart from the base lens, then retrain brieflyRepresentations shift after fine-tuning
Quick qualitative inspectionCompare with the logit lensDisagreement highlights basis drift
Claims about causal mechanismsConfirm with activation patchingThe lens alone shows correlation
Practical choices when using a tuned lens

Limitations of the tuned lens

The central caveat is that a learned translator can introduce information that is not explicitly used by the model at that layer, so a readout is an estimate of latent prediction, not proof of it. The method is also linear by design, which can miss nonlinearly encoded information, and it explains predictions in vocabulary space only.

  • Readouts are approximations: good agreement with final outputs does not guarantee faithful intermediate content.
  • Lenses are model-specific: a lens trained on one checkpoint degrades on another.
  • Interpretation requires care: early-layer predictions often reflect frequency priors rather than reasoning.
  • No direct causal claims: interventions are needed to establish how a layer influences the output.

Stripped to the essentials

A language model thinks in many steps, called layers. Normally, people only see the answer after the last step. The tuned lens lets them peek at the guess after every step.

Each layer speaks a slightly different internal dialect. The tuned lens learns a small translator for each layer. The translator turns that dialect into the language of the final answer. This shows when the model became confident and when it changed its mind.

Where it is applied

A safety team evaluates an open-weight model with 32 layers before deploying it in a customer-support assistant. The team loads a pretrained tuned lens and runs 5,000 normal support prompts plus a set of known prompt injection attacks. For each prompt, it records the trajectory of top predictions across all layers.

On normal prompts, the predicted answer usually settles between layers 18 and 24. Many injection prompts show a different pattern: the trajectory jumps abruptly in the last few layers toward instruction-following tokens. The team trains a simple anomaly detector on these trajectories and uses it as an additional screening signal, while confirming suspicious cases with activation patching before drawing conclusions about the mechanism.