Skip to main content

Encoder & Decoder

Encoder & Decoder

  • Core concepts
  • Stage 4 · Under the Hood
  • refs checked 2026-11-09
What problem it solves

The two halves of a Transformer: one reads, one generates.

What it is
The encoder reads a whole passage and builds understanding; the decoder reads what has been generated so far and keeps writing. BERT is built on the encoder. GPT-style models use only the decoder half. The papers call it "a Transformer that attends only to left context".
Why it matters

The divide between "understanding models" and "generation models" sits right here. It decides what a model is good at: retrieval and comprehension, or continuation and generation.

Sources
  • Attention Is All You Need §3 (paper) ↗
  • BERT paper (Transformer encoder) ↗
  • GPT-1 paper (Transformer decoder) ↗
Use this term in a task

Don’t stop at the definition: use the task handbook for the order and checks, or filter three tool candidates for the job at hand.

Task handbooks → · Filter three candidates →