Much of the cost of quantum algorithms lies in classical functions compiled into reversible circuits. Efficient classical algorithms often lose their advantage in this setting, because a circuit cannot branch on superposed data and must retain intermediate results until it can uncompute them. Removing this overhead can require redesigning the algorithm, data representation and uncomputation together, which automated optimizers cannot do because they preserve correctness through fixed rewrites. In this work, we separate proposal from verification. These circuits compute classical functions, so a conventional computer can test them efficiently. A language model, Claude Mythos 5, can therefore write any circuit-generating program, while an independent evaluator checks its correctness and scores its cost.
We applied this framework to eight tasks in numerical computation, chemistry, optimization, quantum simulation and number theory. In seven, the discovered circuits use both fewer Toffoli gates and fewer qubits than the state of the art. For the Reed–Solomon decoder in decoded quantum interferometry, Claude replaced the input-dependent extended Euclidean algorithm with Berlekamp–Massey decoding, whose regular steps suit a fixed gate sequence. It then reconstructed temporary values from the circuit’s state and used the allowed failure rate to remove storage needed only for rare inputs, reducing the gate count by about 12 times. For modular inversion, Claude made divsteps, a fast classical method previously impractical for reversible arithmetic, viable by recovering its branch history from the numbers being updated. The resulting circuits fill a gap between the fastest and smallest known designs for elliptic-curve point addition.
In each case, the circuit recovers classical efficiency that earlier compilations lost. This suggests that some apparent costs of quantum arithmetic come from existing reversible constructions and not from the algorithms themselves. These results open the door to evaluator-guided co-design of new algorithmic structures for quantum computation.

Evaluator-guided circuit search. Top: the search loop. Candidate programs that pass the evaluator’s tests are scored by T × Q, the product of Toffoli count and peak qubit count, and that feedback informs the next generation. Bottom: TQ-cost reduction for the six tasks with established baselines, labeled with (T, Q) for the baseline and discovered circuit. The Hermitian DQI decoder and the modular-inversion benchmark are not shown because neither has a single established baseline.

