LOGBOOK

HELP

Quiz Entry - updated: 2026.12.01

What is the difference between masked language modelling (BERT) and next-token prediction (GPT)?

BERT fills in a gap using context on both sides (bidirectional). GPT continues text using only the preceding context (causal). BERT is strong at analysing text, GPT at generating it.

Attention masks: BERT lets every token see the whole sentence, GPT lets each token see only earlier tokens

* Bidirectional vs causal: the BERT gap uses the words on both sides, GPT only the words before *

Feature Masked language modelling Next-token prediction
Task Fill in a gap Continue the text
Context Left and right Only the preceding text
Attention Bidirectional Causal
Strength Text analysis, reconstructing missing parts Text generation
Example BERT GPT

In "Das Gemälde hängt in einem goldenen [GAP] an der Wand" ("The painting hangs in a golden [GAP] on the wall"), BERT can use "an der Wand" (on the wall) to the right to infer Rahmen (frame). A GPT model writing "Das Gemälde hängt in einem goldenen …" does not know the future text. It predicts Rahmen from the left context only, then the next token, and so on.

Tip: BERT looks both ways; GPT looks back in order to write forward.

Go deeper:

From Quiz: ETHIK / AI and Machine Learning Foundations for Ethical Judgement | Updated: Dec 01, 2026