A decoder-only language model turns integer token IDs into one vocabulary-score row at every sequence position. Between those endpoints, token and position records enter causal Transformer blocks, a final normalization prepares the readout, and an unembedding maps model width to vocabulary width.
This chapter uses one frozen toy model throughout:
| Quantity | Value |
|---|---|
| vocabulary size | 8 |
| maximum context | 4 |
| model width | 4 |
| decoder blocks | 2 |
| attention heads | 2 |
| head width | 2 |
| MLP width | 8 |
It uses learned absolute positions, pre-LayerNorm blocks, ReLU MLPs, a final LayerNorm, no dropout in deterministic audits, and tied token embedding and unembedding weights. These choices make a complete model inspectable; they are not claims about universal production defaults.
For IDs with , the forward path is
The logits have shape . Each valid row is aligned with exactly one next-token target before cross-entropy is averaged.