Passer au contenu

Bitcoin accepté au paiement  |  Expédié depuis Laval, QC, Canada  |  Soutien expert depuis 2016

Masked Language Modeling

Sovereign AI

Definition

Masked language modeling (MLM) is a self-supervised pretraining task, popularized by BERT, in which some tokens of an input sentence are hidden and the model must predict the originals — essentially a "fill in the blanks" exercise over raw text. Because the model can use the words on both sides of a blank, it learns deeply bidirectional representations of language, and because the training labels come from the text itself, no human annotation is required. MLM is one of the two great pretraining recipes in modern NLP, standing opposite the next-token (causal) objective that powers generative chat models.

How BERT Does It

BERT randomly selects 15% of the tokens in each sequence. Of those, 80% are replaced with a special [MASK] token, 10% are swapped for a random word, and 10% are left unchanged. The model is then trained with a cross-entropy objective to recover the original token at each masked position, conditioning on the full surrounding context to the left and the right. That deliberately messy 80/10/10 mix matters: it keeps the model from over-relying on the literal [MASK] symbol, which never appears at inference time, and forces it to build a genuine contextual representation of every token rather than only the masked ones. Later encoder variants refined the recipe — dynamic masking, longer training, dropping auxiliary objectives — but the core fill-in-the-blank idea survived intact.

MLM vs Next-Token Prediction

The distinction from causal language modeling is architectural destiny. A causal model only ever sees leftward context, which is exactly what you want for generating text one token at a time. An MLM-trained encoder sees both directions at once, which makes it poor at open-ended generation but excellent at understanding: classification, named-entity extraction, semantic search, and producing sentence embeddings. That is why the encoder family still quietly powers most retrieval and ranking systems, even in an era dominated by decoder-only giants. When you embed documents for a local search index, odds are good the embedding model's ancestry runs through MLM pretraining.

Why It Matters for Sovereign Builders

MLM produces general-purpose language representations from nothing but raw text — no labels, no vendor, no API. The practical consequences are attractive for anyone who keeps their data at home. Encoder models trained this way are small by modern standards, typically ranging from tens of millions to a few hundred million parameters, so they fine-tune comfortably on a single consumer GPU and run inference on a CPU. You can take pretrained weights, continue MLM training on your own private corpus — repair manuals, firmware documentation, node logs — and get a model that speaks your domain's dialect without a single document leaving your hardware. From there, a small labeled set adapts it to search, classification, or extraction over that same private data.

Where It Fits in the Stack

MLM is a canonical example of self-supervised learning, and the representations it produces are sized by the model's embedding dimension. In a self-hosted retrieval pipeline, an MLM-descended encoder typically generates the dense vectors that techniques like Matryoshka embeddings and binary quantization then compress for fast local search. The lesson MLM taught the field — that structure hidden in unlabeled data is enough to learn language — is the same lesson that makes sovereign AI feasible at all: the raw material for a capable private model is text you already have, and the objective that unlocks it asks permission from no one.

The recipe has kept evolving since 2018 — later work showed higher masking ratios can work well, and modern encoder revivals pair the MLM objective with longer contexts and better data — but the practical guidance is stable: reach for an MLM-pretrained encoder when the job is understanding, ranking, or embedding text, and reserve generative decoder models for producing it. On modest hardware, the encoder is routinely the better tool per watt, which is exactly the accounting a self-hosted stack lives by.

In Simple Terms

Masked language modeling (MLM) is a self-supervised pretraining task, popularized by BERT, in which some tokens of an input sentence are hidden and the model…

Explore the Full Glossary

Browse all Bitcoin mining terms from A to Z. Whether you are a beginner or expert, deepen your understanding of the mining ecosystem.

Glossaire du minage

ASIC Miner Database

Compare 500+ miners with real-time profitability data, home mining scores, and detailed specs.

Comparer les mineurs