Randomized Benchmarking for Quantum Hardware: Measure Gate Fidelity with Qiskit and Cirq
randomized benchmarkinggate fidelityquantum hardwareQiskitCirqcalibration

Randomized Benchmarking for Quantum Hardware: Measure Gate Fidelity with Qiskit and Cirq

JJust Qubit Editorial Team
2026-11-19
7 min read

Learn how to run and track randomized benchmarking in Qiskit or Cirq, fit gate-error estimates, and interpret hardware changes with confidence.

Randomized benchmarking (RB) gives quantum developers a repeatable way to estimate average gate performance from observed circuit outcomes, rather than relying only on provider-reported calibration metrics. This guide explains how to design standard, interleaved, and simultaneous RB experiments with Qiskit or Cirq, fit survival probabilities, record uncertainty, and revisit results after calibration changes.

Overview

Provider dashboards commonly expose metrics such as readout error, T1, T2, and reported gate error. Those values are useful for selecting a backend, but they do not necessarily describe how a complete workload behaves. Randomized benchmarking probes a chosen set of operations by running many randomly generated Clifford sequences and measuring whether the final state returns to a known reference state.

A typical single-qubit RB experiment follows this pattern:

  1. Prepare a reference state, usually |0⟩.
  2. Generate a random sequence of Clifford operations with length m.
  3. Append an inverse Clifford that should return the ideal state to |0⟩.
  4. Execute the circuit repeatedly with a fixed number of shots.
  5. Record the survival probability: the fraction of results matching the expected reference outcome.
  6. Repeat for several sequence lengths and independent random seeds.
  7. Fit the decay and estimate an average error per Clifford under the experiment's assumptions.

For a basic model, survival probability is fitted with P(m) = A pm + B. The parameter p describes the decay, while A and B absorb state-preparation and measurement (SPAM) effects. For a single qubit and a depolarizing-style interpretation, a commonly used estimate is error per Clifford ≈ (1 - p) / 2. Treat this as an operational estimate, not a direct measurement of every physical error mechanism.

RB is most useful when the same circuit-generation rules, sequence lengths, shot counts, and analysis code are retained across hardware runs. That makes it a tracking tool as well as a one-time experiment.

What to track

Sequence design and inverse construction

Use a consistent Clifford representation and verify the inverse carefully. The inverse is the group inverse of the entire random sequence, not simply the reverse list of labels unless each operation is also inverted correctly. A practical implementation maintains a Clifford group representation, multiplies the selected operations in order, and appends the Clifford that cancels the resulting product.

Before using hardware, test the construction on an ideal simulator. Every generated sequence should produce the expected reference result in the absence of noise. This check catches ordering, qubit-index, measurement, and convention errors. For a multi-qubit experiment, also account for the device's native connectivity and transpilation. The circuit that reaches hardware may contain many more physical operations than the abstract Clifford sequence. See the quantum circuit transpilation optimization guide for a related workflow.

Sequence lengths, seeds, and shots

Select several lengths spanning short to long circuits. The useful range depends on coherence, gate quality, compilation overhead, and shot budget; there is no universal list that works for every device. Include enough lengths to reveal a decay without making nearly every long sequence fail. At each length, generate multiple random sequences rather than relying on one sample.

Record the exact lengths, number of random sequences per length, shots per circuit, random seed, qubits, coupling or layout choice, transpiler settings, basis gates if exposed, and execution date. Keep the sequence identities so that a later run can either reproduce them or deliberately generate an independent set.

Qiskit and Cirq implementation choices

In Qiskit, the experiment can be built from Clifford or unitary objects, transpiled circuits, and a backend or sampler appropriate to the installed SDK and provider. Benchmarking utilities and provider interfaces can change, so pin the environment and consult the version-matched documentation rather than copying an outdated import. In Cirq, represent each Clifford sequence as a circuit, calculate the inverse using the chosen gate representation, and submit the resulting circuits through the available sampler. Cirq's flexible circuit model is useful for custom RB generators, but the analysis, fitting, and uncertainty calculations are usually your responsibility.

Do not compare a Qiskit result with a Cirq result until the experiments use equivalent Clifford definitions, compilation constraints, qubit selection, measurement conventions, sequence lengths, and shot counts. A software label is less important than the physical circuits actually executed.

Benchmark variants

