Quantum Volume tells you the largest square circuit a device passes. It doesn't tell you which gate is dragging that number down. Randomized benchmarking (RB) answers a narrower, more actionable question: what's the average error per gate, and is it possible to isolate one specific gate's contribution from everything else. Qiskit Experiments (version 0.14) implements both the standard version and the interleaved variant that isolates a single gate.
pip install qiskit-experiments
The idea behind RB
Standard RB runs sequences of random Clifford gates of increasing length, each sequence engineered so the final gate inverts everything before it, meaning a perfect, noiseless device always returns to the initial state. As sequence length grows, accumulated gate error shows up as decaying return-to-ground-state probability. Fit that decay curve, and the decay rate converts directly into an average error per Clifford gate, a single number that reflects the device's gate quality independent of any specific circuit you care about.
Running StandardRB
import numpy as np
from qiskit_experiments.library import StandardRB
from qiskit_aer import AerSimulator
from qiskit_aer.noise import NoiseModel, depolarizing_error
lengths = [1, 10, 30, 80, 150] + np.arange(200, 1100, 200).tolist()
num_samples = 5
qubits = [0]
exp = StandardRB(qubits, lengths, num_samples=num_samples, seed=1010)
exp_data = exp.run(backend).block_for_results()
exp_data.analysis_results(dataframe=True)
lengths is the set of sequence lengths to test, and num_samples is how many random sequences to generate at each length, since a single random sequence at a given length is noisy on its own and needs averaging. The results table reports both EPC (error per Clifford) and, where the analysis decomposes it, EPG (error per gate) for the specific single- and two-qubit gates involved.
Isolating one gate with InterleavedRB
Standard RB gives you an average across every Clifford gate the device uses. If you want to know specifically how good the CX (CNOT) gate is, interleave it into the random sequences and compare the decay rate with and without it:
from qiskit_experiments.library import InterleavedRB
from qiskit.circuit.library import CXGate
int_exp = InterleavedRB(CXGate(), qubits, lengths, num_samples=num_samples, seed=1010)
int_exp_data = int_exp.run(backend).block_for_results()
int_exp_data.analysis_results(dataframe=True)
The interleaved variant runs two RB experiments in parallel, one standard, one with the target gate inserted between every random Clifford, and fits the ratio between their decay rates to isolate that specific gate's error. This is the number worth checking when a specific two-qubit gate is suspected of dragging down a circuit's fidelity, rather than the device's blended average.
Setting a realistic error scale for testing
If you're testing the workflow on a simulator rather than real hardware, an ideal AerSimulator() shows no decay at all, same problem as with T1/T2 measurement. Add a depolarizing noise model so there's something to fit:
noise_model = NoiseModel()
noise_model.add_all_qubit_quantum_error(depolarizing_error(0.01, 1), ["sx", "x"])
noise_model.add_all_qubit_quantum_error(depolarizing_error(0.03, 2), ["cx"])
backend = AerSimulator(noise_model=noise_model)
Reading the gate_error_ratio option
The analysis converts EPC into per-gate EPG using an assumed ratio of how much each gate type contributes to total error, configurable through gate_error_ratio:
print(exp.analysis.options.gate_error_ratio)
Leaving this at its default assumes a standard mix of gate types. If your device's gate set differs meaningfully from that default assumption, the reported EPG splits are only as good as that ratio, while the overall EPC number remains solid regardless, since it comes directly from the fitted decay rate rather than from the ratio assumption.
RB versus Quantum Volume: different questions
Quantum Volume answers "what's the largest circuit this device handles," folding qubit count, connectivity, and fidelity together into one pass/fail number. RB answers "how good is a specific gate, on average, independent of circuit structure." Neither replaces the other: a device holds excellent RB numbers on every individual gate and a mediocre Quantum Volume if its connectivity forces expensive routing, or the reverse, decent connectivity masking a genuinely noisy two-qubit gate that only shows up once RB isolates it.
Try this next
- Run
InterleavedRBon both a single-qubit gate and a two-qubit gate on the same simulated device, and compare how much higher the two-qubit EPG comes out, consistent with two-qubit gates almost always being the dominant error source on real hardware. - Sweep the depolarizing error rate in the noise model and confirm the fitted EPC tracks it linearly, a useful sanity check that the fit itself is trustworthy before running against real hardware.
- Pair this with the Quantum Volume tutorial to see both benchmarks on the same simulated device and compare what each one reports.