Always-On Quantum Error Tracking with Continuous Parity Measurements

We investigate quantum error correction using continuous parity measurements to correct bit-flip errors with the three-qubit code. Continuous monitoring of errors brings the benefit of a continuous stream of information, which facilitates passive error tracking in real time. It reduces overhead from the standard gate-based approach that periodically entangles and measures additional ancilla qubits. However, the noisy analog signals from continuous parity measurements mandate more complicated signal processing to interpret syndromes accurately. We analyze the performance of several practical filtering methods for continuous error correction and demonstrate that they are viable alternatives to the standard ancilla-based approach. As an optimal filter, we discuss an unnormalized (linear) Bayesian filter, with improved computational efficiency compared to the related Wonham filter introduced by Mabuchi [New J. Phys. 11, 105044 (2009)]. We compare this optimal continuous filter to two practical variations of the simplest periodic boxcar-averaging-and-thresholding filter, targeting real-time hardware implementations with low-latency circuitry. As variations, we introduce a non-Markovian ``half-boxcar'' filter and a Markovian filter with a second adjustable threshold; these filters eliminate the dominant source of error in the boxcar filter, and compare favorably to the optimal filter. For each filter, we derive analytic results for the decay in average fidelity and verify them with numerical simulations.


Introduction
Quantum error correction (QEC) is essential to building a scalable and fault-tolerant quantum computer [1,2].
Although the theory of QEC has been developing since the 1990s and is now well established for the circuit model of quantum computation, the practical implemention of QEC in realistic hardware raises additional nuance that prompts more detailed investigation. The present work addresses one aspect of QEC implementation that is relevant to modern superconducting qubit architectures [3,4] by investigating whether the timecontinuous nature of standard dispersive qubit measurements can be used in principle to improve the logicalstate-tracking fidelity in the prototypical error correction scenario of a 3-qubit bit-flip code [5]. We show that direct monitoring of the error syndromes reduces hardware resources compared to the circuit model of QEC while maintaining performance.
Circuit models of QEC redundantly encode a logical qubit state into multiple physical qubits. Examples of this model include the Shor [6], Steane [7], and Calderbank-Steane-Shor (CSS) codes [8,9], as well as more general stabilizer codes [10][11][12][13][14]. Encoded information is checked by measuring ancillary qubits that are entangled with the redundant code subspaces. The ancilla measurements project the logical qubits back onto the code subspaces, effectively converting analog drifts of the encoded state into digital jumps between code subspaces (e.g., bit flips, phase flips, or combinations thereof). The measurement results provide information about jumps between code subspaces, thus enabling correct decoding of the logical qubit state. Different encoding schemes protect against different error types and quantities according to the redundancy of the code subspaces, with the simplest codes protecting against only single jumps per measurement cycle. Simple forms of such gate-based QEC have already been implemented in several experiments, see e.g. [15][16][17].
Stabilizer codes typically assume ancilla-based projective syndrome measurements. However, for superconducting qubits this assumption can be problematic for two reasons. First, the repeated entangling and disentangling of the code and ancillary qubits adds additional gate overhead and hardware resources. This overhead also increases the vulnerability of the protocol to additional error mechanisms. Second, superconducting qubit architectures implement projective measurements by integrating and thresholding time-continuous dispersive measurements, which are not instantaneous projections as assumed by the theoretical quantum circuit model [18][19][20][21]. The temporally extended nature of the measurements further increases the overhead by substantially lengthening the achievable cycle time for periodic syndrome measurements. These challenges raise the question whether alternative strategies for performing the syndrome measurements could be fruitful.
A possible route to perform QEC without the overhead of ancilla qubits is to directly monitor the error syndromes continuously in time [22,23]. With this variation, the code subspaces for the error syndromes are directly coupled to a continuous readout device [24][25][26][27][28][29][30], avoiding the need for periodic entangling gates and additional ancilla measurements. This idea of continuous quantum error correction was proposed in Ref. [31], and further developed in Ref. [32][33][34][35][36][37][38][39]. Experiments have since demonstrated several necessary components of continuous QEC, including measurement-generated entanglement between pairs of qubits via continuous parity and partial-parity measurements in superconducting circuits [40][41][42][43]. We have thus reached a stage of technological development where implementing continuous QEC becomes feasible for at least the simplest codes.
In principle, continuous measurements have the advantages of being: (1) Always on -A continuous measurement eliminates dead time between measurement cycles of ancillary qubits, preventing errors from occurring during entangling-gate sequences. (2) Natural -Standard dispersive measurements in superconducting circuitry are already continuous, producing binary results only after integrating and thresholding. (3) Potentially faster -Continuous measurements have a characteristic time scale to distinguish the signal from the intrinsic background noise, which can be shortened to yield "strong continuous measurements" that rapidly yield information about error syndromes. Continuous measurements also have disadvantages, however, since they are: (i) Noisy -An experimenter must interpret a stochastic time-continuous signal, which is a more difficult signal processing problem than for discrete ancilla measurements. (ii) Challenging -Using ancillary qubits of the same design as the data qubits is conceptually straightforward, whereas physically implementing direct syndrome measurements requires specialized qubit circuits. (iii) Computationally expensive -Op-timal signal processing of the continuous readout may have high latency.
In the present paper, we assess the performance of implementing continuous QEC for the simplest three-qubit bit-flip code, assuming a simplified model of modern superconducting hardware, and develop practical filters to interpret the stochastic time-continuous signals. We show that for passive error tracking the benefits of continuous measurements can outweigh the disadvantages, enabling high-fidelity decoding of the logical qubit without the need for active feedback. This positive result is particularly interesting, since much of the previous work on continuous QEC has focused on applying active feedback based on the monitored syndrome signals to also correct the errors continuously [31,39], which has been shown to be rather ineffective due to the large noise of the signal, as well as degradations from signal processing delay [44]. For simplicity, we consider passive error tracking for a prototypical setup that tracks only Poisson-distributed bit-flip errors in a three-qubit code, and consider possible generalizations in the subsequent discussion. However, we emphasize that these techniques also apply to active error correction with the additional caveat that additional errors not considered here may occur during the correction pulses.
We compare three signal-processing filters for interpreting the error syndromes. We expand upon the Bayesian filtering methods discussed by van Handel and Mabuchi [34,35] and derive a linear version of the Bayesian filter that permits faster numerical calculation of the most likely state compared to the nonlinear (Wonham) filter. To address the issue of computational expense we then propose two variations of the simplest Markovian "boxcar" filter that averages the noisy signals over temporal segments of a fixed length. After analyzing the ways in which error tracking can fail for the boxcar filter, we identify the dominant source of error that compromises its performance. We then introduce an improved non-Markovian "half-boxcar" filter that corrects the dominant error of the boxcar filter by re-examining the memory of the preceding half-boxcar average. Finally, we introduce an improved Markovian "double threshold" filter that also corrects the dominant error of the crude boxcar filter by using two signal thresholds. Both variations can be readily implemented with low-latency circuitry, such as field-programmable gate arrays (FPGAs), and compare favorably to the optimal Bayesian filter. We derive analytic results for the initial drop in fidelity and the approximately linear fidelity decay rate for each filter, optimize them over the free filter parameters, and verify them with numerical simulations, finding good agreement.
We now summarize the main findings of this paper. We provide a simple direct parity readout implemen-tation for superconducting transmons that relies on entangling strongly detuned resonator linewidths with the two-qubit parity subspaces. Our proposed design has recently been fabricated and tested [45,46], which motivates our current work. We derive analytic results for the initial drop of each signal-processing filter, as well as their logical error rates, which are summarized in Tables 2 and 3. We verify these analytical results through explicit numerical simulations in Figures 6a-6d. In particular, we conclude that the "half-boxcar" filter performs comparably to the optimal Bayesian filter and is therefore a good candidate for real-time laboratory implementation with an FPGA because of its simple numerical requirements.
The paper is organized as follows. In Section 2 we review the basics of the three-qubit bit-flip code, and pose the problem. In Section 3, we discuss a possible implementation for the continuous syndrome measurements. In Section 4 we introduce and analyze an optimal linear Bayesian filter. In Section 5 we introduce and analyze three periodic averaging filters that are more efficient but suboptimal. In Section 6, we describe our numerical simulations for the continuous syndrome measurements. We verify our analytics of the continuous and periodic filters with the numerics, and discuss the results. We conclude in Section 7. We also include an Appendix that contains a complementary analysis of an ancilla-based projective measurement implementation of the three-qubit bit-flip code.

Three-qubit bit-flip code
For clarity we review the basics of the three-qubit bitflip code and introduce notation and terminology.

Encoding and error syndromes
The standard bit flip code redundantly encodes a logical qubit state α|0 L + β|1 L into three physical qubits, and uses majority-voting to identify and correct single bit flip errors. We number the bits from left to right as 123. We use quantum computing conventions for the Pauli operators: I = |0 0| + |1 1|, X = |0 1| + |1 0|, Y = −i|0 1| + i|1 0|, and Z = |0 0| − |1 1|. To indicate idling and bit flip operations on the physical qubits, we use the Pauli identity I and flip X operators. The initial encoding of the logical state is recovered after an idle operation III. Omitting tensor products for brevity, we use the notation III to indicate the original encoding. Similarly, the operations after a single bit flip on the first, second, or third qubit are XII, IXI, IIX, respectively, which also serve as suitable labels for the resulting encodings. For example, these bit flips produce the states In each single-bit-flip case, the resulting states can be perfectly decoded as long as the new encoding is learned.
We can learn which single bit flip has occurred without destroying the logical state by performing projective parity measurements Z 1 Z 2 and Z 2 Z 3 on the system, where the subscripts of the Pauli Z operators indicate the bit number. These parity measurements give results +1 or −1 if the parity of the two coupled bits is even or odd, respectively. The parity measurements must be performed without measuring each qubit individually in order to preserve the coherence of the logical state. After performing a syndrome measurement of the pair of parities (Z 1 Z 2 , Z 2 Z 3 ), we can use the syndrome outcomes to identify the new logical encoding according to the mapping: These syndrome measurements are checked periodically to detect single bit flips and infer the updated logical encoding. If desired, one could apply the operation of the encoding label to restore the encoding to the original encoding. For example, if we detect the parity measurement outcome is (−1, +1), we know the encoding is XII; therefore, applying the operation XII restores the encoding III since applying XII twice on the initial state yields the identity. However, this correction step may be delayed or omitted, since knowledge of the encoding is sufficient to use the coherent quantum information. Therefore, we assume passive error tracking, rather than active error correction, for the remainder of the paper.
The code does not protect against two simultaneous bit flips from the III encoding, denoted XXI, XIX, and IXX, which produce the states Parity measurements of complementary bit states are identical, so the error syndromes will not correctly identify the change in encoding if two bit flips occur between two syndrome measurements. An incorrect identification of the encoding produces a logical error since the quantum information can no longer be correctly decoded. The situation is the same with three bit flips, denoted XXX, which produces an encoding complementary to the original encoding This syndrome ambiguity is not resolved by including a third parity measurement of Z 1 Z 3 , so we restrict our analysis to two parity measurements to minimize hardware resources. However, we note that adding the third parity measurement would slightly improve our ability to discriminate sequential bit flips from a single bit flip. The code also does not protect against non-bit-flip errors of the data qubits, such as phase flips, which can also produce logical errors. Similarly, the code is not fault-tolerant, so does not protect against all errors that can appear during syndrome measurements, such as bit flips of ancillary qubits in the middle of an entangling gate.
Our task is to track the transitions between the 8 encodings produced by bit flips, starting from the initial encoding III. We measure the syndromes to update our knowledge of the encoding. At some later time t, if we still know the correct encoding then we have tracked all bit flip errors successfully and thus can correctly decode the state. However, if we incorrectly track the encoding, then we have failed to track bit-flip errors, so trying to decode the state will produce a logical error.
We define the (binary) fidelity f (t) ∈ {0, 1} of error tracking after a duration t to be 1 if the knowledge of the encoding matches the true encoding, and 0 if they differ. The average fidelity F (t) ∈ [0, 1] is the average of the binary fidelity over many tracking realizationsequivalent to the process fidelity in quantum process tomography-and serves as a useful performance metric.

