Fig. 4: Schematic representation of an HMM for leakage detection.

For both ancilla and data qubits only two hidden states are considered, corresponding to the qubit being either in the computational (teal) or leakage subspace (orange). Transitions between these states occur each QEC cycle, depending on the leakage and seepage probabilities. The state-dependent observables are the defects \(d\left(Q\right)\) on the neighboring stabilizers. For ancilla qubits, the in-phase component Im of the analog measurement is also used as an observable.