Beam Search
Decoding that keeps the k best partial sequences instead of one — search, not sampling.
Beam search expands the k highest-scoring partial sequences at each step and keeps the best continuations, approximating the most-likely overall sequence. It shines where there is a right answer (translation, speech) and underwhelms in open-ended generation, where it produces bland, repetitive text — which is why chat models sample with temperature/top-p instead.
Worked example: with beam width 4, decoding keeps the 4 highest-probability partial sequences at each step, expanding then re-pruning to 4 — trading compute for a higher-probability final sequence than greedy. Gotcha: beam search shines for short exact outputs (translation) but produces bland, repetitive text for open-ended generation, where sampling wins; wider beams also hit diminishing returns fast.