Bit-flip error model and fidelity
For simplicity of analysis, we assume that bit flips occur independently, infrequently, and at a slow but constant rate µ per qubit, so that the flips are Poisson-distributed in time. We take the bit-flip rate to be equal for each of the three qubits for simplicity and symmetric with respect to the bit states. To focus on the flipping dynamics, we work in the rotating frame of the physical qubits, which remain uncoupled, so the effective idling Hamiltonian is zero.
With these assumptions, the bit-flip-tracking task reduces to finding the evolution of a hidden Markov model [34,35,47,48], with the possible transitions illustrated as the arrows in Fig. 1. Each encoding k = 0, . . . , 7 described in the previous subsection has a probability P k ∈ [0, 1] such that k P k = 1. We assume the initial encoding state is III. The master equation that describes the jump processes on average can then be expressed as a matrix equation with probability vector P = [P 0 P 1 P 2 P 3 P 4 P 5 P 6 P 7 ] T and Markov transition matrix Note that we neglect double-flip or triple-flip processes in this matrix. The solution P (t) = exp(tM) P (0) asymptotically approaches the uniform distribution as a fixed point for large t, lim t→∞ P k = 1/8. The average encoding fidelity F (t) ≡ P 0 (t) may be obtained by solving Eq. (10). Each bit flips independently, so the solution factors into a product of exponential decays of each bit to an asymptotic flip probability of 1/2. The average fidelity with no jump tracking is thus The fractional deviation of this decay from the linear regime is (6µ 2 t 2 )/(3µt) = 2µt. For later optimizations we bound this deviation by 1/15 to ensure that the linear approximation F (t) ≈ 1 − 3µt is a reasonable decay model, which bounds µt ≤ 1/30 and thus the maximum average fidelity drop while remaining in the linear regime to 1 − F (t) ≤ 10%.
For practical error-tracking purposes, it is sufficient to focus on improving the short-time fidelity with linear decay by tracking the jumps with syndrome measurements. After including jump tracking, the approximate form of the fidelity in the linear regime will be where ∆F in is the initial drop in fidelity on a short time scale, while Γ is the average logical error rate for longer time scales after the tracking method takes full effect. In later sections we will derive approximate expressions for and optimize this linear drop in fidelity to assess the relative performance between error correction methods. We will find that with good error correction the optimized linear decay Γ scales as µ 2 after the shortduration initial drop in fidelity ∆F in that is still linear in µ.

Physical Setup
The goal of a physical realization of the three-qubit code is to perform the syndrome measurements of the twoqubit parities (Z 1 Z 2 , Z 2 Z 3 ) and use them to track bit flips to preserve the knowledge of the logical state encoding. We focus on direct syndrome measurement that is continuous in time, in contrast to traditional ancillabased periodic syndrome measurements. For concreteness, we consider one possible physical implementation with modern superconducting transmon qubits [49] on a two-dimensional wafer, shown in Fig. 2, where the parities are measured continuously via dispersive coupling to microwave resonators [45,46]. While a third parity measurement of Z 1 Z 3 is possible in principle by wrapping the qubits into a ring, it increases the complexity of the hardware.
In this configuration, the readout resonators are coupled to pairs of data qubits to directly measure the parity. The dispersive shifts χ for each qubit (e.g., χ 1,2 or χ 2,3 in Fig. 2) must be tuned to be identical, such that they are comparable to or greater the linewidth κ Figure 2: Possible experimental setup for continuous bit flip error correction using the three-bit code. The parity of neighboring qubits (zizj) = ±1 is measured directly by coupling both qubits to the same readout resonator such that they each dispersively shift the resonator frequency by the same amount, χi,j. Pumping on resonance then populates the resonator field entangled with the odd parity subspace, leaving the even parity subspace entangled with a near-vacuum state. Homodyne measurement produces a stochastic signal, Ii,j(t), that directly reveals the parity after renormalization, Integrating this stochastic signal for the characteristic time scale τ produces a unit signal-to-noise ratio for identifying the qubit-qubit parity.
of the resonator, 2χ κ. By fabricating qubits 1 and 3 with tunable SQUID loops, the dispersive shifts can be tuned to match as required [45,46]. The odd-parity subspace with two-qubit states |01 and |10 will shift the resonator frequency first up by χ then down by −χ (or vice versa) to return to its original resonance frequency. The even-parity subspace will have |11 shift the frequency by 2χ κ while |00 will shift by −2χ so that the line widths do not overlap strongly. Hence, the resonant pump will produce a non-vacuum steady-state field in the resonator only for the odd-parity subspace, leaving the even-parity subspace in vacuum.
After amplifying the leaked fields and measuring them via homodyne detection along the maximally in-formative field quadrature, a stochastic signal is obtained for each parity resonator. The resonator connected to data qubits 1 and 2 produces the signal I 1,2 (t), while the resonator connected to data qubits 2 and 3 produces the signal I 2,3 (t). After properly shifting and normalizing these signals, they approximate movingmean Gaussian stochastic processes centered at the parity eigenvalues (z i z j ) = ±1: Here, dW 1,2 and dW 2,3 are statistically independent Wiener increments, each with zero mean Gaussian statistics and variance dt. Formally these increments can also be understood as δ-correlated white noise, For simplicity in what follows, we assume both noises are characterized by the same characteristic measurement timescale τ 1,2 = τ 2,3 = τ , which signifies the integration duration needed to achieve unit signal-to-noise ratio (SNR). The parity information can thus be recovered by processing the stochastic signal over a duration of time. As a temporal reference in simulations, we will fix the measurement timescale to be fast, τ = 100 ns, and consider relatively slow bit-flip rates in the range µτ ∈ [10 −6 , 10 −3 ]. This direct parity-measurement method reduces hardware resources compared to an ancilla-qubit-based approach. Such a gate-based approach would require two additional ancilla qubits to measure the parities (in addition to the readout resonators for each ancilla qubit), as well as periodic entangling gates and projective measurements. In contrast, the direct paritymeasurement method considered here requires only a single readout resonator per parity measurement. The direct method also yields a raw, time-continuous parity signal, which can be processed in two distinct ways for the purposes of error correction: 1. Continuous filtering to track the most likely errors that have occurred in real time

Periodic filtering by integrating and thresholding over consecutive durations ∆t
Notably, the second method can use the same errortracking algorithm as for the ancilla-based approach with periodic projective measurements. We now analyze both methods in the following sections.

Continuous Bayesian filter
Environmental perturbations during monitoring cause jumps between the encoding states in Fig. 1. Encodings connected by a single jump have distinct parity eigenvalues, so the means of the noisy parity signals in Eqs. (14) will correspondingly jump. Integrating these noisy signal with a moving temporal window with a duration longer than τ can therefore identify infrequent single jumps [50], allowing the changes in logical encoding to be tracked via the changing syndromes. However, if multiple jumps occur within a time scale comparable to τ , then the noise can prevent the jumps from being identified before the encoding jumps to a complementary one with a parity indistinguishable from the original one. Such a misidentification of an encoding with its complement oding is a logical error that will not be corrected by continued monitoring. It is thus important to filter the noisy signals in a way that minimizes misidentification errors caused by rapid successive jumps. An optimal time-continuous filter can be derived by using all available information to process the timecontinuous noisy signals. The key idea is to update the encoding probabilities P at each moment in time using Bayes' rule, which requires known likelihoods of observing the collected signals given definite parities and a known estimate of the flipping rate µ. The maximum resulting probability then indicates the best guess for the updated encoding.
Importantly, the fidelity of tracking the encoding is determined only by the correctness of the estimate at the final time. The assumed Markovian dynamics imply that each random jump and random noise fluctuation is independent of past fluctuations, which implies that adding information from temporally extended signal correlations will not improve the final state estimate. In particular, time-symmetric smoothing methods [51][52][53]) that process the past signal still produce estimates identical to forward-in-time estimates for the state at the final time (as we have verified numerically), even though they do generally improve the tracking fidelity for past jumps. It is thus sufficient to consider only forward-in-time Bayesian updates to derive a filter that uses all relevant information about the stochastic signal and the flipping dynamics to achieve an optimal state estimate at the final time.
Such a time-continuous Bayesian filter is known as a Wonham filter [54], and has been applied to continuous error correction of the three-bit code by van Handel and Mabuchi [34,35]. However, the Wonham filter contains a nonlinear update from Bayes' rule that reduces its computational efficiency during real time processing of the stochastic signals. To address this problem, we introduce a variation of the Wonham filter that removes this nonlinearity to improve computational efficiency. Our linear Wonham filter uses unnormalized probabilities σ(t) that reproduce the correct probabilities after renormalization P (t) = σ(t)/|| σ(t)|| 1 with the 1-norm ties can be regularized periodically only as needed, drastically reducing the computational overhead of real-time processing with the filter. We expect this linear filter to be suitable for real-time processing with FPGAs to enable on-demand state estimation and feedback. We derive and analyze this filter in what follows.

Derivation of linear Bayesian filter
Recall that the Markovian master equation for the encoding probabilities P (t) without error tracking is Eq. (10). The goal is to update this evolution to include the information gained by the stochastic parity measurements. This new information will refine the probability evolution with Bayes' rule. Before deriving the linear filter, we first derive the nonlinear Wonham filter for comparison. The deterministic dynamics of the bit-flips is unchanged by the probabilistic updates from the measurement results, so the contribution of the averaged master Eq. (10) will be unchanged in the final dynamical equation. For this reason, we will initially neglect this deterministic part in the derivation, then add it back at the end.

Nonlinear Bayesian (Wonham) filter
After averaging the stochastic signals over a short duration dt, the rescaled readoutsr 1,2 andr 2,3 for the two continuous parity measurements are Gaussian with independent noises according to Eqs. (14), so the joint probability density of both results is a product of Gaussian distributions, Here the index k = 0, . . . , 7 indicates a definite encoding as described in Fig. 1, and the means s i,j|k = ±1 are the parity eigenvalues of the encoding shown in Table 1.
After collecting integrated readouts, each encoding probability P k in P should be updated via Bayes' rule, Since the likelihood probabilities are Gaussian with means that always square to 1, this update ratio considerably simplifies to P k → exp (dt/τ )(r 1,2 s 1,2|k +r 2,3 s 2,3|k ) P k exp (dt/τ )(r 1,2 s 1,2| +r 2,3 s 2,3| ) P . (18) This update is already sufficient to track the most likely state given a temporal sequence of integrated readouts {r i,j (n dt)} N n=0 . However, it can be conceptually useful to put the time-continuous deterministic evolution of Eq. (10) on equal footing with the Bayesian updates by taking the time-continuous limit of the latter to produce a filtering equation that includes both stochastic and deterministic updates. To do this, we expand the Bayesian update equation to first order in dt to obtain a nonlinear stochastic differential equation (SDE) in Stratonovich form (with time-symmetric derivative obeying standard calculus rules), to which we can simply add the deterministic part of the evolution from Eq. (10) giving where M k are the components of the transition matrix M in Eq. (11), and δ k is the Kronecker delta.This equation can be used directly to convert the data stream into a state estimation. The stochastic process can be modeled by converting the SDE to Itô form with a forward-difference derivative, which modifies the equation by adding an effective drift term [55]. After lengthy calculation, the added drift cancels the means of the stochastic signals Since in Itô form the noise terms ξ i,j are uncorrelated with each other and with the state probabilities at the earlier time step, this form of the equation makes it clear that averaging over all noise realizations eliminates the stochastic terms, leaving just the drift, to correctly recover the original Lindblad form master Eq. (10) without tracking. This SDE is the nonlinear Wonham filter used by van Handel and Mabuchi [35,54].

