Inside Modern LLM Architectures

decoder-only architecture

Imagine a writer who can only ever read what comes before the current word, never what comes after, and whose single job is to guess the next word. A decoder-only model is a tall stack of identical transformer blocks wired exactly this way: every token attends to earlier tokens and itself, never to the future. Train it to predict the next token over a huge corpus and the same machine learns to chat, summarize, translate, and code, because all of those are just continuations of some text.

The original transformer had two halves, an encoder that reads the whole input at once and a decoder that writes the output. Modern LLMs threw away the encoder and the cross-attention between them, keeping only the masked decoder stack. Each block does causal self-attention then a feed-forward network, with residual connections and normalization around both. This single design scales cleanly, reuses one set of weights for reading and writing, and turns every task into one uniform problem: given this prefix, what comes next.

Encoder-decoder and encoder-only designs still exist for translation and retrieval, but virtually all general-purpose chat LLMs today are decoder-only.

Also called
decoder-only transformerGPT-style architecture