Blog by Clayton Leite: Qubit routing – fitting quantum circuits to real hardware with a new AI-based method

  • Technology
  • AI
  • Quantum

Qubit routing is essential for adapting quantum circuits to real hardware, and QMill’s AI-powered method makes that step more efficient. Across 26 benchmarks, it used on average about 27% fewer two-qubit gates than standard Qiskit and up to 36% fewer on the largest circuit. It also matched or beat Qiskit AI on 21 circuits. For NISQ devices, reducing two-qubit gates can mean less accumulated noise and a greater chance of obtaining a reliable result.

November 30, 2026—A quantum circuit that looks fine on paper often can’t run as written, because real quantum processors only let certain qubits interact directly. A method called qubit routing closes that gap by moving quantum states around the chip. But every extra operation adds noise and time, and two-qubit gates are the noisiest of all, so the fewer a circuit needs, the better its chance of producing a reliable result.  

In this post, we use a small example on IBM’s Heron r3 processor to show how routing works and why the route with the fewest SWAPs isn’t always the one that leads to the leanest final circuit. We then introduce QMill’s new AI-powered routing method. Across 26 benchmark circuits, it used on average about 27% fewer two-qubit gates than standard Qiskit, and up to 36% fewer on the largest circuit. It also matched or beat Qiskit AI, the strongest benchmark we compared against, on most circuits, with the biggest gains on larger ones. 

1. Why a valid quantum circuit may need modifications before running

When designing a quantum circuit, we can define a gate between any two circuit qubits. But a real quantum processor often has a fixed set of connections: not every pair of qubits can interact directly. A circuit that looks valid on paper may therefore need extra operations before it can run on a specific device. 

The qubits in the circuit are labels for the information used in the computation. Physical qubits are the actual qubits on the processor that hold this information. Before execution, each circuit qubit is assigned to a physical qubit. A two-qubit gate such as a controlled-Z (CZ) gate can run directly only if the two physical qubits are connected. 

Let’s take IBM Heron r3 as an example of a quantum processor. It has a heavy-hex topology. For simplicity, we do not go through this topology in its entirety here. Instead, we consider just a four-qubit part of the processor spanning the hardware qubits from 0 to 3. According to the diagram of qubit connectivity for this quantum processor, these form a line topology: 0—1—2—3.  In other words, physical qubit 0 connects to 1, which connects to 2, which connects to 3.  

Now, let’s imagine that the circuit qubits 0 through 3 are mapped to physical qubits with the identical labels, that is, through an identity qubit mapping where circuit qubit 0 becomes hardware qubit 0 and so forth.  So, if our designed circuit has a gate connecting 0 and 1, then it can run directly. On the other hand, a gate between 0 and 2 is not directly allowed since hardware qubits 0 and 2 are not physically connected in the quantum processor. 

To run a gate between an unconnected pair, we must swap the states between neighboring physical qubits until the required states are adjacent. Qubit routing chooses these movements while keeping the intended computation unchanged.  

2. An example that needs routing

Let’s have a look at a quantum circuit with four qubits and two CZ gates (Figure 1), considering that it needs to be run on the IBM Heron r3 quantum processor and its circuit qubits are mapped identically to the hardware qubits. The circuit needs CZ gates between 0 and 2, then between 0 and 3. Neither pair is directly connected on the quantum processor. This can be handled by adding so-called SWAP gates. A SWAP exchanges the states of two neighboring physical qubits, bringing the required states next to each other.  

One way of carrying out qubit routing on our circuit is by applying a SWAP gate on physical qubits 0 and 1, making it possible to run the first CZ. Next, swap 1 and 2 and run the second CZ. Let’s call this route A (Figure 2 top circuit) since there can be several distinct ways of implementing qubit routing.  Another possible way, route B (Figure 2 bottom circuit) is swapping physical qubits 1 and 2, then running the first CZ. To enable the second CZ, swap 0 and 1, then 2 and 3. This route works too, but requires one extra SWAP. 

Quantum circuit that needs routing.

Figure 1. Quantum circuit that needs routing. Read from left to right. Boxes denote RXand RZ rotations, and connected dots are CZ gates.

Two optional qubit routings

Figure 2. Two optional routings for the example circuit in Figure 1. Route A needs two SWAP gates whereas Route B needs three.

3. Fewer SWAPs are generally better

Each operation introduces small errors into the quantum state. A SWAP usually requires several two-qubit operations, which are generally noisier than single-qubit gates. In addition to excess error, extra SWAPs can also make the circuit execution take longer. During these delays, qubits gradually lose their quantum information through decoherence, even while waiting for other gates to complete. Route A uses 2 SWAPs instead of 3, so it needs fewer noisy operations and can finish sooner, giving errors and decoherence less opportunity to affect the result.

But fewer SWAPs do not necessarily mean a better final circuit. On IBM Heron r3, SWAPs are broken down into CZ gates and single-qubit operations before execution. The compiler can sometimes simplify groups of these operations together with nearby circuit gates, reducing the number of CZ gates needed. A route with slightly more SWAPs may therefore end up with fewer CZ gates after simplification than a route with fewer SWAPs. This is what makes routing more complicated than it first appears: we should compare the final circuits that the hardware will actually run, not just count the inserted SWAPs.

4. QMill’s solution on qubit routing

QMill developed an AI-based routing method that outperformed Qiskit and Qiskit AI across a broad set of benchmark circuits. Table 1 compares the final CZ gate counts for 26 benchmark circuits routed to the IBM Heron r3 topology, using the identity qubit mapping. QMill matched or beat Qiskit AI on 21 of the 26 circuits and used substantially fewer CZ gates than Qiskit across the benchmarks. The advantage becomes more pronounced on larger circuits. For example, on gf2^E8_mult, QMill used roughly 8% fewer CZ gates than Qiskit AI and up to 36%  fewer than Qiskit. For NISQ devices, reducing two-qubit gates can mean less accumulated noise and a greater chance of obtaining a reliable result.

Table 1: Number of CZ gates obtained after routing the benchmark circuits onto the IBM Heron topology. Qiskit 2.5.2 performs qubit routing using the LightSABRE algorithm, whereas Qiskit AI relies on a neural‑network–based router. The chosen topology (IBM Heron) is the one on which Qiskit AI achieves its best performance. A lower CZ gate count leads to higher performance.

Comparing Qiskit 2.5.2, Qiskit AI and QMill qubit routing

**** 

About the author: Dr. Clayton Leite, Quantum AI Engineer at QMill, has a background in artificial intelligence and focuses on developing AI-driven methodologies for quantum circuit design and optimization.