Narration · Module 19
Encoder-Decoder
0:00 / 0:00
Module 19 · Architecture · 8 min

Encoder-decoder,
revisited.

A return to the encoder-decoder pattern.

Reading time8 min Audionarration available Prerequisites07, 12 SourceTrack A · Gemini
§ 1

What this lesson covers.

This module is one of 42 in the curriculum. Below is the canonical interactive lesson — tabs, cards, and diagrams from the source repo, rendered inside the course shell. An audio narration runs alongside it - the sticky player at the top of the page plays the full Module 19 clip.

If you prefer to read first and play with the demos after, the interactive lesson sits below this section. If you'd rather hear it narrated while you scroll, hit play on the sticky audio bar at the top — or just let it autoplay.

§ 2

The lesson itself.

Interactive lesson · ported from Gemini track Click tabs to navigate · hover cards for details

Inspector vs. Storyteller

Transformers process sequences differently based on their architecture. Encoders (like BERT) look at the entire sentence at once in both directions, making them great at analyzing text. Decoders (like GPT) are causally masked, meaning they can only see the past and must generate the future one word at a time, making them master storytellers.

The Inspector (Encoder)

Bidirectional Attention. Reads left-to-right AND right-to-left simultaneously.

The
detective
found
the
[MASK]
on
the
bloody
floor.
Predict Mask
Reset
Click to predict the missing word. Watch the bidirectional gaze pull context from both sides before solving.

The Storyteller (Decoder)

Autoregressive Causally Masked Attention. Only sees the past.

The
detective
found
the
weapon
on
the
bloody
floor.
Generate Next Word
Reset
The model is literally blind to the right side of the screen. It can only guess what comes next based strictly on what has already been typed.
§ PAPERS

Further reading.

The canonical references for this module. External links open in a new tab.

§ NEXT

What to read next.

Use the pager below to move sequentially through the curriculum, or jump to any module from the course index. Each track has a "Prereq: ↑ foundation" callout so you can backfill anything that wasn't clear.