Unsupervised / Objectives
verifiedMasked Language Modeling
Hide some of the words in a sentence and train the model to fill them back in. Because it can see both sides of a gap, it learns representations that account for what comes after — which a model predicting strictly left to right cannot. That bidirectionality is the whole trade: better representations, and no way to generate text one token at a time.
Mask around 15% of the tokens and predict them from the full bidirectional context. It produced the encoders that dominated classification and extraction for years, and it lost the generative frontier to causal models because the objective does not yield a sampler. The mask token also appears in training and never at inference, a mismatch the original work patched by replacing only some of the masks.
Maximise Σ sub i∈M log p(x sub i | x sub visible ) over a mask set M, conditioning on both directions rather than on x sub <t alone. The signal is a fraction of the tokens per sequence against every token for a causal objective, so a masked model sees fewer predictions per unit of data and needs more passes over it to match.
10 queries against 10 keys; a brighter cell means more of that query's attention went to that key. Each query sees itself and everything before it, and nothing after — the upper triangle is masked.
Which positions each token is allowed to attend to. Drag the lookahead up from zero to open a causal view into the bidirectional one masked language modelling trains on.
Reviewed by opendroid · 2026-08-13
- arXiv:1810.04805 — BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding