Paper commentary
The Curious Case of Neural Text Degeneration
Nucleus sampling cuts the unreliable tail to fix neural text degeneration
- Problem Beam search gives bland, repetitive text, while pure sampling drifts into incoherence. Neither gives good open-ended generation from a language model.
- Method Nucleus Sampling keeps the smallest set of most probable tokens whose probabilities sum to at least p. It renormalizes that set and samples from it, so the unreliable tail is cut while the set size adapts to each step.
- Results Nucleus Sampling with p=0.95 reached a HUSE score of 0.97, the highest in the comparison. Its perplexity of 13.13 is close to the 12.38 of human text.
Why the most probable continuation reads poorly
Language models give high scores to well-formed text, so one might expect that searching for the most probable continuation would also give the best output. In practice, beam search with a width of 32 on GPT-2 Large, continuing a unicorn news context, falls into a loop that repeats a university name. The term degeneration covers output that is dull, incoherent or trapped in repetition.
The authors argue this is not simply a search failure. Natural text has a lower per-token probability than beam output, and people rarely stay in a high-probability zone for several steps in a row. Human text also avoids repetition loops, even though the model assigns high probability to such loops.
They also note that informative language is disfavored when every word is made as predictable as possible, so training larger models with per-word objectives is unlikely to close the gap alone.
Why pure sampling and fixed truncation both fall short
Pure sampling, which draws directly from the probabilities the model predicts, avoids loops but produces text that is incoherent and nearly unrelated to the context. The authors trace this to the unreliable tail, a set of tens of thousands of candidates with low individual probability that together receive a substantial share of the mass.
Top-k sampling cuts that tail by keeping a fixed number of candidates, but no single k fits every context. Where the next-token distribution is flat, many reasonable options lie outside a small k, so generations risk becoming bland. Where it is peaked, a large k admits inappropriate candidates whose probabilities grow after renormalization.
Temperature sampling reshapes the distribution so that high-probability tokens gain mass and the tail loses it. Lower temperatures improve quality but reduce diversity, so the trade-off does not remove the underlying problem.
How the nucleus is chosen and renormalized
Given the next-token distribution \(P(x|x_{1:i-1})\), the top-p vocabulary \(V^{(p)} \subset V\) is the smallest set whose probabilities sum to at least p, as in the following condition. \[ \sum_{x \in V^{(p)}} P(x \mid x_{1:i-1}) \ge p \] Selecting the highest-probability tokens until their cumulative mass reaches p gives a set whose size changes with the shape of the distribution at each step.
Let \(p' = \sum_{x \in V^{(p)}} P(x|x_{1:i-1})\). The kept probabilities are divided by \(p'\) and all other tokens receive zero, so the sampling distribution sums to one. \[ P'(x|x_{1:i-1}) = P(x|x_{1:i-1})/p' \text{ if } x \in V^{(p)}, \text{ and } 0 \text{ otherwise.} \] Since \(p'\) is at least p by construction, the division only redistributes the mass that was kept.
A flat distribution yields a large candidate set and a peaked one yields a small set.
Top-k also truncates and renormalizes, and it differs only in where the cut is placed. The top-k vocabulary is a set of size k that maximizes the summed probability. In top-k, the scaling factor \(p'\) can vary widely from step to step, whereas nucleus sampling fixes a lower bound on it through p.
Model, data and generation settings
The likelihood analyses use GPT-2 Large with 762M parameters, a Transformer trained on WebText, a web-scraped collection of about 40GB. Each decoding setting produces 5,000 text passages, which stop at an end-of-document token or at a maximum of 200 tokens. Each passage is conditioned on the opening paragraph of a held-out WebText document, limited to 1 to 40 tokens.
The Self-BLEU analysis draws a subsample of 1000 generations, and each one is scored against the other 4999 generations as references.
Perplexity compared with human text
Perplexity is computed under the model that generated the text, and the authors treat a value close to human text as the target rather than a lower value. Pure sampling reached 22.73, well above the 12.38 of human text, which the authors read as the model confusing itself by drawing many unlikely tokens.
Among the stochastic decoders in Table 1, nucleus sampling with p=0.95 is closest to human text at 13.13. Top-k with k=640 gives 13.82, sampling with t=0.9 gives 10.25, and top-k with k=40 gives 6.88. Greedy decoding and beam search with width 16 reach perplexities of 1.50 and 1.48, which are far below the human value, and they are deterministic rather than stochastic.
Figure 6 shows that sampling and top-k can be tuned to human-level perplexity, but the authors note that both face coherence issues at those settings, while nucleus sampling can be calibrated to human perplexity without that cost.
Diversity from Zipf and Self-BLEU statistics
The Zipf coefficient is compared with an ideal value of 1, and human text scores 0.93 in Table 1. Pure sampling, at 0.93, matches the human value most closely, followed by nucleus sampling at 0.95. The authors note that pure sampling slightly overuses rare words, which may explain its higher perplexity.
On Self-BLEU4, human text scores 0.31 and nucleus sampling with p=0.95 scores 0.32, close to human text. Top-k with k=640 scores 0.32, top-k with k=40 scores 0.39, and pure sampling scores 0.28. Because lower Self-BLEU means higher diversity, the top-k value of 0.39 indicates less diversity than human text.
The authors note that top-k needs high values of k to match human statistics, and that such values bring high variance in likelihood and hint at incoherence. Nucleus sampling matches reference perplexity by tuning p instead.
Repetition across decoders
Greedy decoding has a Repetition % of 73.66, and beam search with width 16 has 28.94, against 0.28 for human text. Nucleus sampling with p=0.95 gives 0.36, top-k with k=40 gives 0.78, and pure sampling gives 0.22.
Figure 9 shows that nucleus sampling and top-k have the least repetition over reasonable parameter ranges, while temperature sampling repeats more unless the temperature is very high.
Beam search becomes less repetitive as the beam width grows, but the authors attribute this largely to shorter average generations, not to better text.
How HUSE combines human and statistical judgement
Truncation gives zero probability to most candidate tokens, so applying HUSE directly to top-k and nucleus outputs gave scores near zero. The authors instead interpolate the original distribution with the truncated one using mass 0.1 when generating text for HUSE.
Each decoding algorithm has 200 generations annotated for typicality, with 20 annotators per generation, which gives 4000 annotations per decoding scheme. The discriminator is a KNN classifier with k = 13 neighbors, chosen because it gave higher discrimination accuracy.
Nucleus sampling with p=0.95 gets the highest HUSE score, 0.97, followed by top-k with k=640 at 0.94. Pure sampling reaches 0.67, sampling with t=0.9 reaches 0.79, and top-k with k=40 reaches 0.19. The interpolation applies to the truncated decoders, so these HUSE values are not computed on the truncated distributions themselves.
The qualitative examples agree with this ranking: beam search gets stuck in a loop, full sampling invents the word umidauda, and nucleus sampling drifts from whales to birds. Top-k combined with a temperature of 0.7 devolves into repetition.
Limits of the evidence
The likelihood and diversity analyses use GPT-2 Large alone, and the Figure 1 observation about stopping at larger beam widths is the only place the XL model appears.
HUSE for the truncated decoders is computed on an interpolated proxy with mass 0.1, so those scores describe a smoothed variant rather than the truncated distribution. Human judgements cover 200 generations per algorithm, each annotated by 20 annotators.
The falling beam search repetition with width is confounded with shorter generations, so the width trend cannot be read as improved quality. Self-BLEU is estimated from 1000 of the 5,000 generations, not from the full set.
The experiments concern open-ended generation. Directed tasks such as machine translation and summarization are described as background and were not evaluated.
Paper info
- Authors
- Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, Yejin Choi
- Venue
- arXiv · Preprint
- First published
- 2019-4-22
- Added
- 2026-11-12
- Updated
- 2020-2-14
- Version
- v2
- arXiv
- 1904.09751
- Category
- cs.CL
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, Yejin Choi (2019). The Curious Case of Neural Text Degeneration. arXiv:1904.09751v2. https://arxiv.org/abs/1904.09751v2
BibTeX
@misc{holtzman2019curious,
title = {{The Curious Case of Neural Text Degeneration}},
author = {Ari Holtzman and Jan Buys and Li Du and Maxwell Forbes and Yejin Choi},
year = {2019},
eprint = {1904.09751},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1904.09751v2}
}