Case Study: Fitting a Circuit Inside the Coherence Budget

Executive Summary

A circuit that is mathematically correct and physically impossible is a common deliverable in quantum computing. A team's 12-qubit chemistry ansatz runs perfectly on the simulator and returns noise on hardware. The circuit is not wrong; it is too deep.

This case study performs the depth triage: measure the budget, measure the circuit, find the excess, and recover it through four independent techniques — parallelization, connectivity-aware mapping, gate-set-aware rewriting, and algorithmic restructuring. Each is worth a known factor, and knowing which to reach for first is the skill.

Skills applied

  • Computing a coherence budget in layers from $T_2$ and gate durations (§7.8).
  • Distinguishing circuit depth from gate count and understanding when each binds (§7.5).
  • Restructuring circuits for parallelism (§7.6).
  • Trading width for depth.

Background

The device

Property Value
$T_1$ / $T_2$ 110 μs / 90 μs
Two-qubit gate (CNOT) 400 ns, error $7\times10^{-3}$
Single-qubit gate 35 ns, error $2\times10^{-4}$
Readout 1.2 μs, error $2\times10^{-2}$
Connectivity Heavy-hex (degree ≤ 3)

The circuit as written

12 qubits, transpiled naively: depth 1,840, with 612 two-qubit gates.

Phase 1: Compute the budget two ways

Time budget. Depth 1,840 dominated by two-qubit layers gives roughly

$$1{,}840 \times 400\,\text{ns} \approx 736\,\mu s$$

against $T_2 = 90\,\mu s$. The circuit takes eight times the coherence time. By the end, the state is thermal noise.

Error budget. Independently, 612 two-qubit gates at $7\times10^{-3}$:

$$F \approx (1 - 0.007)^{612} \approx e^{-4.28} \approx 0.014$$

About 1.4% fidelity. Both budgets agree: this circuit cannot run.

The two budgets are separate constraints. A circuit can fit in time and fail on gate error, or vice versa. Always compute both — the binding one tells you which optimization to reach for.

Targets: to reach a usable ~50% fidelity we need roughly 100 two-qubit gates and depth under ~200 layers. That is a 6× reduction in gates and 9× in depth.

Phase 2: Parallelization (worth ~3× depth, 0× gates)

The naive transpilation applied entangling gates sequentially even where they act on disjoint qubit pairs. Gates on disjoint supports commute and belong in the same layer.

from qiskit import transpile
t = transpile(qc, backend, optimization_level=3, seed_transpiler=11)
print(t.depth(), sum(1 for i in t.data if i.operation.num_qubits == 2))

Result: depth 1,840 → 610, two-qubit count unchanged at 612.

Time cost drops to $610\times400\,\text{ns} = 244\,\mu s$ — still over budget, but the shape of the problem has changed: we are now gate-error-limited, not time-limited.

Lesson. Parallelization is free and always worth doing, but it moves only depth. If gate error is binding, it buys you nothing on fidelity.

Phase 3: Connectivity-aware mapping (worth ~1.7× gates)

Inspecting the transpiled circuit shows 214 of the 612 two-qubit gates are SWAPs inserted for routing — 35% of the entangling budget spent moving qubits, not computing.

The ansatz assumed all-to-all connectivity. Rewriting it so that entangling gates act only on physically adjacent pairs — a hardware-efficient ansatz — eliminates most routing:

Version 2Q gates of which SWAP
All-to-all ansatz 612 214
Hardware-efficient ansatz 358 12

Lesson. Routing overhead is invisible in the algorithm and dominant in the implementation. On limited-connectivity hardware, an algorithmically "worse" ansatz that respects the coupling map usually wins.

This is a genuine trade: the hardware-efficient ansatz is less expressive per layer, so it may need more layers to reach the same accuracy. That trade is empirical and must be measured, not assumed.

Phase 4: Gate-set-aware rewriting (worth ~1.4× gates)

The ansatz used many $R_{zz}(\theta)$ interactions, each compiled as CNOT–$R_z$–CNOT: two entangling gates apiece. But consecutive $R_{zz}$ terms on the same pair merge:

$$R_{zz}(\theta_1)R_{zz}(\theta_2) = R_{zz}(\theta_1+\theta_2)$$

and a chain $R_{zz}(a)$ on (0,1) then (1,2) shares CNOTs that cancel at the boundary. Applying commutation-aware resynthesis:

358 → 247 two-qubit gates.

Also worth checking: whether the backend's native entangler is CNOT or ECR/CZ. Writing circuits in terms of the native two-qubit gate avoids a wrapper of single-qubit gates around every entangler — cheap in error but real in depth.

Phase 5: Algorithmic restructuring (worth ~2.5× gates)

The remaining factor cannot come from compilation; it has to come from the algorithm. Three standard moves:

  1. Reduce ansatz depth ($p$ layers → $p'$). Measure accuracy as a function of layer count. Chemistry ansätze frequently saturate well before the depth the literature recommends — the last layers contribute less than the noise they introduce.
  2. Exploit symmetry. Particle-number and spin symmetries let you drop terms and shrink the active space. Here, restricting to the physically relevant sector removed two qubits entirely.
  3. Split the observable. Measuring a Hamiltonian's terms in commuting groups across several shallower circuits beats one deep circuit that prepares everything at once.

After restructuring: 247 → 98 two-qubit gates, depth 186.

Phase 6: Result

Stage 2Q gates Depth Est. fidelity
As written 612 1,840 0.014
+ parallelization 612 610 0.014
+ hardware-efficient ansatz 358 372 0.081
+ gate merging 247 268 0.178
+ algorithmic restructuring 98 186 0.50

Total: 6.2× fewer entangling gates, 9.9× shallower, fidelity from 1.4% to ~50%. Time is now $186\times400\,\text{ns} = 74\,\mu s$, inside $T_2 = 90\,\mu s$ — though only just, which is itself a warning: a circuit that barely fits will fail on a day when calibration drifts.

Discussion Questions

  1. Parallelization cut depth 3× and did nothing for fidelity. Explain precisely when depth reduction helps and when only gate-count reduction does.
  2. Routing consumed 35% of the entangling budget. What does that suggest about comparing algorithms on gate count alone in the literature?
  3. The final circuit uses 82% of the coherence budget. Would you run it? What margin would you want, and why?
  4. Restructuring gained the largest single factor but required domain knowledge of the chemistry problem. What does that imply about who should be optimizing quantum circuits?

Your Turn: Extensions

  • Take any circuit, transpile at levels 0–3 for a heavy-hex backend, and tabulate depth, total gates, two-qubit gates, and SWAP count.
  • Write a helper that reports what fraction of two-qubit gates are routing SWAPs.
  • Build both an all-to-all and a hardware-efficient ansatz on 8 qubits and compare transpiled cost at equal layer count.
  • Estimate fidelity from gate counts and compare against a noisy simulation; explain any discrepancy.

Key Takeaways

  • Compute both budgets: time (depth × gate duration vs. $T_2$) and error (gate count × error rate). They bind under different circumstances.
  • Parallelization reduces depth only; gate-count reduction is what moves fidelity when errors dominate.
  • Routing SWAPs are invisible in the algorithm and can consume a third of the entangling budget.
  • The largest wins come from restructuring the algorithm, not from the compiler — and require understanding the problem, not just the circuit.
  • A circuit that barely fits the coherence budget will fail on a bad calibration day. Leave margin.