The BERT Lesson: Reusable Context Has a Price

This series began with a concrete problem: language tasks often need context from both directions, yet a model trained to predict text from left to right cannot use future words when it builds each representation. BERT's answer is a complete transfer system, not one isolated trick. The final judgment is therefore about where complexity sits: BERT makes rich contextual representations reusable across tasks, but it pays for that reuse through pretraining data, computation, sequence-length limits, adaptation choices, and careful evaluation.

One causal chain, not a collection of tricks

BERT is easiest to understand as a chain of constraints and responses. A left-to-right language model is well matched to generation, but it restricts the context available to a token-level understanding task. Building a separate architecture for every downstream problem can recover some of the missing structure, but it weakens the promise of a general representation. BERT changes the boundary: it learns a bidirectional representation from unlabeled text first, then lets a task-specific output layer turn that representation into a particular decision.

The first link is the encoder. BERT uses a multilayer Transformer with self-attention that is not restricted to earlier positions. Each token representation can use information from both sides of the packed input, and the interaction is repeated across layers. This is why BERT's bidirectionality is deeper than concatenating a left-to-right feature with a right-to-left feature at the end. The representation that reaches a task head has already been shaped by interactions among the positions that the task placed into the same sequence.

The input format determines which positions can interact. A single text can be packed as one sequence. A pair can be separated with [SEP] and marked with segment information. A question and passage can therefore enter the same encoder before a question-answering head scores possible passage spans. The format preserves token identity, position, and segment membership, while self-attention allows information to cross the segment boundary. The encoder is not deciding the final task label yet; it is creating a shared contextual space in which different task heads can operate.

The second link is the learning signal. A bidirectional model cannot simply be shown every target token and asked to predict it, because the answer would be visible. Masked language modeling hides or alters 15% of WordPiece positions and asks BERT to recover the original token from the remaining context. The 80/10/10 treatment of selected positions reduces the dependence on the [MASK] symbol, which will not normally appear during fine-tuning. The objective therefore creates two conditions at once: the target is hidden enough to prevent a direct copy, and the rest of the sequence remains available in both directions.

Next sentence prediction supplies a different signal. Half the paired examples use the actual next span from the corpus and half use a random span. The [CLS] representation is trained to distinguish IsNext from NotNext. This does not make the representation a complete model of discourse, and the paper warns that [CLS] is not automatically a meaningful general sentence representation before fine-tuning. It does, however, give the shared encoder a pretraining task that explicitly involves the relationship between two text spans.

The two objectives divide the learning problem. MLM pressures token-level representations to use surrounding evidence to recover missing content. NSP pressures a sequence-level representation to support a binary judgment about a pair. Neither objective is the whole of language understanding. Together, in the paper's setup, they give BERT a reason to encode both what appears at a position and how spans are related.

The result of pretraining is a reusable checkpoint, not a completed application. The checkpoint contains the parameters that learned from BooksCorpus and English Wikipedia through the two objectives.