Beam search is a heuristic search algorithm that expands the most promising node in a limited set for exploring a graph. This technique uses a breadth-first search algorithm to build a tree data structure and generate successors of each level's current state.
Natural language processing (NLP) software applications and speech recognition models use beam search as a decision-making layer. The goal here is to choose the best output for target variables like next output character or maximum probability.
The beam search algorithm selects tokens for a particular position in a sequence based on conditional probability. It adjusts the beam width (β) to choose various hyperparameter n alternatives.
Unlike greedy search, beam search widens the search to explore possible fits for words in a sequence. Beam search gets its name from how the algorithm casts a wide search beam.
Beam search has different variants, depending on the algorithm in use, such as depth-first search (DFS), limited discrepancy search, and memory-based search.
Beam search has three components:
Beam search attempts to find the optimal complex in a heuristical way. The benefits of using beam search for solving optimization problems are:
The main disadvantage of using a beam search is that users may not reach an optimal goal in the end. Most beam search algorithms terminate in two scenarios: either the user has yet to reach a goal node and there's no node left to be explored, or has reached the required goal node.
Moreover, beam search can be incomplete due to its probabilistic nature. Despite these disadvantages, beam search algorithms have seen success in speech recognition, vision, planning, and machine learning.
Beam search has multiple uses in machine translation systems, NLP, and speech recognition. Large systems with insufficient memory to store the entire search tree frequently turn to beam search to remain manageable.
Neural machine translation (NMT) systems use beam search to choose the best translation and process each part. They keep the best translations with the right sentence structures and discard the rest. The translator then checks the translations and picks the best one that meets the goals. In 1976, Carnegie-Mellon University’s Harpy Speech Recognition System was the first to use a beam search.
A greedy search follows the problem-solving heuristic to build a solution gradually, one step at a time. The system prioritizes selecting the next piece that provides clear and immediate advantages. Greedy algorithms work best for problems where it’s important to choose locally optimal solutions.
Beam search optimizes best-first search to reduce memory requirements.
Both greedy and beam searches use sequence-to-sequence models to generate sequence outputs or tokens from a neural network. However, the former evaluates each position independently, and the latter considers more than one at a time.
Best-first search is a graph search technique that sorts and orders partial solutions based on heuristics. However, beam search considers a predetermined number of best partial solutions as candidates. That’s why beam search is treated as a greedy algorithm.
Looking to interpret data in a digestible manner? Explore the best natural language generation (NLG) software for processing data sets.