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

Decoder-Only Transformer diagram from Intelligence at Scale
Diagram from chapter 3, Attention Is All You Need

Explained in

Chapter 3: Attention Is All You Need Free

The paper behind every major AI model today. Google invented it. Then watched someone else ship it.

Related terms

This is one term. The chapter is the argument.

Intelligence at Scale: 22 chapters, 65,000 words, 80-plus diagrams. Kindle, paperback and hardcover on Amazon.

Buy on Amazon.com
← All terms