Greedy decoding, and why the highest-probability token is not the goal
The simplest rule: take argmax(logits). Deterministic, free, and reproducible.
It has two distinct problems, and they are worth separating.
It is locally greedy. The most likely first token may lead into a region of low-probability continuations. The sequence "The" → "cat" might have higher joint probability than "A" → "cat", but if P(A) > P(The) greedy commits to "A" and never looks back. This is the standard search critique, and it motivates beam search.
It produces degenerate text. This one is more surprising and more important. Greedy output on open-ended prompts falls into loops — repeating a phrase, then a sentence, then a paragraph, indefinitely. Not occasionally: reliably. Holtzman et al. documented this carefully in 2019, and the mechanism is a positive feedback loop. A repeated phrase raises the model's estimate that it is in a repetitive context, which raises the probability of repeating again.
The deep point is that high probability is not the objective. Human text is not the most likely text under a language model. Holtzman's Figure 2 is the memorable evidence: the per-token probability of real human writing fluctuates wildly, dipping low constantly, while beam-search output sits at a consistently high probability. Real language is full of surprise — that is what makes it informative. A decoder that maximizes likelihood systematically strips the surprise out.
Where greedy is still right:
- Reproducibility matters — evaluation, regression tests, debugging.
- The output space is narrow — extraction, classification, format conversion. If there is one correct answer, sampling can only hurt.
- Speculative decoding verification — the target model's greedy choice defines acceptance.
Where it is wrong: anything open-ended. Creative writing, dialogue, brainstorming, and — perhaps counterintuitively — long chains of reasoning, where a little diversity helps escape a bad line of argument.
REMEMBERGreedy is locally optimal and globally arbitrary: picking the best token at each step does not produce the best sequence.