Masked Language Modeling

Also known as: MLM

Category: NLP / Language Processing

A pre-training objective where random tokens in the input are replaced with a mask token, and the model learns to predict the original tokens from the surrounding context.

Full Explanation

Masked language modeling (MLM) is the primary pre-training objective used by BERT and its variants. During training, approximately 15% of input tokens are selected for prediction: 80% are replaced with a [MASK] token, 10% are replaced with a random token, and 10% are left unchanged. The model then predicts the original tokens using bidirectional context from both left and right. This approach enables rich bidirectional representations since every token can attend to every other token. MLM is well suited for producing encoder representations used in classification, NER, and other understanding tasks. However, the mismatch between pre-training (with [MASK] tokens) and fine-tuning (without masks) is a known limitation. Variants like whole-word masking and span masking have been proposed to improve MLM training.

Related Terms

More in NLP / Language Processing

Explore More

  • AI Tools Library — Discover AI tools related to Masked Language Modeling
  • AI Education — Courses to learn about NLP / Language Processing
  • AI News — Latest news and updates