Comparison
Beam Search vs Sampling
Beam Search and Sampling are both common AI/LLM terms but cover different ideas. Here is a quick side-by-side.
When you would reach for Beam Search
Beam Search comes up when the question is fundamentally about inference.
Translation systems with beam width 4-10.
When you would reach for Sampling
Sampling comes up when the question is fundamentally about inference.
OpenAI default: temperature 1.0, top-p 1.0.
Frequently asked
What is the difference between Beam Search and Sampling?
Beam Search: Beam search explores several candidate continuations in parallel, keeping the top-k partial sequences at each step. Common in translation; rare in modern LLM chat. Sampling: Sampling is the act of choosing the next token from the model's output distribution, typically after applying temperature and a truncation strategy like top-p or top-k.
When should I use Beam Search vs Sampling?
Beam Search is the right concept when you are focused on inference. Sampling applies when you are focused on inference.
Are Beam Search and Sampling the same thing?
No. Beam Search is inference; Sampling is inference. They are related but address different parts of the AI stack.