Skip to main content
Workbench
generate

Algorithm Evolution

Several proposers write heuristics for one small optimisation problem in a closed DSL; the simulator scores every one, the fittest survive, and the proposers are asked again with the survivors in front of them. Quantinuum’s Hive loop, cut down to a budget you can watch.

Fitness curve and lineage

Fitness 1.0 is cut 6 of 6 edges. Faded nodes survived unchanged from the previous column; a teal ring means the challenge grader passed it. Colours by proposer: seed, mutation.

Run the search, then pick any node in the tree or any row in the list.

Nothing has run yet.

What this tool does

Pick a problem, set a population and a number of generations, and run. Generation 0 is the hand-written seeds plus mutations of them. Every later generation keeps the top few candidates unchanged, shows them to each ticked model with the grammar and the scores, and admits whatever comes back that parses; the built-in operator — random perturbation of the elites, driven by the seed — fills any slot the models leave empty. Every admitted candidate is executed on the statevector simulator and scored: for MaxCut, the expected cut of a QAOA state or the cut a local search reaches, divided by the brute-forced optimum; for the GHZ challenge, one minus the distance to the target distribution, with the real challenge grader confirming a pass.

Watch the solid curve: it can only rise, because survivors are kept. Watch the dashed mean: it tells you whether the proposals are getting better as a group, or whether one lucky candidate is carrying the run. In the tree, a node with many descendants is a heuristic the loop found worth varying; a faded node survived without being improved on.

What this tool does not do

Hive edits real Guppy and CUDA-Q source with a swarm of frontier models and executes it on Quantinuum hardware and simulators; the candidates are programs in the ordinary sense. Here a candidate is a few lines of a closed DSL — cost and mixer angles, an annealing schedule, a local-search recipe, or a short gate list — that this page parses and interprets. No model output is ever run as code; a line the grammar does not recognise rejects the candidate, and the rejection is listed under its generation. That is the sandbox, and it is also the ceiling: the search can find a better schedule, not a new algorithm.

The budget is the whole story at this scale. At most 12 candidates for 12 generations on graphs of six or seven nodes, where the optimum is known by exhaustion. Fitness 1.0 on these problems is not an achievement; it is the ceiling. The point is to see the loop — propose, execute, select, repeat — and to read the lineage of a survivor back to the seed it came from.

The grammar every proposer must follow

Everything a candidate can be is below. Angles are radians and may be written as pi/4; comments start with #. This problem accepts qaoa and classical programs.

qaoa
# one line per operation, in order. Angles in radians, |angle| <= 2π.
cost <gamma>            # apply exp(-i·gamma·C) for the MaxCut cost C
mix x <beta>            # transverse-field mixer: RX(2·beta) on every node
mix xy <beta>           # XY ring mixer: exp(-i·beta·(XX+YY)/2) on ring pairs
anneal <p> <gamma> <beta>   # p layers: gamma·k/p then beta·(1-(k-1)/p), k=1..p
# at most 12 cost/mix layers in total. Start state is |+…+⟩.
classical
# a deterministic local-search heuristic for MaxCut.
start zeros | alternate | greedy | random <seed>
sweep <passes>          # best-improvement single-node flips, up to <passes> passes
kick <flips> <seed>     # flip <flips> nodes chosen by <seed>, keep only if a later sweep improves
# exactly one start line first, then at most 20 steps.

Where the physics is checked

The QAOA interpreter is tested against the closed form for depth-one QAOA on triangle-free graphs: on a four-node ring, ⟨C⟩ = 2 + sin 4β · sin 2γ, so γ = π/4, β = π/8 gives exactly three of four edges. The XY mixer is checked to conserve Hamming weight, the cost layer to change no probability on its own, the local search to gain exactly two edges per flip from the all-zeros split of a ring, and the GHZ reference circuit to pass the same grader the challenge page uses. Those tests live in lib/workbench/evolve.test.ts, next to the tests that prove a malformed candidate is rejected before anything runs.