Curriculum / Real-World Quantum Python / Error Mitigation: Zero-Noise Extrapolation
Error Mitigation: Zero-Noise Extrapolation
Implement Zero-Noise Extrapolation in Python, the most widely used NISQ error mitigation technique.
Zero-Noise Extrapolation (ZNE)
ZNE is the most practical error mitigation technique for NISQ devices. Instead of correcting errors after the fact, it measures the effect of noise at several amplified levels and extrapolates back to the zero-noise limit.
The Problem ZNE Solves
On real hardware, every gate has a small error probability. A Bell state circuit (2 gates) has ~99.5% fidelity per gate, giving ~99% total. A VQE ansatz with 20 gates has ~82% fidelity. These errors bias the expectation value ⟨O⟩ away from its ideal value.
Error correction fixes this but requires thousands of physical qubits per logical qubit: infeasible on NISQ devices. Error mitigation reduces bias at a cost of more shots. ZNE is the most hardware-agnostic mitigation technique.
The ZNE Idea
Assume the expectation value degrades with noise level λ: E(λ) = E₀ + a₁λ + a₂λ² + ...
If we measure E(λ) at several values of λ (the same circuit at different effective noise levels), we can fit this polynomial and extrapolate to λ=0 to recover E₀.
Noise amplification methods:
- 1.Gate folding: replace G → G†·G·G (adds noise without changing the ideal circuit)
- 2.Pulse stretching: stretch microwave pulses in time (only on real hardware)
- 3.Identity insertion: insert U†U pairs at strategic points
Richardson Extrapolation
For m noise levels λ₁ < λ₂ < ... < λₘ with measured values E₁, E₂, ..., Eₘ, Richardson extrapolation uses Lagrange interpolation at λ=0:
E₀ = Σᵢ Eᵢ × Lᵢ(0)
where the Lagrange basis weights are: Lᵢ(0) = ∏_{j≠i} (0 − λⱼ) / (λᵢ − λⱼ)
Two-point (linear): E₀ = (λ₂E₁ − λ₁E₂) / (λ₂ − λ₁). Simple but only removes linear noise bias.
Three-point (quadratic): Also removes quadratic noise terms. The "right" number of points depends on the noise model.
Practical Limits
- •Shot overhead: ZNE with 3 noise levels requires 3× the shots for the same statistical precision
- •Noise model mismatch: Richardson extrapolation assumes the noise is well-behaved polynomial. Real noise can be non-Markovian, making extrapolation unreliable
- •Amplification ceiling: gate folding increases circuit depth, beyond ~3× amplification, the circuit is too deep to remain coherent
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.