Quartz: superoptimization of Quantum circuits

Mingkuan Xu, Zikun Li, Oded Padon, Sina Lin, Jessica Pointing, Auguste Hirth, Henry Ma, Jens Palsberg, Alex Aiken, Umut A. Acar, Zhihao Jia

TL;DR

This paper introduces Quartz, a novel quantum circuit superoptimizer that automatically generates and verifies circuit transformations for arbitrary quantum gate sets. By exploring a vast space of potential optimizations and formally verifying their correctness, Quartz can significantly reduce the gate count of quantum circuits, often outperforming existing hand-tuned optimizers.

What Problem Does This Paper Address?

Quantum computers are rapidly evolving, with different hardware architectures supporting unique sets of quantum gates (instruction set architectures or ISAs). This diversity makes it challenging to develop optimizing compilers that can efficiently translate quantum programs across these different platforms. Existing quantum compilers rely on manually designed circuit transformations, which are labor-intensive to create, difficult to adapt to new ISAs, and may miss subtle, hard-to-discover optimizations. This leads to sub-optimal circuit performance and a significant barrier to efficient quantum computation.

Methods

Quartz tackles this problem by introducing a superoptimization approach. Its core components are:

  • Circuit Generator (REPGEN): This algorithm automatically generates candidate symbolic circuit transformations. It uses a representative-based approach to explore the exponentially large space of possible transformations efficiently, ensuring completeness for a given gate set and circuit size.
  • Circuit Equivalence Verifier: This component formally verifies that generated transformations are functionally equivalent, even for parametric quantum gates. It achieves this by reducing the problem to SMT solving over nonlinear real arithmetic, handling trigonometric functions and global phase ambiguities.
  • Circuit Optimizer: This module uses a cost-based backtracking search algorithm to apply the verified transformations to an input circuit, aiming to minimize the total gate count.
  • Pruning Techniques: Quartz employs ECC simplification and common subcircuit pruning to reduce redundancy in the generated transformations, making the optimization process more efficient without sacrificing completeness.

Datasets

The paper evaluates Quartz on a benchmark suite of 26 quantum circuits, previously used in other research ([6, 23]). These benchmarks include arithmetic circuits, controlled gates, Galois field multipliers, and quantum Fourier transformations.

Key Insights and Ideas

  • Automated Discovery of Transformations: The most significant insight is that complex, effective circuit transformations can be automatically discovered and verified, rather than relying solely on human expertise. This has the potential to unlock new levels of optimization.
  • Symbolic Representation is Crucial: To handle parametric quantum gates effectively, Quartz introduces symbolic quantum circuits and transformations. This allows for general optimizations that are not limited to specific parameter values.
  • Trade-off Between Completeness and Performance: The paper highlights a crucial trade-off: increasing the completeness of the generated transformations (by increasing n and q in the (n,q)-complete ECC set) leads to more potential optimizations but also significantly increases the search time for the optimizer.
  • Formal Verification is Essential: The rigorous verification of circuit equivalences, even with symbolic parameters, is critical for ensuring the correctness of the generated optimizations.

Key Results

  • Significant Gate Count Reductions: Quartz achieves substantial gate count reductions across various gate sets. For example, on the Nam, IBM, and Rigetti gate sets, it obtained average reductions of 29%, 30%, and 49% respectively, often outperforming or matching existing hand-tuned optimizers.
  • Efficiency of Generation: The generator and verifier can produce (n,q)-complete ECC sets for useful values of n and q within a few hours, even for complex gate sets.
  • Pruning Techniques are Effective: The REPGEN algorithm, combined with ECC simplification and common subcircuit pruning, reduces the number of transformations considered by the optimizer by one to three orders of magnitude.
  • Outperforms Existing Optimizers: In evaluations on benchmark circuits, Quartz consistently matched or surpassed the performance of established optimizers like Qiskit, tket, and voQC.

Limitations and Future Work

  • Search Time vs. Optimization: While Quartz can generate highly complete sets of transformations, the optimizer's search time can become a bottleneck, especially for larger circuits and more complete ECC sets. The paper suggests that improving the search algorithm could lead to better optimization.
  • Logical Optimization Only: Quartz currently focuses on logical circuit optimization and does not consider qubit mapping, which is a crucial step for running circuits on physical hardware. The authors suggest that extending superoptimization to jointly optimize circuit logic and qubit mapping is a promising future direction.
  • Hyperparameter Tuning: The effectiveness of the optimizer is influenced by hyperparameters like y and the search timeout. Finding optimal settings can be circuit-dependent.

Summary updated

BibTeX
@inproceedings{xu2022quartz,
  author = {Mingkuan Xu and Zikun Li and Oded Padon and Sina Lin and Jessica Pointing and Auguste Hirth and Henry Ma and Jens Palsberg and Alex Aiken and Umut A. Acar and Zhihao Jia},
  title = {{Quartz: superoptimization of Quantum circuits}},
  booktitle = {PLDI},
  year = {2022},
  doi = {10.1145/3519939.3523433},
}

Loading related content...

Figure