Skip to content
Query Feedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  • News
  • Business
    • Digital Marketing
      • Marketing & Sales
      • SEO
      • Content Marketing
      • AEO and GEO
    • Startups
      • Founder Stories
      • Funding & VC
      • Product & Growth
    • Money
      • Investing
      • Markets & Economy
      • Saving & Budgeting
  • AI & Technology
    • Technology
      • Consumer Tech
      • CRM
      • Cyber Security
      • Software Engineering
      • WordPress
      • Hardware
    • Artificial IntelligenceAI Glossary
      • LLMs
      • Machine Learning
      • AI Fundamentals
      • Generative AI
      • Deep Learning
    • AI Use Cases
      • Automation
      • Content
      • Customer Support
      • Finance
      • Marketing
      • View All
  • Tools & Software
  • Account
    • Submit Guest Post
    • Submit a tool
    • My listing
  • Contact
QueryFeedz
  1. Home /
  2. AI Glossaries /
  3. LLMs /
  4. What is Masked Language Modeling?
LLMs

What is Masked Language Modeling?

Updated September 26, 2026 Read 3 min

Masked language modeling (MLM) is a training method where random tokens in a text are hidden and the model learns to predict them using context from both sides. It is the objective behind BERT and similar encoder models.

Contents 11
  1. 01Key takeaways
  2. 02Masked language modeling explained in simple terms
  3. 03How MLM training works
  4. 04A worked example
  5. 05MLM vs causal language modelling
  6. 06Variants
  7. 07Where MLM models are still used
  8. 08Limitations
  9. 09Common Use Cases
  10. 10Frequently Asked Questions
  11. 11Related Terms

Masked language modeling (MLM) is a training objective in which random tokens in a text are hidden and the model learns to predict them using the words on both sides. Because the model sees left and right context, it builds rich bidirectional representations. MLM is the objective behind BERT (2018) and many encoder models used for classification and embeddings.

Key takeaways

  • MLM is a form of self-supervised learning: the text provides its own labels.
  • BERT masked about 15% of tokens in each sequence.
  • Bidirectional context makes MLM strong for understanding tasks.
  • It is not designed for text generation, unlike causal language modelling.
  • Variants include whole-word masking and span masking.

Masked language modeling explained in simple terms

It is a fill-in-the-blanks exercise. Take the sentence “The train to Mumbai leaves at ___ o’clock” and the model must guess the missing word. To do well, it must understand grammar, context and meaning from both sides of the gap. Repeat across billions of sentences and the model develops a deep sense of how language works.

How MLM training works

  1. Take a text sequence from the training data.
  2. Randomly select about 15% of the tokens.
  3. Replace them according to BERT’s scheme: 80% become a special [MASK] token, 10% become a random token and 10% are left unchanged.
  4. The model predicts the original token at each selected position.
  5. Cross-entropy loss measures the error only at those positions.

The 80/10/10 rule exists because the [MASK] token never appears when the model is later used on real text. Mixing in random and unchanged tokens forces the model to build good representations everywhere, not just at masks.

A worked example

Input: “QueryFeedz publishes articles about [MASK] and startups.”

The model considers the surrounding words. “Publishes articles” suggests a topic noun; “and startups” suggests a related domain. It may predict “technology” with high probability, “business” next, and unrelated words with very low probability. The error between its prediction and the true word updates the weights.

MLM vs causal language modelling

AspectMasked LMCausal LM
Context availableBoth sidesLeft only
Tokens predicted per sequenceAbout 15%Every token
Data efficiency per passLowerHigher
Text generationWeakStrong
Typical useClassification, search, embeddingsChat, writing, code
ExamplesBERT, RoBERTa, DeBERTaGPT-style LLMs

Variants

  • Whole-word masking: hide all subword pieces of a word together, which makes the task harder and more realistic.
  • Span masking: hide contiguous spans, as in SpanBERT and T5’s approach.
  • Replaced token detection: ELECTRA trains the model to spot which tokens were replaced, learning from every position.
  • Masked image modelling: the same idea applied to image patches.

Where MLM models are still used

Encoder models trained with MLM remain popular for text classification, named entity recognition, reranking search results and producing sentence embeddings. They are small, fast and cheap compared with generative LLMs, which matters at high volume.

Limitations

  • Cannot generate fluent text on its own.
  • Learns from only a fraction of tokens per pass, so training is less data-efficient.
  • A mismatch exists between training, which uses masks, and real use, which does not.
  • Less able to follow instructions than modern instruction-tuned LLMs.

Common Use Cases

01

Text classification

Power sentiment, intent and topic classifiers.

02

Named entity recognition

Extract names, places and organisations from text.

03

Search reranking

Score how well documents match a query.

04

Sentence embeddings

Generate vectors for semantic search and clustering.

05

Spelling and grammar tools

Predict likely corrections from surrounding context.

06

Domain adaptation

Continue MLM training on industry text before fine-tuning.

Frequently Asked Questions

A training method where random tokens are hidden and the model predicts them using context from both sides.

BERT and its successors such as RoBERTa and DeBERTa.

About 15% of tokens in each sequence.

To reduce the mismatch between training with [MASK] tokens and real text, which contains none.

Not fluently. They are built for understanding tasks; causal models are used for generation.

Related Terms

  • Causal Language Model
  • Encoder
  • Self-Supervised Learning
  • Pretraining
  • Embedding
  • Cross-Entropy Loss

Related AI Terms

What is an Attention Head?An attention head is a single attention unit inside a transformer layer, with its own query, key and…What is Prefix Tuning?Prefix tuning is a parameter-efficient fine-tuning method that learns trainable vectors inserted into the attention keys and values…What is an Attention Mechanism?An attention mechanism is a technique that lets a neural network focus on the most relevant parts of…What is Self-Attention?Self-attention is a mechanism where each position in a sequence attends to every other position in the same…What is Multi-Head Attention?Multi-head attention runs several attention operations in parallel, each with its own learned projections, so a model can…What is RoPE (Rotary Positional Embedding)?RoPE (rotary positional embedding) encodes a token's position by rotating its query and key vectors by an angle…

Contents

  1. 01Key takeaways
  2. 02Masked language modeling explained in simple terms
  3. 03How MLM training works
  4. 04A worked example
  5. 05MLM vs causal language modelling
  6. 06Variants
  7. 07Where MLM models are still used
  8. 08Limitations
  9. 09Common Use Cases
  10. 10Frequently Asked Questions
  11. 11Related Terms

AI Topic

  • LLMs

Related Terms

  • What is an Attention Head?
  • What is Prefix Tuning?
  • What is an Attention Mechanism?
  • What is Self-Attention?
  • What is Multi-Head Attention?
  • What is RoPE (Rotary Positional Embedding)?

Quick Navigation

  • Common Use Cases
  • Frequently Asked Questions
  • Related Terms
  • Back to top

Details

Updated
September 26, 2026
Read
3 min
  • Forum
  • Submit a tool
  • Submit Guest Post
  • List Your Startup
  • Privacy Policy
  • Editorial Policy
  • Account
  • Contact
  • AI Productivity
  • AI Video
  • AI Coding
  • AI Chatbots
  • Sales
  • AI Business
  • View All Tools

Subscribe our Newsletter

Get weekly exclusive content - No spam.

Copyright © 2026 -  Query Feedz

Manage Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
  • Manage options
  • Manage services
  • Manage {vendor_count} vendors
  • Read more about these purposes
View preferences
  • {title}
  • {title}
  • {title}