Skip to main content

Appendix C — The echo-calibration protocol and inversion in Hamming sectors (§105–§108)

Chapter 22 explains why the echo is needed: the qg filter discards the shots that left the sector, but it does not see the errors that move an excitation from one qubit to another without changing the weight. This appendix gives the protocol step by step, what it costs, an exact example generated by tools/make_appendices.py with the functions of qang.sectors, and the record of the four pre-registered runs of the notes.

C.1 The protocol

  1. Sector. \(n\) qubits and weight \(w\): the sector has \(D=\binom{n}{w}\) basis states, \(|e_1\rangle,\dots,|e_D\rangle\) (sector_states).
  2. Echoes. For each \(j\): prepare \(|e_j\rangle\) with \(X\) gates, apply the network \(W\) and then \(W^\dagger\), and measure in \(Z\). Without errors the circuit returns to \(|e_j\rangle\). The notes use 4000 shots per echo.
  3. Matrix. Filter each echo to the sector (filter_distribution). Its distribution over the \(D\) states is column \(j\) of \(M\), with \(M_{ij}=P(e_i\text{ measured}\mid e_j\text{ prepared})\) (echo_transfer_matrix).
  4. Root. The circuit to be read has half the gates of the echo, so it is corrected with \(A=M^{1/2}\): the principal, real, non-negative, column-normalized root (matrix_power_stochastic).
  5. Unmixing. Filter the circuit’s distribution, \(f\), and solve \(Ax=f\) with \(x\ge0\) by non-negative least squares; normalize \(x\) (unmix_sector).
  6. Reading. Each qubit reads \(m_Z(q)=1000\,(1-2p_q)\) with the populations of \(x\).
  7. Before using it. Simulate without noise at the same shots to know the sampling error. The echo helps when the filtered error is well above that level, and not when it is already almost all shot noise (§108).

C.2 Cost

Table C.1: One echo per sector state; the matrix is measured once per network, not per input.
qubits weight sector states \(D\) echo circuits echo shots (4000 each) used in
5 1 5 5 20,000 §105, §106, §108
5 2 10 10 40,000 §107
8 1 8 8 32,000 —
8 2 28 28 112,000 §115

The cost grows as \(\binom{n}{w}\), not as \(2^n\): that is what makes the inversion practical. At weight 2 with 8 qubits it is 28 circuits; a full readout confusion matrix on 8 qubits would need 256.

C.3 An exact example

The script builds an in-sector channel \(K\) on 5 qubits and weight 1, with probability 0.90 of staying on the right qubit, and a T1 loss of 15% of the shots to \(|00000\rangle\), which reads \(+1000\) m-qg on every qubit. The echo applies \(K\) twice, so \(M=K^2\) (mean diagonal 0.81), and the principal root recovers \(K\) exactly. That is the assumption behind \(M^{1/2}\): that the way back has the same error as the way out. In §105 the full \(M\) did better on Forte-1, so it does not always hold.

Table C.2: No shot noise. The filter removes the loss; \(M^{1/2}\) undoes \(K\); the full \(M\) over-corrects and ends near the filter alone.
readout mean \(qg_Z\) error (m-qg)
without qang 71.9
qg filter 37.5
filter and echo, \(M^{1/2}\) \(<10^{-12}\)
filter and echo, \(M\) 36.7

Why non-negative least squares and not the inverse. With 1000 shots per run, in 37 of 300 runs the direct inverse \(A^{-1}f\) gives some negative population, which is not a probability. The non-negative solution never does. The mean \(qg_Z\) error is almost the same: 21.6 m-qg with the inverse and 21.5 m-qg with the non-negative solution. What is gained is that the result is always a distribution, not accuracy; that is why the usual readout mitigation also restricts the solution to the simplex.

C.4 The four pre-registered runs

Table C.3: The runs of the notes, on the noise models of three IBM and two IonQ devices.
§ predictions (commit) passed result
§105 C1–C4 (052752d) 4 of 4 weight 1, 5 qubits, five simulated devices: the echo removes 38–47% of the error the filter leaves; filter plus echo, 6–7× more accurate than the raw readout
§106 L1–L4 (fa8eda6) 4 of 4 the weight-1 classifier, 189 inputs: the decision-value error falls 43–56%; decisions differing from the noiseless model, 15 → 7 → 3
§107 W1–W4 (4d83029) 4 of 4 weight 2, a 10 × 10 matrix: the echo removes 37–43% of the \(qg_Z\) error and 39–48% of the \(qg_{ZZ}\) error
§108 M1–M4 (4ae2674) 0 of 4 narrow-margin inputs: the filter cuts flipped decisions from 47 to 17 and the echo adds nothing (19)

In total, 12 of 16 predictions passed. The script checks that each cited commit exists and that in it the notes did not yet have the section: the four ’before’s are consistent (Appendix E). The numbers in the table come from the notes; the examples/ scripts each section names reproduce them, but they take hours and this appendix does not run them.

The failure of §108 is the rule of step 7. In that model the decision value scatters by about 0.22 from shots alone, and with the filter the error was already 0.26–0.35: little in-sector bias was left, and inverting the matrix only added variance. In §106 the filtered error was 0.47–0.87, mostly bias, and the echo halved it.

Bibliographic notes

The echo is that of Hahn (1950); readout-error mitigation by inverting a confusion matrix, Bravyi et al. (2021). The sector filter is the symmetry verification of Bonet-Monroig et al. (2018). The numbered notes (§) and the scripts are in the repository (Monteverde 2026).