NLP Foundations
Neural Text Degeneration
The umbrella diagnosis behind most decoding research, why decoders that maximise sequence probability produce measurably worse text than decoders that sample from the model's actual distribution.
intermediate · 8 min read · Premium
"The model sounds robotic" and "the model keeps repeating itself" are usually not model problems at all. They are decoding problems, specific, well-studied, and named. Holtzman et al., 2019, in "The Curious Case of Neural Text Degeneration," gave the phenomenon its name and its first rigorous diagnosis: text generated by maximisation-based decoders, greedy-decoding and beam-search, is measurably, quantifiably worse than either human-written text or text sampled from the model's own distribution, despite having higher probability under the model. This concept is the underlying diagnosis that nucleus-sampling-top-p, min-p-and-typical-sampling, and repetition-penalty were each built to treat.
The paradox, stated precisely
A well-trained language model assigns high probability to fluent, plausible text; that is what training on next-token prediction optimises for (see next-token-prediction-cross-entropy). It is natural to assume, then, that the highest-probability continuation is also the best continuation, and that a decoder which searches harder for high-probability sequences (beam search over greedy) should produce better text. Holtzman et al. show this intuition is wrong for open-ended generation. As beam width increases, and as decoding leans harder into maximisation, output quality by human judgement does not improve monotonically, it degrades: text becomes more repetitive, more generic, and measurably less like human text on distributional statistics, even as its probability under the model climbs.
The evidence: three distinct symptoms
The paper documents this with several concrete measurements, not just a qualitative impression.
Repetition. Maximisation decoders fall into self-reinforcing loops: once a phrase is produced, the context that contains it makes reproducing that phrase the (locally) highest-probability continuation again, with no mechanism to break out (see greedy-decoding for the mechanics of why). The paper shows this quantitatively via repeated n-gram counts, which are dramatically elevated in beam-search output relative to human text.
Probability concentration mismatch. The paper compares the per-token probability the model assigns to its own generated tokens against the probability it assigns to the actual next token in human-written text. Human text is not simply "the most likely word every time"; the per-token probability trace of real text zigzags, is sometimes highly predictable, sometimes genuinely surprising. Maximisation decoding produces a probability trace that stays implausibly high and flat throughout, which is itself a statistical fingerprint distinguishing machine text from human text, and a giveaway that the generation process, not the model's underlying knowledge, is the source of the unnaturalness.
Boring, generic content. Independent of repetition, maximisation-decoded text skews toward safe, high-frequency, low-information phrasing, because generic continuations are, definitionally, the ones many training documents agree on and therefore assign consistently higher probability to. Sampling from the actual distribution, properly truncated (see nucleus-sampling-top-p), recovers some of the specificity and variation that maximisation systematically discards.
Why sampling helps, and why unrestricted sampling doesn't
The naive fix, sample directly from the model's untruncated distribution instead of maximising, trades one failure mode for another. Ancestral sampling at T=1 with no truncation samples from the full long tail of the vocabulary, including tokens the model assigns only a sliver of probability to precisely because they are genuinely poor continuations. Over a long enough generation, sampling from that tail even occasionally is enough to derail the sequence into incoherence, since each token conditions on everything before it, and one bad token corrupts the context for every subsequent step.
Keep reading with Pro.
You're reading the preview. Unlock the full concept plus the library, study plans, the AI mentor, and daily emails.