Index Ai Academy
Glossary · Phase 5 · Transformers

Beam search

Also written: beam width

A way of choosing a model's output that keeps the few best partial sequences at every step, where greedy decoding keeps only one.

Try it now

Press Next three times. The lit boxes are what the beam keeps; the pale ones are thrown away.

Learn it properly

Beam search and constrained decoding · Why the likeliest word isn't the likeliest sentence, beam search with log probabilities, its taste for short and repetitive text, and forcing output into a grammar: what that guarantees and what it doesn't. About 40 minutes.

Other terms from the same lesson

  • constrained decoding: Blocking, at each step, every token that would break a required format, so that the output is certain to fit it.
  • length normalization: Dividing a sequence's log probability by its length, so that a search doesn't always prefer the shortest output.
Keep learning

More in plain English.

1286 terms in the glossary, each with the lesson that teaches it.

1286 terms

The glossary

Every word you'll meet in AI and machine learning, explained in everyday language.

Phase 5 · lesson 40 min

Beam search and constrained decoding

Why the likeliest word isn't the likeliest sentence, beam search with log probabilities, its taste for short and repetitive text, and forcing output into a grammar: what that guarantees and what it doesn't.

Never trained an AI? Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account. Teach it to write