Site Tools


qiskit-error-mitigation

Error Mitigation

Error mitigation reduces the effect of noise without correcting errors—it trades quantum resources (more circuits) for classical post-processing to improve result accuracy. Unlike error correction (which requires thousands of physical qubits per logical qubit), error mitigation works on current hardware.

Common techniques: zero-noise extrapolation, symmetry enforcement, readout error correction.

Zero-Noise Extrapolation (ZNE)

Run circuits at different noise levels by scaling gates, extrapolate to zero noise. Scale factors amplify noise, then fit the results to estimate the noiseless value:

$$\text{Cost}(\lambda) = A + B e^{-\lambda}$$

where $\lambda$ is the noise scaling factor. Solve for the noiseless limit.

from qiskit_aer import AerSimulator
from qiskit_aer.noise import NoiseModel, depolarizing_error
import numpy as np
 
# Evaluate at different noise scales
costs = []
scales = [1.0, 1.5, 2.0, 2.5, 3.0]
 
for scale in scales:
    # Scale noise by repeating 1-qubit gates
    scaled_qc = scale_noise_circuit(qc, scale)
    result = sim.run(scaled_qc, shots=1000).result()
    cost = compute_cost(result)
    costs.append(cost)
 
# Fit exponential and extrapolate
coeffs = np.polyfit(scales, costs, 1)
zero_noise_cost = np.polyval(coeffs, 0)
print(f"Mitigated cost: {zero_noise_cost}")

Readout Error Mitigation

Measurement errors can be mitigated by calibrating the confusion matrix (which measurement outcomes are actually read) and inverting it:

from qiskit_experiments.library import LocalReadoutError
 
# Calibrate readout errors
exp = LocalReadoutError(qubits)
result = exp.run(backend).block_for_results()
readout_fitter = result.analysis_results(0).value
 
# Apply to measured data
mitigated_counts = readout_fitter.apply(raw_counts)

Symmetry-Based Mitigation

If your cost function has known symmetries, enforce them post-measurement. For example, if parity must be even, discard odd-parity results and renormalize.

Error mitigation is practical on current hardware but has limits: if noise is too high, no mitigation helps. It's a trade-off between circuit depth, classical resources, and accuracy improvement.

qiskit-error-mitigation.md · Last modified: by 127.0.0.1