In BERT's masked language modelling, of tokens are chosen for prediction. Of those, become [MASK], become a random token and stay unchanged. What fraction of all tokens are in each case? Why not simply use [MASK] every time?
Sequence models and transformers, Pre-training objectives
Level L2 Elementary. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you understand the pre-train/fine-tune mismatch caused by [MASK] and how the 80/10/10 rule reduces it.
Key idea
The [MASK] symbol never appears at fine-tuning time. Replacing with random or unchanged tokens forces the model to build a useful representation of every input token, not only of [MASK].
Steps
- Fractions of all tokens: [MASK] ; random token ; unchanged . The remaining are not predicted.
- If every chosen token became [MASK], the model would learn that only [MASK] positions need good representations. At fine-tuning there is no [MASK], so there is a mismatch.
- With unchanged, the model cannot assume that an unmasked token is correct, and must still predict the original token from context. This pushes it to keep a good representation of the actual word.
- With random, the model cannot trust the visible token either, so it must use the context to check whether it fits.
- Only random replacement is a small amount of noise, so it does not hurt language understanding.
- The loss is the cross-entropy at the chosen of positions only, which is why BERT needs more epochs than a causal language model to see the same number of training signals.
Common mistakes
- Saying of all tokens are masked; it is of the selected .
- Claiming the loss is computed at all positions.
- Saying the random and unchanged cases are there to "regularise" without mentioning the [MASK] mismatch.
How long your answer should be
Half a page; 3–4 minutes.
Read this
Previous in Sequence models and transformers: A model gives next-token probabilities for tokens A–E. What is the sampling distribution under top- with , and under nucleus (top-) sampling with ? Why is nucleus sampling often preferred to a fixed ?
Next in Sequence models and transformers: Training compute is approximately FLOPs for parameters and tokens. The Chinchilla result suggests a compute-optimal ratio of about . (a) For FLOPs, what and are compute-optimal? (b) How many tokens and how much compute does a compute-optimal B model need? (c) How much compute does a B model trained on T tokens use?