Comparing and combining measurement-based and driven-dissipative entanglement stabilization

We demonstrate and contrast two approaches to the stabilization of qubit entanglement by feedback. Our demonstration is built on a feedback platform consisting of two superconducting qubits coupled to a cavity which are measured by a nearly-quantum-limited measurement chain and controlled by high-speed classical logic circuits. This platform is used to stabilize entanglement by two nominally distinct schemes: a"passive"reservoir engineering method and an"active"correction based on conditional parity measurements. In view of the instrumental roles that these two feedback paradigms play in quantum error-correction and quantum control, we directly compare them on the same experimental setup. Further, we show that a second layer of feedback can be added to each of these schemes, which heralds the presence of a high-fidelity entangled state in realtime. This"nested"feedback brings about a marked entanglement fidelity improvement without sacrificing success probability.


INTRODUCTION
The ability to perform quantum error correction (QEC) by feedback is a crucial step towards fault-tolerant quantum computation [1,2]. An open challenge, that has drawn considerable interest recently [3][4][5], is to find the best strategy for this task. Two nominally distinct feedback strategies for QEC are the measurement-based and driven-dissipative approaches. The former has been more well-understood [6], owing to an existing foundation in classical control and feedback in engineering. In the measurement-based (MB) approach, a classical controller performs projective measurements of a set of multi-qubit stabilizer operators that encode the logical qubit [1,4] in order to track errors and/or perform any necessary correction. Thus for good performance, this approach requires both high-fidelity projective measurements and low-latency control electronics to process the measurement result within the relevant coherence times of the quantum system. The elements required for this MB strategy have been demonstrated for small quantum systems on various physical platforms such as Rydberg atoms [7], trapped ions [8,9], photons [10], spin [11] and superconducting qubits [1,[12][13][14][16][17][18][19][20][21]. However, a steady-state multi-qubit QEC capability has yet to be achieved and one of the key questions for this development is whether the MB strategy is scalable to larger systems or whether an alternative approach is more optimal.
One such alternative, driven-dissipative (DD) schemes [22], also called reservoir/bath engineering or coherent feedback (as discussed below), utilizes coupling between the quantum system of interest and a dissipative environment to transfer the entropy caused by decoherence-induced errors out of the quantum system. They have been demonstrated on a variety of physical systems including atomic ensembles [23], trapped ions [24], mechanical resonators [25,26] and superconducting qubits [6,27,28,[30][31][32]. Moreover, experiments with trapped ions [33] and superconducting qubits [34] have demonstrated some of the basic elements of autonomous QEC. These schemes do not require high-fidelity projective measurements, external control and its associated latency. They can also be described as autonomous or coherent feedback [35], where the reservoir coupled to the target quantum system can be considered as an effective "quantum controller" that reacts with quantum degrees of freedom [36]. Adjusting the feedback by changing the "quantum controller", however, can be more challenging than re-programming a classical controller, built with conventional electronics. Thus, a further question is whether one can combine this DD approach and the conventional MB approach with minimal negative consequences from their respective drawbacks.
Here we report an experiment in which we built a feedback platform utilizing a nearly quantum-limited measurement chain and a customized field-programmable gate array (FPGA) system to perform MB and DD schemes within the same setup. The task of this platform was to stabilize an entangled Bell state of two superconducting transmon qubits [37]. This particular task of stabilizing a single state is a proxy for more general QEC experiments where a manifold of states is protected. We realize, for the first time, an MB stabilization of a Bell state by repeated active correction through conditional parity measurements [1,2,38]. We compare this scheme to a DD entanglement stabilization scheme [30] in which the conditional parity switch is autonomous. By performing both schemes on the same hardware setup and circuit QED (cQED) system [40], we shed light on their close connection and compare them on a level playing field.
Previous theoretical works have compared DD (under the name of "coherent feedback") and MB for linear quantum control problems [41], such as for minimizing the time required for qubit state purification [42] or for cooling a quantum oscillator [43]. These comparisons showed coherent feedback to be significantly superior. In our particular setup, we find that distinguishing the superior approach among DD and MB is a more subtle task. The subtlety is two-fold. First, the performance difference depends on which process can be better optimized: the design of the cQED Hamiltonian or the efficiency of quantum measurement and classical control. In the current experiment, we show that DD has better steadystate performance as the cQED Hamiltonian parameters are engineered such that DD has a shorter feedback latency. But DD's advantage over MB is not immutable. As certain experimental parameters are improved, such as coherence times and measurement efficiency, MB's performance can catch up with DD.
Secondly, in the current situation in which neither the cQED Hamiltonian parameters nor the measurement and control parameters are ideal, we can obtain a boosted performance by combining DD and MB to get the best of both worlds. We explored this by devising a heralding method to improve the performance of both stabilization approaches.
This protocol exploits the high-fidelity measurement capability and the programmability of the feedback platform. The protocol is termed "nested feedback" since it has an inner feedback loop based on either the DD or MB scheme, and an outer loop that heralds the presence of a high-fidelity entangled state in real-time. Previously, heralding schemes have been demonstrated for state preparation to combat photon loss or decoherence [1,12,[44][45][46][47][48][49].
Extending such heralding capability to state stabilization will be a valuable addition to the QEC toolbox. Furthermore, the ability to herald in real time as opposed to post-selection is important for on-demand and deterministic quantum information processing since only successful events lead to subsequent processing. Real-time heralding for entanglement stabilization is particularly challenging for superconducting qubits due to their shorter coherence times compared to other systems. In this article, we implement this real-time heralding capability on a time scale faster than the few microsecond coherence time of our qubit-cavity system. By extending the feedback platform developed primary for the MB approach to the DD approach, our results bring to light a new application of MB. Adding a level of MB feedback can significantly improve performance beyond what a single layer of feedback, whether DD or MB, can achieve.
The cavity output is amplified by a Josephson Parametric Converter (JPC) operated as a nearly quantum-limited phase-preserving amplifier [52] enabling rapid, single-shot readout [7] and thus real-time feedback. The key component of the experiment is a controller realized with two FPGA boards [54] that both measure and actively control the cavity-qubit system. An essential operation for our experiment is a two-qubit joint quasi-parity measurement using the common readout cavity [1,2,38]. As shown in Fig. 1b, the cavity is driven at f gg (both qubits in ground state) and at f ee (both in the excited state) at the same time.
The output at f gg and f ee together distinguishes the even parity manifold {|gg , |ee } from the odd parity manifold {|ge , |eg }. When the two cavity output responses both have an amplitude below a certain threshold, the qubits are declared to be in odd parity; when either one has amplitude above the threshold, the qubits are declared to be in even parity. We note that, unlike a true parity measurement, this readout actually distinguishes the two even parity states |gg and |ee , hence we refer to it as a "quasi" parity measurement. However, the feedback schemes described below apply the same operation on both even states, and thus we need only record the parity of the measured state. The choice of driving at the "even" cavity resonances rather than between the "odd" resonances (f eg and f ge ) mitigates the effect of the χ mismatch, reducing associated measurement-induced dephasing of the odd manifold [2]. The controller FPGA a (b) modulates the f gg (f ee ) drive to the cavity and also demodulates the response. The two FPGAs share their measurements of the cavity response to jointly determine the parity. In addition, FPGA a and b generate the qubit pulses to Alice and Bob, respectively, which are conditioned on the joint state estimation during real-time feedback.

PRINCIPLE OF EXPERIMENT AND RESULTS
We first briefly outline the DD stabilization of entanglement, described in detail in Ref. 6 and 30. This stabilization targets the two-qubit Bell state Bob at their zero-photon qubit frequencies (ω 0 Alice and ω 0 Bob , see Supp. Mat. Sec. I) couple the wrong Bell state |φ + to the even states, |gg , |ee , in the energy manifold with zero cavity photons. A second pair of Rabi drives at the n-photon qubit frequencies (ω 0 Alice − nχ and ω 0 Bob − nχ,χ = (χ Alice + χ Bob ) /2), with their relative phase opposite to the first pair, couple |gg, n , |ee, n to the Bell state |φ − , n . The two cavity drives, at f gg and f ee connect the two manifolds and hence the combined action of the six drives transfers the population from |gg , |ee and |φ + to |φ − , n . Finally, cavity photon decay brings |φ − , n back to |φ − , 0 . In effect, the cavity drives separate qubit states based on their parity, allowing one pair of Rabi drives to move the erroneous odd population to the even states while the other pair transfers the even states population to |φ − .
Counterparts to these elements of the DD feedback loop can be found in the corresponding MB feedback scheme. The action of our MB algorithm is shown as a state machine in Fig. 2.
We describe the quasi-parity measurementP by the projectors P odd = |ge ge| + |eg eg|, P gg = |gg gg| and P ee = |ee ee|. We assign the outcomesp = +1 to the even projectors, P gg and P ee andp = −1 to P odd . The MB algorithm is built with a sequence of correction steps, each of which consists of a conditional unitary and a quasi-parity measurement. The two possible states of the state machine correspond to whether we apply the unitary U E or U O , followed by the quasi-parity measurement. Specifically, . In a correction step k, the qubits are initially in either |gg , |ee or in the odd manifold, due to the projective quasi-parity measurement in step k − 1; the controller then applies U E (U O ) ifp in previous step reported +1 (−1).
The effect of the state machine on the two-qubit states is shown in Tab. I, where the action of the controller during one correction step is described in terms of the four basis states, |φ − , |φ + , |gg and |ee (the latter two are grouped in the "even" column). The quasi-parity measurement infidelity, labeled by E|O ( O|E ), gives the error probability of obtaining an even (odd) parity outcome after generating an odd (even) state. Because these measurement infidelities are small, the dominant events are those that occur without measurement errors.
At each step, U E on either |gg or |ee followed by the quasi-parity measurementP transfers the states to |φ − with 50% probability. Since |φ − is an eigenstate of U O andP (modulo a deterministic phase shift that can be undone, see later discussion), these operations leave it unaffected. On the other hand, U O andP transform |φ + into {|gg , |ee }; more generally, they take population in any other odd state (i.e., a superposition of |φ − and |φ + ) into |φ − and the even states.
By repeating a sufficient number of these correction steps in sequence, the controller stabilizes the target Bell state irrespective of the initial two-qubit state. The similarity between this active feedback and DD is that MB also transfers population between different parity states by conditional Rabi drives. However, while the Rabi drives in DD are conditioned autonomously by the photon number in the cavity, the unitary Rabi pulses in MB are conditioned by real-time parity measurement performed by active monitoring of cavity outputs.
The pulse sequences for DD and MB are shown in Fig. 2b and e. In DD, a set of continuous-wave drives are applied for a fixed time T s and after some delay T w to allow remaining cavity photons to decay, a two-qubit state tomography is performed [55,56].
The cavity and Rabi drive amplitudes and phases were tuned for maximum entanglement fidelity, following the procedure described in Ref. 30. In particular, the optimal cavity drive amplitudes were found to ben = 4.0. For MB, the continuous drives are replaced by a pre- Next state even |φ − |φ + even even/|φ − even/|φ + We experimentally determined the infidelity of the quasi-parity measurement to be E|O and O|E of 0.04 and 0.05, respectively. The quasi-parity measurement also causes a deterministic qubit rotation about the respective Z axis due to an AC Stark shift [2]; this rotation was corrected within the unitary gate U O as discussed in Supp. Mat. Sec. VI. There is a clear trade-off between success probability and fidelity. To reach the maximum fidelity in DD of 82%, at least 75% of experiment runs need to be discarded. The trade-off is less severe in MB, where only 50% of runs need to be discarded to reach the maximum fidelity of 75%. However we aim to eliminate this trade-off all together, i.e., to improve the fidelity while maintaining a high success probability.
This goal is achieved by introducing a nested feedback protocol (NFP), in which the stabilization feedback loop enters into a higher layer of feedback for "fidelity boosting" instead of proceeding to state tomography directly. In contrast to the "fixed time" protocol, is assessed by the cumulative probability, the integral of the probability of having completed a certain number of boost attempts before tomography, as plotted in Fig. 4c,f. Since MB requires a less stringent threshold than DD to gain fidelity improvement, the MB success probability converges to unity much faster than that of DD. Finally, we show that the high success probability does not come at the cost of reduced fidelity. The fidelity to |φ − for DD improves from an unconditioned value of 76% to 82% (averaged over all successful attempts).
For MB, the improvement is more pronounced: fidelity rises from an unconditioned value of 57% to 74%. Thus for both DD and MB, NFP attain close to the fidelity achieved via stringent post-selection. These results for NFP also agree well with a numerical simulation (see Supp. Mat. Sec. V).
One will note, however, a continuous downward trend of the fidelity in both DD and MB schemes as the number of attempts increases. This is due to the non-negligible population in the |f states of the two qubits in the experiment, which escape correction by the stabilization feedback loops. After each further boost attempt of stabilization, the probability of the population escaping outside the correction space thus increases, diminishing the fidelity (see Supp. Mat. Sec. VII). Also note that the error bars on the fidelity of MB are bigger than those in DD for large attempt numbers simply because the probability of needing many attempts is lower in MB than in DD.
While real-time heralding by NFP removes the trade-off between fidelity and success probability, it does so by introducing a different trade-off -high fidelity and success probability are achieved but the protocol length now varies from run to run. If NFP is a module within a larger quantum information processing (QIP) algorithm, then this asynchronous nature must be accommodated by the controller. For our FPGA-based control, NFP is easily accommodated because it is a natural extension to "fixed-time" or synchronous operation.
In "fixed time" operation, the controller conditions its state by the protocol length which is pre-determined and stored in an internal counter by the experimenter. On the other hand in NFP, the controller conditions its state on a pre-determined logical function of its real-time inputs.

CONCLUSION
In conclusion, we have implemented a new MB stabilization of an entangled state of two qubits, which parallels a previous DD stabilization scheme. Instead of coherent feedback by reservoir engineering, MB relies on actively controlled feedback by classical high-speed electronics external to the quantum system. When comparing both schemes in the "fixedtime" protocol, we observe that DD gives a higher fidelity to the target state due to lower feedback latency. Furthermore, we have improved the fidelity of both schemes by a nested feedback protocol which heralds stabilization runs with high-quality entanglement in real time. The real time heralding brings about the fidelity improvement without a common trade-off in QIP: it does not sacrifice the experiment success probability. It eliminates this trade-off by allowing asynchronicity in the experiment.
Our experiment shows some of the key advantages of MB platforms that have not been previously explored. Typically, the performance of MB feedback has not been at par with methods based on post-selection, due to the latency of the controller. However it is widely recognized that the trade-off of success probability for fidelity in the case of post-selection is untenable for large scale systems. Therefore, existing digital feedback [1,12,14,16] have focused on achieving nearly perfect success probability. Here, we are exploring another direction of feedback which achieves high fidelity with high success probability. Our nested feedback strategy maximizes the use of the information coming out of the qubit-cavity system in order to make the correction process as efficient as possible. We find that our feedback platform, comprised of a nearly-quantum-limited measurement chain and a realtime classical controller, provides the necessary tool-set to implement such a strategy. We show that this technology can be extended to improve the performance of DD approaches as well as single-layer MB approaches themselves. This strategy could be carried out further in the future. For example, the FPGA state estimator could perform a more sophisticated quantum filter of the microwave output of the DD stabilization to herald successful events with better accuracy, significantly improving the success probability convergence rate.
Similar ideas can be applied in the future towards other forms of stabilization, such as for stabilizing Schrödinger cat states of a cavity mode [57], a proposed logical qubit. Initial experiments on such logical qubits with high fidelity-measurement [58] or dissipation engineering [31] have been performed and could now be combined. Likewise, future logical qubits based on the surface code [4] could also be stabilized by either active stabilizer measurements [17][18][19] or as recently proposed by dissipation engineering [5,59]. Our experiment demonstrates that measurement-based and driven-dissipative approaches, far from being antagonistic, can be merged to perform better than either approach on its own.

II. MEASUREMENT STRENGTH AND DURATION CALIBRATION FOR MB
The quasi-parity measurement strength and duration were optimized in order to maximize the fidelity of MB. This optimization was done by maximizing the fidelity of the Bell state created in a calibration experiment, similar to Ref. 1. The qubits are prepared in ground states (by post-selection) and then two π/2 pulses, are applied to Alice and Bob, producing the state |ψ = 1 2 (|gg + |ee + |ge + |eg ). The quasi-parity measurement, consisting of the two cavity drives on f ee and f gg respectively, projects the qubits into one of the two even states or entangles the qubits into a Bell state with odd parity. We varied the duration of this parity measurement and its strength in terms of photon number (set to be identical) for each readout frequency to find the parameters that maximize the fidelity of the entangled state to the closest Bell state (Fig. S.2). The Bell state fidelity would ideally increase and asymptotically approach one with increasing measurement time as the parity measurement better distinguishes the odd Bell state from the even states. On the other hand, at long measurement duration, the coherence of the entangled state decreases due to both natural and measurement-induced dephasing, the latter of which is caused by the χ mismatch between the qubits and is proportional to the average number of photons used for the measurement [2]. Therefore, there is an optimal measurement strength and duration.
For our experiment,n = 4.5 for each readout frequency and a measurement duration of 660 ns are found to be close to the optimal values and are chosen to attain a Bell state fidelity of 80%.
The value of 80% sets the upper bound on the fidelity that we should expect for heralding MB. In the actual MB experiment, an extra 310 ns delay was introduced after the quasiparity measurement in a correction step, which does not occur in the sequence described in this section for optimizing the parity measurement parameters. This extra delay was required to accommodate the feedback latency in MB. The conditioned fidelity we obtained for heralded MB is about 6% lower.

III. MEASUREMENT OUTCOMES DISTRIBUTION FOR DD AND MB
The cavity outputs at f gg and f ee for both DD and MB can be used to monitor the state of the qubits during stabilization (Fig. S.3a). Histograms of the measurement outcomes I gg and I ee , recorded by integrating the cavity output at f gg and f ee , respectively, are shown in This feature also appears in numerical simulations of DD by the stochastic master equation [3]. The state estimation used in both DD and MB uses the "box car" filtering [4] which simply sums up the recorded cavity output signals over time to obtain the measurement outcomes. This method, while appropriate for MB, is not suited for DD since in the latter, the qubits are undergoing actively-driven dynamics when the measurement is taking place. A more advanced filter, such as a non-linear quantum filter can be designed from either first-principles or machine learning [5] in the future to improve the state discrimination accuracy in DD.
The measurement outcomes to the left of both the I herald gg (shown in figure) and I herald ee thresholds are much less likely to come from even states than those to the right. Therefore the experiment runs with these outcomes are selected for state tomography, giving the results plotted as a color map in Fig. 3 (main text). Moving the threshold further to the left increases the stringency of the threshold as fewer measurement outcomes are included. The success probability for each threshold choice (plotted as contours in Fig. 3) is calculated by the ratio of included outcomes to the total number of experiment runs.

IV. STEADY STATE MODEL FOR DD AND MB
The steady state behavior of both DD and MB is simulated by a Lindblad master equation, given by The Hamiltonian H(t) is treated differently in DD and MB. For DD, the Hamiltonian is described in detail in the theory proposal [6] and parameters in the Hamiltonian, such as the cavity and qubit drive amplitudes, are swept in simulation to find the optimal values. The optimal value for the cavity drive amplitude is found to be κ √n /2 withn = 4.0, and κ/2 for the qubit drive amplitudes at both zero-photon and n-photon qubit frequencies. The DD simulation predicts a characteristic time constant of 1 µs and a steady state fidelity of 76% (accounting for the delay between stabilization and state tomography to allow remaining cavity photons to decay).
For MB, a correction step is broken into four segments for effectively piecewise master equation simulation. The first part contains the conditional Rabi pulses which are simulated as perfect instantaneous unitary operations on the qubits. The second part is the decay during the pulses (154 ns total). The Hamiltonian during this part is just the the dispersive interaction between the qubits and the cavity, in the rotating frame of the two qubits (ω 0 A , ω 0 B ) and the cavity mode ((ω gg c + ω ee c )/2). The third part is the quasi-parity measurement during which the cavity drives at the f gg and f ee resonances are on and the Hamiltonian is given by , where c is the amplitude of the cavity drive (660 ns total). The last part is the remainder of the correction step, incurred by the latency of the feedback during which all drives are off and the qubit-cavity system is in free-decay. The dynamics in this part is again simulated by the dispersive interaction, H(t) = H disp (686 ns total). For the piecewise master equation simulation of a complete correction step as four segments, the density matrix at the end of a segment is used as the initial density matrix for the next segment.
Since in MB, the state at the end of a correction step depends only on the initial state at the beginning of the step, we can model the MB scheme as a Markov chain (Fig. S.4).
In the rest of this section, we show how we derive the transition matrix that describes this Markov chain.
As discussed in the main text, we can describe the qubits by the density matrix ρ = π − |φ − φ − | + π + |φ + φ + | + π gg |gg gg| + π ee |ee ee|. Therefore, in terms of probability distributions in the four basis states, the qubits's state,S, can be represented by a vector, If the qubits are prepared in |φ − , that isS φ − after a correction step by applying the master equation simulation method described above. We need to consider the two possible cases where the conditional unitary applied is U O or U E , respectively. TheS E|O and O|E are the quasi-parity measurement infidelities due to limited measurement efficiency, introduced in the main text. In a similar manner, we can obtainS (f ) φ + . In the case of an even initial state, for example,S (i) gg = (0, 0, 1, 0) T , we havẽ And similarly forS gg andS (f ) ee , we can construct the transition matrix T of a correction step, where theS (f ) 's are the columns of the 4 by 4 matrix. Now applying this transition matrix on any arbitrary initial state gives the final state after a correction step, The transition matrix T is also called the stochastic matrix, with the property that each column sums to 1. One of T 's eigenvalues is guaranteed to be 1 and the corresponding eigenvector,S ∞ , is the steady state of the Markov chain. It can easily be shown that for any arbitrary initial state,S (i) We can calculate the expected fidelity when some of the experimental parameters are improved in the near future. If the measurement efficiency is improved from 30% to the current state-of-the-art value of 60%, the measurement duration can be reduced by half while maintaining the quasi-parity measurement infidelities [7]. The instrument and FPGA latencies incurred in the experiment can also be reduced by 100 ns, in the latest hardware After stabilization of some pre-determined duration, if the qubits are (on average) in stateS (0) , then the average state of the qubits that are heralded is then given by, herald = (π − , π + , π gg , π ee ) T . Given the success probability P s of using the thresholds (the white dashed contour line of Fig. 3b,d in the main text), the diagonal elements can be calculated as, For the specific heralding thresholds used in the experiment (represented by the black squares in Fig. 3b,d in the main text),c DD andc MB are explicitly given by, Ideally forc, only c φ − should be non-zero. But in practice, since we cannot distinguish |φ − and |φ + , c φ + is comparable to c φ − . Furthermore, for both DD and MB, c gg and c ee are also non-neglibile. In DD, this is predominantly due to the lack of separation between the even and odd measurement outcomes as discussed in Supp. Sec. II. In MB, the qubits can jump during the delay between the completion of the quasi-parity measurement and the end of a correction step due to T 1 events. Thus for MB, trajectories that are heralded by very stringent thresholds still have a non-zero probability of being in the even parity states.
Given the heralding matricesc DD andc MB , we can now calculate the average state of the trajectories that are not heralded and thus require a boost attempt as where we introduce the lowercases (0) boost as the unnormalized population distribution vector. || · || 1 denotes the L 1 norm of the numerator.
After this boost attempt, the qubits are in stateS (1) , where T is the stochastic transition matrix that models the stabilization during a boosting attempt. In Supp. Sec. III, we have already found T for MB. By the same method, we can also derive the effective transition matrix of a boost attempt for DD. The calculation of T for DD is an approximation: due to the continuous cavity drives, the state of the qubits at the beginning of a boost attempt is entangled with a qubit-state dependent cavity state, which we approximate unconditionally by the average steady-state cavity state in DD.
Nonetheless, as we shall show, the model still produces a quantitative behavior that agrees very well with the experimental results. From the above equations, it is easy to show that the average qubits state of the heralded trajectories after k boost attempts is given bỹ   Fig. 4 of the main text. Furthermore, from the simulation, we find that with the realistic system parameter improvement as specified in Supp. Sec. III, the fidelity of heralded trajectories can be 90% and 95% for DD and MB, respectively, with order unity success probability.

VI. MEASUREMENT-INDUCED AC STARK SHIFT AND CORRECTION FOR MB
The quasi-parity measurement induces a deterministic phase shift between the two qubits due to measurement-induced AC Stark shift [2]. This is evidenced by examining the phase of the Bell state created in the measurement optimization experiment described in Supp. Sec. I, in which we varied the measurement duration. As the measurement duration is increased, the Bell angle of the final Bell state changes linearly (Fig. S.7a). In order for MB to work, we need to account for the deterministic phase shift induced by the measurement. This correction is accomplished by a "Z " rotation on Bob before the unitary U O . Fig. S.7b gives one example of a sequence trajectory to illustrate how the correction works. With no loss of generality (and the reason will become clear soon in the discussion that follows), we construct U E = R a x (π/2) ⊗ R b −φo (π/2) and U O = R a x (π/2) ⊗ R b φo (π/2) (where φ o = 0 corresponds to the X axis) such that |φ o = |ge + e iφo |eg is the eigenstate of U O and applying U E on the even states results in |φ o with 50% probability after the quasi-parity measurement. Suppose that the qubits are in the ground states, U E is applied and the subsequent quasi-parity measurement givesp = −1. During the quasi-parity measurement, a deterministic phase shift of φ D is added. Since the measurement reports odd, the next conditional unitary is U O . The Z gate before U O undoes the phase shift and recovers the eigenstate which U O leaves unchanged. After another parity measurement, the qubits are in the state |ge +e i(φo+φ D ) |eg , with the phase shift added again. Consequently, we can see that the MB sequence actually stabilizes |ge +e i(φo+φ D ) |eg state. In practice, for our experiment, the Z rotation for Bob is constructed from a composite of X and Y rotations, such that , and the effective correction angle θ is swept (Fig. S.7c) to find the optimal value that cancels the deterministic phase shift and thus maximizes the fidelity. Furthermore, to make the target state of the stabilization |φ − , the rotation axis of the pulses on Bob in U O and U E is chosen such that φ o + φ D = π. This correction for measurement-induced AC Stark shift is also done in the simulation for MB.

VII. F STATE MEASUREMENT DURING NFP
While we have been treating our two qubits as purely two-level systems, in reality there are higher energy levels, in particular the second excited level is expected to play a nonnegligible role in the dynamics. We find that the equilibrium qubit population not in the |gg state was about 15%, and the f state was also populated. To investigate whether the decrease of the fidelity in NFP as a function of boost attempts number is due to the role played by the f -state population, we measured the populations in |f g , |f e , |gf , |ef , |f f after a given number of boost attempts in DD. The population in |f g was measured by applying a π pulse on Alice's e-f transition, then a π pulse on its e-g transition, followed by a measurement of the population in |gg . The other f -state populations are similarly obtained. The sum of these 5 populations gives the total f -state population plotted in   Alice and Bob, respectively. The I/Q modulations were output by the FPGAs with one and two single-sideband modulations in MB and DD (so that both zero-photon and n-photon qubit frequencies were addressed), respectively. The microwave frequency drives and I/Q modulation were mixed by IQ mixers. Two Agilent N5183 microwave generators produced the cavity drives at f ee and f gg respectively. The cavity drives were also pulsed by the FPGAs. On the output side: the transmitted signal through the cavity was directed by two circulators to the JPC for nearly quantum-limited amplification. It was further amplified at the 3 K stage by a cryogenic HEMT amplifier. After additional room temperature amplification, the signal was split into two interferometric setups for readouts at the f gg and f ee frequencies, respectively. In each of the interferometers, the signal arriving from the fridge was mixed with a local oscillator set +50 MHz away to produce a down-converted signal at 50 MHz. A copy of the cavity drive that did not go through the fridge was also down-converted in the same manner to produce a reference. Finally, the two signals with their respective references were sent to the analog-to-digital-converters on the FPGA boards for digitization and further demodulated inside the FPGAs. The two FPGAs jointly estimate the qubits' state by communicating their results with each other. Along the input and output lines, attenuators, low pass filters and homemade Eccosorb filters were placed at various stages to protect the qubits from thermal noise and undesired microwave and optical frequency radiation. Moreover, the cavity and JPC were shielded from stray magnetic fields by aluminum and cryogenic µ-metal (Amumetal A4K) shields.