HomeMachine Learning & Neural NetworksBeam Search: Finding Good Sequences Without Brute Force

🔦 Beam Search: Finding Good Sequences Without Brute Force

Explore beam search, the decoding algorithm behind machine translation, speech recognition, and text generation that tracks several promising candidate sequences at once instead of greedily committing to one token at a time.

Machine Learning & Neural Networks3DModerate60 FPS
beam-search-decoding-lab ↗ Open standalone

The simulation visualizes beam search as a branching tree of candidate token sequences, showing how the algorithm expands every surviving beam at each step, scores all the extensions, and prunes back down to the top-k highest-scoring paths.

🔬 What It Demonstrates

The simulation visualizes beam search as a branching tree of candidate token sequences, showing how the algorithm expands every surviving beam at each step, scores all the extensions, and prunes back down to the top-k highest-scoring paths.

🎮 How to Use

Drag the beam width slider to change how many candidate sequences are kept alive at each step, then press play to watch the tree grow, get pruned, and converge on a final chosen sequence, comparing the result against pure greedy decoding.

💡 Did You Know?

Setting beam width k=1 makes beam search mathematically identical to greedy decoding, which is why greedy decoding is often described as simply the narrowest possible beam search.

⚙ Under the hood

Watch a search tree grow level by level while only the top-k highest-scoring beams survive pruning at every step.

beam searchdecodingsequence generationmachine translationmachine-learningnlp

3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)