TL;DR
- The idea
- Pre-train deep bidirectional representations by conditioning on both left and right context in every layer.
- The trick
- Mask random tokens and predict them from context — so a deep bidirectional model never trivially sees the word it’s predicting.
- The result
- Eleven new state-of-the-art results, with GLUE pushed to 80.5% — a 7.7-point absolute jump.
- The legacy
- Rich unsupervised pre-training became a core component of language understanding — now deep and bidirectional.
Language models only read one way
Standard LM pre-training predicts the next word left-to-right — so it can never look ahead.
A language model is trained to predict the next token from the ones before it. That is fine for generation, but it hobbles transfer learning to tasks that need the whole sentence at once — question answering, entity tagging. The major limitation is that standard language models are unidirectional, and this limits the choice of architectures that can be used during pre-training.
The masked language model randomly masks some of the tokens from the input, and the objective is to predict the original vocabulary id of the masked word based only on its context.
Read both directions at once
BERT conditions on left and right context in every layer — the property it is built around.
BERT is designed to pre-train deep bidirectional representations from unlabeled text by jointly conditioning on both left and right context in all layers. That single design choice — bidirectional self-attentioninstead of a left-only mask — is what separates it from the prior generation of pre-trained Transformer models. The mechanism on the right of the hero shows it live: a hidden word is recovered from context on both sides.
Masking is what makes bidirectionality trainable
You can't train a deep two-sided model normally — a word would see itself. Masking removes it from the input.
The masked language model (a Cloze task) hides a fraction of tokens and asks the model to recover them. In all of our experiments, we mask 15% of all WordPiece tokens in each sequence at random. A twist keeps pre-training aligned with fine-tuning, where [MASK] never appears — click through the 80/10/10 rule below.
Click any word to hide it, then reveal what the model recovers. Because attention runs in both directions, the slot is filled from the words on its left and right.
When a token is chosen (15% of them)
The token is replaced with [MASK] — the usual case.
§3.1 · 15% masking rate§3.1 · 80/10/10 corruption
Next Sentence Prediction
A trivially generated binary label teaches the model how two sentences relate — which QA and inference need.
Alongside the masked LM, BERT is pre-trained to tell whether one sentence really follows another. 50% of the time B is the actual next sentence that follows A (labeled as IsNext), and 50% of the time it is a random sentence from the corpus. No annotation is required — the labels fall out of any monolingual corpus for free.
BERT vs GPT vs ELMo
BERT-BASE is sized to match GPT exactly — so the gains come from attention direction, not parameter count.
All three pre-train on text, but their connectivity differs. Critically, however, the BERT Transformer uses bidirectional self-attention, while the GPT Transformer uses constrained self-attention where every token can only attend to context to its left. The reported sizes are BERT-BASE (110M parameters) and BERT-LARGE (340M parameters), the two configurations behind every headline number.

Pre-train once, fine-tune anywhere
The same architecture and the same pre-trained parameters initialize every downstream task.
BERT is a two-phase recipe. Pre-training runs the masked LM and next-sentence tasks on unlabeled text; fine-tuning swaps in a small task-specific head and updates all parameters end-to-end. The encoder stack — and its weights — carry straight across.

The ablation that isolates bidirectionality
Hold data and setup fixed, swap only the objective — and watch token-level tasks collapse.
This is the experiment that pins the credit on two-sided attention rather than scale or data. Flip the metric to see which tasks feel the loss most.
Drop the mask, drop the score (Table 5)
Swapping the masked LM for a left-to-right objective — everything else held fixed — costs ↓ 10.7 here. The LTR model performs worse than the MLM model on all tasks, with large drops on MRPC and SQuAD.
Table 5 · Ablation over pre-training tasks
Eleven new states of the art — guess it first
Then see the full GLUE scoreboard, where even BERT-BASE beats every prior system on every task.
Before the reveal — what GLUE average did BERT-LARGE hit?
BERTLARGE, GLUE test average
GLUE test average (Table 1)
Table 1 · GLUE results
Both BERTBASE and BERTLARGE outperform all systems on all tasks by a substantial margin, obtaining 4.5% and 7.0% respective average accuracy improvement over the prior state of the art. BERT also works without fine-tuning: concatenating the top four hidden layers as frozen features lands within 0.3 F1 of fine-tuning the whole model.
Bigger keeps helping — even on tiny tasks
Drag through the six configurations: perplexity falls and accuracy rises the whole way up.
Larger models lead to a strict accuracy improvement across all four datasets, even for MRPC which only has 3,600 labeled training examples. With enough pre-training, extreme size pays off on small fine-tuning sets too — a result that was far from obvious at the time.
Model size · #L / #H / #A
24L / 1024H / 16A
Masked-LM perplexity
↓ 3.23
86.6
MNLI-m
87.8
MRPC
93.7
SST-2
The BERT-LARGE config — lowest perplexity, highest accuracy across the board.
Table 6 · Effect of model size
Five things to remember
Read both directions at once.
Standard LM pre-training is unidirectional; BERT conditions on left and right context in every layer, the property that unlocks token-level tasks like QA.
Bidirectional designThe unidirectional constraintBERT vs GPT attention
Masking is what makes bidirectionality trainable.
Mask 15% of WordPiece tokens and predict them from context — with an 80/10/10 corruption rule so [MASK] never leaks the pre-train/fine-tune mismatch.
Masked LM objective15% masking rate80/10/10 corruptionNext Sentence Prediction
New state of the art on eleven tasks.
GLUE lifted to 80.5% (+7.7 absolute), SQuAD v1.1 to 93.2 F1 — even BERTBASE, matched to GPT's size, beats every prior system on every GLUE task.
Headline resultGLUE average gainModel sizes
The ablation isolates deep bidirectionality.
Swap MLM for a left-to-right objective, hold everything else fixed, and token-level tasks collapse (SQuAD 88.5→77.8) — proof the gains come from two-sided attention.
Ablation: bidirectionalityScaling to small tasks
Rich pre-training is now core to NLU.
BERT works fine-tuned or feature-based (within 0.3 F1 frozen), and extends unsupervised pre-training from unidirectional to deep bidirectional architectures.
Feature-based BERTConclusion