Optimizing Ancilla-Based Quantum Circuits with SPARE. Sharma, R. & Achour, S. Proceedings of the ACM on Programming Languages, 9(PLDI):154, Association for Computing Machinery, New York, NY, USA, June, 2025. doi abstract bibtex 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.
@article{Sharma2025,
author = {Sharma, Ritvik and Achour, Sara},
title = {Optimizing Ancilla-Based Quantum Circuits with SPARE},
year = {2025},
publisher = acm,
address = {New York, NY, USA},
volume = {9},
number = {PLDI},
doi = {10.1145/3729253},
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.},
journal = pacmpl,
month = jun,
eid = {154},
pages = {154},
numpages = {25},
keywords = {quantum optimizing compilers, quantum programming languages},
webnote = {PLDI '25},
bibsource = qplbib
}
Downloads: 0
{"_id":"Wcajxv9dsm7iGazoR","bibbaseid":"sharma-achour-optimizingancillabasedquantumcircuitswithspare-2025","author_short":["Sharma, R.","Achour, S."],"bibdata":{"bibtype":"article","type":"article","author":[{"propositions":[],"lastnames":["Sharma"],"firstnames":["Ritvik"],"suffixes":[]},{"propositions":[],"lastnames":["Achour"],"firstnames":["Sara"],"suffixes":[]}],"title":"Optimizing Ancilla-Based Quantum Circuits with SPARE","year":"2025","publisher":"Association for Computing Machinery","address":"New York, NY, USA","volume":"9","number":"PLDI","doi":"10.1145/3729253","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.","journal":"Proceedings of the ACM on Programming Languages","month":"June","eid":"154","pages":"154","numpages":"25","keywords":"quantum optimizing compilers, quantum programming languages","webnote":"PLDI '25","bibsource":"Quantum Programming Languages & Verification Bibliography, https://git.io/qpl-bib","bibtex":"@article{Sharma2025,\n author = {Sharma, Ritvik and Achour, Sara},\n title = {Optimizing Ancilla-Based Quantum Circuits with SPARE},\n year = {2025},\n publisher = acm,\n address = {New York, NY, USA},\n volume = {9},\n number = {PLDI},\n doi = {10.1145/3729253},\n 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.},\n journal = pacmpl,\n month = jun,\n eid = {154},\n pages = {154},\n numpages = {25},\n keywords = {quantum optimizing compilers, quantum programming languages},\n webnote = {PLDI '25},\n bibsource = qplbib\n}\n\n","author_short":["Sharma, R.","Achour, S."],"key":"Sharma2025","id":"Sharma2025","bibbaseid":"sharma-achour-optimizingancillabasedquantumcircuitswithspare-2025","role":"author","urls":{},"keyword":["quantum optimizing compilers","quantum programming languages"],"metadata":{"authorlinks":{}}},"bibtype":"article","biburl":"https://raw.githubusercontent.com/QuantumPL/bib/main/bbt.bib","dataSources":["JG9W34HAXfSxsC6ML"],"keywords":["quantum optimizing compilers","quantum programming languages"],"search_terms":["optimizing","ancilla","based","quantum","circuits","spare","sharma","achour"],"title":"Optimizing Ancilla-Based Quantum Circuits with SPARE","year":2025}