← Speech and Language Processing
NLP›Popular Textbooks› SLP · Chapter 9

Chapter 9

Masked Language Models: Learning from Both Sides

Chapter: Masked Language Models, in Daniel Jurafsky and James H. Martin, Speech and Language Processing, 3rd edition draft, August 19, 2026.

Topics to learn

Page numbers refer to the linked chapter PDF.

FAQ

How is a masked model different from the causal model in Chapter 7?

A masked encoder can use tokens on both sides of a position. Its loss is on selected corrupted positions, not on every next token.

If you stop scoring an easy selected token, why can the mean loss rise?

The mean is only over selected targets. Removing an easy one can raise the average even though no remaining probability got worse.

What is a BIO tag?

A span encoding: beginning, inside, or outside an entity. It lets a per-token classifier mark multi-token names.

Is next-sentence prediction the same objective as masked token prediction?

No. It is a second signal about whether two spans followed each other. The masked-token loss still only scores the corrupted positions selected for that loss.