IT lexicon › AI & ML › Beam search (LLM)

Beam search (LLM)

AI & ML På svenska → Updated: 2026-05-29

A decoding strategy that keeps several candidate sequences ("beams") alive in parallel and extends them step by step, to find the overall most likely complete sequence — not just the greedy word at each step. Common in machine translation, less so in creative chat models.

The problem it solves: greedy decoding (always pick the most likely next word) can paint itself into a corner — a locally good choice leads to a worse whole. Beam search keeps the B most promising partial sequences at each step, extends them all, and keeps the B best again → it explores several paths and finds a sequence with higher total probability. Win: good for tasks with a "right" answer (translation, summarization). Downside: for open/creative generation it often gives dull, repetitive, generic text (the most likely sequence is rarely the most interesting) → which is why chat models prefer sampling (temperature/top-p). A classic choice between maximizing probability and letting it vary. Related to nucleus sampling and greedy decoding.

← Back to the lexicon