Purity Benchmarking in Coherent/Incoherent Error Decomposition#

Randomized benchmarking (RB) reports a single average gate-error rate, but that number mixes two physically different contributions: incoherent errors (decoherence, i.e. loss of purity) and coherent errors (systematic, calibration-related, e.g. over/under-rotation). Purity benchmarking measures how quickly a qubit’s state purity decays under random Clifford sequences — a quantity that, unlike RB’s average fidelity, is insensitive to coherent errors — and so isolates the decoherence-limited (incoherent) error bound on its own. Combined with a companion randomized-benchmarking result for the same qubit, it further decomposes RB’s total error into its coherent and incoherent parts, following Wallman et al. (“Estimating the coherence of noise”, New J. Phys. 17 113020) and Zhu et al. (arXiv:2407.07960).

Code structure#

Class: PurityBenchmarking#

The PurityBenchmarking class drives single-qubit purity benchmarking. Like RandomizedBenchmarking, each of the n_seeds independent random-Clifford realizations needs its own compiled schedule — the random sequence is baked directly into the pulses — so seeds is driven as the outer sample-space dimension (recompiled fresh per seed), while clifford_sequence_lengths and the three measurement bases are inner, plain Python loops within each seed’s own compiled schedule. Every per-seed compile gets its own automatic calibration-points block, so each seed’s populations are normalized against its own calibration rather than an average across seeds.

Class: PurityBenchmarkingMeasurement#

The measurement class responsible for executing the benchmarking sequences.

Method: point_schedule / schedule_function#

Unlike randomized benchmarking, no recovery Clifford is appended. Instead, each random Clifford sequence is measured in the X, Y and Z bases — a basis-change gate (H for X, X90 for Y, nothing for Z, since Z is already the native measurement basis) is applied immediately before Measure — and the analysis combines the three resulting Pauli expectation values into a purity. Every point is hardware-averaged over repetitions (bin_mode="average_append"), matching T1/Ramsey-style analog IQ readout rather than RB’s single-shot SSRO classification: purity benchmarking only ever needs the \(|0\rangle\)–\(|1\rangle\) calibration axis, never state classification. Each qubit runs its own independently seeded random Clifford sequence per sequence length (different qubits’ sequences take different physical durations, so they cannot share one synchronized measurement point).

Class: PurityBenchmarkingAnalysis#

The analysis class that combines per-basis Pauli expectation values into a purity and fits its decay against the number of Cliffords.

Method: compute_qoi#

  1. Calibration and projection: each seed’s three basis measurements are projected onto the \(|0\rangle\)–\(|1\rangle\) axis using calibration points measured in that same compiled schedule (never averaged across seeds, mirroring RandomizedBenchmarking’s analysis), then converted to Pauli expectation values (x_exp = 2*p_x - 1, etc.).

  2. Purity: the raw sum x_exp**2 + y_exp**2 + z_exp**2 is a biased estimator of the true purity at finite shot count — squaring a noisy sample mean systematically overestimates ⟨P⟩² by about 3/N per point. This is corrected using the unbiased estimator ⟨P⟩²_hat = (N·m² - 1)/(N - 1) (Wallman et al., eq. 5), without which purity can land above the physical bound of 1, especially deep into the decay.

  3. Decay fit: purity is averaged across seeds (weighted, in the fit, by the seed-to-seed standard deviation) and fit to an RB-style decay model against the number of Cliffords, giving the unitarity parameter u and its reduced chi-squared.

  4. Error decomposition: the unitarity alone already bounds the incoherent error, incoherent_error = (1/2)(1 - sqrt(u)) (Zhu et al. eq. 13, single-qubit case). If a RandomizedBenchmarking result for the same qubit has been written to Redis (rb_fidelity trusted value), the coherent error is additionally recovered as coherent_error = (1 - rb_fidelity) - incoherent_error (Zhu et al. eq. 14). RandomizedBenchmarking must therefore run before purity benchmarking for coherent_error to be available — otherwise it is reported as NaN, while incoherent_error (which needs no RB result) is still computed.

Output: xarray.Dataset#

The dataset holds, per qubit, the hardware-averaged shots indexed by seed, number of Cliffords, and measurement basis (X/Y/Z), plus the automatic calibration-points block appended per seed.

Class: PurityBenchmarkingParameters#

The PurityBenchmarkingParameters class encapsulates the parameters for purity benchmarking. All fields are currently acquisition fields (baked into the hardware sweep — changing one requires re-running on hardware); see Parameter field categories.

Acquisition fields#

  • n_seeds: int = 10 — number of independent random-Clifford-sequence realizations (a fresh, differently seeded sequence per sequence length), recompiled and executed once per seed. Purity is fit against their seed-averaged values, weighted by the seed-to-seed spread at each sequence length.

  • repetitions: int = 1024 — hardware-averaged shots per (seed, sequence length, basis) point, and for the automatic calibration-points block appended per seed.

  • clifford_sequence_lengths: list[int] = [0, 2, 4, 8, 16, 128, 256, 512] — numbers of random Cliffords applied per sequence. Each sequence is measured in the X, Y and Z bases (no recovery Clifford) so the Pauli expectation values can be combined into a purity.

Class: PurityBenchmarkingQOI#

  • purity_fidelity / purity_fidelity_error: the raw purity-decay fit parameter, i.e. the unitarity u of Wallman et al. / Zhu et al.

  • reduced_chi2: goodness-of-fit indicator for the purity decay.

  • incoherent_error / incoherent_error_error: the decoherence-limited error bound derived from u alone.

  • coherent_error / coherent_error_error: the coherent (systematic/calibration) error, which additionally needs a companion RandomizedBenchmarking result for the same qubit; NaN when unavailable.

There is no device-model attribute purity benchmarking writes back — it is a characterization quantity, not a calibration knob — so to_dict returns an empty mapping, and results are only written to Redis (informational).