Why it matters

Greedy is the baseline. Knowing its behavior explains why sampling and beam search exist and when to use them.

Advertisement

The architecture

At each step: compute logits, pick argmax, generate that token.

Equivalent to temperature=0 or top-k=1.

Greedy decodingCompute logitsfor next tokenPick argmaxhighest probRepeatuntil doneFast and deterministic but often suboptimal for open-ended tasks
Greedy loop.
Advertisement

How it works end to end

Determinism: same prompt → same output. Useful for reproducibility, testing.

Speed: no sampling overhead. Fastest possible generation.

Limitations: can miss globally better sequences; prone to repetition.