The Residual Stream.
One vector per position, edited by every layer in turn. Read it at any depth and it already makes a prediction.
Writing each block as x ← x + Attn(Norm x), then x ← x + MLP(Norm x) suggests a different picture of the network. There is one vector per position — the residual stream — and every sub-layer reads from it and writes an addition back into it. The output head reads it at the end. Since the stream has the same width at every depth and the head is just a norm and a matrix, one can apply the head to the stream after any layer and ask what the model would predict if it stopped there.
That shortcut is called the logit lens (plate XXVIII.1 returns to it properly). On micro it shows how a prediction forms: after the embedding alone the stream predicts something crude, and each block refines it. It also explains how layers cooperate without ever talking to each other directly: whatever an early layer writes, a later one can read.
Below: micro reading the prompt. For the last position, the most likely next token and its probability when the output head is applied to the stream after the embedding and after each block; and how similar the stream at each depth is to the final one.
- Describe a Transformer as layers reading and writing a shared stream.
- Apply the output head to intermediate layers.
- Watch a prediction sharpen through depth.
- Explain how layers communicate through additions.
A stream with many writers
Read straight after the embedding, the stream at the last position predicts, with probability 100.0%, the very token it already holds. That is the tied head of plate V.7 showing through: an embedding scored against the same table matches itself best, so the “prediction” at depth zero is no prediction at all. The first block breaks the echo (its top choice has probability 65.6%), and block by block the prediction is revised until, after the fourth, the head’s top choice has probability 9.5%. The stream also turns: its cosine similarity to the final vector is 0.08 straight after the embedding and 0.60 after two blocks. Information accumulates by addition, so each layer’s contribution remains readable later, unless a later layer writes over it in the same directions.
This view — layers as readers and writers on a shared channel, of fixed width — organises much of what is known about Transformer internals. It explains why the stream must be wide enough to carry many things at once (plate XXVIII.5, superposition), why normalising before each read matters (plate III.6), and why some heads exist only to move information from one position’s stream to another’s (plate IV.6). The logit lens is crude for small models and early layers, where the stream is not yet in the head’s coordinates; plate XXVIII.1 shows better probes.
Terms
- Residual stream
- The per-position vector that every sub-layer reads from and adds into.
- Logit lens
- Applying the output head to the residual stream after an intermediate layer.
- Read
- A sub-layer’s input: a normalised copy of the stream.
- Write
- A sub-layer’s output, added into the stream.