Abstract: A quantum circuit transformation (QCT) is required when executing a quantum program in a real quantum processing unit (QPU). By inserting auxiliary SWAP gates, a QCT algorithm transforms a quantum circuit to one that satisfies the connectivity constraint imposed by the QPU. Due to the nonnegligible gate error and the limited qubit coherence time of the QPU, QCT algorithms that minimize gate number or circuit depth or maximize the fidelity of output circuits are in urgent need. Unfortunately, finding optimized transformations often involve exhaustive searches, which are extremely time consuming and not practical for most circuits. In this article, we propose a framework that uses a policy artificial neural network (ANN) trained by supervised learning on shallow circuits to help existing QCT algorithms select the most promising SWAP gate. ANNs can be trained offline in a distributed way and the trained ANN can be easily incorporated into QCT algorithms to enable them to search deeper without bringing too much overhead in time complexity. Exemplary embeddings of the trained ANNs into target QCT algorithms demonstrate that the transformation performance can be consistently improved on QPUs with various connectivity structures and random or realistic quantum circuits.
Introduction
In the current "Noisy Intermediate-Scale Quantum" (NISQ) era, quantum computers face significant hardware limitations, most notably connectivity constraints. On a physical Quantum Processing Unit (QPU), two-qubit operations like CNOT gates can typically only be performed between adjacent physical qubits. To execute a general quantum program, compilers must perform Quantum Circuit Transformation (QCT), inserting auxiliary SWAP gates to move logical qubits until they satisfy these adjacency requirements.
However, SWAP gates are costly. As shown in Figure 1, a single SWAP gate is equivalent to three CNOT gates. In noisy NISQ devices, every additional gate increases the risk of decoherence and gate errors, potentially compromising the entire computation.
The QCT Challenge
Finding an optimal sequence of SWAP gates that minimizes overhead is a computationally intensive search problem. Existing approaches generally fall into two categories:
- Exact Solvers: These find the absolute minimum number of SWAPs but are limited to very small circuits due to exponential complexity.
- Heuristics: These are fast but often "short-sighted," making suboptimal choices that lead to excessive gate counts in deeper circuits.
Proposed Framework: ANN-Guided Search
This research proposes a framework that uses a policy Artificial Neural Network (ANN) to guide heuristic search algorithms. The core idea is to provide fast heuristic algorithms with the "foresight" of more complex search methods without the associated time complexity.
The framework consists of four main modules:
- Training Circuit Generation: Creating a large set of shallow random circuits.
- Label Generation: Using a high-quality (but slower) QCT algorithm to solve these shallow circuits and identify the most effective SWAP gates.
- ANN Training: Training a policy ANN to predict these optimal SWAP choices based on the current circuit state.
- ANN Embedding: Integrating the trained ANN into existing algorithms like Simulated Annealing and Heuristic Search (SAHS). The ANN acts as a pruning mechanism, focusing the search on the most promising candidates and allowing for deeper exploration within the same time budget.
Experimental Evaluation
The framework was evaluated across several hardware architectures and circuit benchmarks, including random circuits, realistic benchmarks, and the Qiskit library.
Key results include:
- Performance Gains: The ANN-enhanced SAHS algorithm achieved up to a 28% reduction in gate overhead compared to greedy baselines.
- Scalability: An ANN trained only on shallow circuits generalized effectively to much deeper, complex circuits.
- Efficiency: On a 16-qubit Grid architecture, the enhanced algorithm processed gates significantly faster than standard versions at equivalent search depths (7.4 gates per second vs. 0.4).
- Cross-Architecture Consistency: Improvements were consistent across various topologies, including the 53-qubit Google Sycamore device.
Conclusion
By leveraging supervised learning to prune search spaces, this framework significantly enhances the performance of QCT algorithms. Future work aims to improve label quality using near-exact solvers and explore Graph Neural Networks to create models that can generalize across different hardware architectures without the need for retraining.
Summary updated