- The paper introduces QAP-Router, which recasts qubit routing as a dynamic Quadratic Assignment Problem optimized through reinforcement learning.
- It employs a solution-aware Transformer that fuses logical and physical encodings to guide globally effective SWAP selections.
- Empirical results demonstrate significant CNOT count reductions, validating global routing strategies while revealing transferability challenges.
Introduction and Motivation
Qubit routing represents a bottleneck in the compilation pipeline for near-term quantum computers, particularly in NISQ devices characterized by restricted qubit connectivity and limited native gate sets. The routing problem is inherently NP-hard and dynamic: each SWAP operation alters the mapping and modifies the set of pending logical interactions, meaning myopic local decisions accumulate and propagate sub-optimally through the global circuit execution. Existing heuristic and RL-based approaches often operate with insufficient global context, optimizing locally and failing to leverage the tightly coupled interaction-structure of quantum circuits and their hardware constraints.
QAP-Router addresses this by reframing qubit routing as a dynamic instance of the Quadratic Assignment Problem (QAP). The central insight is to treat logical qubits and their pairs (pending gate operations) as facilities with structured communication patterns (captured in a flow matrix), and physical qubits as positions in space characterized by a distance matrix induced by device topology. Routing is then the process of sequentially permuting the logical-to-physical assignment so as to minimize a global cost reflecting interaction proximity over the entire circuit, while respecting device constraints and execution order.
Figure 1: The quantum compilation pipeline decomposes algorithms into logical circuits, applies device-specific mapping, and applies routing to meet connectivity constraints via SWAP insertion.
The Quadratic Assignment Problem is classically defined as the task of permuting N facilities among N locations to minimize Tr(FXDX⊤), where F is the facility flow matrix and D is the location-wise distance matrix. In QAP-Router, each time slice of the circuit defines a distinct flow matrix Ft​, representing pending two-qubit interactions, and hardware connectivity is encoded by a static D. Routing unfolds as a series of local permutations (SWAPs) Xt​, updating assignments and removing gates as their dependencies are satisfied.
By recasting the reward function in the RL environment as the negative difference in the QAP objective before and after a SWAP, QAP-Router ensures that every RL action is evaluated against its global effect on interaction proximity. This direct structural coupling between routing actions and routing cost function allows the RL agent to learn routing strategies that are not just locally greedy but globally effective.
Figure 2: Illustration of the QAP-motivated reward where two alternative SWAPs have differing effects on distance between interacting qubits.
Policy Architecture: Solution-Aware Mixed Attention Encoding
The QAP-Router policy network employs a solution-aware Transformer encoder integrating both the logical flow information and the physical qubit placement information:
Empirical Evaluation and Ablation
Experimental Setup
The study benchmarks QAP-Router on the MQTBench, AgentQ, and QUEKO circuit collections over grid and IBM Tokyo-like device topologies at 12, 16, and 20 qubits. The main evaluation metric is the total number of inserted CNOT gates required for compilability—an unbiased measure of routing overhead with direct correlation to circuit error rates.
Compared reference methods include Greedy, Qiskit BasicSwap, Qiskit SabreSwap (basic/lookahead), Pytket LexiRouting, and Qiskit AIRouting. All comparisons are run from fixed initial mappings to ensure statistical fairness.
Results
QAP-Router achieves substantial reductions in CNOT insertion across most datasets and device topologies. On 16-qubit AgentQ, it yields an 18.4% CNOT reduction relative to AIRouting and an 11.7% reduction compared to SabreSwap (lookahead). On MQTBench, CNOT count is reduced by 7.61% (16 qubits, 2D grid) versus AIRouting. For QUEKO benchmarks (20 qubits, 2D grid) the reduction reaches 21.8% over AIRouting.
In settings with more challenging connectivity or greater gate density (20-qubit MQTBench circuits), performance is competitive but does not outperform the strongest baselines. This highlights the sensitivity of dynamic QAP-based policies to both circuit topology and device mapping flexibility.
Figure 4: Routing quality improves monotonically with larger lookahead horizon in the policy, for both MQTBench and AgentQ on 16-qubit devices.
Figure 5: Inserted CNOT count for distinct 12-qubit circuit types; QAP-Router systematically outperforms all classical and learning-based baselines.
Figure 6: Inserted CNOT count across 16-qubit MQTBench circuit types, highlighting the global improvement of QAP-Router's approach.
Figure 7: Results for 20-qubit circuits further emphasize the method's competitiveness as problem size increases.
Ablation: Lookahead Horizon
A critical architectural component is the use of decay-weighted lookahead in the flow matrix. Empirical ablation over horizon length N0 demonstrates clearly monotonic improvement in routing efficiency as the window broadens, validating the hypothesis that routing policies benefit from global circuit context and not just local interaction structure.
Implications and Future Prospects
The QAP-Router approach provides a novel intersection of combinatorial optimization theory and deep RL, yielding policies that internalize global circuit-device structure rather than relying solely on local heuristics or black-box RL. The results suggest strong theoretical alignment between QAP and quantum circuit routing, which is underexploited in conventional compilers.
Practically, CNOT minimization correlates with reduced error rates, shallower circuits, and improved algorithmic fidelity on NISQ hardware. Integrating such RL policies into production compilers or hybrid classical-AI frameworks will likely prove essential for high-quality quantum compilation in near-term and future large-scale quantum architectures.
Several limitations persist. The current policy requires retraining for each circuit size and device topology, limiting transferability and scalability in heterogeneous or dynamically reconfigurable devices. Addressing this with size-agnostic, graph-based encoding architectures is a clear next step, as is leveraging multi-task or meta-learning to produce robust, reusable routing solutions.
Conclusion
QAP-Router introduces a theoretically justified and practically effective methodology for qubit routing via dynamic QAP-based RL. By unifying the classical structure of the QAP with learning-based optimization, it achieves superior CNOT minimization over strong baselines across realistic benchmarks and device models. This work signals the necessity—and effectiveness—of exploiting global problem structure in RL-based quantum compilation, setting the stage for further advancements in scalable, device-aware quantum software stacks.
(2605.12365)