Curriculum / Real-World Quantum Python / Quantum Circuit Benchmarking
Quantum Circuit Benchmarking
Implement quantum volume, randomized benchmarking, and cross-entropy benchmarking to characterize hardware quality.
Quantum Circuit Benchmarking
Before deploying quantum algorithms on real hardware, engineers characterize device performance using standardized benchmarking protocols. Three protocols dominate: Quantum Volume, Randomized Benchmarking, and Cross-Entropy Benchmarking.
Quantum Volume (QV)
Quantum Volume (IBM, 2018) measures the largest random circuit a device can execute reliably. QV = 2ⁿ where n is the largest circuit size where P(heavy output) > 2/3 with statistical confidence.
Definition: A QV circuit of size n consists of n layers of random 2-qubit gates applied to n qubits. For each layer, randomly pair the n qubits and apply a Haar-random SU(4) gate to each pair.
Heavy output probability: For a random unitary, the ideal output probabilities {pₓ} follow a Porter-Thomas distribution. The "heavy outputs" are states x where pₓ > median(p). The ideal H_est = P(heavy output) = Σ_{x: pₓ > median} pₓ ≈ 0.85 (by the Porter-Thomas distribution).
Pass criterion: H_est > 2/3 with 95% confidence. On a noisy device, depolarizing noise reduces H_est toward 0.5 (uniform distribution). The largest n where this passes determines QV.
As an illustrative example, a device passing the protocol up to n=9 has QV = 2⁹ = 512, while one passing up to n=10 has QV = 2¹⁰ = 1024. (Published records cluster lower: IBM Falcon-class devices reached QV = 128.) QV penalizes limited connectivity and high error rates.
Randomized Benchmarking (RB)
RB measures the average error per Clifford gate. It works by:
- 1.Apply m random Clifford gates, then the inverse gate sequence
- 2.Measure survival probability P(|0⟩): should be 1 in ideal case
- 3.Fit P(m) = A × pᵐ + B where p is the "depolarizing parameter"
- 4.Average gate error rate: r = 1 − p
RB is robust to state preparation and measurement (SPAM) errors because A and B absorb those contributions. Typical results on superconducting qubits: r ≈ 0.1–0.3% per Clifford gate.
This is the opening of the lesson. The full walkthrough, the interactive circuit, and the graded challenge continue inside myqubit.
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: Real-World Quantum Python
Write production-quality quantum Python, circuit optimization, hybrid algorithms, cloud backends, noise modeling, and software engineering patterns.
This lesson is part of Pro
Unlock Real-World Quantum Python and all 10 tracks with Pro: $12.99/month, $79/year, or $97 lifetime. Start with the free track first if you are new.