The logit lens
At every layer the model holds a running guess of the next token in its residual stream. We apply the model's final norm and unembedding to each layer's hidden state, so you read out that guess directly. The math is implemented from scratch and checked against a reference to the last decimal.
nostalgebraist, 2020