AlphaRouter: Quantum Circuit Routing with Reinforcement Learning and Tree Search

Wei Tang, Yiheng Duan, Yaroslav Kharkov, Rasool Fakoor, Eric Kessler, Yunong Shi

Introduction

In the current era of Noisy Intermediate-Scale Quantum (NISQ) computing, the physical constraints of hardware present a significant barrier to executing complex quantum algorithms. One of the most critical challenges is the "routing problem." Because physical qubits on a chip are typically only connected to their immediate neighbors, executing a multi-qubit gate between distant logical qubits requires the insertion of additional SWAP gates. These gates move logical information across the chip until the required qubits are adjacent.

However, SWAP gates are not free; they introduce noise, increase circuit depth, and accelerate decoherence. Minimizing the number of SWAPs is an NP-hard optimization problem. While exact solvers exist, they are computationally prohibitive for large circuits, and common heuristics like SABRE often fall into local optima due to their greedy nature. This paper introduces AlphaRouter, a reinforcement learning (RL) framework that leverages the strategic lookahead of Monte Carlo Tree Search (MCTS) and the sequence-modeling power of Transformers to achieve state-of-the-art routing efficiency.

The AlphaRouter Framework

AlphaRouter adopts a hybrid architecture inspired by the AlphaZero framework. It combines the global search capabilities of MCTS with a high-capacity neural network agent to navigate the complex state space of quantum circuits.

1. Transformer-Based Agent

The core of AlphaRouter is an actor-critic Transformer model. Transformers are uniquely suited for this task because they can process the dependencies within a quantum circuit—represented as a Directed Acyclic Graph (DAG)—as a sequence of operations. The agent evaluates a "lookahead" window of up to 48 gates, allowing it to understand the downstream implications of current routing decisions.

2. Training with MCTS

During the training phase, the system employs MCTS to simulate various sequences of SWAP gates. This process allows the agent to discover non-obvious strategies where a seemingly sub-optimal move in the short term leads to a significantly more efficient circuit overall. The MCTS provides a policy and value signal that refines the Transformer agent's internal representations.

3. Efficient Inference

A key innovation of AlphaRouter is its performance during deployment. While MCTS is computationally intensive, the researchers found that the trained Transformer agent is sufficiently robust to perform routing on its own during inference. By bypassing the search tree at runtime, AlphaRouter provides high-quality routing solutions at speeds compatible with modern quantum software stacks.

Experimental Evaluation

The researchers evaluated AlphaRouter across a diverse set of benchmarks and hardware topologies to test its versatility and scaling properties.

  • Benchmarks: The suite included the Quantum Approximate Optimization Algorithm (QAOA), Quantum Fourier Transform (QFT), Quantum Volume (QV), GHZ state generation, Bernstein-Vazirani (BV), and Hidden Shift (HS) algorithms, alongside purely random circuits.
  • Hardware Topologies: Testing was conducted on various connectivity graphs, including the 12-qubit Tokyo grid (IBM), the 8-qubit OQC ring, and the 16-qubit Guadalupe heavy hexagon layout (IBM).

Key Results and Insights

AlphaRouter demonstrates a clear advantage over industry-standard heuristics like SABRE, consistently reducing SWAP gate overhead by 10–20% across nearly all tested benchmarks.

Strategic Generalization

One of the most significant findings is the agent's ability to generalize. An AlphaRouter agent trained on one class of circuits (e.g., QAOA) maintains high performance when applied to entirely different algorithms like QFT. This suggests that the model learns fundamental principles of qubit movement and topology navigation rather than simple pattern memorization.

Scalability and Refinement

As circuit complexity increases, the performance gap between AlphaRouter and traditional heuristics widens. The model showed a 15% improvement in the linear scaling coefficient, indicating that it handles larger, more complex routing problems more efficiently than previous methods. Furthermore, when combined with classical "bidirectional mapping"—a technique that optimizes initial qubit placement by iterating the routing process forward and backward—AlphaRouter achieved a 40% reduction in SWAP overhead on the Tokyo topology.

Conclusion and Future Work

AlphaRouter represents a significant step forward in quantum compiler design, proving that RL-based agents can outperform hand-tuned heuristics in complex hardware optimization tasks. By moving beyond greedy local choices, AlphaRouter preserves the limited coherence time of NISQ devices, enabling the execution of deeper and more complex quantum programs.

Future research directions include developing a unified RL model that simultaneously optimizes both initial qubit placement and routing, creating topology-agnostic agents that can adapt to any hardware layout without retraining, and shifting the optimization objective from raw gate counts to total circuit depth to better align with specific hardware performance metrics.

Summary updated

BibTeX
@inproceedings{tang2024alpharouter,
  author = {Wei Tang and Yiheng Duan and Yaroslav Kharkov and Rasool Fakoor and Eric Kessler and Yunong Shi},
  title = {{AlphaRouter: Quantum Circuit Routing with Reinforcement Learning and Tree Search}},
  booktitle = {QCE},
  year = {2024},
  doi = {10.1109/qce60285.2024.00112},
}
Figure