Linear Bayesian filter
We will now linearize the Wonham filter by removing the nonlinear normalization step from the Bayesian update. To do this, we define "unnormalized probabilities" σ such that σ/|| σ|| 1 = P recovers the same encoding probabilities as before. We then modify the key Bayesian update step of Eq. (18) by omitting the denominator: Note that we have preserved the cancellation of stateindependent Gaussian factors in the Bayesian update to prevent irrelevant (state-independent) changes in the norm. This linearized update isolates only the statedependent changes to the unnormalized probabilities.
Proceeding as before, we can expand this update to linear order in dt to obtain a filtering equation. Importantly, the instantaneous signals r i, ±1 of the actual encoding (i.e., not an expectation value in an estimated state), so do not depend upon the distinction between P or σ. We then add the deterministic updates as before with one modification: we remove the diagonal part −3µI of the transition matrix in Eq. (11) that is proportional to the identity matrix I. Any such term proportional to the identity causes irrelevant increases in the norm of σ and thus can be added or removed arbitrarily without affecting the relative sizes of its components. This freedom of choice is analogous to choosing a gauge and will be useful in the derivation to follow. The Stratonovich filtering equation then takes the simple linear form where This linear Bayesian filter directly depends on the measured signals r i,j (t) as well as the diagonal matrices S i,j of the parities s i,j|k shown in Table 1. Converting this equation to Itô form simply adds a state-independent drift term, σ/τ , on the right hand side that only changes the overall norm and can thus be omitted. As a result, Eq. (22) can be understood in either the Stratonovich or Itô picture without changing the results that will be predicted by the maximum unnormalized probability, We show examples of this filter being used for error tracking in Fig. 3. We contrast one example trial with only single bit-flip errors (top) against one trial with one "double-flip" error that is uncorrectable (bottom). In the successful tracking case, the filter tightly tracks the actual encoding jumps, with a delay in detecting jumps set by the characteristic measurement time τ . Noise fluctuations cause occasional errors that are rapidly corrected on the same time scale of τ . In the unsuccessful tracking case, two successive jumps that occur on a timescale faster than τ are misinterpreted as a different single bit flip, which produces a logical error that the filter is not designed to correct.

Bayesian filter analysis
We now derive simple expressions for the linear degradation of state-tracking fidelity in Eq. (13). We first consider the initial fidelity drop ∆F in , then consider the linear decay rate Γ at steady-state after the filter takes full effect. The Bayesian filter has no free parameters to optimize; it only depends on knowledge of the parity eigenvalues, the characteristic measurement time τ of the collected signals, and the estimated bit-flip rate µ. As a result, the derived expressions for fidelity decay provide an estimate for the best tracking fidelity that could be achieved in principle with continuous parity measurements.

Initial fidelity drop
The Bayesian filter has an initial drop in fidelity F in primarily because of its delayed response to a bit flip. This delay makes the filter vulnerable to bit flips that occur just before the final state estimate is requested. We thus expect a drop in fidelity by the probability of a bit flip occurring within one filter response time. We stress this is a general feature of all error correction techniques and is in no way special to our protocol.
The filters starts from time t = 0 with the correct encoding. Since the initial encoding is 0 (III) with certainty, we focus on the encodings reachable by one bit flip: 1 (XII), 2 (IXI), and 3 (IIX) according to the numbering in Fig. 1. For simplicity, we initially neglect the Gaussian noise in Eq. (22) to focus on the evolution caused by the signal means. We also use the freedom of the norm to add a constant term to Eq. (22) and shift the parity eigenvalues after each jump to 0 for the correct states and -2 for incorrect states; this shift simplifies the analysis by keeping correct state (unnormalized) probabilities nearly constant.
Focusing on the four states relevant from the previous paragraph (σ 0 , σ 1 , σ 2 , σ 3 ), the equation of motion is Here we have assumed that the true state of the system is (III), so the parities read by the detectors is r 1,2 = 1, r 2,3 = 1 (even,even). From Eq.
We have used the freedom of the overall norm of σ to subtract a factor of 2I/τ from all diagonal entries, so the correct state (0) does not grow, but rather the incorrect states decay.
It is now straightforward to see that starting from the initial condition (1, 0, 0, 0) the components σ 1 and σ 3 reach a steady state of µτ /2, while the component σ 2 reaches its steady state of µτ /4. The true component σ 0 actually grows very slowly from 1 as σ 0 ≈ 1+(5/4)µ 2 τ t, but we can neglect this correction on the time scales of interest. This is then the idling state of the filter while in the error-free original state.
The filter is able to catch the error when the value of σ 1 exceeds the value of σ 0 . This timescale defines the response time of the filter. Solving then µτ = e −2t/τ , we find the response time of the filter to a qubit 1 flip to be t (1) r = (τ /2) ln(1/µτ ). The definition of the initial drop of the filter fidelity is if the bit flip occurs before the filter can respond appropriately. Consequently, if the process is called after an error occurs, but before the filter can respond, then a logical error happens. The probability of this occurring is the drop in fidelity, ∆F = µt (1) r , which is linear in µ. Repeating this analysis for qubit 3 gives the same result, t For a qubit 2 error, both parities change (odd,odd), so the relevant equation of motion is Starting from the same initial conditions as before, the solutions are σ 0 (t) = e −4t/τ , and σ 2 (t) = (µτ /2) − (µτ /4)e −4t/τ , which limits quickly to µτ /2. Thus, the time when σ 0 becomes smaller than σ 2 is given by t

Adding up the drop contributions for the three single bit flips produces
The initial drop in fidelity is linear in µ up to logarithmic corrections, since the error correction has not taken full effect. As a reminder, we expect the long-time decay after error correction takes effect to be quadratic in µ. This estimate for the initial drop has neglected the role of the Gaussian noise in the signals. As seen in Fig. 3, noise fluctuations can occasionally cause the filter to jump to a different state estimate even when no bit flip occurs. These fluctuations produce false positives that are usually quickly corrected on the time scale of the filter response and do not contribute to the logical error rate. However, if such a fluctuation occurs just before the termination time, then the false positive is not corrected before the estimated state is requested, resulting in a misidentification error. A drop contribution from such noise-induced misidentifications should be added to the flip-based drop estimate in Eq. (29).
As we present in Section 6, we have numerically checked Eq. (29) with flip rates ranging from µτ ∈ [10 −6 , 10 −3 ]. We found that the derived expression systematically underestimates the drop by a small amount, as anticipated from the omission of the noise contribution. In order to correct this systematic underestimation in a crude way, we found that it is sufficient to alter the numerical prefactor in the first term of Eq. (29) by substituting 5/4 → 3/2, effectively adding a noisebased contribution that is approximately half that expected from a flip-induced single parity flip µt (1) r /2 = (µτ /4) ln(1/µτ ). Though physically unjustifiable due to the lack of true bit flip, this adjustment compensates for the additional noise-based drop and agrees with numerics within the range µτ ∈ [10 −6 , 10 −3 ]. A proper treatment of the noise-induced drop is analytically lengthy and beyond the scope of the simple derivations given here, so we make this crude prefactor substitution for simplicity in the plots of Section 6.

Logical error rate of the Bayesian filter
In addition to the errors contributing to the initial drop in fidelity, which only occur just before the final time, the Bayesian filter is vulnerable at any time to logical errors caused by two consecutive bit flips that occur within one response time of the filter. Since the first bit flip does not have time to be registered by the filter, the two flips will be interpreted as a single flip, which causes the filter to track an incorrect complementary encoding, as shown in the bottom half of Fig. 3. These logical errors require two flips, so produce a logical error rate that scales as µ 2 .
Logical errors of this type can be produced by 6 double-flip scenarios, which we can reduce to three distinct cases by symmetry. We start with the {1, 2} case. Consider a bit 1 flip at time t = 0 (chosen arbitrarily) followed by a bit 2 flip at a later time T that is faster than the filter can resolve it. After the second bit flip the correct encoding is 4 (XXI). The filter can sometimes make an error and return the value of 3 (IIX), because it cannot resolve the time between the two parity flips, and can only see the transition from 0 to 3, connected by a single bit flip on the third qubit (see Fig. 1). Formally, this occurs if σ 4 (t) < σ 3 (t) asymptotically for t T . We will now calculate the rate at which this mistake can occur, which leads to a logical error that can not be corrected.
We generalize the analysis of the last subsection by also including the dynamics of state σ 4 , which will be the true state at the end of the section. This state connects to states 1 and 2 by bit flips, and before the first flip has the equation of motion ∂ t σ 4 = µ(σ 1 + σ 2 ) − 2σ 4 /τ . Its steady state value is 3µ 2 τ 2 /8.
Qubit 2 then flips at time t = T , making the true state of the system now 4 (XXI) and the parity eigenvalues (even, odd). The new diagonal terms of the equation matrix become {−2, −4, −2, 0, 0}/τ . This indicates that neither state 3 nor state 4 are dynamically suppressed by the filter, because both have the correct parities associated with them. We now reset our time, and need to solve the following approximate set of equations In the equations above, we have kept the leading order terms assuming µτ 1 (states 2,5,7 are not relevant to this discussion). These equations can be solved with standard methods, leading to the asymptotic results for t T ofσ 3 = µτ e −2T /τ , and The filter will give a logical error ifσ 3 >σ 4 since it returns the incorrect state. From the asymptotic results derived above, this error occurs when This result makes physical sense: If the second error occurs at a time shorter than the filter response time, it cannot sense the difference between the two scenerios we have sketched here. The logical error rate is the rate at which this kind of process occurs. This rate can be calculated as the rate of the first error occurring, µ, times the probability that a second error occurs within a time T after it, µT . Consequently, the error rate is given by Γ {1,2} = (µ 2 τ /2) ln(2/µτ ). We next consider the {2, 1} case. The reverse scenario of a bit 2 flip followed by a bit 1 flip produces a very similar derivation to the one above, which we omit for brevity, and also yields the same condition T < (τ /2) ln(2/µτ ). Therefore, the contributions to the logical error rate from this scenario (or bit 2 then bit 3 flips) are the same Γ {2,1} = Γ {2,3} = (µ 2 τ /2) ln(2/µτ ).
Finally, we consider the {1, 3} case. The scenario of a bit 1 flip followed by a bit 3 flip produces a slightly different result than the other two cases. After the bit 1 flip, at time T we have the same states from before, the largest of which are σ 0 (T ) = exp(−2T /τ ) and σ 1 (T ) = µτ . Now, qubit 3 flips instead of qubit 2, so the relevant states are 5 (XIX), the correct state, and 2 (IXI), the incorrect one, with the same parity results of (odd,odd). The relevant diagonal terms in the matrix equation are now {−4, −2, 0, −2, −2, 0}/τ , so we now focus on the σ 0 , σ 1 , σ 2 , σ 5 dynamics. The equations of motion for this situation are then, with the initial conditions established after the qubit 1 bit flip, σ 0 (T ) = e −2T /τ , σ 1 (T ) = µτ , σ 2 (T ) = µT e −2T /τ , and σ 5 (T ) = µ 2 τ 2 /2. Solving these equations with standard methods yields for t T the asymptotic results,σ 5 = µ 2 τ 2 , andσ 2 = µT e −2T /τ . We can find the logical error rate by finding the time whereσ 2 >σ 5 , or whenever t < T , where and c is a number of order 5 in the logarithm approximation. By symmetry, all other error processes identified in the beginning of the section reduce to the type identified above. Adding them yields the total logical error rate, We numerically verify this expression over the range of bit-flip rates µτ ∈ [10 −6 , 10 −3 ] in Section 6.

