Beam Search

Beam search is a heuristic search algorithm that uses the promising node in a limited set for exploring a graph.

Updated: October 12, 2023

Beam search is a heuristic search algorithm that uses the promising node in a limited set for exploring a graph. A breadth-first search algorithm is used by this technique to build a tree data structure and generate successors of  current state of each level.

Beam search is used by natural language processing (NLP) software applications and speech recognition models as a decision-making layer. The main goal is to choose the best output for target variables like maximum probability or next output character.

Tokens are selected by the beam search algorithm for a particular position in a sequence based on conditional probability. The beam width (β) is then adjusted to choose various hyperparameter n alternatives.

Beam search widens the search to explore possible fits for words in a sequence unlike greedy search. Beam stack search, Depth-first beam search, Local beam search, Stochastic beam search, Beam search using limited discrepancy backtracking (BULB) and Flexible beam search are different types of beam search.

A problem that can be either a graph or may contain a set of nodes representing a goal, heuristic rules and memory are three components of beam search. Reduced computation and improved suboptimal choices are the benefits of using beam search for solving optimization problems.

The disadvantage of using a beam search is users may not reach an optimal goal in the end and it can be incomplete due to its probabilistic nature.