Beam search generates an output step by step while retaining a limited group of high-scoring partial sequences. At each step it extends those candidates and keeps the strongest ones, rather than committing immediately to a single path or sampling freely from many possibilities.
Keeping multiple candidates can improve the final result for some tasks, including choosing item sequences for recommendations. It also requires more computation than a simpler one-path method, so accuracy gains must be weighed against latency and the needs of the application.
ELI5
Beam search lets an AI system consider a few possible answers at once as it builds a longer answer. It keeps the most promising paths and drops others along the way.
For example, when suggesting the next songs in a playlist, the system can keep several possible sequences until it has enough information to choose one. Checking more paths can take longer.
Is beam search the same as random sampling?
No. Beam search keeps high-scoring partial sequences, while sampling deliberately chooses among possible next steps using a probability rule.
Why might beam search be slower?
It evaluates several candidate paths at each step instead of following just one, which requires additional computation.

