Review
Review the residual-stream equations, normalization calculations, norm placement, position-wise MLP, activations and gates, dropout modes, stacking, parameter counts, and block audit sequence.
A Transformer block preserves a model-width residual stream while two branches update it. Under the pre-norm convention used in this subject,
What You Should Be Able to Reconstruct
- Residual stream: distinguish the persistent stream from temporary branch updates and calculate both additions.
- LayerNorm: calculate per-token mean and population variance, normalize the feature axis, then apply learned gain and bias.
- RMSNorm: scale by the root mean square without subtracting the mean.
- Operation order: write and calculate both pre-norm and post-norm forms.
- Position-wise MLP: derive projection shapes, parameter counts, and the independence of different sequence positions.
- Activation or gate: name the exact nonlinear operation and compare it under a common input or parameter budget.
- Dropout: separate training from evaluation and state probability and placement.
- Stacking: preserve while using distinct parameters at different depths unless sharing is explicit.
One Compact Numerical Check
For :
- LayerNorm has mean and population variance ;
- RMSNorm has root mean square ;
- the normalized outputs differ because only LayerNorm subtracts the mean.
For any residual branch , remember that
in general. Shape equality does not imply functional equality.
Audit Before You Trust a Block
- Write the equations in execution order.
- Label every intermediate shape.
- Check normalization one token record at a time.
- Change one position and test MLP independence.
- Zero one branch at a time and inspect the changed downstream input.
- Test dropout separately in training and evaluation modes.
- Count parameters from declared projection shapes and bias conventions.
The next exercises require these calculations without relying on a framework block whose internal choices remain hidden.