Masked Language Model: BERT's Bidirectional Secret

BERT's revolutionary Masked Language Model (MLM) pre-training objective, combined with the Transformer encoder architecture, allowed it to learn deep bidirectional representations by predicting masked tokens based on both left and right contexts.

The top 3

  1. Before BERT: How MLM Revolutionized NLP Pre-training: Prior to BERT, models like Word2Vec and GloVe learned context-independent word embeddings, while early language models such as GPT-1 were unidirectional, predicting the next word based only on preceding text. BERT's Masked Language Model (MLM) introduced a paradigm shift by enabling deep, bidirectional contextual understanding, forcing the model to infer masked words from both left and right contexts.
  2. BERT's Bidirectional Edge: MLM vs. Unidirectional LMs: Unlike traditional language models that process text sequentially in one direction (e.g., left-to-right), BERT's Masked Language Model simultaneously considers both left and right contexts for masked tokens, enabling a deeper, more comprehensive contextual understanding.
  3. BERT's Masking: The 15% Secret and Its Randomness: BERT's MLM masks 15% of input tokens, but only 80% of those are replaced with [MASK]. The remaining 20% are split: 10% replaced by a random word and 10% kept unchanged, preventing pre-training fine-tuning mismatch.

Sources

Open the full topic