|q⟩ Bad Qubits

advanced · Programming · Benchmarking, Noise Characterization & RB

Randomized Benchmarking

Randomized benchmarking (RB) is the field's standard for measuring an average gate error rate. Its brilliance is that the answer is independent of state-preparation and measurement (SPAM) errors and independent of which input state you use — the two failings of the naive approach from the opening lesson.

The protocol

RB applies long sequences of random Clifford gates and watches how quickly the circuit forgets where it started. A single sequence of length mm is built as follows:

  1. Start in 0|0\rangle.
  2. Apply mm uniformly random Clifford gates C1,C2,,CmC_1, C_2, \dots, C_m.
  3. Compute the single Clifford Cm+1=(CmC1)1C_{m+1} = (C_m \cdots C_1)^{-1} that inverts the whole sequence, and apply it.
  4. Measure. In the ideal, noiseless case the net operation is the identity, so you return to 0|0\rangle with certainty — this is the survival probability.

Repeat over many random sequences and many lengths mm. Errors accumulate with each gate, so the average survival probability decays with mm.

Why the decay is a clean exponential

The key mathematical fact is twirling. Averaging an arbitrary noise channel over the uniformly random Clifford group turns it into a depolarizing channel, which is described by a single number. Consequently the average survival probability obeys a simple exponential model (Magesan et al.):

Fˉ(m)=Apm+B.\bar F(m) = A\,p^{\,m} + B.

Here pp is the depolarizing parameter per Clifford, and AA, BB absorb all the SPAM errors into constants. Fitting the measured decay to this curve extracts pp while the SPAM nuisance parameters fall out — that is the SPAM robustness, made precise.

The average error rate per Clifford follows directly from pp and the Hilbert-space dimension d=2nd=2^n:

r=(d1)(1p)d.r = \frac{(d-1)(1-p)}{d}.

For a single qubit, d=2d = 2 and r=(1p)/2r = (1-p)/2.

A noiseless sequence on the simulator

Our simulator is noiseless, so every RB sequence returns survival probability exactly 11 — which is precisely the reference curve every real device is compared against. The mechanical heart of RB is that a sequence followed by its inverse is the identity. We can verify that with a concrete Clifford sequence.

Take the Clifford word H,S,HH,\, S,\, H on one qubit and then append its inverse, H,S,HH,\, S^\dagger,\, H (gates inverted and reversed in order, using H1=HH^{-1}=H and S1=SS^{-1}=S^\dagger). The whole six-gate circuit composes to the identity, so a noiseless run returns 0|0\rangle with probability 11. On a noisy device that probability would be slightly below 11, and its decay with sequence length is what RB measures.

Try it

Build the length-3 Clifford sequence H,S,HH, S, H on one qubit, then append the inverting Clifford so the net operation is the identity, and measure. The grader checks that the survival probability of 0|0\rangle is exactly 11.

Run your code to see the quantum state.

After running, the Probabilities tab should show all weight on 0: the sequence-plus-inverse is the identity, the noiseless RB survival probability.

Sign in on the full site to ask questions and join the discussion.