masked language model

Masked Language Modeling (MLM) is a pretraining objective where random tokens in the input sequence are masked and the model learns to predict them based on bidirectional context, enabling BERT-style models to learn rich language representations. During training, typically 15% of tokens are selected for masking: 80% are replaced with [MASK] token, 10% with random tokens, and 10% unchanged. The model predicts the original tokens using context from both directions. MLM enables bidirectional pretraining unlike autoregressive language modeling which only uses left context. This bidirectional understanding makes MLM-pretrained models excellent for tasks requiring full context: classification, entity recognition, and question answering. MLM pretraining learns syntactic and semantic relationships, coreference, and world knowledge. Variants include whole word masking (masking complete words rather than subwords) and span masking (masking contiguous spans). MLM is the core pretraining objective for BERT, RoBERTa, and related encoder-only models. The approach revolutionized NLP by enabling effective bidirectional pretraining at scale.

Go deeper with CFSGPT

Get AI-powered deep-dives, save terms, and run advanced simulations — free account.

Create Free Account