Randomized benchmarking (RB) is the standard protocol real quantum-computing labs and certification courses use to measure average gate fidelity without needing full state tomography. A qubit starts in |0⟩. A sequence of m random Clifford gates is applied, followed by one computed inversion gate equal to the exact inverse of the net rotation — so in a perfect, noiseless device the qubit always returns to |0⟩.
Bloch vector after m steps (noiseless net rotation = identity):
|v(m)| = p^m (p = average per-gate depolarizing retention)
Survival probability:
P(0) = (1 + p^m) / 2 = A·p^m + B (A=B=1/2)
Average error rate: r = (d-1)(1-p)/d = (1-p)/2 for a qubit (d=2)
Average gate fidelity: F_avg = 1 - r
- Run RB Sequence — animates one random Clifford sequence of length m on the Bloch sphere, then applies the inversion gate; the depolarizing noise channel shrinks the arrow toward the origin at every step, so it lands short of the pole even though the rotation itself is exact.
- Sweep m & fit decay curve — repeats this at several sequence lengths (each averaged over K trials), plots P(0) vs m, and fits P(m) = A·p^m + B by linear regression on log-space to recover p and the average gate fidelity — exactly how a real RB experiment extracts a single-number fidelity for a physical qubit.
- The point cloud around the sphere shows the K final Bloch vectors for the current m: tight near the pole at small m/low error, spread and shrunk toward the center as m grows or the per-gate error rises — a direct visual of how error accumulates over a circuit.
Real-world relevance: this is the exact benchmark IBM, Google, Rigetti and quantum-workforce training labs run to certify a qubit's usable gate fidelity before it goes into a real algorithm — the number reported here (Favg) is the same "gate fidelity" figure quoted on every quantum-hardware spec sheet.