|q⟩ Bad Qubits

advanced · Programming · Benchmarking, Noise Characterization & RB

Readout Error Mitigation

The last operation in almost every quantum program is a measurement — and measurement is one of the noisiest steps. A qubit that is truly in 0|0\rangle is sometimes reported as 1, and vice versa. Readout error mitigation corrects these assignment errors after the fact, using a calibration of how often each kind of misreport happens.

The assignment (confusion) matrix

Characterize the readout by preparing each basis state and recording what the detector reports. For one qubit this fills a 2×22\times 2 assignment matrix (also called the confusion or response matrix):

A=(P(00)P(01)P(10)P(11)),A = \begin{pmatrix} P(0\,|\,0) & P(0\,|\,1) \\ P(1\,|\,0) & P(1\,|\,1) \end{pmatrix},

where P(ij)P(i\,|\,j) is the probability of measuring ii given the qubit was prepared in jj. Each column sums to 1. A perfect detector gives A=IA = I; a realistic one might look like

A=(0.900.050.100.95),A = \begin{pmatrix} 0.90 & 0.05 \\ 0.10 & 0.95 \end{pmatrix},

meaning a true 0|0\rangle is misread as 1 10% of the time, and a true 1|1\rangle is misread as 0 5% of the time.

Inverting the readout

The measured distribution pmeasp^{\text{meas}} is the true distribution ptruep^{\text{true}} passed through the detector:

pmeas=Aptrue.p^{\text{meas}} = A\, p^{\text{true}}.

To recover the truth we simply invert:

ptrue=A1pmeas.\boxed{\,p^{\text{true}} = A^{-1}\, p^{\text{meas}}.\,}

For the 2×22\times 2 case, with A=(abcd)A = \begin{pmatrix} a & b \\ c & d \end{pmatrix} and detA=adbc\det A = ad - bc,

A1=1adbc(dbca).A^{-1} = \frac{1}{ad - bc}\begin{pmatrix} d & -b \\ -c & a \end{pmatrix}.

So if the detector reports pmeas=(0.4, 0.6)p^{\text{meas}} = (0.4,\ 0.6), the corrected probability of 0 is

p0true=dp0measbp1measadbc=0.95(0.4)0.05(0.6)0.90(0.95)0.05(0.10)=0.350.850.4118.p^{\text{true}}_0 = \frac{d\,p^{\text{meas}}_0 - b\,p^{\text{meas}}_1}{ad - bc} = \frac{0.95(0.4) - 0.05(0.6)}{0.90(0.95) - 0.05(0.10)} = \frac{0.35}{0.85} \approx 0.4118.

The correction pulls the distribution apart — it pushes weight away from the value the noisy detector spuriously favoured.

Mitigation, not correction

It is worth being precise about the claim. Readout mitigation does not fix a single shot — it adjusts the aggregate statistics of many shots so that expectation values come out unbiased. It also assumes the assignment matrix is stable between the calibration run and the experiment; readout drift breaks that assumption and is one reason calibration is repeated often. Unlike quantum error correction, no information is recovered at the quantum level — this is classical post-processing of measurement outcomes.

Try it

You are given a measured distribution pmeas=(0.4, 0.6)p^{\text{meas}} = (0.4,\ 0.6) and the assignment matrix above. Compute and return the corrected probability of outcome 0, p0truep^{\text{true}}_0, by applying A1A^{-1}. The grader checks your value against the analytic result 0.35/0.850.35/0.85.

Run your code to see the quantum state.

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