MethodQuestion answeredWhat to recordMain limitation
Standard RBWhat is the average error of a gate set or Clifford operation?Reference survival curves, fitted decay, sequence metadataIt averages errors and does not isolate one native gate.
Interleaved RBHow does inserting a target operation change the decay?Reference and interleaved curves using matched sequencesThe estimate depends on assumptions about gate independence and compilation.
Simultaneous RBDoes operating on one qubit affect another at the same time?Individual and simultaneous results, qubit pairs, scheduleIt can expose crosstalk but is sensitive to layouts and parallel timing.

For interleaved RB, use the same random reference sequences in the reference and interleaved experiments, placing the target operation consistently between Clifford elements. Compare the fitted decay parameters, but report the uncertainty and the analysis assumptions. The result is not automatically the isolated physical error of the target gate, especially when transpilation replaces it with a composite sequence.

Cadence and checkpoints

Run a baseline after selecting a backend or qubit set, then repeat on a monthly or quarterly cadence if the hardware is part of an active development workflow. A shorter interval is appropriate after a calibration event, maintenance window, software upgrade, qubit remapping, or material change to compilation settings. The purpose is not to create a universal leaderboard; it is to detect meaningful change under controlled conditions.

Use an experiment worksheet with one row per run:

  • Date and environment: provider, backend, SDK versions, authentication or project context, and circuit-construction commit.
  • Hardware selection: physical qubits, logical labels, connectivity, and whether the run was individual or simultaneous.
  • Protocol: standard, interleaved, or simultaneous RB; Clifford convention; target gate; sequence lengths; random-sequence count; and shots.
  • Fit: model, fitted A, B, and p; fitting bounds; residuals; and confidence interval method.
  • Outcome: estimated error per Clifford, interleaved estimate if applicable, excluded data with reasons, queue or execution notes, and links to raw results.

Keep raw counts, not only percentages. Counts allow you to recompute binomial uncertainty, inspect anomalous circuits, and change the fit without rerunning the hardware experiment. Also capture provider calibration snapshots when available, while treating them as contextual data rather than a substitute for RB.

How to interpret changes

A higher fitted error rate can result from hardware drift, readout changes, crosstalk, a different qubit assignment, deeper transpiled circuits, altered pulse or basis-gate choices, or an unstable execution window. A lower value does not prove that every gate improved. First compare the experimental conditions, then examine residuals and the raw survival curves.

SPAM errors mainly affect the fitted amplitude and offset, which is why a nonzero intercept does not automatically indicate a failed experiment. However, strong curvature, poor residuals, or a decay that is not approximately exponential may indicate leakage, non-Markovian behavior, drift during acquisition, or an unsuitable sequence range. Try fitting a restricted range, splitting the run into time blocks, or increasing the number of random sequences. Report those choices transparently.

Use confidence intervals rather than a single point estimate. For each circuit, shot noise is approximately binomial, but uncertainty also comes from variation between random sequences and from the nonlinear fit. Bootstrap resampling across sequences is a practical approach: resample complete sequence records at each length, refit each sample, and report a percentile interval. Do not treat overlapping or non-overlapping intervals as a complete statistical test; use them as evidence alongside controlled repeats.

When comparing standard and interleaved RB, remember that the extracted quantity is an average error under the selected Clifford compilation. If the target gate is synthesized differently in each context, the comparison may reflect compilation or scheduling effects. For backend selection, combine RB with T1, T2, readout error, queue behavior, and workload-specific tests. The backend selection guide provides a useful companion checklist.

When to revisit

Revisit this article and rerun the experiment on a regular monthly or quarterly checkpoint, after a backend calibration change, or whenever the SDK, transpiler, device layout, or provider interface changes. Start by cloning the last known-good environment and reproducing one short simulator test. Then run the same stored sequences on the same qubits where possible, followed by a fresh random-sequence set to check that the result is not seed-specific.

For each checkpoint, compare fitted decay, confidence intervals, sequence-level variation, transpiled depth, and execution conditions. Mark a change as actionable only after a controlled repeat or a clear workload impact. If your goal is fault-tolerant development, connect the findings to quantum error-correction code behavior; if your goal is application development, validate the conclusion with a representative circuit rather than RB alone.

A durable RB record should answer three questions: what was measured, under which physical and software conditions, and whether the change matters for the workload. Store the worksheet, raw counts, generated circuits, fit code, and environment lockfile together. That simple practice turns randomized benchmarking from a one-off metric into a repeatable quantum hardware performance monitor.

Related Topics

#randomized benchmarking#gate fidelity#quantum hardware#Qiskit#Cirq#calibration
J

Just Qubit Editorial Team

Quantum Computing Editors

Senior editor and content strategist. Writing about technology, design, and the future of digital media. Follow along for deep dives into the industry's moving parts.