Skip to content
BENIBIX Learn

Decoder (Transformer)

AI💬 LLMsTransformer Architecture

Also known as Decoder, Decoder-Only Model

The part of a transformer that writes. It adds one token at a time.

Think of it like

Think of it like a storyteller. They say one word, then pick the next, and the next.

Example

Jack asks his chat assistant for a packing list. A model that is only a decoder writes it one token at a time. Each new token looks back at all the ones before.

Why it matters

Decoders are what generate text. Every chat reply you read was written by one.

Definition

A decoder is the part of a transformer that writes text, one token at a time. Each token can only look at the tokens before it. So the model never sees the future while it learns to guess it. Almost every chat model is only a decoder. It is one tall stack of decoder layers. In a translator, the decoder also looks at what the encoder gave it.
The decoder, in the middle, writes one token at a time. Chat models are built from this shape alone.

Common mistake

Thinking the decoder rereads the whole answer from scratch each step. It keeps notes on earlier tokens so each new step is quick.

Key takeaways

  1. 1
    Writes text. One token at a time.
  2. 2
    Only looks back. Never at future tokens.
  3. 3
    Chat models use it. Decoder-only stacks.

Compare

Learn it properly