Curriculum / Quantum Hardware & NISQ / Hardware-Aware Circuit Optimization
Hardware-Aware Circuit Optimization
Optimize a circuit for minimal CNOT count and depth on linear topology.
Hardware-Aware Circuit Optimization
Given a target quantum state, there are often many circuit implementations. For NISQ hardware, the best implementation minimizes two-qubit gate count and circuit depth.
Why CNOT Count Matters
On current superconducting hardware:
- •Single-qubit gate error rate: ~0.1% per gate
- •Two-qubit gate (CNOT) error rate: ~0.5-1% per gate
- •Measurement error rate: ~1-2%
A circuit with 10 CNOTs has roughly 5-10% error from two-qubit gates alone. Reducing CNOT count from 10 to 4 cuts this error source in half.
GHZ State Optimization
The 3-qubit GHZ state can be implemented in multiple ways on linear topology (q0-q1-q2):
Naive implementation: H(0), CX(0,1), CX(0,2) Problem: CX(0,2) is not adjacent on linear topology, requiring a SWAP (3 extra CNOTs). Total: 1H + 2CX + 3CX (SWAP) = 1H + 5CX
Standard implementation (cascade along chain): H(0), CX(0,1), CX(1,2) Each CX uses adjacent qubits. No SWAPs needed. Total: 1H + 2CX = 3 gates
Optimal implementation (using middle qubit): H(1), CX(1,0), CX(1,2) The center qubit (q1) is adjacent to both q0 and q2. Both CNOTs share the control qubit q1, so they cannot run in the same time step: the circuit depth is 3. Total: 1H + 2CX = 3 gates at depth 3. The advantage is fewer CNOTs (2 vs 5) and no SWAP routing, not a lower depth.
Circuit Depth vs. Gate Count
Both the cascade and optimal implementations use 3 gates. But:
- •Cascade: depth 3 (H, CX(0,1), CX(1,2), each depends on previous)
- •Centered: depth 3 (H(1), then CX(1,0), then CX(1,2); both CNOTs share q1, so they cannot run in parallel)
Fewer CNOTs and no SWAP routing mean less noise. The optimal strategy uses the topology-aware insight that q1 is a hub.
The qubit connectivity graph of a quantum device is not just a constraint: it is an optimization opportunity. Algorithms that can be mapped to use hub qubits (qubits with many connections) benefit from reduced depth. The linear chain has q1 as a hub for 3 qubits. A 2D grid has corner vs. edge vs. center qubits with 2, 3, and 4 connections respectively. Mapping your algorithm's most-connected nodes to the hardware's most-connected qubits minimizes SWAP overhead.
How this lesson works
A hands-on coding challenge. You write Qiskit-compatible Python in the browser editor, run it instantly via WebAssembly, watch the circuit and Bloch sphere react, and pass automatic output checks. The AI tutor Qubitus gives Socratic hints if you get stuck.
Part of: Quantum Hardware & NISQ
Explore the physics of real quantum computers, understand noise, and learn near-term algorithms designed for today's noisy hardware.
This lesson is part of Pro
Unlock Quantum Hardware & NISQ and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.