In BERT's masked language modelling, 15% of tokens are chosen for prediction. Of those, 80% become [MASK], 10% become a random token and 10% 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

  1. Fractions of all tokens: [MASK] =0.15×0.8=12%; random token =0.15×0.1=1.5%; unchanged =0.15×0.1=1.5%. The remaining 85% are not predicted.
  2. 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.
  3. With 10% 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.
  4. With 10% random, the model cannot trust the visible token either, so it must use the context to check whether it fits.
  5. Only 1.5% random replacement is a small amount of noise, so it does not hurt language understanding.
  6. The loss is the cross-entropy at the chosen 15% 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

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 (0.50, 0.20, 0.15, 0.10, 0.05) for tokens A–E. What is the sampling distribution under top-k with k=2, and under nucleus (top-p) sampling with p=0.8? Why is nucleus sampling often preferred to a fixed k?
Next in Sequence models and transformers: Training compute is approximately C≈6ND FLOPs for N parameters and D tokens. The Chinchilla result suggests a compute-optimal ratio of about D≈20N. (a) For C=1023 FLOPs, what N and D are compute-optimal? (b) How many tokens and how much compute does a compute-optimal 7B model need? (c) How much compute does a 70B model trained on 1.4T tokens use?