Research
Automating quantum circuit optimization with AI agents
Overview Research area: Quantum computing software — specifically quantum circuit compilation and optimization (fermion-to-qubit encodings, qubit routing/layout, and unitary synthesis) — combined with

- arXiv
- 2610.31352
- Published
- 2026-10-22
- Authors
- Marcos Crichigno, Steve Flammia
AI summary
Overview
Research area: Quantum computing software — specifically quantum circuit compilation and optimization (fermion-to-qubit encodings, qubit routing/layout, and unitary synthesis) — combined with AI-driven automated research using LLM coding agents.
Technical level: Intermediate. The paper is written for readers comfortable with basic quantum computing concepts (qubits, CNOT gates, Pauli operators, Trotter steps), but the emphasis is on methodology and results rather than deep derivations.
Scope: The paper presents a general method for letting AI agents solve hard quantum-compilation optimization problems under an exactly verified, automatically constructed evaluation harness, and applies it to three compilation problems with substantial measured improvements.
What This Paper Is About
Compiling a quantum algorithm into a circuit a real device can execute involves hard combinatorial optimization problems, and how well those are solved can decide whether an algorithm runs at scale at all. The authors extend the "autoresearch loop" pattern — where an AI agent iteratively rewrites a program against a fixed evaluator — with two additions: a frozen, exact verifier that certifies every result, and a separate AI-driven system that builds and validates that verifier (against a solved case, deliberately broken solutions, and published results) before any search begins. They then apply this to three quantum-compilation problems and report the certified gains.
Key Contributions
-
A verified autoresearch loop. Agents compete under a frozen verifier and scorer, so every reported result is certified, and every score is tied to a cryptographic hash (SHA-256 fingerprint) of the frozen evaluator so that any change invalidates and forces rescoring of all stored results.
-
An automated challenge-construction system. An agent, in dialogue with a researcher, formulates the problem as a contract, implements the verifier, scorer, instance generator and reference constructions, and must pass a validation gate — an analytically solved case, deliberately broken artifacts that must be rejected with specific diagnoses, and reproduction of published results — before the evaluator is frozen and the challenge opened.
-
Three constructed challenges with different kinds of exact checks: fermion-to-qubit encoding (an algebraic condition over F₂ on binary symplectic vectors), Hamiltonian layout (deterministic replay of a schedule against hardware connectivity), and unitary synthesis (evaluation on all 2ⁿ basis states plus exact comparison of linear maps).
-
Certified improvements across all three problems, from 19 verified agent submissions, with the agents' notes retained alongside each submission so the reasoning behind each improvement is recorded in human-readable form.
Main Findings
-
Fermion-to-qubit encodings: On a 225-site (15×15) square lattice, the best submissions reduced total Pauli weight by 37% relative to the Jordan–Wigner encoding — 10,749 against 17,025 — and outperformed a state-of-the-art quadratic-assignment optimizer by 23%, beating it at every size by between 15% and 23%. The reduction grows with lattice size, from 3% at L = 4 to 37% at L = 15. Maximum weight fell by up to 29% relative to published values at every size from L = 5 upwards, reaching 9 at L = 15 against a best published value of 11.
-
Triangular and hexagonal lattices: Best submissions reduced total weight by up to 24% and 17% respectively, relative to the best of the Jordan–Wigner and ternary-tree encodings scored by the same evaluator.
-
The winning encoding idea: The decisive step was algebraic — conjugating Majorana strings by Clifford unitaries e^{iπP/4} (transvections), which preserve all pairwise commutation relations, so the encoding stays valid for any choice of P. The search therefore becomes a search over moves that cannot break validity. A lineage of six submissions lowered the total weight from 12,020 (a ternary tree in snake order) to 10,749; the last five each added one idea.
-
Validation caught real defects: The validation gate exposed two defects in the first Hamiltonian implementation (density–density interaction contributed only one of its three Pauli terms; hopping terms lacked their imaginary parts), and a unitary-synthesis verifier draft that compared only phases and not the linear map, which would have accepted a circuit omitting uncomputation of its parities at half the cost. An exhaustive search over all 9! orderings of the 3×3 lattice showed the minimum total weight of a Jordan–Wigner encoding there is 201, not the published 237.
-
Hamiltonian layout: On a 64-qubit (8×8) grid, SWAP counts fell 73% relative to the standard swap network; the first agent submission already used 72% fewer SWAPs. Best submissions used 90% fewer on 3×3 grids and 73% fewer on 8×8. The record matches the exact optimum on three small instances whose optimum is known, and on 8×8 lies within a factor of 3.7 of a counting lower bound. The swap network still retains the lowest circuit depth from 4×4 upwards, since depth was not optimized.
-
Layout ideas that mattered: An annealed placement followed by a greedy walk, where candidate SWAPs are ranked by the state reached after 30 to 40 further greedy steps rather than immediate gain, and where the potential's shape is fitted with an evolution strategy (rising steeply to distance three, flattening beyond). A key observation: a routing read backwards is again a routing of the same cost.
-
Unitary synthesis: Best submission used 50% to 73% fewer CNOTs than naive synthesis at every size from three qubits upwards — 23 instead of 46 for the diagonal eight-qubit target and 25 instead of 73 with the linear map (up to 66% relative to standard synthesis as stated in the abstract). The linear map, which costs 27 extra CNOTs in the naive construction at eight qubits, cost only 2 here. Exhaustive search shows the circuits are optimal at every size up to four qubits, for both families.
-
Synthesis insight: A circuit with k CNOTs is a walk of length k through the invertible matrices over F₂; the submission searches for a single walk along which every required parity appears and which ends at A, rather than building each parity and the map separately. At n = 3 the target with the linear map needs fewer CNOTs than the diagonal one (3 against 4), because a diagonal target forces the walk to return to its start. The agent also fully characterized when two phase polynomials give the same unitary, leaving 2^629 equivalent forms of each target at eight qubits.
-
A common pattern: In all three challenges, the leading submissions recast the problem as a search over elementary moves in a group — symplectic transvections for encodings, qubit exchanges along grid edges for layouts, and elementary row operations over F₂ for CNOT circuits — so that every intermediate state is a valid solution rather than something to be repaired.
-
No accepted submission exploited an evaluator flaw. Because rejected submissions are not recorded, attempts cannot be excluded, but the design assumes them.
-
Ancilla variant: In a separate challenge allowing ancillas, no submission used fewer ancillas than the compact encoding of Derby et al. at maximum weight three; at maximum weight four an agent found encodings with fewer ancillas at every lattice size, for example 21 instead of 25 at 8×8.
Methodology in Plain English
The authors split the work into two stages.
Stage 1 — build and validate the judge. A coding agent, working in dialogue with a researcher, turns the optimization problem into a contract: what an instance is, what an artifact (a circuit, an encoding, a layout) is, and what a submission (a program generate(spec)) is. The agent then writes the verifier, the scorer, an instance generator, and two or three reference constructions from the literature. Before anything else happens, this evaluator must pass a gate: it must correctly handle an analytically solved case, reject a set of deliberately broken artifacts each with a specific diagnosis, and reproduce published results. The researcher signs off, and the evaluator is frozen and fingerprinted. Tests of the evaluator are themselves tested by mutation and property-based testing.
Stage 2 — let agents compete. Multiple agents run the autoresearch loop: each modifies only its own program, the frozen evaluator alone assigns scores, and a submission is accepted only if every instance it claims verifies. Submissions run as untrusted code in a sandbox without network access, against a read-only copy of the evaluator. Costs are reported as vectors rather than weighted sums, to avoid inviting trade-offs between terms. Each accepted submission is stored with its source code and the agent's notes, so later agents — which have no memory of earlier sessions — can build on it.
Design choices map directly onto failure modes: exact (not sampled) checks because sampled checks get exploited; hash-pinned scores for stability; vector costs and all-instances-must-verify for resistance to reward hacking; sandboxing for containment; and persistent documents for continuity.
Why This Matters
The paper's central claim is that as agents become good at searching, the bottleneck in AI-driven research shifts from search to formulation — stating a problem completely and building an evaluator that cannot be fooled. The challenge-construction system turns that step into a repeatable procedure while keeping a human at the two points where an error would propagate unchecked: approval of the contract and sign-off of the validated evaluator. Because evaluators are frozen, challenges remain comparable across agents and over time and can be reopened when new models appear, making them controlled benchmarks on problems whose answers are not known in advance.
Real-world applications:
- Quantum simulation on near-term hardware — cheaper fermion-to-qubit encodings and lower-SWAP layouts directly reduce the gate counts and coherence-time demands of simulating fermionic systems such as molecules and materials.
- Compiler backends for quantum hardware vendors — routing and layout heuristics that exploit interaction-graph structure rather than ignoring it.
- Circuit optimization pipelines — reduced CNOT counts for CNOT-phase circuits, which the paper notes arise throughout circuit optimization and Hamiltonian simulation.
- Benchmarking and evaluation of AI research agents — frozen, fingerprinted challenges as controlled testbeds on open problems.
Industry relevance: The work comes from Phasecraft (a quantum software company) with an academic co-author, and targets exactly the compilation layer that sits between quantum algorithms and device execution — the layer where industrial quantum advantage is often won or lost. The result that a first agent submission already beat published or standard references on all three problems suggests a practical route to automating part of the compiler-engineering workflow.
Future Directions
- Held-out targets. The best unitary-synthesis submission stores one precomputed circuit per instance, so it is a set of constructions rather than a general algorithm; the authors propose a challenge with held-out targets to measure the method rather than the instances.
- Multi-objective challenges. Depth was reported but not optimized, and it worsened in the layout challenge; each challenge optimizes only the objective it declares, leaving room for challenges that optimize several costs at once.
- Certified rather than exactly computed properties. Extending constructed challenges to rigorous bounds or formal proofs would widen the range of problems the approach can cover.
- New problem domains. The authors name table-lookup circuits, rewrite rules for circuit optimization, magic-state distillation protocols, and measurement circuits for stabilizer codes as problems that fit the same mould.
Target Audience
Quantum computing researchers and compiler engineers interested in automated circuit optimization; AI/agent researchers interested in verifiable rewards, reward hacking, and program search; and research-methodology readers interested in how to make AI-generated scientific results trustworthy. Readers wanting to reuse the approach need enough background to define a problem contract and judge a verifier, but the paper's framing of verified search is accessible to a broader technical audience.
Authors’ abstract
Compiling quantum algorithms for real devices involves hard optimization problems that can decide whether an algorithm runs at scale. We present a general method for solving such problems with AI agents, with every result certified. It builds on autoresearch loops, in which agents iteratively improve programs against a fixed evaluator and which have recently improved quantum cryptanalysis circuits, and adds two elements: a frozen, exact verifier certifies every result, and this verifier, together with the challenge around it, is built by an agent that formulates the problem with a researcher and validates the verifier against a solved case, deliberately broken solutions and published results before any solution exists. The method applies to any optimization problem whose solutions can be verified exactly and efficiently. We apply it to three compilation problems in quantum simulation, namely fermion-to-qubit encoding, Hamiltonian layout and unitary synthesis. In each, the agents improved substantially on published or standard constructions, reducing the cost being optimized by up to 73% at the largest sizes tested and outperforming a state-of-the-art optimizer for fermion-to-qubit encodings. Every submission is a program accompanied by its agent's notes, so the ideas behind each improvement are recorded in human-readable form; later agents built on them, and we describe them here. These results open the way to automated, certified discovery across quantum circuit design and beyond.