Statistics · Quantum error correction
Online Bayesian drift tracking for QEC decoders
GitHub(private)
Abstract
A surface-code decoder is matched against a detector error model calibrated once; the hardware drifts, and a stale noise prior costs logical error rate. qecdrift is the online estimator: a bootstrap particle filter over two channel scales sg, sm that consumes the live syndrome stream and re-primes a minimum-weight matching decoder between batches. Two structural facts fix the design. Uniform drift shifts every matching edge weight by the same constant and leaves the decoder invariant, collapsing the tracked state to the relative channel split; marginal firing rates respond near-collinearly to the two channels, a ridge broken by time-like pair coincidences. An exact algebraic collapse of the composite likelihood onto its interpolation grid makes update cost nearly independent of particle count: 106 particles at ~2 ms/batch on an H100. In 4M-shot simulation sweeps the adaptive decoder cuts post-event logical errors 10.0–13.6% at d = 3/5/7 (each z > 18). A strictly causal replay of all 248 configurations of Google's 105-qubit Willow dataset certifies most of the device stable and resolves one readout ramp to 1.81×.
keywords: particle filter · surface code · composite likelihood · frequentist coverage · MWPM
## The drifting-noise state and its decoder coupling
A distance-d surface-code memory experiment emits, per batch of B shots, a B × D binary detection-event matrix and the batch's logical outcomes. The detector error model represents circuit noise as independent Bernoulli mechanisms, each firing with probability pe and flipping at most two detectors; a matcher assigns edge weight we and returns the minimum-weight perfect matching of the observed events. The pe are the decoder's prior, and everything here concerns what happens after calibration stops being true. The latent drift is two multiplicative scales relative to nominal, sg on the depolarizing gate and idle channels and sm on the measurement- and reset-flip channels, tracked in log-scale so drift is additive and positivity is automatic:
The random-walk dynamics track drift as a discrete-time latent process indexed by batch, the streaming unit within which noise is effectively constant. Scaled probabilities are capped below 1/2 so no particle proposes an invalid circuit.
## Why the state is two-dimensional
Scaling a mechanism's probability to s·pe moves its edge weight by a constant additive shift to leading order in pe:
Adding the same constant to every edge changes a candidate matching's cost by that constant times its edge count, so MWPM decisions move only where minimum-weight solutions of different cardinality compete. Uniform drift is therefore decoder-irrelevant: the sweep's in-phase control confirms that a decoder handed the true uniform scale gains nothing over one that never recalibrates, at every distance tested. Any drift monitor that summarizes the device by a single number is decoder-irrelevant for matching, however accurately it tracks; adaptation pays only for the relative split, which is what licenses a two-dimensional state. That split is hard to see from marginals. The exact firing probability of detector i under its incident mechanisms,
has a Jacobian in (ln sg, ln sm) whose two columns are strongly correlated: a likelihood ridge. On marginals alone the gate scale tracks at RMSE 0.03 in log-scale while the measurement scale wanders at 0.23. Time-like pair coincidences break the ridge, because measurement errors flip the same stabilizer's detectors in consecutive rounds and drive the shared-mechanism term of the exact pair rate P11 = (1−c)ab + c(1−a)(1−b). Adding the top K = 4000 most-informative pairs brings the measurement RMSE to 0.125 and stabilizes the filter.
## Composite likelihood, calibration, and the grid-field collapse
The batch statistic is marginal counts ni and pair counts nij, modeled as independent binomials against μi(s) and P11,ij(s) — a composite likelihood, consistent for point estimation but overconfident. Rates are evaluated exactly on a 15 × 15 log-spaced grid over (sg, sm) ∈ [1/4, 4] by rebuilding the DEM at each node, cached once per (d, r, pnom), with no small-p approximation anywhere. Tempering the composite log-likelihood by an exponent λ restores calibration: measured frequentist coverage sets λ for near-nominal 90% bands, and the choice costs nothing in decoding — adaptive logical error rate is flat to 0.2% across 2.5 decades of tempering. The composite log-likelihood is bilinear in per-node grid fields, so it collapses exactly onto a per-node dot-product: the data summary is computed once per batch on the grid nodes, and each particle reads its likelihood off by bilinear interpolation, making update cost nearly independent of particle count. The CuPy filter holds 106 particles at ~2 ms/batch in float64 on an H100, an order of magnitude inside the ~19 ms the device takes to produce the batch. The GPU field path is unit-tested against the dense likelihood to round-off.
## Simulation and the Willow replay
Each batch is decoded three ways: a static matcher that never recalibrates, an adaptive matcher rebuilt at the filter's causal one-step-ahead estimate, and an oracle that knows the true scales. In SLURM array sweeps over d = 3/5/7 at 4M shots per condition, an uncompensated readout event tripling measurement noise makes the adaptive decoder cut post-step logical errors 10.0/10.0/13.6%, each z > 18, recovering 93–100% of the oracle gap; the gain grows with distance. Against the per-edge Spitz moment-matching estimator, the filter holds oracle-grade decoding at batch sizes 10× smaller — a data-budget frontier, not a uniform win, since Spitz drops below the static decoder at 250-shot batches. All 248 configurations of Google's 105-qubit Willow memory dataset (12.4M shots) were replayed strictly causally. The released RL-optimized priors are decoding-tuned but per-detector miscalibrated, with observed-to-predicted firing ratios 0.60–1.66; anchored to them the filter drifts to a spurious optimum, so base rates are set in a causal calibration window and the DEM supplies only the response. The filter then certifies most of the device stable with bands that tighten with distance (0.30/0.23/0.19 at d = 3/5/7), resolves one placement's readout ramp to 1.81× within minutes with the gate scale pinned at 1, and finds adaptive decoding at exact statistical parity with static across all 248 configurations — the honest null the simulations predict for drift of this amplitude on a frequently recalibrated device. Anchors reproduced the dataset's published values before any drift claim.
Python, Stim, PyMatching, NumPy, CuPy (float64) · SLURM array sweeps · A100/H100 · 17 unit tests incl. grid-field-vs-dense to round-off and GPU/CPU parity.
Liam Kozma · liam@liamkozma.com