Periodic Filters
The linear Bayesian filter analyzed in the preceding section produces an optimal estimate and is more computationally efficient than the nonlinear Wonham filter. However, it requires prior knowledge of the bit-flip rate µ and the Gaussian noise time scale τ , and still requires several matrix multiplications per time step. We wish to compare this optimal case against simpler and more practical filters that require less prior information and are more easily implementable in hardware, e.g. with field-programmable gate arrays (FPGAs), to enable ondemand state estimation for purposes of feedback control. We consider variations of a particularly simple "boxcar-averaging" filter, which should be well-suited for low-latency hardware.
Boxcar filters average successive durations ∆t of the noisy parity signals r i,j (t), then threshold the integrated meansr i,j = ∆t 0 r i,j (t)dt/∆t, often using two thresholds a + and a − , with a + > a − . That is, if the average signal exceeds the threshold a + , we assign the value +1 to the parity. Similarly, if the time-averaged signal is less than the threshold a − , then we assign the value −1 to the parity. Any result between the two thresholds a + and a − is treated as ambiguous, mandating a separate strategy for resolving the ambiguity. The final outputs of the filter are binary parity results, These results can then be used to track changes in the encoding using the syndromes in Eq. (5). This filter is the most direct translation of standard ancilla-based error correction with periodic projective measurements to continuous syndrome measurements. The primary difference is that continuous measurements are always on, and the collected data is only later partitioned into bins of duration ∆t for averaging and tracking.
In what follows, we analyze three simple boxcaraveraging filter variations: A. Boxcar filter : The simplest method for averaging sequential time bins of duration ∆t, using symmetric thresholds a + = a − = 0.
B. Half-boxcar filter : A non-Markovian modification to the simple boxcar filter that removes its dominant source of error by occasionally processing the averaged signal shifted by a half duration ∆t/2.
C. Double-threshold boxcar filter : A Markovian modification to the simple boxcar filter that also removes its dominant source of error, using asymmetric thresholds a ≡ a + ≥ 0 and a − = 0.
We find that although the simplest boxcar filter performs poorly compared to the Bayesian filter, the two proposed modifications can achieve performance comparable to the optimal Bayesian filter with significantly less computational overhead. Note that for these considered filters, only two tunable parameters must be set prior to filtering: the boxcar duration ∆t for all three filters, and the asymmetric threshold a ≥ 0 for the double threshold filter.
Over the next few subsections, we identify the dominant error mechanisms and define the three boxcar filters in more detail. For each filter, we derive expressions for the long-time linear decay rate Γ. We then derive expressions for their initial fidelity drops ∆F in , since they arise from similar mechanisms. We then consider optimization of the tunable filter parameters and analytically optimize the parameters to obtain simpler formulas that can be directly compared with those of the Bayesian filter. We numerically verify both the optimal parameters and the derived expressions in Section 6.

Boxcar error mechanisms
There are two main mechanisms for causing a change in syndrome in a boxcar filter: (i) A bit flip can occur with rate µ (yielding a probability of flip per averaging box of µ∆t), which can alter one or both parities. (ii) Noise fluctuations can cause the average parity signal over a box to appear changed, even though no actual bit flip occurs. Such a misidentification of a parity flip will be incorrectly interpreted by the filter as an actual bit flip.
Logical errors are produced by sequences of these basic mechanisms occurring at particular times. For example, a bit flip that occurs in the latter half of an averaging box will not produce a detectable parity flip until the subsequent box, which allows time for a second bit flip to occur and place the bits in a state complementary to the estimated state tracked by the filter. Similarly, if one parity is misidentified in an averaging box, a nearby bit flip can confuse the filter so that it tracks an estimation that is complementary to the actual state. We detail these dangerous event sequences in the following sections.
Parity misidentification errors play an important role in the following analysis, so we give a general analysis of their probabilities to occur here. A parity misidentification occurs when the integrated signal for a box is observed to be less than the discrimination threshold a, even though no bit flip occurs. Given an integration duration ∆t and mean parity r m over that duration (e.g., r m = ±1 for a definite parity that persists the entire duration), the probability of obtaining an integrated signalr is Gaussian, P (r | r m ) = exp(−(r − r m ) 2 ∆t/2τ )/ 2πτ /∆t. Thus, the probability of obtaining an integrated signal less than a discrimination threshold a is where erfc(x) = 1 − erf(x) is the complementary error function.

Boxcar logical error rate
The simplest boxcar filter with symmetric threshold a = 0 is an important reference case for the other boxcar filter variations. As such, we first analyze its error mechanisms in detail so that we can identify its dominant error. The subsequent boxcar variations will use different strategies to target and correct this dominant error. We focus here on deriving the dominant contributions to the logical error rate Γ, and delay the consideration of the initial drop ∆F in until after all three boxcar variations have been carefully defined.
Since the 3-bit code is designed to protect against only a single bit-flip error, the most straightforward contributions to the logical error rate Γ are from pairs of errors. For example, the two-flip sequence III → XII → XIX can be misinterpreted as a single flip III → IXI to the complementary encoding, causing a logical error. These problematic error pairs can be broadly categorized into three groups: (a) two bit flips, (b) one bit flip and one parity misidentification, or (c) two parity misidentifications. The contributions that involve three or more basic errors are comparatively small, so we will neglect them in this analysis.
In addition to these mechanisms involving pairs of errors, however, there is a more subtle and dangerous single error mechanism: (d) a mid-box flip of bit 2. In this case a single flip III → IXI can cause the parities to flip in successive boxes due to their independent noise fluctuations. Negative-biased noise fluctuations can make one averaged parity pass the zero threshold within the first box, while positive-biased noise fluctuations can make the other parity pass the zero threshold at a later time that occurs in the subsequent box. As such, the reported parity flips will be interpreted as the sequence III → XII → XIX and yield a complementary encoding, causing a logical error. Since this last type of error is caused by a single flip, it is the dominant source of error for the simple boxcar filter that will be removed by the boxcar variations in subsequent sections. We illustrate this problematic error mechanism in Fig. 4, which we will refer to again when discussing the mechanisms of the boxcar variations that fix this error. We now discuss each error contribution in turn.
(a) Two bit flips Each bit flip has an independent probability of µ∆t.
There are three ways to have two distinct flips with 3 qubits. Therefore, the probability for two distinct flips to occur within one box ∆t is 3(µ∆t) 2 , yielding a contribution to the logical error rate of Γ bb = 3(µ∆t) 2 /∆t = 3µ 2 ∆t.
More precisely, a bit flip in the first half of a box is likely to be detected, but a bit flip in the second half is unlikely to be detected until the following box. The sensitivity region for flips is thus shifted by a half-box in time from the periodic syndrome information. That is, for two bit-flip errors the danger is in having two flips within a region of duration ∆t that starts at a mid point of one box and ends at the midpoint of the next box. However, this temporal shift by a half-box does not affect the reasoning used for the logical error rate.
(b) One bit flip and one misidentification Logical errors generally require two averaging boxes to manifest. Over two consecutive boxes 2∆t there are two possible parities to misidentify in each box and three half-boxes ∆t/2 in which a flip of one of the three bits could cause parity changes, yielding 36 total pairs of errors to consider. After checking each of these possibilities, we identify 4 classes that produce a logical error: i. A misidentification and a flip of a complementary bit within the first half of the same box: For example, starting from encoding III a misidentification in channel r 1,2 and a flip of bit 3 in the first half of the box produces a syndrome with two flipped parities, which is misinterpreted as a bit 2 flip. This error leaves the true encoding in IIX while the estimated encodings follow the sequence III → IXI → XXI to produce a logical error. There are 2 parities to misidentify in one box ∆t, with 2 complementary bits each, so there are 4 possibilities of error, each with probability µ(∆t/2) P mis , producing a contribution to the logical error rate of 4(µ∆t/2) P mis /∆t = 2µ P mis .
ii. A misidentification and a flip of a complementary bit within the second half of the same box: For example, misidentifying r 1,2 produces the estimated encoding XII. After a flip in bit 3 the true encoding becomes IIX, which in the following box will make it appear that both parities have flipped, leading to the estimated encoding sequence III → XII → XXI. As with the preceding case, there are 4 possibilities yielding a contribution to the error rate of 2µ P mis .
iii. A misidentification in one box, then a bit flip in the first half of the next box: The parities from this sequence appear identical to the previous case. There are 4 possibilities, so the error rate contribution is also 2µ P mis . iv. A bit flip in the second half of a box, then a complementary parity misidentification in the following box: In the first box no error will be reported, but the second box will have two apparent bit flips interpreted as a wrong single flip. There are 4 possibilities, so the contribution is also 2µ P mis .
The total error rate contribution is Γ bm = 8µP mis .
(c) Two misidentifications A misidentification in one channel followed by a second misidentification in the complementary channel during the next box causes a logical error. For example, misidentifications of r 1,2 then r 2,3 causes the estimated encoding sequence over three boxes: III → XII → XXI → XXX. There are two orderings for this type of error, so the contribution to the logical error rate is Γ mm = 2P 2 mis /∆t.
where the integral over the product of error functions rapidly reaches an exact asymptotic value after ∆t 10τ . The contribution of this scenario to the logical error rate is therefore Γ b2 = µ τ /π∆t. As highlighted previously, this is the most dangerous error mechanism because its error rate is linearly dependent on µ.
Gathering all of the above contributions produces the total logical error rate for the boxcar filter, arranged in order of significance: = µ τ π∆t + 3µ 2 ∆t + 8µ P mis + 2 P 2 mis ∆t We will later optimize this formula over the boxcar duration ∆t and numerically verify its accuracy over the range of bit-flip rates µτ ∈ [10 −6 , 10 −3 ].
Because of the dominant error that is linearly dependent on µ the boxcar filter performs poorly compared to the Bayesian filter and is not useful for error correction. To make the boxcar filter viable, we therefore wish to eliminate this dominant error with a simple and minimal modification to the boxcar filter. We consider two such modifications in the subsequent sections: a non-Markovian modification that uses previous history in the continuous record to identify the problematic bit-2 flip, and a Markovian modification that identifies the problematic bit-2 flip by bracketing the parity signals between two thresholds. We will see that both variations compare favorably to the Bayesian method, so are suitable for practical error correction.

Half-boxcar filter and error rate
To overcome the problem of the bit-2 flip in the boxcar filter, we introduce a non-Markovian extension that we call the half-boxcar filter. To the basic boxcar filter we add one extra conditional action that reexamines any ostensible sequential flips of bits 1 and 3 to make sure they are not an incorrectly interpreted flip of bit 2. That is, if a parity flip is observed after an averaging boxcar, t ∈ [0, ∆t], and a second parity flip is observed in the opposite channel one boxcar later, t ∈ [∆t, 2∆t], then the filter reexamines the signal in an interval that straddles both boxcars. The raw signal is reaveraged over a duration ∆t that is shifted one half-boxcar behind the most recent boxcar, t ∈ [∆t/2, 3∆t/2], and compared to the zero threshold as a secondary check.
With this modification, a flip in bit 2 that happens near the center of the first box will cause both parities to change in the re-averaged middle box, unlike sequential flips of bits 1 and 3. The top portion of Fig. 4 illustrates how both averaged signals will flip when averaging the shifted middle box in the protocol. Therefore, this modification correctly distinguishes a bit-2 flip from sequential bit-1 and bit-3 flips and eliminates the primary logical error mechanism of the boxcar filter. When a bit-2 flip is detected, the interpreted history of bit-flips must then be corrected so that the first box, t ∈ [0, ∆t] records correctly that bit 2 flipped, while the second box, t ∈ [∆t, 2∆t], records that nothing additional occurred.
An elegant implementation of this non-Markovian extension averages sequential half-box intervals ∆t/2 of the raw signals, storing the most recent three half-box averages in memory in addition to the accumulating sequence of parity values. Averaging pairs of these preintegrated half-boxes then efficiently produces either the most recent full-box average or the required shifted box to reassess a suspected bit-2 flip as needed. As such, this extension only minimally increases the computa-tional complexity compared to the basic boxcar filter, while improving the fidelity so that it compares favorably with the Bayesian filter. It thus achieves a good balance between accuracy and efficiency.

Half-boxcar logical error rate
We follow the same procedure for categorizing contributions to the logical error rate Γ as we did for the boxcar filter in the preceding section. While the addition of the half-box mechanism removes the most serious of the boxcar errors, it also subtly alters the other logical error mechanisms, both removing a few more errors and adding new ones. We now discuss each category of contributions in turn.

