Definition
Decoder-Only Transformer
A decoder-only Transformer uses a stack of Transformer decoder-style layers without a separate encoder. Common text generators use a causal attention mask and predict tokens from preceding context. Pretraining can derive next-token targets from text itself. Later training and the decoding procedure also shape how the model behaves.
Trace what each position can see
Suppose an illustrative tokenizer maps a prefix to the three tokens “four”, “ plus”, and “ two”. In a causal decoder, the second position can attend to the first two positions. The third can attend to all three. At inference, the last position yields a distribution for the next token. The system appends the selected token and repeats the process.
Generative pretraining with a Transformer decoder
Intelligence at Scale by Shashank Agarwal

Explained in
Chapter 3: Attention Is All You Need FreeThe paper behind every major AI model today. Google invented it. Then watched someone else ship it.
Related terms