uncompute

A companion to the paper Discovering state-of-the-art quantum circuits with large language models (Gu, Kemeny, Yelin, Lukin, 2026, arXiv:2610.22367).

To get a feel for the circuit model, try writing your own circuit for inversion in GF(16) at the bottom of this page. Your browser runs it and checks it the way the evaluator checks the paper's circuits, then reports its Toffoli and qubit counts.

Reed–Solomon DQI decoder

440k1,837Toffolis executed →live qubits ↑

A Reed–Solomon decoder for DQI, rebuilt around the Berlekamp–Massey recurrence and run backward with almost no stored history.

Hermitian DQI decoder

930k2,395Toffolis executed →live qubits ↑

A decoder for a code on the Hermitian curve that finds the error locator as a null vector of a matrix it never stores.

HHL rotation angle

1.3k115Toffolis executed →live qubits ↑

The HHL rotation angle, evaluated on 345 power-of-two pieces that the input bits select directly.

Coulomb potential

1.1k142Toffolis executed →live qubits ↑

The inverse distance between two particles, built from 128 table lines whose words are erased by measurement.

Fixed-point Gaussian

1.6k139Toffolis executed →live qubits ↑

A fixed-point Gaussian that never forms x² and skips the table wherever the function is below the error budget.

Fe₂S₂ alias–Select

15k126Toffolis executed →live qubits ↑

One step of an iron–sulfur chemistry simulation, with the terms and alias table ordered so the lookup can skip repeated words.

Nonabelian lattice-gauge simulation

170k1,859Toffolis executed →live qubits ↑

A lattice gauge theory update in which neighboring loops share one running product of group elements.

Prime-field modular inversion

4.0M935Toffolis executed →live qubits ↑

Modular inversion inside elliptic-curve point addition, using fixed-shape divsteps whose choices the circuit reads back from its registers.

Method

Each circuit is the output of a Python program that builds it gate by gate. Functions, loops, and named registers keep the structure of the computation visible, so a change to one arithmetic routine changes every place it is used. An LLM writes and rewrites these programs. It starts from a blank program and a fixed task specification, and it sees nothing of the evaluator beyond the feedback on each submission.

Each iteration starts a fresh agent session with a parent program, its feedback, and a few alternatives from the archive with their costs. The agent can run drafts on test inputs and query a classical oracle before it submits a revised program. Each architecture proposed at the start founds its own family, and leading programs are shared between families from time to time. Within a family, the archive keeps the circuit with the lowest TQ-cost in each cell of the (Toffolis, qubits) plane, so a circuit with fewer qubits but more Toffolis stays available for later rewrites.

The circuits use classical reversible gates, diagonal sign gates, and destructive X-basis measurements. On a basis-state input the state stays one bit string with a sign, so the evaluator simulates each shot exactly, at full size. A shot passes when the output matches the target, every ancilla is back at |0⟩, and the sign is correct. A circuit is valid when no more shots fail than the task's failure budget allows, and its cost is its Toffoli count times its peak qubit count.

LLM agentrewrites a programprogrambuilds the circuitevaluatorsimulates shots exactlyarchivebest circuit per (T, Q) cellverdict, Toffolis, qubitsparent, feedback, alternatives

GF(16) inversion

GF(16) is a number system with sixteen elements, each written as four bits. Adding two elements is bitwise XOR. Multiplying them is polynomial multiplication reduced modulo x4 + x + 1. Every nonzero element has an inverse, and your circuit must XOR the inverse of x into a second register h while leaving x unchanged: |x⟩|h⟩ ↦ |x⟩|h ⊕ x−1⟩, with 0 mapped to 0.