Attention is one update inside a Transformer block. A block keeps a model-width residual stream, adds an attention result, then adds a position-wise MLP result. Normalization controls the inputs or outputs of those branches according to a declared order.
This chapter uses a pre-norm block as its implementation spine:
The two normalization operations have separate learned parameters. Every residual-stream tensor retains shape .
The original Transformer used a post-norm order:
These equations define different functions. We will calculate both, but we will not switch conventions halfway through an implementation.
The chapter then opens the two operations hidden behind short names:
- LayerNorm and RMSNorm calculate different statistics along the feature axis;
- an MLP expands each token record, applies an activation or gate, and contracts it back to model width;
- dropout changes branch outputs during training but not evaluation;
- stacking repeats the same shape-preserving interface with different parameters.