(a) Two bit flips
Unlike the basic boxcar filter, the partitioning of two consecutive boxes into half-boxes matters for sequences of two bit flips. Logical errors can occur from bit flips within the same box, or two consecutive boxes. There are four relevant cases.
ii. Two consecutive flips of bits 1 and 3, one in the second half of a box and the other in the first half of the following box: The first flip is not detected in the first box, so both parities will flip in the second box and be incorrectly interpreted as a flip in bit 2 after the second box. There are two possible orderings, so the total contribution to the logical error rate is: 2 (µ∆t/2) 2 /∆t = µ 2 ∆t/2.
iii. A flip in either bit 1 or 3 during the second half of a box followed by a flip in bit 2 during the first half of the following box: The first flip is not detected after the first box, so only one parity will flip in the second box and be incorrectly interpreted as a flip of the complementary bit. After a third box, both parities will appear change and be incorrectly interpreted as a bit-2 flip, which leaves the estimate in a complementary state. There are two possibilities, with a similar situation if the bits flip in reverse order, so the total contribution to the logical error rate is 4 (µ∆t/2) 2 /∆t = µ 2 ∆t.
iv. Two consecutive flips of bits 1 and 3, one in each half of the same box: The second flip is not detected, so one parity appears to flip, followed by the other parity in the next box. The half-box prescription then averages the middle of the boxes, which will show that both parities flip, and thus be misinterpreted as a flip in bit 2, which is a logical error. There are two possible orderings, so the total contribution to the logical error rate is 2 (µ∆t/2) 2 /∆t = µ 2 ∆t/2.
The final error above is newly introduced by the half-boxcar mechanism, so the total contribution of two bit flips to the logical error rate is larger than the simple boxcar filter: Γ bb = (7/2)µ 2 ∆t.

(b) One bit flip and one misidentification
There are 6 distinct mechanisms for a bit flip and misidentification to cause a logical error. The halfboxcar filter modifies these contributions significantly from the simple boxcar filter.
i. A misidentification and a flip of a complementary bit both within the same box: This mechanism is the same as the boxcar case, but with the improvement that any flip in bit 2 is now corrected by the half-box mechanism. There are 2 possible misidentifications, each with 1 complementary bit that flips with probability µ∆t. The total contribution to the logical error rate is 2µP mis .
ii. A misidentification then a complementary flip of bit 1 or 3 during the first half of the next box: This appears as a sequence of two flips not corrected by the half-boxcar mechanism. For example, if bit 1 flips then the actual encoding becomes XII, but the apparent encoding follows the sequence III → IIX → IXX. There are two possibilities, so the contribution is µP mis .
iii. A misidentification then a complementary flip of bit 1 or 3 during the second half of the next box, but near the middle: The bit flip will be reported with probability P (r < 0 | r m ), with r m = 2δt/∆t as in Eq. (39), where δt is the location of the flip with respect to the middle of the box, resulting in the same logical error as in the previous case. There are two possibilities, so the contribution to the logical error rate is 2 µ P mis 1 0 P (r < 0 | r m ) dr m → µ P mis τ /2π∆t. This exact asymptotic value is reached by ∆t 15τ . iv. A misidentification then a flip in bit 2 during the first half of the next box: This produces an apparent sequence of flips in bits 1 and 3, which triggers the half-box mechanism. However, for the half-box-shifted middle section that is checked, bit 2 flipped too late to be detected. It is thus possible for only one parity to flip, analogously to the original bit-2 flip issue of the basic boxcar in Eq. (39), which leaves the logical error uncorrected. The contribution to the logical error rate is 2µP mis 1 0 P (r < 0 | r m )P (r > 0 | r m ) dr m → µ P mis τ /4π∆t. This exact asymptotic value is reached by ∆t 15τ . v. A misidentification then a flip in bit 2 during the second half of the next box: This scenario appears identical to the preceding case, so also contributes µ P mis τ /4π∆t. vi. A flip in bit 2 near the middle of a box that triggers the half-box mechanism, followed by a misidentification in one of the channels during the check of the middle box: The check will then not correct the misinterpretation of the bit 2 flip as two consecutive bit 1 and bit 3 flips. The probability of this occurring is identical to the preceding two cases, so also contributes µ P mis τ /4π∆t.

(c) Two misidentifications
The mechanism for two misidentification to cause a logical error is unchanged from the boxcar filter, so contributes Γ mm = 2P 2 mis /∆t. Gathering all contributions produces the total logical error rate for the half-boxcar filter: Note that the value of the prefactors for several terms is achieved only for ∆t 15τ . We will later optimize the free parameter ∆t to find that this condition is satisfied self-consistently for µτ 10 −4 , and verify this expression numerically for the bit-flip rates µτ ∈ [10 −6 , 10 −4 ], with slight numerical deviations visible for µτ ∈ [10 −4 , 10 −3 ] due to shorter optimal ∆t violating the approximation of the prefactor integrals.

Double-threshold filter and error rate
The non-Markovian half-boxcar filter has the drawback of requiring extra memory and reinterpreting the past tracking record. We thus also introduce an alternative filter that also corrects the problem of the bit 2 flip in the simple boxcar filter while remaining Markovian. This new filter saves on memory at the expense of extra conditional processing per boxcar.
We use the intuition that if a bit-2 flip happens near the center of a box, then both integrated parities should be near zero, with only noise fluctuations determining their sign about the usual threshold of zero. However, if a succession of bit 1 and bit 3 flips happens, then only one parity will cross the threshold at a time. We thus use a second signal threshold a > 0, that together with the zero threshold can bracket a region that checks whether both parities are simultaneously close to zero. Fig. 4 demonstrates this effect with the horizontal dashed green line for a > 0: Both averaged signals enter the region between 0 and a during the first boxcar, making the bit-2 flip correctly detectable using the second threshold.
More precisely, assuming an initially even-parity encoding III, if both integrated signals are less than the new threshold a, then we infer that bit 2 has likely flipped. Otherwise, the signals are thresholded as normal. In pseudocode, given an estimated encoding III, ifr 1,2 < a andr 2,3 < a then flip bit 2 elseifr 1,2 < 0 then flip bit 1 elseifr 2,3 < 0 then flip bit 3 else do nothing where the flips are performed on the estimated state in accordance with passive error tracking. More generally, for an initial estimated encoding with parities P 1,2 , P 2,3 ∈ {+1, −1}, the parity-corrected integrated signals (r 1,2 P 1,2 ) and (r 2,3 P 2,3 ) should be used in the above algorithm in place ofr 1,2 andr 2,3 . The relaxed threshold can more robustly detect simultaneous parity changes when bit 2 flips close to the middle of a box, while remaining Markovian.

Double-threshold logical error rate
One more we follow the same procedure as the boxcar filter to find the remaining contributions to the logical error rate Γ. As with the half-boxcar filter, the additional correction mechanism alters the mechanisms for producing logical errors. We now consider each category of contributions in turn.

(a) Two bit flips
The logical error rate caused by two bit flips in the same box is exactly the same as the basic boxcar filter: Γ bb = 3µ 2 ∆t.

(b) One misidentification and one bit flip
There are three distinct contributions: i. A zero-threshold misidentification, then a complementary flip in the next box: This case is the same as the basic boxcar, so the contribution of this kind of error to the logical error rate is 4 µ P mis . ii. An a-threshold misidentification, then a complementary flip of bit 1 or 3 in the same box: Since both parities are observed to be below a, this is interpreted by the double-threshold filter incorrectly as a bit 2 flip. There are two possibilities, so the contribution to the logical error rate is 2 µ P mis (a), recalling the general form of the misidentification probability from Eq. (36). iii. A flip in bit 2 near the middle of a box, at time ∆t/2 + δt, followed by parity misidentification: As with the bit-2 flip in the boxcar case, the parity signals will both be Gaussian-distributed with mean r m = 2δt/∆t and variance τ /∆t as in Eq. (39). The probability of misidentifying the parity requiresr 1,2 > a whiler 2,3 < 0, or vice versa. There are two possibilities, so the contribution to the logical error rate after summing over all r m ∈ [−1, 1] is This Gaussian approximation to the error function integral is very accurate for ∆t 10τ and 0 ≤ a ≤ 1, and correctly reduces to Eq. (39) when a = 0. It can be derived using the approximation erfc(x) ≈ exp(−c 1 x − c 2 x 2 ) valid for x > 0 with c 1 ≈ 1.1 and c 2 ≈ 0.76 [56].

(c) Two misidentifications
The second threshold slightly modifies the simple boxcar contribution. After one misidentification of probability P mis , either bit 1 or bit 3 flips. The next box corrects this error unless a second misidentification in the complementary channel occurs to make it appear that both parities have flipped. However, it is sufficient for both integrated signals to be less than a in this case, due to the double threshold mechanism. Thus with probability P mis (a) there is a flip in bit 2. In the third box the remaining bit will flip, producing a logical error. There are two possibilities, so the contribution to the logical error rate is Γ mm = 2 P mis P mis (a)/∆t.
Gathering all above contributions produces the total logical error rate: = 3µ 2 τ ∆t τ + 4µ P mis + 2 µ P mis (a) + 2 P mis P mis (a) ∆t We will later optimize this formula over the free parameters, the boxcar duration ∆t and threshold a ≥ 0, and numerically verify its accuracy over the range of bit-flip rates µτ ∈ [10 −6 , 10 −3 ].

Initial drop in fidelity
The initial drop in fidelity ∆F in for all three variants of the boxcar filter comes from single logical errors in the final averaging box that do not have time to be detected. There are two dominant types of logical error: a single parity misidentification, or a single bit flip that happens too late within the averaging period. Other errors are higher-order and comparatively negligible. Since there are two parities, a misidentification can occur with probability 2P mis . The case of the bit flip requires more careful analysis, since it may occur at any point within the final box. For bits 1 and 3, if a flip happens at time δt after the center of the last box, ∆t/2 + δt, the probability of not detecting the flip is P (r > 0 | r m ) with a shifted signal mean of r m = 2δt/∆t and variance τ /∆t as in Eq. (39). There are two possibilities of a bit flip, so their contribution to the initial drop is To detect a bit 2 flip correctly, both integrated signals should be less than the threshold a (where a = 0 for boxcar and half-boxcar filters and a > 0 for the doublethreshold filter). The negation of this is for one of the signals to be greater than a. To not double-count the errors for bits 1 and 3, the remaining signal should also remain greater than 0. Therefore, a flip is not detectable ifr 1,2 > 0 andr 2,3 > a, or vice versa. If we denote one such event A and the reverse configuration B, then the total probability of not detecting the bit 2 flip is P (A ∪ B) = P (A) + P (B) − P (A ∩ B), where the intersection A ∩ B has both signals greater than a. After summing this probability for all r m we obtain The total contribution of this scenario to the initial drop is thus, (µ∆t/2)P 2 . Gathering the above contributions, the total initial drop in fidelity for all boxcar filters is Since this formula involves an unwieldy integral, we will find suitable approximation before continuing. As will become clear in the next section, for the simple boxcar and double-threshold filters the averaging duration ∆t should be set fairly long compared to τ to achieve good performance. In this regime, we P 2 ≈ 1 is an excellent approximation. Similarly, we will find that P mis is negligible for both the simple boxcar and double-threshold filters when ∆t τ . For the half-boxcar filter, the peak performance will be achieved for significantly smaller ∆t, so we must evaluate P 2 more precisely to obtain an accurate estimate. When a = 0, P 2 acquires the asymptotic form which converges very slowly to 1 as ∆t → ∞. For ∆t ∼ 15τ , P 2 ∼ 0.85. The dominant part of this asymptotic form must be kept, as well as the P mis contribution to the error rate. Anticipating these simplifications now and using the asymptotic formula P mis ≈ exp(−∆t/2τ )/ 2π∆t/τ thus yields the final approximations appropriate for the parameter regimes that yield peak filter performance: In Section 6 we verify these expressions numerically for the bit-flip rates µτ ∈ [10 −6 , 10 −3 ]. The final expressions for the logical error rate Γ and initial fidelity drop ∆F in are summarized in Table 2.

