Overview
An algorithm's cost on paper (gate count, depth) and its cost on a device can differ by large factors. Devices have limited connectivity, error rates that vary from qubit to qubit and from day to day, and errors that depend on which gates run simultaneously. Hardware-aware algorithms take these facts into account at two levels.
- In the compiler. Noise-aware mapping chooses physical qubits and routes using calibration data (Murali et al.; Tannu and Qureshi), and crosstalk-aware scheduling serialises gates that disturb each other (Murali et al.).
- In the algorithm. Constructions are reorganised so that they need only the connectivity the device has, as in the fermionic swap network for chemistry (Kivlichan et al.), or circuits are built directly from native gates, as in the hardware-efficient ansatz (Kandala et al.).
Co-design goes one step further: choosing the problem, the encoding and the hardware layout together. Experiments on problems that match the device graph and on problems that must be compiled onto it show how much this matters (Harrigan et al.).
Intuition
A generic compiler sees a circuit and a device and does its best. An algorithm designer who knows the device can often do better, because many algorithms have freedom the compiler cannot see: the order of commuting terms in a Trotter step, the choice of qubit encoding, the form of a variational circuit. Using that freedom to make every interaction nearest-neighbour removes routing altogether.
Noise awareness is a second, independent lever. Two qubits with the same nominal gates may differ in error rate by a large factor, so the "same" circuit placed on different physical qubits succeeds with different probability. Using the best qubits and links is cheap, as long as one remembers that calibrations drift.
Prerequisites
Quantum compilation, in particular the routing problem and the SWAP identity; parameterized circuits for the variational parts. The lessons on QAOA and VQE in practice give concrete settings.
Mathematical Definitions
The connectivity graph of a device is with its physical qubits and when a native two-qubit gate can be applied to and . It may be time-dependent: in devices that move qubits, is the set of pairs that can be brought together in a given step.
A stabilizer code can be measured by a constant-depth circuit of native gates, one ancilla per check, when every check's qubits are adjacent to its ancilla in . Typical cases:
- Planar nearest-neighbour graphs (square grid): sufficient for the surface code, whose checks have weight at most four (Fowler and co-authors). If the device's qubits sit in the plane with bounded-length couplers, the code's checks are geometrically local in two dimensions and the Bravyi–Poulin–Terhal bound limits its parameters.
- Bounded-degree graphs with some long edges: the bivariate-bicycle memory of Bravyi and co-authors needs a degree-6 graph made of two edge-disjoint planar subgraphs, and in exchange keeps 12 logical qubits with 288 physical qubits.
- Reconfigurable connectivity: in neutral-atom arrays the edges are created by moving atoms (Bluvstein and co-authors), and in trapped-ion charge-coupled devices by shuttling ions between zones (Kielpinski, Monroe and Wineland); both trade time for connectivity.
Gates between qubits that are not adjacent must be routed, through SWAP chains, moving qubits, ancilla paths or teleportation, and the routing cost is part of every resource estimate.
A hardware-efficient ansatz of depth on qubits prepares
where each is a product of native single-qubit rotations with real parameters and is a fixed circuit of native two-qubit gates acting only on edges of (or, as in the original proposal, the device's natural cross-resonance evolution). The parameters are optimised classically, as in any parameterized quantum circuit. The construction was introduced by Kandala et al. to run a variational eigensolver for small molecules with circuits short enough for the hardware of the time.
The ansatz needs no routing, but it encodes no symmetry or structure of the problem. Deep random instances approach unitary designs and then suffer from barren plateaus, and hardware noise itself can flatten the landscape (Wang et al.), so its use is usually restricted to shallow depths.
- A device with connectivity graph and a native entangling gate on each edge.
The product is the probability that no error occurs anywhere if each location fails independently with its calibrated rate. Taking logarithms turns it into a sum of per-location costs , which is how it is used as an edge weight in layout and routing searches: a path through high-fidelity couplers can beat a shorter path through poor ones. Compilers that choose layouts and routes from daily calibration data in this spirit are studied by Murali et al. and Tannu and Qureshi, who show that variation between qubits and links makes such choices matter. The ESP is a ranking heuristic: it is not the probability of a correct answer for algorithms that tolerate some errors, it ignores crosstalk between simultaneous gates, and its accuracy is limited by the drift of calibration data between characterization and execution.
- Errors at different locations are independent and any error ruins the run; and are the calibrated error rates of gate and measurement on the specific physical qubits used.
- The idle factor, with idle time and a coherence time of qubit , is optional and crude; it ignores how errors propagate and cancel.
Theorems
After the rounds the qubit that started at position is at position , the network contains exactly SWAPs, and every unordered pair of qubits occupies adjacent positions and is swapped exactly once.
Consequently, a layer of commuting two-qubit gates acting on all pairs (for example the terms of a QAOA layer on a complete graph, or the pair terms of a Trotter step) can be applied on a line in depth by merging each pair's gate into the SWAP that exchanges it. For fermions under the Jordan–Wigner encoding the SWAP is replaced by a fermionic SWAP, which keeps the encoding local; Kivlichan et al. use this to apply a Trotter step of the electronic-structure Hamiltonian in depth with about entangling gates on a linear array. The output order is reversed, which is harmless if the next layer runs the network backwards.
- Qubits (or modes) at positions of a path graph; in round a SWAP is applied to every pair with and .
Proof · Proof that swap networks make every pair adjacent once
Active pairs. In round the SWAPs act on the pairs with . Each position belongs to at most one active pair: as its left member if and , as its right member if and . Position with and position with are the only positions not in an active pair.
Trajectories. Define the fold map for , for and for . For the qubit starting at put if is even and if is odd; for these stay in . Call the qubit a right-mover after rounds if with even or with odd, and a left-mover otherwise. From the formulas, for a right-mover not at position , for a left-mover not at position , and for a right-mover at or a left-mover at . A direct parity check gives: a qubit with is a right-mover exactly when (for even unreflected ; reflected ; for odd unreflected ; reflected ).
We show by induction on that after rounds the qubit starting at sits at . This holds for . Assume it after rounds and consider round . A right-mover at has , so it is the left member of an active pair and moves to . A left-mover at has , so it is the right member of an active pair and moves to . A right-mover at (then ) and a left-mover at (then ) are in no active pair and stay. In every active pair the left member is a right-mover and the right member a left-mover, so these moves are exactly the SWAPs of the round, and each agrees with as computed above.
Reversal. The ranges stay within the domain of : for even , , so ; for odd , , so .
Every pair exactly once. Round with even contains SWAPs and round with odd contains . Among there are even and odd values, which gives SWAPs in total for both parities of . A SWAP changes the relative order of only the two qubits it exchanges. Every pair ends in the opposite order, so it was swapped an odd number of times, at least once. With pairs and SWAPs, each pair is swapped exactly once, and it is adjacent at that moment.
Let and . Under the assumptions, for every fixed and ,
where . For an -qubit Pauli observable, , so the variance is at most . By Chebyshev's inequality, : almost all circuits in the ensemble have gradients exponentially close to zero, and resolving a gradient component by sampling needs a number of measurement shots exponential in .
This exact computation is a special case of the theorem of McClean, Boixo, Smelyanskiy, Babbush and Neven, who treat the cases where the circuit before or after the parameter (or both) is a 2-design and conclude that the gradient variance vanishes exponentially in . Locality of the cost and depth matter for circuits that are not 2-designs: Cerezo et al. prove that for layered circuits of local two-qubit blocks, global costs have exponentially vanishing gradients at any depth, whereas local costs at depth have gradients that vanish at most polynomially. A survey of the mechanisms is Larocca et al..
- The circuit is on qubits, , with Hermitian and ; the input is a pure state and .
- The unitary (the gates after the -th parameter) is random and its distribution agrees with the Haar measure on in all second moments, for all (a unitary 2-design); and are arbitrary, possibly random and independent of .
- The observable is Hermitian and traceless, .
Proof · Proof of the barren-plateau variance formula for 2-designs
Write , and .
The derivative. Since , at . Hence
is Hermitian (the commutator of two Hermitian operators is anti-Hermitian) and traceless.
First moment. Taking in the 2-design condition and tracing out the second factor shows , the last equality because the Haar average commutes with every unitary and is therefore a multiple of , fixed by its trace. With this gives .
Second moment. , so by the 2-design assumption with the Haar twirl . By invariance of the Haar measure, commutes with every , and by Schur–Weyl duality the commutant of is spanned by the identity and the swap (with ). So . Because and are invariant under conjugation by (which commutes with ), and . Using , , and for the identities and :
Then, with and ,
The commutator norm. Expand . Since is a pure state, and ; with the four traces are , , and , where . Thus , which gives the stated formula. For a Pauli observable , and for . The variance is the second moment because the mean is zero, and Chebyshev's inequality gives the tail bound.
This computation follows the strategy of McClean, Boixo, Smelyanskiy, Babbush and Neven, restricted to the case in which the circuit after the parameter is a 2-design, where it becomes exact.
The barren-plateau theorem is the main theoretical caution against deep unstructured hardware-efficient circuits; noise adds a second, independent flattening mechanism (Wang et al.).
Worked Examples
Choosing qubits by estimated success probability
A three-qubit GHZ circuit needs two CNOTs along a path and three measurements. On a device, path P1 has CNOT errors and and readout errors ; path P2 has CNOT errors and but readout errors (illustrative values). Then and . Although P2 has better gates, P1 wins for this shallow circuit because readout dominates. For a circuit with twenty CNOTs per qubit pair the ranking would flip, which is why the ESP must be evaluated for the actual compiled circuit.
All-to-all interactions on a line
A QAOA layer on the complete graph applies for all pairs. On a line with routing by a generic compiler the SWAP count depends on the heuristic. With the swap network, each SWAP is merged with the rotation of the pair it exchanges into one two-qubit gate, which costs at most three CNOTs by the three-CNOT theorem. For : merged gates in depth , at most CNOTs per layer, and the qubit order is reversed at the end, which the next layer undoes by running the network in the opposite direction. Without the merge, the rotations would cost two CNOTs each and the SWAPs three each, CNOTs in total.
Fermionic simulation in linear depth
For spin-orbitals under the Jordan–Wigner encoding, a hopping term between non-adjacent modes carries a string of operators. Replacing SWAPs by fermionic SWAPs keeps every interacting pair adjacent in the encoding when it acts, so the strings never appear; Kivlichan et al. obtain a Trotter step of the electronic-structure Hamiltonian in depth with about entangling gates on a linear array.
Algorithms and Implementations
- Noise-adaptive mapping. Solve a layout and routing problem whose costs are calibrated error rates, by constraint solving for small instances or heuristics such as weighted SABRE-type search (Murali et al.; Li, Ding and Xie).
- Variability-aware allocation. Avoid the worst qubits and links and prefer routes through reliable couplers (Tannu and Qureshi).
- Crosstalk-aware scheduling. Characterise which simultaneous gate pairs interfere and insert serialisation only where needed, trading depth (and hence decoherence) against crosstalk (Murali et al.).
- Native-gate algorithm design. Swap networks, hardware-efficient ansatze, and problem instances defined on the hardware graph.
Limitations and Common Pitfalls
- Calibration drift. Error rates change between calibration and execution; layouts optimised on stale data can be worse than uninformed ones.
- Independence assumptions. Products of fidelities ignore correlated errors, crosstalk and coherent error cancellation.
- Hardware-native is not problem-native. A problem defined on the device graph is easy to run but may be easy classically as well; results on such instances do not transfer to problems that need compilation (Harrigan et al.).
- Trainability. Shallow hardware-efficient circuits avoid routing, but deeper ones run into barren plateaus, and noise compounds the problem.
- Overfitting to one device. Algorithms tuned to one generation of hardware may lose their advantage when connectivity or native gates change; keep the logical algorithm and the hardware mapping separable.
State of the Art
As reported in the cited papers (years are publication years):
- 2017: a hardware-efficient variational eigensolver ran on up to six qubits for Hamiltonians with over a hundred Pauli terms, up to the molecule BeH₂ (Kandala et al.).
- 2020: crosstalk characterization on three 20-qubit IBM devices was made two orders of magnitude cheaper than all-pairs measurement, and used for crosstalk-aware scheduling (Murali et al.).
- 2021: QAOA on a planar superconducting processor (up to 23 qubits) gave approximation ratios independent of problem size for problems on the hardware graph, and performance that increased with depth there, while problems requiring compilation (Sherrington–Kirkpatrick, MaxCut on non-planar graphs) were studied for contrast (Harrigan et al.).
Related Research
Error mitigation is the other main tool for running algorithms on noisy devices and is often combined with noise-aware compilation. Variational algorithms and Hamiltonian simulation are the main consumers of connectivity-aware constructions; quantum architecture is the same co-design question asked for fault-tolerant machines.