Masked Language Models · Part 1 / 5

Two ways to read

Book 01 read left-to-right to write the next word. There is another way — read both directions at once, to understand.

In Book 01 the model read left-to-right and wrote the next word. It hid the future with the — peeking ahead would be cheating.

That model is a writer. This book builds its sibling: a reader.

The fork

A writer reads one direction, because it only ever needs the past.

But to understand a sentence, you want the whole thing at once. “The movie was not boring” only makes sense if “not” can reach across to “boring”.

So make one change: drop the mask. Now looks left and right — it reads . That model is an . The famous one is .

Same sentence, two readers. The decoder's causal mask hides the future; the encoder removes it, so every word sees the whole sentence. The grid is the mask itself — the only thing that changed.

Try it: focus on “boring”, then flip to Encoder. Watch it reach back to “not” — the word that makes this review positive. The decoder never could.

That’s the entire architectural difference from Book 01. Same blocks, same attention — one rule deleted.

So what do we train it on?

A writer trains on “guess the next word.” But if our reader can see the whole sentence at once, that game is trivial — the answer is right there.

We need a different game. Next.

Sources · 5