Optimizing filter parameters
The boxcar filters contain several tunable parameters that play the role of the prior information about µ and τ required for the Bayesian filter. That is, the averaging duration ∆t and asymmetric threshold a must be set prior to processing the parity signals. To achieve peak filter performance, these parameters must be optimized for each µ and τ . As such, in order to fairly compare the performance of the boxcar filters to the Bayesian filter,   (0). We find numerically that for the Bayesian initial drop, more accurate results can be obtained in the regime µτ ∈ [10 −6 , 10 −3 ] via the substitution 5/4 → 3/2, which crudely compensates for neglected noise-fluctuation contributions. The three boxcar filters should be optimized over the averaging duration ∆t, while the double-threshold variation should also be optimized over the threshold a ≥ 0. For the initial drop of the boxcar filters, we have approximated that ∆t/τ 1 for the simple and double-threshold boxcar filters and ∆t/τ > 8 for the half-boxcar filter to achieve peak performance (see Section 5.5).
we must choose an appropriate optimization strategy for the boxcar filter parameters.
We choose to optimize the filter parameters to minimize the total decay in average fidelity in the linear decay regime. Both the initial fidelity drop ∆F in and the linear decay rate Γ contribute to the total infidelity, so we optimize both together by maximizing the duration of time required for the average fidelity to drop a total of 10%. As discussed after Eq. (12), a 10% fidelity drop is roughly the maximum tolerable drop while remaining in the linear decay regime without error correction, which makes it a reasonable target. Since F (t) = 1−∆F in −Γt for a duration t in this linear regime, this optimization procedure yields a maximum time to drop by 10% fidelity: For most cases, the duration t max will be sufficiently long that the linear decay dominates the total averagefidelity decay, making this procedure essentially equivalent to minimizing the decay rate Γ directly. However, for some cases with larger flip rates µ the initial drop becomes too large to neglect and this maximum-time optimization produces more reasonable results.
We now systematically optimize the general formulas for the initial drop in fidelity ∆F in and the logical error rate Γ, using the maximum drop-time procedure outlined in Eq. (51). The post-optimization formulas will show the best achievable performance of each filter more clearly. For sake of simple comparisons, we only keep the dominant scaling of each analytical approximation in what follows. However, we will numerically optimize the full formulas in Table 2 and use the full expressions when comparing theory to numerical simulations in Section 6.

Boxcar filter
The boxcar filter has only one free parameter to optimize: the boxcar duration ∆t. We use the optimization procedure of Eq. (51), with the logical error rate from Eq. (40) and initial drop from Eq. (48). We use the error function approximation P mis ≈ exp(−∆t/2τ )/ τ /2π∆t from Eq. (38) to make the formulas analytically tractable. We solve for the minimum by taking a derivative of Eq. (51) with respect to ∆t and setting it to zero, in the usual way, which produces the results ∆t τ ≈ 0.207 (µτ ) −2/3 − 1.3 (µτ ) −1/3 + 6, where we have replaced purely numerical prefactors with decimal approximations and have truncated the expressions to remove negligible terms. We choose the precision of these numerical constants and the truncations so that the simplified analytical formulas closely reproduce the numerically optimized result. Notably, the optimal averaging duration ∆t dominantly scales as µ −2/3 ∝ Γ −1/2 , so becomes impractically long for small error-rates Γ. Moreover, since the logical error rate Γ scales as µ 4/3 , the filter performs dramatically worse than the µ 2 scaling of the Bayesian filter. These features make the simple boxcar filter illsuited for practical error correction.

Half-boxcar filter
To optimize the half-boxcar filter over the duration ∆t, we follow the same procedure as in the previous section for the boxcar filter. We use Eqs. (41) and (49) and the error function approximation from Eq. (38). The minimization procedure by taking a derivative with respect to ∆t produces the approximate nonlinear relation exp(∆t/2τ ) = 3/14µτ π∆t/2τ , which we solve recursively for ∆t/τ . This procedure yields the following continued fraction as a perturbative solution where the final approximation truncates the recursion at the dominant logarithmic functional form. The constant inside the logarithm is chosen as a crude fit to the full numerically optimized curve within the parameter regime µτ ∈ [10 −6 , 10 −3 ] to help simplify the scaling comparison. Using this simplification, the logical error rate and initial drop have the forms where numerical constants have again been reduced to appropriate precision decimals based on fits to the numerically optimized results. Notably, the logical error rate Γ now scales with µ 2 , up to logarithmic corrections, analogously to the Bayesian filter in Eq. (34), making the half-boxcar filter suitable for practical error correction. In the full numerical simulations that we detail in the following section, we will see that of the boxcar-averaging filters the half-boxcar variation has the closest performance to the optimal Bayesian filter, despite its dramatic reduction in computational overhead.

Double threshold filter
Unlike the preceding boxcar filters, the doublethreshold filter has two free parameters to optimize: the boxcar duration ∆t, and the second threshold a ≥ 0. To get a rough idea of the analytic scaling, we follow a crude sequential optimization strategy. First, we follow the same optimization procedure from the previous section for ∆t for a fixed a, using Eqs. (43) and (50) and the error function approximation from Eq. (38). This optimization again yields a continued fraction solution where the final approximation truncates the recursion at the second-order, which achieves better accuracy than the first-order truncation in the parameter regime µτ ∈ [10 −6 , 10 −3 ]. We find numerically that the dependence of the optimal a on µτ varies slowly in this parameter regime, so we approximate it using the following function which is a crude fit to the numerically optimized result and not derived analytically. We compare this crude  Table 3: Dominant scaling with µτ of optimized filter performance. We compare the initial fidelity drops ∆Fin, logical error rates Γ, boxcar averaging durations ∆t/τ , and second thresholds a ≥ 0. We show only the dominant scaling in each case, truncating smaller corrections for sake of simple comparison. We choose the precision of numerical prefactors to best fit the full numerically optimized results obtained from Table 2 in the regime µτ ∈ [10 −6 , 10 −3 ]. See Section 5.6 for details on the optimization procedures.
formula to the numerically optimized result in Fig. 5 for completeness. We will use these approximate analytical fits to the numerical optimization in Figs. 6a-6d in the following section. For the purposes of comparing the dominant scaling of the various filters, we further approximate the threshold as constant, a ≈ 0.5, and truncate the recursive solution of ∆t/τ to first-order, which yields the following loose approximations to the logical error rate and initial drop in fidelity, ∆F in ≈ 12 (µτ ) ln 1 150µτ .
As with the preceding filters, we have replaced constants factors with to best fit the full numerical optimization. The intention of these final formulas is not to be exceptionally accurate, but rather to capture the crude dominant scaling for sake of simple comparison with the other filters.
As with the half-boxcar filter, the double-threshold filter achieves the µ 2 scaling of the logical error rate Γ, up to logarithmic corrections, so is also a suitable filter for error correction. It has the benefit of being Markovian, as opposed to the half-boxcar filter that requires memory, but its scaling prefactors are not as favorable as in Eq. (54) for the half-boxcar filter or Eq. (34) for the Bayesian filter. For convenience, we compare the dominant scaling of all filters in Table 3.

Numerical Simulations
To check the validity of our filter analysis, we numerically implement continuous measurements of the 3-bit code, the linear Bayesian filter, and the three boxcar filter variations in the programming language julia [57]. To do this efficiently, we first pick a target bit-flip rate µ to test, such that µτ ∈ [10 −6 , 10 −3 ] with τ being the reference timescale for the numerics (set to 1 for convenience). We then initialize a 3 × N array of bits to describe N = floor(10 max∆t/dt) time steps of duration dt = τ /10. The timescale max∆t is the maximum optimal boxcar size of the four filters being tested for each µ, and ensures that enough data is simulated per trajectory to assess the behavior of each filter. We compared the results to those obtained with dt = τ /100 to verify that no residual time discretization artifacts were present in the numerics. The optimal box sizes are numerically determined from the formulas presented in Table 2, and shown in Fig. 6b, with maxima ranging from max∆t/τ ∈ [5,2000].
To simulate each trajectory, at the initial time the bit state is set to 000, representing the encoding III. Random bit flips are then added with Poisson statistics at the rate µ. Specifically, the wait-time distribution for n steps between two successive jumps is exponential, p(n) = exp[−n/(µdt)]/(µdt); for each qubit we sample this wait-time distribution to find the random number of steps floor(n) until the next jump for each bit, then flip the appropriate bits between specified jumps. After this procedure the 3×N array holds the "true" state trajectory for the 3-bit code. This numerical model is thus a direct implementation of the hidden Markov model in Fig. 1 that is described in the main text.
Given a true 3-bit trajectory, we then simulate the noisy parity signals r i,j by computing the exclusive-or x(i, j) between neighboring bits i and j at each timestep dt, then constructing r i,j = −2x i,j + ξ, where ξ is sampled from a normal distribution with mean +1 and variance τ /dt. This construction vectorizes the noise simulation efficiently, and centers the mean signals for even parities at +1 and odd parities at −1. The resulting noisy signals then simulate the parity signals that one would obtain from performing continuous direct parity measurements in the laboratory, after the signals have been correctly normalized.
Given the simulated noisy signals r i,j , we then pass both signals through each of the four trial filters analyzed in the preceding section: linear Bayesian, simple boxcar, half-boxcar, and double-threshold boxcar. We set the tunable parameters, ∆t and a, for the three boxcar filters to optimal values determined by the numerical optimization of the formulas in Table 2. (We also verify numerically that tuning these parameters away from the theoretical optimum correctly shows that the parameter values are optimum.) Each filter then returns a 3 × N array of estimated 3-bit state trajectories. For each dt, we compute the bit state fidelity as a simple equality test between the triplet of true bits and the triplet of estimated bits, yielding 1 if the bits agree and 0 if they disagree. We compute the average state fidelities by repeating this process between 10 6 and 10 8 times and averaging the fidelities at each time step.
This simulation procedure produces the numerical results plotted as the points in Figs. 6a-6d, with final numerical error bars on the order of the width of the points or smaller. The solid lines show the formulas summarized in Table 2 after numerical parameter optimization. For reference, the dashed lines show the crude analytical approximations of the optimized formulas that we presented in Section 5.6. (Note that for the doublethreshold filter in Figs. 6b-6d we plot the more accurate a-dependent analytic formulas in Eqs. (55) as the dashed lines.) For the boxcar filters, we found that in order to apply the linear decay formula in Eq. (13) to the simulated data, the initial drop ∆F in should be placed in the middle of the first averaging box, at t = ∆t/2, after which the linear fit with slope Γ correctly describes the data. For smaller µ the logical error rates Γ become quite small so require more realizations to resolve the average to sufficient numerical precision; in the cases of the double-threshold and simple boxcar filters the optimized durations ∆t/τ were sufficiently long to prohibit accurate averaging of Γ below µτ ∼ 10 −4 . Nevertheless, for all successfully simulated results the agreement is excellent between numerical simulations and numerically optimized analytical formulas from Table 2.
In Fig. 6a, we show the time-dependent average fidelities F (t) of all methods, optimized for a relatively large bit-flip rate of µτ = 10 −3 . The numerical simulations (data points) confirm the numerically-optimized analytical results for ∆F in and Γ summarized in Table 2 (solid lines), as well as the corresponding crude approximations (dashed lines). The gray line is a simulation of idealized 3-bit code error correction using perfect-fidelity projective parity measurements with a rapid cycle delay of δt/τ = 4 (see the Appendix for details); the shaded gray region above this line roughly represents fidelities that are inaccessible to even an ideal implementation of the 3-bit code. The light red shaded region below indicates fidelities that are worse than that of a single bit without error correction.
After the initial drops in fidelity ∆F in in Fig. 6a, the Bayesian filter (orange, top curve) and half-boxcar filter (green, second curve from top) achieve asymptotic slopes (corresponding to the logical error rates Γ) that are comparable to that expected for ideal operation of the code. The double threshold filter (blue, bottom curve at left of graph) performs slightly less favorably, while the simple boxcar filter (red, third curve from top at left of graph) performs significantly worse, as anticipated in the previous section. For the half-boxcar filter, the last box decays at the same rate as the simple boxcar filter because the non-Markovian correction cannot be applied to the last box. This change in decay rate in the final box yields an additional contribution to the net fidelity drop ∆F fin ≡ ∆t(Γ boxcar − Γ half-boxcar ) that is not observed with the Markovian filters.
In Fig. 6b, we show the optimized averaging durations ∆t for the boxcar methods (solid lines) and corresponding crude approximations (dashed lines). The gray line at bottom indicates the rapid cycle delay of 4τ for the idealized projective measurements. The non-Markovian half-boxcar filter achieves the shortest averaging durations with ∆t 20τ even for small bit-flip rates of µτ ∼ 10 −6 . The simple boxcar filter requires excessively long optimal averaging durations (up to two  Table 2 are plotted as solid lines, while the simplified formulas in the main text are plotted as dashed lines. The shaded gray areas indicate the regions that are unattainable even by an ideal 3-qubit code, while the shaded red areas indicate the regions that are worse than that of a single qubit with no error correction. The analytical initial drops for the Bayesian filter include the prefactor correction 5/4 → 3/2 discussed in Section 4.2. The analytical initial drops for the boxcar filters numerically correspond to the time at half of the first box ∆t/2. orders of magnitude longer than the half-boxcar filter for small bit flip rates). The Markovian double threshold filter consistently requires averaging lengths that are a factor of roughly 2-4 longer than the half-boxcar to achieve similar performance.
In Fig. 6c, we show the optimized scaling of the initial drop ∆F in with µ for all methods, using the same color and line-style conventions as Fig. 6a. The numerical simulations confirm the numerically-optimized analytical results in Table 2 for the entire tested range of pa-rameters µτ ∈ [10 −6 , 10 −2 ]. For the Bayesian filter analytical curve we adjust the derived formula by making the substitution 5/4 → 3/2 in Eq. (29), which corrects a systematic deviation caused by noise-fluctuations, as discussed at the end of Section 4.2. Notably, the halfboxcar filter achieves an initial drop roughly a factor of 2 larger than the optimal Bayesian filter. For contrast, the double-threshold filter has an initial drop that is roughly a factor of 8 larger than the Bayesian filter. The simple boxcar filter suffers from comparatively large drops greater than 0.3%, even with small bit-flip rates of µτ ∼ 10 −6 , which is nearly two orders of magnitude larger than the Bayesian filter.
In Fig. 6d, we show the optimized scaling of the logical error rate Γ with µ for all methods, using the same conventions. The numerical simulations again confirm the numerically-optimized analytic results, up to small deviations for the half-boxcar filter at larger bit-flip rates. We anticipated this slight deviation between the analytics and the simulated data points for µτ > 10 −4 during the derivation in Section 5.3, where it arises from a short boxcar duration, ∆t 15τ , that prevents convergence to the asymptotic behavior assumed in the analytical formulas. For the double-threshold and simple boxcar filters we simulate only larger bit-flip rates µτ 10 −4 due to the optimal boxcar sizes ∆t becoming prohibitively long for smaller µτ ; however, the tested cases confirm the µτ -dependence expected from the analytics.
These simulations confirm that quantum error correction based on passive state tracking with continuous parity measurements is a viable strategy. As anticipated, the linear Bayesian filter performs the best, achieving only a slight reduction in performance compared to the idealized 3-bit code due to the noise of the monitored signal. Moreover, the half-boxcar filter nearly matches the Bayesian filter in performance despite a dramatic reduction in processing requirements, which makes it the best balance between performance and practicality of the minimal filters considered here. The double-threshold filter also scales comparably, though performs slightly worse overall. We also emphasize that in the presence of experimental nonidealities, realistic implementations of the 3-bit code that use entangling gates, ancillas, and projective measurements are likely to perform comparably to the continuous measurement filters considered here; for completeness, we provide a similar analysis of the ancilla-based projective case in the Appendix.

