{"id":9519,"date":"2026-07-27T12:30:28","date_gmt":"2026-07-27T10:30:28","guid":{"rendered":"https:\/\/www.kubicek.ai\/?post_type=lexicon&#038;p=9519"},"modified":"2026-07-27T13:07:32","modified_gmt":"2026-07-27T11:07:32","slug":"beam-search","status":"publish","type":"lexicon","link":"https:\/\/www.kubicek.ai\/en\/lexicon\/beam-search\/","title":{"rendered":"Beam search"},"content":{"rendered":"<p class=\"wp-block-paragraph\"><strong>Beam search<\/strong> is a heuristic decoding algorithm that looks for a probable whole sequence in autoregressive models, rather than merely the most probable next token. The motivation is the short-sightedness of greedy decoding: the token that looks best at a given step may lead into a dead end from which every continuation only worsens the overall probability. Beam search therefore keeps several of the best partial variants at once \u2013 their number is the beam width \u2013 weighs the possible continuations of each at every step, and again retains only the best k of the resulting set according to the sum of log probabilities. Because longer sequences necessarily receive lower scores, length normalization is applied. The method is standard for tasks with one correct answer where fidelity matters \u2013 machine translation, speech transcription, summarization. For open-ended generation, by contrast, it proved unsuitable: the most probable text tends to be dull, generic and prone to repetition, because human speech is not an exercise in maximizing probability. There, sampling with temperature and nucleus sampling is used instead.<\/p>\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n<p class=\"wp-block-paragraph\">It is like planning a game of chess against a greedy opponent. The greedy player grabs the highest-value piece available on every move and is checkmated two moves later. The prudent player holds the three most promising lines in mind at once, extends each by one move, then again picks the best three out of nine. He does not calculate the whole game \u2013 nobody could \u2013 but he does not walk into a trap on the very first move either. For translation that is ideal. For telling a story, however, the prudent player writes desperately lifeless prose, because the &#8220;most probable&#8221; sentence is usually a cliche.<\/p>\n","protected":false},"featured_media":0,"template":"","class_list":["post-9519","lexicon","type-lexicon","status-publish","hentry"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.kubicek.ai\/en\/wp-json\/wp\/v2\/lexicon\/9519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kubicek.ai\/en\/wp-json\/wp\/v2\/lexicon"}],"about":[{"href":"https:\/\/www.kubicek.ai\/en\/wp-json\/wp\/v2\/types\/lexicon"}],"wp:attachment":[{"href":"https:\/\/www.kubicek.ai\/en\/wp-json\/wp\/v2\/media?parent=9519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}