Next Sentence Prediction (NSP)
Masked language modelling teaches a model a great deal about the words inside a sentence and nothing at all about whether two sentences belong together — yet question answering and entailment are both questions about a pair of texts. Next Sentence Prediction was the first attempt to pre-train that missing skill.
How it works
During BERT's pre-training, each example is two text segments joined by a [SEP] token and distinguished by segment embeddings. Half the time the second segment is the passage that genuinely followed the first; half the time it is a segment drawn at random from a different document. A binary classifier on top of the pooled [CLS] position predicts IsNext or NotNext. The labels cost nothing — the corpus itself provides them — so NSP rode along with masked language modelling at almost no extra expense.
Why it was dropped
- The task is too easy. A random segment from another document usually discusses something else entirely, so the model can win on topic mismatch without learning anything about discourse coherence.
- RoBERTa removed NSP, trained on full-length contiguous text instead, and matched or beat the original BERT on downstream tasks.
- ALBERT kept the shape but fixed the shortcut with sentence-order prediction: both segments are genuinely consecutive, and the model must say whether they were swapped — topic gives nothing away.
Why it matters
NSP is the clearest case study in objective design: a free, plausible-looking label that quietly teaches an easier skill than the one intended. Its architectural residue is still everywhere — segment embeddings and the [CLS] pooling that sentence-pair classifiers fine-tune — which is why reading the objective explains the input format of every BERT-style model you will load.
Next Sentence Prediction is the secondary pre-training objective of BERT: given two text segments, the model predicts from the pooled [CLS] position whether the second genuinely followed the first or was drawn at random from another document. The labels are free, which is why it was attractive. It was also solvable from topic mismatch alone, so RoBERTa dropped it and ALBERT replaced it with sentence-order prediction — a standard illustration of a pre-training objective teaching less than intended.
Imagine a reading exercise where you are given two paragraphs and asked whether the second one really came after the first, or was pulled from a completely different book. Do it enough times and you start to notice how writing hangs together.
That exercise is Next Sentence Prediction, one of the drills used to train early language-understanding models. The idea was to teach software not just about words, but about how sentences connect. It turned out to be too easy — a paragraph from another book is usually about another subject, so the software could pass by spotting the change of topic rather than understanding the flow. Later models replaced it with harder versions of the same exercise.