Conclusions
We have analyzed the 3-qubit bit-flip code to assess the performance of direct methods for measuring the syndromes using time-continuous parity measurements. For interpreting the time-continuous noisy signals of the direct syndrome measurements, we have introduced and analyzed four distinct filters: (i) an efficient linear variation of an optimal Bayesian filter, (ii) a simple boxcaraveraging filter, (iii) a minimal non-Markovian "halfboxcar" variation of the boxcar-averaging filter, and (iv) a minimal Markovian variation of the boxcar-averaging filter that uses two thresholds. We have derived analytic estimations for the performance of all filters and have verified them with numerical simulations.
These direct parity-measurement methods benefit from a reduction in hardware resources compared to ancilla-based methods (namely two fewer ancillary qubits), which limits the number of inherent bit-fliperror pathways even before extending the bit-flip code to more sophisticated encoding schemes. The Bayesian filter most closely approaches the ideal performance of the ancilla-based bit-flip code, but also requires the most computational resources for real-time processing of the noisy syndrome measurements. The boxcar variations require less active processing than the optimal Bayesian filter, so should be more easily implemented with signal processing hardware, such as field-programmable gate arrays (FPGAs), for the purposes of real-time syndrome tracking. The non-Markovian half-boxcar filter achieves the best balance between performance and computational overhead of the considered methods. The Markovian double-threshold filter performs slightly less well than the half-boxcar filter, but avoids the additional memory overhead at the expense of an increased boxcar duration. All three methods are suitable for immediate implementation with current superconducting hardware.
The results of our study are promising for the continued investigation of direct syndrome-measurement methods. However, three scalability issues that we have ignored need to be addressed before direct methods can achieve full quantum error correction. First, we have focused our analysis on the performance of the methods with respect to their intended design: protecting against bit-flip errors. As such, we have ignored other sources of infidelity, particularly dephasing of the parity subspaces due to imperfect overlap of the entangled microwave fields, which is analogous to ignoring entangling gate infidelity in analyses of ancilla-based error correction. Some analysis of these types of implementation imperfections has begun in recent years [58][59][60][61], but more investigation is needed for a definitive assessment. Second, while we have presented a practical method for directly measuring the ZZ parities needed for bit-flip correction, we have not addressed how to directly measure the XX parities needed for additional phase-flip correction. Obtaining high-fidelity direct parity measurements for both ZZ and XX is an open problem currently under investigation. Third, high-fidelity extensions of direct two-qubit parity measurements need to be developed to implement more sophisticated errorcorrection schemes, such as the surface code that requires four-qubit parity measurements.
A direct quantitative comparison of the performance of this continuous error correction to conventional implementations of gate-based ancilla plus projectivemeasurement is challenging. This is because different assumptions must be made about how the ancilla-based scheme is implemented, and what a fair comparison of the approaches is. In superconducting-based architectures, projective measurements have traditionally been implemented as thresholded continuous measurements anyway. Consequently, the always-on methods with a fast measurement rate have the obvious advantages of not needing time to implement the two-qubit gates, or to have any down time between repeating the cycle again, where other errors might sneak in. There is also the possibility of errors occurring in the ancilla qubits, which would then demand a much larger quantum circuit to make everything fault tolerant, but at the price of even more hardware. We analyze several different error scenarios that can occur in the gatebased implementation in the Appendices, for contrast. Our overall conclusion is that the hardware efficiency of the measurement-based parity has the potential to minimize error possibilities, assuming both good parity measurement fidelity and good gate fidelity.
Although full error correction using continuous parity measurements requires additional investigation, several experimental tasks can be achieved in the short term. First, the 3-qubit bit-flip code as analyzed here can be implemented immediately with current superconducting architectures. Second, a simple extension of the parity-syndrome monitoring idea to a 4-qubit Bacon-Shor error-detection code is a natural next step. Such a code involves four qubits in a square grid, coupled pairwise to parity-measuring resonators analogously to Fig. 2. A detailed analysis of the simultaneous measurement of ZZ and XX parities on the square grid is considered in Ref. [38], which demonstrates that the error detection scheme works in a time-continuous way. A simpler variation of this idea can be performed without direct XX measurements by alternating ZZ measurements of different pairs, and suitably interleaving single-qubit rotation gates to effectively switch between ZZ and XX measurements. Such a variation is in between the usual ancilla-based projective scheme and a fully continuous scheme, much like the boxcar filters in the present work are in between ancilla-based schemes and fully continuous schemes. We expect such an experiment to be performed in the near future.

A Ancilla-based parity measurements
Traditional ancilla-based error-correction with the three-bit code uses the correction circuit shown in Fig. 7, repeated over many cycles. At the beginning of the first cycle, we assume that the initial states of the ancillary qubits are known to be |b 4 and |b 5 with b 4 , b 5 ∈ {0, 1}. We couple the parity of qubits 1 and 2 (P 1,2 ) to ancillary qubit 4, as well as the parity of qubits 2 and 3 (P 2,3 ) to ancillary qubit 5, using a sequence of CNOT gates. For timing efficiency, the CNOTs may be performed in parallel so that the total duration of the gate sequence is the length of two CNOTs.
In the analysis that follows, we notate a CNOT that flips ancilla qubit j conditioned on the excited state of qubit k as C j|k . A CNOT gate must be implemented by a sequence of more basic rotation gates that are hardware-dependent. For specificity, we model the CNOT with the cross-resonance gate used by the IBM group [62][63][64]. The cross-resonance interaction occurs when the data qubit k is pumped at the resonance frequency of the ancilla qubit j, which can be modeled crudely by an effective interaction Hamiltonian H ∝ J(Z k X j + mI k X j ) with a coupling strength J and a chip-dependent cross-talk strength m [62] that is measurable [63]. (For a more complete treatment of the cross-resonance gate, see Ref. [65].) For a suitably timed pulse, a rotation phase of ±π/2 can be accumulated by the ZX interaction to yield the unitary gate: exp(−i(Z k X j )π/4 − i(I k X j )mπ/4). The simple crossresonance interaction can take ∼ 300-400 ns to complete [62], while echo optimizations can reduce the time to ∼ 160 ns [63]. After correcting the residual cross-talk rotation phase, the interaction produces a (ZX) 90 gate, which can be converted into a CNOT using single-qubit rotations and a phase correction, e.g.
= e −iI k ⊗Ij π/4 (e iZ k π/4 ⊗ e iXj π/4 )e −iZ k ⊗Xj π/4 The single qubit gates take roughly ∼ 30-50 ns to implement [66]; therefore, we estimate the total CNOT gate to have an optimistic duration of 200 ns in the following analysis, implying that the 2-CNOT gate time is δt ∼ 4τ assuming a typical measurement timescale of τ ∼ 100 ns. For most purposes, it will be sufficient to use this final standard form of the CNOT. However, for analysis of potential logical error sources the specific gate implementation becomes important. We then measure Z 4 and Z 5 for the two ancillary qubits, using dispersive microwave readout similar to that outlined in Section 3, and integrate the resulting signals for a duration ∆t. After thresholding the integrated signals with a symmetric threshold of a = 0, we obtain the pair of binary results (R 4 , R 5 ) with R 4 , R 5 ∈ {−1, 1}. Using the knowledge of the initial ancilla states, we convert these results to the parity eigenvalues of (Z 1 Z 2 , Z 2 Z 3 ) with the relation ((−1) b4 R 4 , (−1) b5 R 5 ). These eigenvalues are the error syndrome outcomes for tracking single bit flip errors with the same table used in Eq. (5).
We start the next cycle after a total cycle duration ∆T , which includes the gate time δt, the syndrome measurement integration time ∆t, an arbitrary waiting duration, and a heralding measurement time ∆t. This heralding measurement is made to ensure the ancillas are in a known state before the next gate cycle, since bit flips may have occurred on the ancillas during the waiting time. If the waiting time is sufficiently short, such that ∆T −δt < 2∆t, the readout and heralding measurements may be combined into a single long measurement of the ancillas. The only reason for separating the two for long cycle times is that long integration times may hide bit flips of the ancillas just prior to the start of the next cycle. If we assume that bit flips of the ancillas prior to the heralding measurement can be corrected, then there is no penalty for the measurements continuing for the entire waiting duration before thresholding.
We use three strategies to estimate the performance of the ancilla-based case: 1. Idealistic strategy : We assume that the only errors which are not correctable are from higher-order data-qubit bit-flips. We also assume that the ancillas are not reused, so do not limit the cycle time. This is the optimal theoretical performance of the bit-flip code if no additional errors are introduced in the implementation.
2. Pessimistic strategy : We keep all errors that arise from sudden bit flips of either the data qubits or the ancillas, including during measurement times and during the cross-resonance gate interaction. We use this strategy as a worst-case-scenario of the ancillabased case that would occur without more sophisticated correction methods.
3. Optimistic strategy : We assume that all bit-flipinduced phase-flip errors can be avoided by embedding the 3-qubit code into a suitable fault-tolerant code, leaving only second-order errors. We assume non-Markovian processing of the syndrome history to remove the detectable ancilla-flip errors. We also assume that the ancillas are reused in each cycle. We use this strategy as a more realistic benchmark to assess the relative performance of the continuous case.
The idealistic case acts as an effective lower bound for the infidelity to show how the realistic cases compare against the best possible theoretical case. In Figs. 6a, 6c, and 6d we plot this idealistic case as the gray line to provide a crude comparison for the continuous measurement cases. The pessimistic case acts as a worst-case scenario to show how the raw 3-qubit code would behave if implemented in a laboratory that only caused pure bit flips, with no sophisticated non-Markovian processing of the syndrome history. Although better processing techniques would certainly be employed to avoid most of these errors, the pessimistic case is still a useful comparison as a lower bound to bracket expectations. The optimistic case acts as a more realistic in-between scenario that incorporates plausibly achievable corrections. For evaluating realistic QEC, additional enhancements beyond the simple bit-flip code should be assumed, which makes the optimistic strategy a reasonable performance comparison. We now derive expressions for the initial drop in fidelity ∆F in and the logical error rate Γ for these projective measurement scenarios, to be compared to the continuous measurement case. In each case, we fix the gate time δt = 4τ to the length of two CNOT gates and optimize over two free filter parameters: measurement integration time ∆t and cycle repetition time ∆T ≥ ∆t+δt. As a caution, when experimentally implemented the value of the measurement timescale τ will differ between the continuous parity measurements of the main text and the ancilla measurements in the appendix. Parity measurements are likely to have a timescale τ that is several times longer than the τ achievable for the measurement of a single qubit. For simplicity of notation, however, we ignore this distinction in what follows; nevertheless, care should be taken when comparing results to the continuous measurement cases.

