Optimizing Ancilla-Based Quantum Circuits with SPARE
Open Access
- 10 June 2025
- journal article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 9 (PLDI) , 176-200
Abstract
Many quantum algorithms instantiate and use ancillas, spare qubits that serve as temporary storage in a quantum circuit. In particular, many recently developed high-level and modular quantum programming languages (QPLs) use ancilla qubits to implement various programming constructs. These are lowered to circuits with nested/cascading compute-uncompute gate sequences that use ancilla qubits to track internal state. We present SPARE, a rewrite-based quantum circuit optimizer that restructures these compute-uncompute gate sequences, leveraging the ancilla qubit state information to optimize the circuit. In this work, we prove the correctness of SPARE’s rewrites and link SPARE’s gate-level transforms to language-level program rewrites, which may be performed on the input language. We evaluate SPARE on QPL-generated quantum circuits against Unqomp and Spire, two optimizing compilers for QPLs. SPARE achieves a reduction of up to 27.3% in qubit count, 56.7% in 2-qubit gates, 68.2% in 1-qubit gates and 73.9% in depth against Unqomp, and up to 17.8% in qubits, 67.3% in 2-qubit gates, 61.4% in 1-qubit gates and 59.9% in depth against Spire. We also evaluate SPARE against the Quartz, Feynman, and PyZX circuit optimizers: SPARE achieves up to a 70.0% reduction in two-qubit gates, up to a 53.6% reduction in 1-qubit gates, and up to a 56.7% reduction in depth compared to the best result from all the gate-level optimizers.Keywords
This publication has 43 references indexed in Scilit:
- A review on Quantum Approximate Optimization Algorithm and its variantsPhysics Reports, 2024
- Suppressing quantum errors by scaling a surface code logical qubitNature, 2023
- Fault-tolerant resource estimate for quantum chemical simulations: Case study on Li-ion battery electrolyte moleculesPhysical Review Research, 2022
- Direct measurement of Bacon-Shor code stabilizersPhysical Review A, 2018
- Experimental comparison of two quantum computing architecturesProceedings of the National Academy of Sciences of the United States of America, 2017
- Demonstration of Weight-Four Parity Measurements in the Surface Code ArchitecturePhysical Review Letters, 2016
- Quantum Computation and Quantum Information2012
- Theory of fault-tolerant quantum computationPhysical Review A, 1998
- Elementary gates for quantum computationPhysical Review A, 1995
- Teleporting an unknown quantum state via dual classical and Einstein-Podolsky-Rosen channelsPhysical Review Letters, 1993