How do we search for the best sequence in a sea of possibilities?
Image: Sora / OpenAI, Public domain, via Wikimedia Commons
How do we search for the best sequence in a sea of possibilities?
Imagine you're trying to find the perfect recipe for a new dish. You're experimenting with different ingredients and cooking times, but you want to avoid wasting time on bad combinations.
Beam search is like trying out recipes. You keep picking the best ones until you can't find any better, stopping before you exhaust all options.
Example
You try 5 recipes, then 3 more, and finally 2 more after noticing the first 8 aren't improving your dish.
Remember this
Beam search stops exploring once you can't find a better sequence, saving time and effort.
Text adapted from Wikipedia, licensed under CC BY-SA 4.0.
Greedy vs beam search decoding: greedy picks best token, beam maintains k candidates
Ever wondered why Google Search sometimes shows you the top results first?
Hierarchical navigable small world
HNSW is an efficient ANN search algorithm
weight tying does in language models: shares embedding and output projection matrices
Ever wonder how machines understand the sequence of words in a sentence?
Overlapping subproblems
Ever calculated a huge Fibonacci sequence by hand?
the Y combinator does: enables recursion in languages without named functions
Can a computer program call itself to solve problems?
batch size affects generalization: larger batches find sharper minima
Larger batch sizes lead to sharper minima, enhancing generalization by providing more accurate gradient estimates
Swipe through 100 ML concepts daily
Open Pocket Polymath