A.1 Logical error rate: Idealistic case
In the idealistic case, we ignore all errors introduced by the ancilla qubits, ignore all errors that could happen during CNOT gates, ignore phase flips, and ignore misidentification errors of the readout. We also assume that all ancilla measurements can be done in parallel with an infinite supply of ancillary qubits, so that there is no restriction on repetition time arising from reuse of the ancillas. As such, the cycle time is limited only by the gate time, ∆T → δt, with the measurement time ∆t → ∞ allowed to be as large as necessary in parallel to eliminate misidentification errors.
With these assumptions, only double-bit-flips of the data qubits during the gate time δt contribute to the logical error rate, with no delay between successive gate times. Thus, where we have taken the gate time to be δt = 4τ . The initial drop in fidelity of ancilla-based error correction comes from errors that would normally be detectable after multiple cycles, but do not have enough time to be detected before the final detection cycle ends. For the idealistic case, only data-qubit bit flips that happen after the initial CNOTs will cause an error, since bit flips before the CNOTs will be detected. Examining the gate timings in Fig. 7 shows that only flips of bits 1 and 2 in the second half of the gate time can cause such an error, which yields a total fidelity drop of A.2 Logical error rate: Pessimistic case In the pessimistic case, logical errors can arise from several distinct mechanisms: (a) two data-qubit bit flips during the same cycle, (b) a single data-qubit bit flip during a CNOT gate, (c) one data-qubit bit flip and one ancilla-qubit bit flip, (d) two ancilla-qubit bit flips, (e) one misidentification and one bit flip, and (f) two misidentifications. For completeness, we also briefly consider a non-bit-flip error that is particularly problematic, (g) a single ancilla-qubit bit-phase-flip during a CNOT gate. Note that single ancilla-qubit bit flips are not problematic since they are simply corrected by the subsequent cycle. We now consider each logical error source in turn.
(a) Two data-qubit bit flips This source of error is the same as in the idealistic case, but single bit flips during the gate time δt are now dangerous. In practice, however, ∆T δt for the pessimistic case, so we can neglect all δt/∆T corrections without harm. With this simplification, the two data-qubit bit-flip contribution to the logical error rate becomes 3µ 2 ∆T .
(b) One data-qubit bit flip during CNOT For specificity, we assume an initial 5-qubit state |ψ = (α|000 + β|111 )|00 , with an arbitrary logical superposition of data qubits 1,2, and 3, and the ancilla qubits 4 and 5 initialized in their ground states. We use the CNOT gate implementation outlined in Eq. (58). Since the single-qubit gate corrections require only 1/4 the gate time, we assume that the relevant errors are caused by bit flips during the two-qubit gate and neglect single-qubit-gate errors. Since the (Z k X j ) 90 gate is a continuous rotation that takes a finite time, a bit flip can occur at any intermediate angle of the rotation.
An (I k X j ) bit flip of the ancilla commutes with this gate, so does not cause problems beyond those considered in subsequent sections. However, an (X k I j ) bit flip of a data qubit disrupts the gate rotation.
In the C 4|2 case, the ancilla measurement can additionally misidentify a bit-2 flip as a bit-1 flip with probability cos 2 (ϕ/2); this produces a logical error since the subsequent correction cycle yields a syndrome of (−1, −1) with an estimated encoding XII, which will be interpreted as a bit-3 flip to the encoding XIX that is the inversion of the true IXI encoding. Averaging over ϕ again produces probability 1/2, and a contribution to the logical error rate of (1/2)µ(δt/2)/∆T .
The total contribution to the logical error rate from data-qubit bit-flips during a CNOT is thus (5/4)µδt/∆T . Since this contribution is linear in µ, it is the dominant source of error for the ancillabased approach. It is this term that is largely responsible for the smallness of the factor δt/∆T upon optimization.
(c) One data-qubit bit flip and one ancilla-qubit bit flip A logical error can occur from flips within a single cycle when a data-qubit flip is combined with a misinterpretation of the syndrome measurement. Since data-qubit flips during the gate time have already been included in the logical error of the preceding subsections, we consider only flips that happen in the interval [δt, ∆T ], with probability µ(∆T − δt).
A syndrome misinterpretation can occur if an ancilla qubit is either incorrectly prepared, or flips just prior to readout. An incorrect preparation occurs if the ancilla flips during the second half of its heralding measurement ∆t/2 before a detection cycle (see Fig. 7), since that flip will not be detected by the averaged record of the heralding measurement. Similarly, if the ancilla flips during the gate time δt (assuming it commutes with the CNOT gates) or the first half of the final readout duration ∆t/2, then the flip causes a misinterpretation of the syndrome. The total probability of these ancilla flips is thus µ(∆t + δt). There are four ways that combinations of flips can cause a logical error: Both 1+5 and 3+4 flips will misinterpret a bit 1 or bit 3 flip as sequence of two flips and cause a logical error in the next cycle. For example, 1+5 produces a true encoding of XII but yields the two-cycle sequence of estimated encodings: III → IIX → IXX. Both 2+4 and 2+5 flips will misinterpret a bit 2 flip as a bit 1 or bit 3 flip and cause a logical error in the next cycle. For example, 2+4 produces a true encoding of IXI but yields the two-cycle sequence III → XII → XIX. The total contribution to the logical error rate from a single cycle is therefore 4 µ 2 (∆t + δt)(∆T − δt)/∆T .
A logical error can also occur from flips over two cycles when an ancilla qubit flips in one cycle and a data qubit flips in the next. In this case, the only situation that can cause a logical error is when the ancilla flips in the second half of the heralding measurement, with probability µ∆t/2. This flip is unlikely to be detected in the current cycle, so will be postponed to the next cycle where it combines with the data-qubit flip to produce a logical error, with probability µ(∆T −δt). Tallying the same four ways this can produce a logical error produces the probability 2µ 2 ∆t(∆T −δt) that this type of logical error occurs within a two cycle window. Given N 1 total cycles, there are N − 1 ≈ N windows of 2 consecutive cycles. The error rate contribution is therefore N − 1 times the probability within a 2cycle window over the total duration N ∆T , which is 2µ 2 ∆t(∆T − δt)/∆T .
A similar situation arises when a data-qubit flips in one cycle followed by an ancilla-qubit flip in the first half of the syndrome measurement of the next cycle. The probability of obtaining a logical error from this scenario is similar to the previous twocycle scenario, but includes the gate time. Therefore, the contribution of this type of error to the logical error rate is also 4µ 2 (∆t/2 + δt)(∆T − δt)/∆T .
(d) Two ancilla-qubit bit flips A logical error can occur from flips in a single cycle when one ancilla flips during the first half of its syndrome measurement (producing an incorrect readout) and the remaining ancilla flips during the second half of its heralding measurement (producing an incorrect preparation for the next cycle). If the flips are ancilla 4 then ancilla 5, this produces the following sequence of estimated encodings over three cycles III → XII → XXI → XXX. The reversed order of ancilla flips is also possible, so the contribution to the logical error rate is 2µ 2 (∆t/2) 2 /∆T . A logical error can occur from flips over two cycles when the two ancillas sequentially flip during the first halves of their syndrome measurements, which produces the same result as above. Similarly, the same result occurs when the two ancillas sequentially flip during the second half of their heralding measurements. Thus, the logical error rate acquires two more contributions of 2µ 2 (∆t/2) 2 /∆T .
The total contribution of two ancilla-qubit flips to the logical error rate is thus (3/2)µ 2 ∆t 2 /∆T .
(e) One misidentification and one bit flip error from such a phase-bit flip. Suppose that instead of the symmetric coupling of the (Z k X j ) 90 gate, one directly implemented a controlled rotation gate X j|k (π). (The realistic gate operation is somewhere in between these idealizations.) A bitphase flip in the middle of, e.g., the C 4|1 gate would then yield with similar outcomes for the other scenarios. In both cases of the ancilla measurement, the logical information is altered. In one case the logical state is completely projected and the information is destroyed, while in the other case the logical state is partially projected by a random amount. Neither of these types of logical error can be corrected by the three qubit code.
In the spirit of analyzing how the bit-flip code protects against pure bit-flip errors, however, we do not include these sorts of errors caused by phasebit-flips in our final estimate. This keeps the analysis focused solely on the performance of the code against the type of error for which it was intended.
Adding up all contributions to the logical error rate and neglecting δt/∆T 1 corrections produces the total formula: For both pessimistic and the optimistic methods, there are three contributions to the initial drop. First, if a data qubit flips after the CNOT gates, i.e. during the ancilla measurement time, then the flip is not detectable. Such a flip can occur with probability 3µ∆t. Second, if an ancilla flips during the first half of its measurement time in the final cycle, then its reported parity outcome will be incorrect. Such an ancilla flip can occur with probability 2µ(∆t/2). Third, if an ancilla has its readout misidentified in the final cycle, then its reported parity outcome will be incorrect. Such a misidentification can occur with probability 2P mis , with P mis as defined in Eq. (38). Adding these contributions together, the drop in average fidelity from the final cycle is thus Using the optimization outlined in Eq. (51), and methods similar to the main text, we can analytically obtain crude formulas for the optimized ∆F in and Γ. We find that the optimized measurement time scales logarithmically with the bit-flip rate, ∆t τ ≈ 2 ln 3 8µτ π ln[3/(8µτ √ π · · ·)] ≈ 2 ln 1 15µτ , where the final approximation applies in the range µτ ∈ [10 −6 , 10 −3 ] by renormalizing the nested logarithmic dependence to a constant. The cycle time scales as the inverse square root, These time scales produce an optimized logical error rate and initial drop of roughly . (66) Due to the dangerous ancilla-flips during the CNOTs, the logical error rate dominantly scales as µ 3/2 rather than µ 2 , which makes the pessimistic case significantly worse than the ideal case and unusable for practical error correction. Of all considered methods, it is the worst performing.

A.3 Logical error rate: optimistic case
In the optimistic case, we assume that the 3-qubit code is a sub-code of a larger code that should be able to correct many of the errors introduced by the ancilla qubits in the pessimistic case. Most importantly, we assume that the phase-flip errors introduced by bit-flips during the CNOTs can be corrected by a suitable phaseflip encoding. We also assume that the code is faulttolerant, so other errors that occur during the CNOT gates and ancilla measurements will be corrected. Similarly, we assume a non-Markovian extensions to the 3qubit code that can track the most likely past errors