Home▸AI & Machine Learning▸Program Synthesis Beam Search (2D)

🧩 Program Synthesis Beam Search (2D)

A 2D beam-search tree over a toy DSL: candidates are scored by a deterministic verifier, only the top-k survive each generation, and a side-by-side greedy (beam=1) run on the identical tree shows it get stuck below the brute-force optimum.

AI & Machine Learning2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-program-synthesis-beam-search ↗ Open standalone

This 2D companion runs the same beam-search mechanics as the 3D version — expand every candidate in the beam, score all children with a verifier, keep only the top-k — on a small, fully enumerable token tree so the pruning is countable and the outcome is checkable. A parallel greedy (beam width 1) run on the identical scored tree is shown next to it, and a brute-force search over every possible program confirms, level by level, whether the beam actually reached the true optimum and whether greedy really did get stuck.

⚙ Under the hood

A deterministic hash-based verifier scores every candidate token; real beam search expands, scores and prunes to the top-k each generation, while a side-by-side greedy (k=1) run and a brute-force ground truth show exactly where greedy gets stuck and whether the beam reached the true optimum.

Canvas 2DAIProgram SynthesisSearch AlgorithmsBeam Search

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

What did you find?

Add reproduction steps (optional)