TL;DR
This paper introduces Quarl, a novel reinforcement learning (RL)-based optimizer for quantum circuits. Quarl tackles the challenge of optimizing complex quantum circuits by employing a hierarchical RL approach with a graph neural network (GNN) for state representation, significantly outperforming existing optimizers in reducing gate count and improving circuit fidelity.
What Problem Does This Paper Address?
Optimizing quantum circuits is a critical but challenging task. Quantum programs are represented as circuits, and their performance is heavily influenced by the number of gates, circuit depth, and noise. While various optimization techniques exist, they often struggle with the vast search space of equivalent circuits and the need for transformations that might temporarily increase cost. Existing methods include rule-based strategies (like those in Qiskit) and search-based approaches (like Quartz). However, these methods can be inefficient or fail to discover complex, non-local optimizations. This paper addresses the need for a more effective and automated approach to quantum circuit optimization that can learn to navigate this complex landscape.
Methods
Quarl employs a reinforcement learning framework to optimize quantum circuits. The core of Quarl's approach lies in its novel neural architecture and RL training procedure:
- Hierarchical Action Space: To manage the enormous action space (possible transformations), Quarl decomposes it into two stages: first selecting a gate, then selecting a transformation to apply to that gate. This hierarchical approach makes the learning problem more tractable.
- Graph Neural Network (GNN) for State Representation: Quarl uses a K-layer GNN to represent the local environment of each gate in the circuit. This "K-hop neighborhood" representation is designed to capture local reasoning, which is crucial for many circuit transformations. The GNN's output is independent of circuit size, allowing for generalization.
- Hierarchical Advantage Estimation (HAE): A novel advantage estimator is proposed to better estimate the rewards in the RL setting. This estimator focuses on the "influenced gates" of a transformation, capturing local value propagation.
- Actor-Critic Architecture with PPO: Quarl uses a combined actor-critic architecture trained with Proximal Policy Optimization (PPO). The actor learns the gate and transformation selection policies, while the critic estimates the value of states.
- Pre-training, Fine-tuning, and Policy-Guided Search: To accelerate learning and improve generalization, Quarl utilizes a multi-stage approach: pre-training on diverse circuits, fine-tuning on specific circuits, and finally, policy-guided search for more aggressive optimization.
Datasets
The paper evaluates Quarl on several benchmark circuits, including:
- Nam Gate Set Benchmarks: A set of arithmetic and reversible circuits previously used in related work (e.g., barenco_tof_3, mod5_4, gf2^4_mult).
- IBM Gate Set Benchmarks: The same benchmark circuits transpiled to the IBM gate set.
- MQTBench Library: A broader suite of circuits including QAOA and VQE examples.
The paper does not introduce new benchmark datasets.
Key Insights and Ideas
- Locality is Key: The authors hypothesize that optimization decisions are largely guided by local circuit environments. This insight drives the use of GNNs to represent local gate neighborhoods.
- Hierarchical RL for Tractability: Decomposing the action space into gate selection and then transformation selection is crucial for making RL feasible in this domain.
- Cost-Increasing Transformations are Essential: The paper highlights that effective optimization often requires transformations that temporarily increase cost, a capability that Quarl's RL approach can learn to manage.
- GNNs Generalize Well: The learned gate representations from the GNN are independent of circuit size and generalize to unseen circuits, a significant advantage.
- Autonomous Discovery of Complex Optimizations: Surprisingly, Quarl can learn to perform complex, non-local optimizations like rotation merging through its exploration, without explicit programming for it.
Key Results
Quarl demonstrates superior performance compared to existing optimizers across various metrics:
- Gate Count Reduction: On the Nam gate set, Quarl achieves an average reduction of 35.8% in total gate count and 33.9% in CNOT count, outperforming the best existing optimizers (28.3% and 20.6% respectively). On the IBM gate set, Quarl achieves 36.6% total gate count reduction and 21.3% CNOT count reduction, significantly better than existing methods (20.1% and 7.7% respectively).
- Circuit Depth Reduction: Quarl achieves an average reduction of 25.7% in circuit depth on the Nam gate set, outperforming existing optimizers (19.6%).
- Fidelity Improvement: On the IBM gate set, Quarl improves circuit fidelity by an average of 1.37x, with a maximum improvement of 4.66x, significantly outperforming other optimizers. This is attributed to Quarl's strong performance in CNOT reduction, as CNOT gates have higher error rates.
- Rotation Merging: Quarl autonomously discovers optimizations similar to rotation merging, a complex non-local optimization, through its exploration.
Limitations and Future Work
- Partitioning for Scalability: While circuit partitioning helps scale Quarl to larger circuits, it may lead to performance degradation due to missed optimization opportunities across partitions. The authors plan to explore this further.
- Exploration vs. Exploitation Balance: Fine-tuning the balance between exploration and exploitation, particularly with the temperature parameter in the gate selector, is an ongoing area of research.
- ZX-Calculus Integration: The authors suggest that applying Quarl's techniques to optimize circuits in ZX-calculus is a promising avenue for future research.
- Combining with Qubit Routing: Quarl's techniques are orthogonal to RL-based qubit routing, and combining them may lead to further improvements in circuit optimization on NISQ devices.
Summary updated