LinkedIn analytics tracking pixel for AIDOLS AI consulting website performance measurement
Models

Masked Language Model

A masked language model (MLM) is a model trained to predict tokens that have been hidden in the input, learning bidirectional context rather than left-to-right next-token prediction.

Full definition

BERT (Devlin et al., 2019) introduced the MLM objective: randomly mask 15% of tokens and train the model to recover them from surrounding context. Because attention is bidirectional, MLMs build representations informed by both left and right context — ideal for classification, named-entity recognition, and embedding generation. RoBERTa, DeBERTa, and modern embedding models use MLM-style pretraining. MLMs are not naturally generative; for generation, decoder-only autoregressive models dominate.

Why it matters

Most production embedding models in vector search are MLM-style encoders. Buyers selecting a retrieval stack should know whether the embedding model is MLM-pretrained (typical) or contrastively fine-tuned on top, since this drives semantic-search quality.

Example

BERT-base, fine-tuned on a regulatory-text dataset, classifies clauses as "data-processing" vs "liability-cap" with 94% F1 — a task where bidirectional context matters more than generation.

Source & further reading

Primary source: Devlin et al. — "BERT: Pre-training of Deep Bidirectional Transformers" (NAACL) (2019).

Citation policy: this entry is part of the AIDOLS AI Implementation Glossary and may be quoted for research, journalism, and education with attribution to aidolsgroup.com/sv/glossary/masked-language-model/.