Characterizing quantum instruments: from non-demolition measurements to quantum error correction

In quantum information processing quantum operations are often processed alongside measurements which result in classical data. Due to the information gain of classical measurement outputs non-unitary dynamical processes can take place on the system, for which common quantum channel descriptions fail to describe the time evolution. Quantum measurements are correctly treated by means of so-called quantum instruments capturing both classical outputs and post-measurement quantum states. Here we present a general recipe to characterize quantum instruments alongside its experimental implementation and analysis. Thereby, the full dynamics of a quantum instrument can be captured, exhibiting details of the quantum dynamics that would be overlooked with common tomography techniques. For illustration, we apply our characterization technique to a quantum instrument used for the detection of qubit loss and leakage, which was recently implemented as a building block in a quantum error correction (QEC) experiment (Nature 585, 207-210 (2020)). Our analysis reveals unexpected and in-depth information about the failure modes of the implementation of the quantum instrument. We then numerically study the implications of these experimental failure modes on QEC performance, when the instrument is employed as a building block in QEC protocols on a logical qubit. Our results highlight the importance of careful characterization and modelling of failure modes in quantum instruments, as compared to simplistic hardware-agnostic phenomenological noise models, which fail to predict the undesired behavior of faulty quantum instruments. The presented methods and results are directly applicable to generic quantum instruments.

In quantum information processing quantum operations are often processed alongside measurements which result in classical data. Due to the information gain of classical measurement outputs non-unitary dynamical processes can take place on the system, for which common quantum channel descriptions fail to describe the time evolution. Quantum measurements are correctly treated by means of so-called quantum instruments capturing both classical outputs and post-measurement quantum states. Here we present a general recipe to characterize quantum instruments alongside its experimental implementation and analysis. Thereby, the full dynamics of a quantum instrument can be captured, exhibiting details of the quantum dynamics that would be overlooked with common tomography techniques. For illustration, we apply our characterization technique to a quantum instrument used for the detection of qubit loss and leakage, which was recently implemented as a building block in a quantum error correction (QEC) experiment [1]. Our analysis reveals unexpected and in-depth information about the failure modes of the implementation of the quantum instrument. We then numerically study the implications of these experimental failure modes on QEC performance, when the instrument is employed as a building block in QEC protocols on a logical qubit. Our results highlight the importance of careful characterization and modelling of failure modes in quantum instruments, as compared to simplistic hardware-agnostic phenomenological noise models, which fail to predict the undesired behavior of faulty quantum instruments. The presented methods and results are directly applicable to generic quantum instruments.
The most general operation an experimenter can perform on a quantum system is a quantum instrument [2,3]. It includes both quantum and classical inputs as well as outputs and thereby generalizes quantum measurements, state preparation, and operations [4]. Quantum instruments are commonly used to describe scenarios where one needs to keep track of a classical input or output of a quantum operation, occurring e.g. in the description of quantum networks [5], quantum causality [6], measurement uncertainty trade-offs [7,8], and weak measurements [9][10][11].
In the context of quantum information processing, we are increasingly confronted with situations where quantum computations are not simple linear evolutions, but contain elements such as in-sequence measurements and feedforward. A prime example of this are quantum error correction (QEC) codes [12][13][14][15][16][17][18] and quantum non-demolition (QND) measurements [1,[19][20][21][22][23][24], where it is important to keep track of the measurement outcome in each cycle. More subtly, imperfections in realizations of quantum systems are caused by coupling to other quantum systems [25][26][27][28][29][30][31]. As a consequence, the operations that are performed on what is considered a qubit usually feature a small non-unitary component due to coupling to and ignorance of other relevant degrees of freedom. Such small deviations often go unnoticed when enforcing a unitary de-scription onto the system [26]. Device-independent [32] and self-testing [33,34] protocols have been developed to assess the performance of positive operator-valued measures (POVMs) [35,36] and quantum instruments. However, these methods do not give full information on the dynamics that is required in the context of high-precision quantum computation [37][38][39][40][41][42][43] and QEC.
Here we describe a characterization method for quantum instruments that will be particularly useful to characterize building blocks of quantum information processors. We identify quantum instruments where conventional quantum process tomography fails and introduce tomography procedures that are suitable to completely reconstruct such quantum instruments. As an example, we analyse in detail a recently implemented QND measurement for detection of qubit loss and leakage [1], which are processes that can drastically deteriorate the performance of QEC codes, if these loss-mechanisms go unnoticed [44][45][46]. Based on an experimental quantum instrument reconstruction, we derive a full instrument description for a faulty QND loss detection unit, and study its effect on a QEC cycle on a low-distance near-term logical qubit. Our results highlight the importance of developing microscopic, experimentally informed noise models of faulty quantum instruments over widely used generic hardware-agnostic noise models. The methods introduced are widely applicable to other quantum instruments including the fields of quantum information and quantum metrology [47].

I. INTRODUCTION TO QUANTUM INSTRUMENTS
Formally, a quantum instrument I is a set of trace non-increasing completely-positive (CP) maps {E j } j∈I , labelled by an index j ∈ I, such that their sum is tracepreserving, Tr ∑ j E j (ρ) = Tr(ρ), for every state ρ, see Fig. 1a. For example, when I describes a quantum measurement, then j ∈ I labels the measurement outcomes and E j transforms the input state ρ to the eigenstate corresponding to outcome j. The quantum instrument I : H 1 → H 2 ⊗ C |I| thus maps the input Hilbert space H 1 to an output Hilbert space H 2 of potentially different size, and a classical space C |I| . The index of the applied operation can be represented by a set of orthogonal projectors | j j| ∈ C |I| . In practice, one might realize such a measurement by coupling the system to an ancilla, such that the ancilla state encodes the classical index, see Fig. 1a. In the following we will focus on the simplest case with two possible measurement outcomes (|I| = 2), but all results can be straightforwardly extended to the general case.

II. TOMOGRAPHY OF QUANTUM INSTRUMENTS
For qubit systems, complete information on their quantum evolution can be gained by quantum process tomography [48]. However, when the evolution is described by a quantum instrument, the constituent maps are, in general, not individually trace-preserving. For example if leakage from the qubit level is present the tomographic measurements do not probe the full Hilbert space. In this case standard reconstruction techniques such as maximum likelihood estimation [49,50] will not be able to describe the quantum dynamics faithfully, because they force the reconstructed map to be trace preserving. To approach this problem, we rely on a relaxed tomography algorithm that does not enforce trace preservation [26,51,52].
In order to reconstruct the quantum channel E , we make use of the Choi-Jamiolkowsky isomorphism [53] to relate E to an (unnormalized) quantum state Λ E , the Choi operator. The correspondence between Λ E and E is given by The operation U realizes a generic quantum instrument on the system in the initial state ρ q and writes the index i of the applied operation into the state of an ancilla initialized in the state |0 a . The ancilla is finally projected onto the computational basis to read out the classical index. (b) A QND qubit loss detection unit as our application example for a quantum instrument. The system qubit is encoded in the computational subspace {|0 q , |1 q } and is affected by loss to a third level |2 q . For details see text. (c) A quantum erasure-channel implemented by first inducing partial loss from |0 q followed by its detection using the gadget from (b). Conditional on the qubit not being lost, the same partial loss is induced from |1 q and subsequently detected.
where d is the dimension of the Hilbert space. Following the notation of Ref. [26], the probability p i, j for observing the outcome state ρ j after preparing the state ρ i and subjecting it to the non-trace-preserving channel described by the Choi operator Λ is given by Defining the projector Π i j ≡ ρ * i ⊗ρ j and the column vector i, j Λ i, j | j ⊗|i , obtained by stacking the columns of Λ (similarly for Π i j ), we can identify the trace in Eq. (1) with an inner product of the vectorized operators: We now define the vector of observed frequencies f , and the quadratic form S, as follows: The most direct way to reconstruct the non-tracepreserving Choi operator Λ, is by inverting the above relation, a technique known as linear inversion, where · 2 denotes the vector 2-norm, and the estimator Λ is analytically given by: Unfortunately, linear inversion can produce unphysical results, especially in situations where the true (Choi)-state is close to pure [49]. To avoid these problems, we can use modified maximum likelihood estimation by constraining the estimator to be positive semi-definite, i.e. a physical state: Here W = ∑ i, j N j p j (1−p j ) |i, j i, j| is a weight matrix, taking into account the multinomial distribution of observed frequencies. Note that in contrast to standard maximum likelihood quantum process tomography, we do not enforce the map to be trace preserving, i.e. Tr[Λ] = d.

III. EXAMPLE: QUBIT LOSS DETECTION
We now study in detail the example of a quantum instrument devised for a QND detection of qubit loss or leakage. Using a trapped-ion quantum processor we implement the qubit-loss detection circuit in Fig. 1b, based on our previous work in Ref. [1]. Our quantum processor uses trapped 40 Ca + ions [54], where the qubits are encoded in two (meta-)stable electronic states S 1/2 (m = −1/2) ≡ |0 and D 5/2 (m = −1/2) ≡ |1 . A universal set of quantum gate operations is realized by single-qubit rotations by an angle θ around the x-or y-axis of the Bloch sphere, R σ (θ ) = exp(−iθ ∑ j σ j /2) with the Pauli operators σ = X or Y , together with two-qubit Mølmer-Sørenson entangling gate operations MS i, j (θ ) = exp(−iθ ∑ i, j X i X j /2) [55]; see Supplementary Material for more details [56].
The dominant loss mechanism in a trapped-ion quantum processor is leakage from the qubit subspace {|0 , |1 } to other electronic states, which can occur due to radiative decay from meta-stable electronic qubit states [57], in Raman transitions [58], or due to imperfections in spectroscopic decoupling pulses [59] when additional electronic states outside the computational subspace are used deliberately. Hence, loss can be induced in a controlled fashion by transferring part of the population from either computational basis state to an auxiliary level D 5/2 (m = +1/2) ≡ |2 referred to as loss-transition R loss (φ ) denoting a full coherent Comparison of trace-constrained and traceunconstrained tomography for the non-unitary map E 0 from Fig. 1b. We compute the total variation distance between directly measured frequencies and those predicted from the reconstructed Choi operators. Standard MLE increasingly fails to capture the underlying dynamics for higher loss probabilities. Error bars correspond to one standard deviation of statistical uncertainty due to quantum projection noise. transfer in case of φ = π. We then apply the QND unit to map the information about a loss of the system qubit (q) onto an ancilla qubit (a), which is subsequently read out. In the language of quantum instruments, this means that one of two possible maps ('loss' or 'no loss') has been applied to the system, with the classical index of the applied map stored qubit states |0 a and |1 a of the ancilla. Similar QND loss detection protocols have been devised using various other physical platform [60][61][62].
Notably, for both ancilla outcomes the system qubit is subject to a map that is completely-positive (CP), but in general not trace-preserving (TP). This non-unitarity of the individual maps leads to several counter-intuitive effects: For example, in the present case, the evolution of the system qubit differs from the identity map, even in the case where no loss is detected, if loss occurs asymmetrically, i.e. from only one of the computational basis states. More precisely, for loss restricted to occur from |0 the system qubit follows (up to normalization) a non-unitary evolution given by considering the coherent loss operation R loss (φ ). This is a consequence of the information gain in the no-loss case, given by the ancilla measurement [1]. In either case, the reconstruction becomes challenging, since standard reconstruction techniques for quantum process tomography enforce the reconstructed processes to be completely-positive and trace-preserving (CPTP), thereby suppressing the deviations from this condition characteristic for quantum instruments. This becomes evident in Fig. 2, where we compare the accuracy of quantum process reconstructions of the 'no-loss' dynamics obtained via standard maximum likelihood technique (MLE) referred to as traceconstrained approach in contrast to the trace-unconstrained approach of Eq. (4). As a figure of merit we use the total variation distance between the measured frequencies and the measurement outcomes that are predicted from the reconstructed Choi operators. This highlights how the traceconstrained approach can fail to capture the dynamics, an error that might go unnoticed for maps that are close to trace preserving.

IV. RESULTS
We now discuss features associated in experiments with QND measurements that can only be captured using a full description as a quantum instrument. We start by characterizing the instrument acting on a two-level system (qubit), followed by a complete characterization in a higher dimensional Hilbert space that captures the entire dynamics of the QND measurement.
We implement the circuit in Fig. 1b on a two-ion string studying several input states , |1 q } on the system qubit for a range of loss probabilities. We apply quantum state tomography for the runs that signal no-loss events, effectively applying the "no-loss" map E 0 as given by Eq. (5). We focus on the no-loss outcome E 0 given that in a realistic scenario the system qubit would remain intact, as opposed to the loss case. We find that the superposition input states are distorted towards the basis state that is not affected by the loss with increasing loss probability, see Fig. 3a. This is a consequence to the asymmetry of the loss, occurring only from one basis state, as detailed in Eq. (S9) in the Supplementary Material [56]. Importantly, however, the states display no notable reduction in purity, regardless of the loss probability. More details are given in the Supplementary Material [56].
The archetypal description of a qubit loss channel features symmetric loss, often referred to as a quantum erasure-channel [63], where loss occurs with a given probability, irrespective of the qubit state, and the position of the lost qubit is known. Experimentally, we realize this quantum erasure-channel sequentially in two steps, by first inducing partial loss from |0 q followed by its detection, and, conditional on detecting no loss in this first step, inducing the same amount of partial loss, but now from |1 q in this second step. Experiments are conducted on a three ion string using a single system qubit (q) and two ancilla qubits a 1 and a 2 as depicted in Fig. 1c. By observing the evolution of the Bloch vectors in Fig. 3b we find that the initial state is preserved up to experimental noise, as de-rived in Eq. (S12) in the Supplementary Material [56]. The purity is again found independent of the loss, see Supplementary Material [56].
These findings are further corroborated by quantum process tomography characterizing the map describing the system qubit dynamics by using the unconstrained reconstruction approach of Eq. (4). In the case of the asymmetric loss previously discussed, the single qubit Choi operators for the map E 0 are close to the identity only given little loss on the order of a few percent and clearly deviate for higher loss, revealing their non-unitary behavior, see Fig. 4a left for a low loss probability and right for a high loss probability. We note that a standard MLE approach would force unitary maps and thereby prevent the correct reconstruction not displaying this non-unitary behaviour. In contrast, for the quantum erasure-channel, for both 2 % and 61 % loss cases maps are found close to the identity following the theoretical predictions, depicted in Fig. 4b.
For higher loss rates, however, we observe a deviation of the reconstructed from the predicted channel, quantified by the fidelity between the reconstructed and ideal Choi operator shown in Fig. 4c. For high loss rates, only few experimental cycles remain in the no-loss case. As a result, error terms, such as state-preparation-and-measurement (SPAM) errors, as well as errors in the implementation of the loss process contribute with a higher relative weight. We can model these additional error terms as depolarizing noise at the level of the Choi operator as a function of the loss rate p loss : where Λ denotes the ideal Choi operator of the no-loss channel, 1 is the identity matrix, representing a fully depolarizing channel, p e is a generic error rate of the erasurechannel and p spam is the error rate due to SPAM errors. The first term of Eq. (6) describes the ideal channel where no loss happened and the QND detection worked, while the second term is a case where a loss happened, but the QND unit failed to detect it as such. The final term describes the contribution from SPAM errors. From a fit to the data, we find that p e = 0.09 and p spam = 0.03 captures the observed drop in fidelity well. From Fig. 4c we see that these effects become predominant for high loss rates, while for up to ∼ 60% a faithful reconstruction of the experimental Choi matrix is possible. The results presented so far covered a single system qubit and revealed potential obstacles of our quantum instrument tomography, which are generally transferable to other experiments utilizing QND measurements. We now go one step further by analyzing these effects on a multi-qubit entangled state. Experiments are conducted using four system qubits, initialized in the GHZ-state 1/ √ 2(|0000 q + |1111 q ), accompanied by one ancilla.
(iv) (a) loss from -state (asymmetric loss) (b) erasure-channel |0 FIG. 3. Bloch-vectors after undergoing the QND-detection in the no-loss case for different loss channels.(a) State vector evolution for asymmetric loss from |0 q is captured by the color gradient, ranging from 0 % loss (bright points) to 100 % (dark points) for various input states (i) |0 q , (ii) |1 q , (iii) |− X,q and (iv) |− Y,q . Notably, the Bloch-vectors remain close to the surface of the sphere independent of the loss probability, see Supplementary Material [56]. The initial superposition states |− X,q and |− Y,q are found transitioning to the basis state not affected by the loss. (b) The erasure-channel is realized by consecutively inducing the same partial loss from |0 q followed by |1 q and post-selecting to both no-loss cases, i.e. both ancilla's |0 a outcome. Our results support the theory derivation of a map ∝ ρ leaving the initial states up to noise unaltered; see Supplementary Material [56].
After state preparation, partial asymmetric loss from |0 q,1 on system qubit 1 is induced followed by its detection using the QND detection unit. The "no-loss" evolution E 0 is analyzed by four-qubit quantum state tomography. In Fig. 5 the states again show no significant reduction in purity (•) over the range of measured loss probabilities and by that obscuring the non-unitary effect from our instrument. However, an asymmetric effect is displayed by computing the population ratio of the GHZ basis states |0000 q and |1111 q in Fig. 5 referred to as population imbalancing ( ) showing a distortion towards the basis state not affected by loss in analogy to the Bloch-vectors in the single qubit case. The underlying theory curve follows 1 − p loss as can be seen from eqn. (5). The fidelity with the initial GHZstate further remains above 50 % within 1 standard deviation of statistical uncertainty, thus certifying multipartite entanglement independent of the loss probability.
The full dynamics of our coherent loss process can be reconstructed by explicitly taking the loss level |2 q into account. The state of the system ion needs then to be represented by a qutrit with basis states {|0 q , |1 q , |2 q }. We perform quantum process tomography on the combined system of data qutrit and ancilla qubit. This allows us to study both loss cases by distinguishing the maps dependent upon the ancilla state, and provides more fine-grained information on the microscopic error processes. The reconstructed Choi operators for both ancilla outcomes and various loss probabilities are given in Fig. 6a. For the sake of clarity the operators are color coded by peaks occurring in the absence of loss (blue), peaks denoting the partial loss rotation (orange) and erroneous peaks (red). The latter are restricted to the diagonal for simplicity. Note that these experimentally derived maps on the qutrit-level now follow unitary maps, see Eq. (S5) in the Supplementary Material [56].
One key piece of information gained from the full tomography are the dominant failure modes of the experimental realization of the QND detection unit.
In the no-loss case, false-negatives are retrieved from diagonal elements {|02 q , |12 q , |22 q } corresponding to undetected rotations to the level |2 q outside the computational subspace. Likewise falsepositives in the loss case are retrieved from the elements {|00 q , |01 q , |10 q , |11 q , |20 q , |21 q } corresponding to qubit rotations mistakenly assigned as loss. Note that for standard tomography restricted to qubit levels such finegrained analysis would be precluded for two main reasons. First, the true population in the loss state of the system qutrit cannot be estimated independently from the ancilla outcome in the qubit description. Thus, one cannot reliably assign false-positive and false-negative events by post-selecting on the ancilla since all erroneous population adds up to the main peaks {|00 q , |11 q } blurring the information about the error origin. Second, when tracing over the ancilla, the loss state |2 q would be incoherently added to the state |1 q creating an unphysical bias under which tomography is likely to break; see Supplementary Material [56]. For a more quantitative analysis the corresponding false-positive and false-negative rates are depicted in Fig. 6b. To avoid errors from the quantum instrument reconstruction, these rates were extracted from the raw-data for three different loss states: Notably, there is a significantly higher false-positive rate owing to their sensitivity on the entangling operation implementing a correlated two-qubit rotation. This operation shows a higher er- As an input we chose the 4-qubit GHZ-state (|0000 q + |1111 q )/ √ 2. Loss is induced from |0 q,1 on system qubit 1. Results for purity (•) and population imbalancing between the GHZ basis states |0000 and |1111 ( ) in analogy to the Bloch-vector picture (Fig. 3) are shown. The purity is found constant, while the population imbalancing increases towards higher loss probabilities finally causing a distortion to the state |1111 q not affected by the loss. Errors correspond to one standard deviation of statistical uncertainty due to quantum projection noise.
ror rate compared to single-qubit operations [41] and only plays a role in the no-loss case: the reason is that as under loss the entangling operation, when it only acts on the ancilla qubit alone, its action is on purpose trivial and no longer induces a correlated qubit-qutrit flip process. Therefore, the loss map is left with the local bit-flip operations explaining why false-negatives are dominated by singlequbit errors, resulting in smaller rates. For loss detection in a QEC setting, we expect this asymmetry to be quite beneficial, as a false-positive event would merely trigger an unnecessary loss correction, while a false-negative event leads to an undetected loss, which can be catastrophic, i.e. leading directly to uncorrectable logical errors, as will be discussed in the next section.
We now build noise models to characterize the QNDdetection unit, which can then be used to study implications on QEC. From the above phenomenological discussion, we assume that the dominant contributions will come from false-positive and false-negative events, where the latter in particular can have a severe impact. However, extracting the respective rates from tomography data as in Fig 6b in the presence of SPAM errors can be unreliable if these contributions are of the same magnitude. A rough estimate of the SPAM errors from tomography of the identity yields a fidelity of 0.96 (2), which indicates that this is indeed the parameter regime we are dealing with here.
Hence, to describe imperfections in the QND loss detection unit we instead focus on a microscopic noise model E noise defined as [56] ρ → E noise (ρ) = U noise ρU † noise (7) where the unitary U noise = MS(α)R X (β ) describes the dominating error source as correlated bit flips with a rate of p corr = sin 2 (α/2) resulting from systematic miscalibrations in the two-ion MS-gate, and single qubit flips with a rate of p single = sin 2 (β /2) from errors in the collective local rotations. Fitting the channel E noise to the experimental data returns values of p corr. = 0.045 and p single = 2.47 · 10 −4 , respectively, see Supplementary Material [56]. The fidelity of the experimental data with respect to this model in the no-loss case is 0.94, compared to 0.91 for the noiseless theory prediction.
In order to validate this model against generic hardwareagnostic noise models typically considered in the quantum information literature, we further add depolarizing and dephasing noise channels [64]. As discussed in detail in the Supplementary Material [56], by fitting a model that includes all 4 error channels to the experimental data, we again find the correlated bit-flip error to be dominant. The contributions from depolarizing and dephasing noise are consistently on the order of 0.01 and adding these terms does not significantly improve the fit to the data. From this analysis we conclude that the microscopic model is the most suitable description of our experimental noise and the resulting imperfections in the QND loss detection, and we will thus use this model in the following analysis of the impact of a faulty QND loss detection unit on QEC.

V. IMPLICATION ON QUANTUM ERROR CORRECTION
In the context of QEC and the pursuit for robust and eventually fault-tolerant quantum computers, qubit leakage and loss errors are known to be particularly harmful to the performance of QEC codes, if they go unnoticed [44][45][46]. Dedicated protocols to fight qubit loss have been devised, including the 4-qubit quantum erasure code [63], which has been implemented in the form of post-selective state analysis protocols using photons [65,66]. Moreover, protocols to cope with qubit loss in elementary quantum codes such as the 5-qubit code [67] as well as topological QEC codes including the surface code [68] and color codes [59,69,70] have been developed.
Here, our aims are to (i) estimate the parameter regimes in which active qubit loss error correction and detection is expected to reach break-even, i.e. to become beneficial for low-distance QEC codes as currently pursued in various efforts [1,13,59,61,[71][72][73][74]. (ii) Whereas most theory studies exclusively focus on the simple (and ideal) quantum erasure-channel to describe loss, we are interested in illustrating the effect of various qualitatively different imperfections in the loss detection process on QEC performance, highlighting the importance of microscopically informed noise models of the components used in QEC of qubit loss. (iii) Finally, to predict the performance of QEC protocols by numerical simulations, it is desirable to develop effective few-parameter noise models, informed by experi-mental data, which can be simulated efficiently, e.g. using stabilizer simulations, to predict the performance of largescale QEC codes built from noisy components. Here, we are therefore interested in understanding to which extent the microscopic noise model of the QND loss detection can be reliably substituted by such efficiently simulatable noise models.
To be concrete, we will focus on the smallest 2D color code [69], a 7-qubit stabilizer code equivalent to the Steane code [69,75], which is at the focus of current experimental efforts to achieve the break-even point of beneficial and fault-tolerant QEC with low-distance QEC codes [76][77][78][79]. The code is obtained by projecting the Hilbert space of seven qubits (Fig. 7) into the +1 eigenspace of six commuting stabilizer generators S x i and S z i (i = 1, 2, 3), see Fig. 7a, that define a two-dimensional code space hosting one logical qubit. Logical X and Z operators are defined as . The code is a distance d = 3 QEC code (d = 2n + 1, n being the number of correctable computational errors), so that one arbitrary computational error (bit and/or phase flip error) on any of the physical qubits is correctable. Note that besides computational errors, this code also allows one to correct the loss of any two of the seven physical qubits, or even the loss of some, though not all subsets of three or even four qubits (see Supplementary Material for more details [56]). We note for each of the seven qubits forming the code, we incorporate the state |2 q , i.e. adopt a qutritdescription, and use this additional level to induce loss of a controllable amount via the coherent rotation in the subspace {|0 q , |2 q } of the quantum instrument depicted in Fig. 1b.
We then model one round of qubit loss error detection and correction, depicted in Fig. 7, as follows: starting from an ideal (noise free) logical state ρ L of the 7-qubit code, qubit loss is induced with an independent and equal probability p loss on each of the physical qubits of the register. Subsequently, a noisy QND loss detection unit is sequentially applied to each of the 7 qubits, in order to detect the possible occurrence of loss. Each data qubit, for which the QND measurement indicates the occurrence of a loss, is replaced by a fresh qubit in the computational basis state |0 q . This is followed by one round of possibly faulty measurements of all six stabilizers of the code. For simplicity, since our focus lies on the QND loss detection, here we model imperfections in each stabilizer measurement by a phenomenological noise model, in which the stabilizer measurement outcome is assumed to be faulty with a probability q operators are typically measured with a circuit involving (at least) four two-qubit gates, we work with four times the two-qubit error rate as the error rate of the stabilizer measurement, which results in q = p corr , in what follows. Based on the obtained syndrome (±1 stabilizer eigenvalues) from the measurement of the stabilizers, Pauli corrections are applied if needed (such a Pauli frame update can be done on the software level and are thus modelled as error-free). Finally, to determine the logical error rate, it is checked whether the original logical state ρ L has been recovered or not, by evaluating the expectation value of the logical operator corresponding to the initially prepared encoded state. Figure 8 shows the predicted logical error rate of the loss QEC cycle applied to all physical qubits as a function of the physical qubit loss rate p loss , for various error rates of faulty stabilizer measurements. At the current two-qubit gate infidelities and associated error rates,  z each acting on a plaquette of four physical qubits [59]. Loss is subsequently detected on all code qubits using a faulty QND circuit (top part). We model this taking into account both correlated and single qubit overrotations representing our leading error mechanisms by treating every qubit as a qutrit. (b) Single QEC cycle of qubit loss detection and correction including initial controlled induction of loss, followed by faulty QND loss detection operations on the qubit subspace of all physical qutrits and stabilizer measurements triggering respective conditional Pauli corrections. the regime of beneficial loss correction, when the logical error rate falls below the physical loss rate p loss , is not reachable. However, a moderate reduction of the two-qubit gate error rate by about 50%, from p corr = 0.045 to about p corr = 0.023 suffices to enter the regime where applying a cycle of faulty loss QEC outperforms storing information in a single physical qubit that can suffer loss.
Furthermore, Fig. 9a-b shows the calculations of the logical error rate for the no-loss case p loss = 0, which highlights the effects resulting from imperfections in the QND loss detection unit itself in a full QEC cycle. Here, the imperfections in the QND unit are implemented either with the coherent noise channel or an effective incoherent few-parameter Clifford noise model (details on the error models are given in the Supplementary Material [56]).  Fig. 7 for different error rates q in the stabilizer readout. The black line (with equation 1 − p loss ) represents the error rate when no encoding is performed. The logical error rates for the ideal case with no overrotation errors in the QND loss detection unit are shown in green . Blue • show the logical error rates when the QND detection unit is simulated with overrotation parameters (p corr = 0.045 resulting in a stabilizer measurement error rate q = 0.045 and p single = 2.47 · 10 −4 ) coming from the experimental data. Data simulated with q = p corr = 0.023 corresponding to an improvement in the MS-gate fidelity is shown with orange . In the region with 0.03 p loss 0.33, error correction is beneficial in protecting the logical states with respect to storing information in an unencoded single physical qubit.
In Fig. 9a the logical error rate is shown as a function of the single qubit overrotation rate p single for p corr = 0 and it goes to zero as p 2 single (black lines) as expected, representing the rate of weight-two bit flip errors, which are uncorrectable by the distance-3 color code. In Fig. 9b instead the logical error rate is shown as a function of the correlated overrotation rate p corr for p single = 0. In this case the error rate goes to zero as p 3 corr (black line) representing the rate of three-bit flip errors. The bit-flip errors from the correlated overrotations result in false-positive events, where a non-lost qubit is substituted by a fresh qubit before the stabilizer measurement. Since two (detected) losses on any two qubits are correctable, some (detected) three-loss events are not, this results in the observed p 3 corr scaling of the logical error rate. This highlights and explains the different sensitivity of the logical error rate to false positive and false negative events where the presence of false negative events, i.e. overlooked losses, occurs for p single = 0 and constitutes the more severe source of errors.
Finally, Figures 9c-d show a comparison of the logical error rate for the two scenarios, where faults in the QND loss detection unit are modelled as coherent vs incoherent errors, respectively. When p corr = 0 or p single = 0, the logical error rate goes to a finite value when the loss probability p loss → 0 as error processes involving data qubit bit-flips arise and lead to a finite failure rate of the error correction cycle. Moreover, we observe that the incoher- Logical error rates for p loss = 0 as a function of (a) the single qubit overrotation rate p single for p corr = 0 and (b) the correlated overrotation rate p corr for p single = 0 after a round of error correction of the 7 qubit color code following the scheme in Fig. 7 where the imperfections in the QND loss-detection unit are implemented either with a coherent or an incoherent noise channel. (c) Logical error rate as a function of the loss probability when the faulty QND loss-detection unit is modeled as a coherent channel. (d) same as (c), but when errors in the QND loss-detection are modeleded as an incoherent Clifford channel. ent approximation of the coherent error channel slightly underestimates the logical error rate, by a maximum relative factor of 0.51. This behavior is not unexpected, and has been observed also in other contexts, e.g. for an incoherent approximation of coherent crosstalk errors [82]. Overall, the results therefore indicate the reliability of the incoherent approximation of the faulty QND loss detection unit in the QEC cycle. This is important as the latter incoherent model is efficiently simulatable and allows the study of faulty loss correction using stabilizer simulations of larger QEC codes.

VI. DISCUSSION & OUTLOOK
The techniques for characterizing quantum instruments that we introduced here can be applied to a wide range of scenarios beyond our example problem of qubit loss detection in QEC. Within QEC, other key operations, such as multi-qubit stabilizer measurements take a similar form where a classical outcome is used to feed-forward onto the post-measurement state, and are thus best described as quantum instruments. Characterizing such operations and producing reliable effective models will be crucial for understanding their effect onto QEC protocols. Beyond QEC, the same pattern is found in weak measurements, where a quantum system is measured in a way that minimizes the disturbance of the post-measurement state, while still extracting useful information on average. Furthermore quantum instruments are already used in quantum communication as the appropriate tool to describe the involved operations.
The presented techniques rely on tomographic reconstruction to guide the development of effective models for the studied quantum instruments. However, like any tomographic approach, such reconstructions are sensitive to SPAM errors, which can dominate in the low-error regime that is approached by state-of-the-art quantum devices. An interesting question for future research would thus be to generalize and validate SPAM-free characterization techniques such as randomized benchmarking and gate set tomography [24] with respect to quantum instruments with low error rates. Acknowledgements

Supplementary Material: Characterizing quantum instruments: from non-demolition measurements to quantum error correction
The additional information presented here aims at providing further experimental and theoretical results supporting our findings into more detail. We start by giving a broader insight on the experimental setup in Sec. I. Upon those building blocks we will be able to derive the maps underlying our quantum non-demolition (QND) loss detection unit for both asymmetric loss and the quantum erasure-channel. This will be complemented by further experimental data, both presented in section Sec. II. We continue in Sec. III by developing a noise model giving a well-founded description to our experimental limitations. Thereafter, those noise models form the basic building blocks to numerical simulations studying the implications of the loss detection in respect of quantum error correcting (QEC) codes. We conclude with Sec. IV by giving more detailed derivations covering the loss treatment in the 7-qubit color code.

I. EXPERIMENTAL DETAILS AND TOOLBOX
Our ion-trap based quantum computer works on a chain of 40 Ca + ions stably confined within ultra high vacuum using a linear Paul trap [54]. Each ion represents a physical qubit encoded in the electronic levels S 1/2 (m = −1/2) = |0 and D 5/2 (m = −1/2) = |1 denoting the computational subspace. Qubit manipulation is realized by coherent laser-ion interaction. Thereby the setup is capable of implementing a universal set of quantum gate operations consisting of addressed single-qubit rotations with an angle θ around the x-and the y-axis of the form R σ (θ ) = exp(−iθ ∑ j σ j /2) with σ = X or Y together with two-qubit Mølmer-Sørenson entangling gate operations MS i, j (θ ) = exp(−iθ ∑ i, j X i X j /2) [55]. Multiple addressed laser beams, coherent among themselves, allow for arbitrary two-qubit connectivity across the entire ion string. Read-out is performed by driving a dipole transition only resonant to the lower qubit level |0 and simultaneously collecting its scattered photons revealing the qubit's state after multiple shots. This dipole laser collectively covers the entire ion string. However, we are able to read out only a subset of the qubits within the register, by shelving electronic populations of specific qubits in the upper D-state manifold, referred to as addressed read out. Apart from quantum non-demolition measurements this becomes essential for reading out quantum trits (qutrits) demanding for two subsequent detections separating both levels D 5/2 (m = −1/2) = |1 and D 5/2 (m = +1/2) = |2 , see [83].

II. QUANTUM INSTRUMENT: QND LOSS DETECTION
This section gives a more thorough introduction to the QND-detection, serving as our quantum instrument working example, by deriving all maps relevant to our studies. Then, additional experiments are presented addressing the demonstration of the QND-detection's principal working ability complemented by results on the higher dimensional process tomography fully characterizing its underlying maps.
As loss on our setup naturally occurs on rates similar to those of single-qubit errors we introduce it in controlled fashion. For instance from the system qutrit's (q) state |0 q loss can be induced by coherently transferring part of the population outside the computational subspace into D 5/2 (m = +1/2) = |2 q via the rotation (S1) The loss rate φ relates to the loss probability via p loss = sin 2 (φ /2). Note that loss in general can be induced through an arbitrary state α |0 q + β |1 q with |α| 2 + |β | 2 = 1 using a single coherent rotation on the system qutrit before and its inverse after the loss rotation R loss (φ ). To detect loss two full entangling MS X (φ /2) · MS X (φ /2) = MS X (φ ) couple to ancilla and system qutrit and realize a collective bit-flip only if both qubits are present to their computational subspace: On the other hand if the system qutrit occupies a state outside the computational subspace, for instance in |2 q , the MSgate is subject to an identity operation, which can be seen from the argument of its exponential X i X i = I acting merely on the ancilla qubit. This follows a collective bit-flip Consequently, in the absence of loss the effect of the MS-gate is undone whereas under loss the ancilla qubit gets excited by the final bit-flip signaling the event of loss. The overall unitary combining loss operation and QND detection is given by Taking the additional loss state |2 q on the system qubit into account and by that extending the view from qubit to qutrit one ends up with two unitary processes fully describing this quantum instrument. We emphasize that on the qutrit level the entire dynamics of our detection unit can be captured, which is well exploited by the experiments from Fig. 6 in the main text of the paper.
However, to pick up the discussion on the non-unitary effects potentially leading to unwanted and erroneous mechanisms, we restrict our view again to the qubit level and further assume that no population was initially present in |2 q .
Hence, the unitary operators U leading to single qubit processes describing the QND detection restricted to the system qubit. We can describe both maps {A q } by two trace non-increasing completely-positive (CP) maps E 0 and E 1 .
acting on the system qubits as where the two maps are together unitary again. It is noteworthy that the no-loss map E 0 initially starting from the superposition state 1/ √ 2(|0 q + |1 q ) would be transitioning to |1 q as the loss probability from |0 q increases, which is subject to Fig. 3a in the main text. Only for very little loss φ ∼ 0 the no-loss map converges to an identity operation.
Next to having loss asymmetrically with respect to either computational basis state {|0 q , |1 q }, we follow a different, often utilized, scenario called the quantum erasure-channel [63]. Its circuit is depicted in Fig. 1c from the main text. First, partial loss is induced from |0 q followed by its detection. The protocol only continues in the absence of loss by inducing the same partial loss from the other qubit state |1 q together with its detection. The second part of the map can be q } where we swap the role of |0 q and |1 q . Thus, the quantum erasure-channel can be described using the following map with probabilities p L and p L for any arbitrary input state α |0 q + β |1 q p L = |α| 2 sin 2 (φ /2) p L = |β | 2 sin 2 (φ /2) (|α| 2 cos 2 (φ /2) + |β | 2 ) . (S11) In this case the process reduces to where the effect of the loss is proportional to the arbitrary input state ρ indicating that after normalization the initial state can be retrieved independent of the loss probability. The basic idea of this quantum instrument is the detection of qubit loss, i.e unwanted leakage to levels outside the computational subspace, that in a realistic scenario would be followed by its correction representing the scope of our foregoing work [1]. To give the rather formal discussion a physical meaning, we demonstrate the unit's working principle. Partial loss induced from |0 q via the loss transition R loss (φ ) is continuously increased and subsequently detected. Note that both qubits are read out denoting their population in the upper |D -state manifold referring to directly measured loss in case of the system qubit and detected loss for the ancilla qubit. In Fig. S1 results are presented for individual and repeated loss detection employing up to two ancilla qubits. Slopes extracted from the linear-fit in the repeated detection read 0.938(9) and 0.944(12) for ancilla a 1 and a 2 respectively. On the individual read-outs we get 0.977(2) and 0.995(2) with a resonant cross-talk to the ancilla not participating of 0.005(1) and 0.003(1) respectively. When utilizing a 2 we end up with a higher detection efficiency because of a better performing MS-gate on the particular ion-pair. 200 cycles were taken on this measurement. Errors correspond to one standard deviation of statistical uncertainty due to quantum projection noise. FIG. S1. Investigating the performance of the QND-detection unit according to Fig. 1b in the main text. Population in the D 5/2 state for the system qubit (directly measured loss) vs. transferred excitation on the ancilla qubit (detected loss) in case of detecting loss repeatedly using both ancilla qubits a 1 and a 2 (left), solely with ancilla a 1 (middle) and ancilla a 2 (right). The imprinted detection efficiencies demonstrate reliable loss mapping onto the ancilla qubit and its read out by means of QND. Errors correspond to one standard deviation of statistical uncertainty due to quantum projection noise.
Next, we complement the results from Fig. 3a in the main part revealing a pull towards the state not affected from asymmetric loss by further demonstrating that the purity Tr(ρ 2 ) of the associated reconstructed states remains constant across the entire loss probability range; see Fig. S2a. The purity value is found independent of the loss and therefore underlining at first glance a correct experimental outcome whereas only in the Bloch sphere picture (Fig. 3a) deviations due to the non-unitary map become visible. Likewise considerations have been done on the erasure-channel, previously discussed in Fig. 3b and similarly producing purity values independent of loss, as can be seen in Fig S2b. Next, we estimate the detection correlation of a single loss event by two repeated detections. Such system capabilities emphasize the work on the erasure-channel and more generally become relevant in a realistic scenario demanding several consecutive read-outs especially when embedded in QEC codes. In Fig. S3 positive correlation occurs for a certain shot when both ancilla qubits agree upon a certain loss event. Further, the data on the repeated read-out allows us to quantify false-positive and false-negative rates manifesting important failure modes of our detection unit. Again, false-positive rates dominate owing to their strong sensitivity on the entangling MS-gate as was the case in Fig. 6b in the main text. 100 cycles for |0 q -loss and 200 cycles for 1/ √ 2(|0 q + |1 q )-loss were taken on this measurement. Errors correspond to one standard deviation of statistical uncertainty due to quantum projection noise. After a single QND-detection with loss from |0 q we find purity values unaffected by the amount of loss for all of the given input states. At high loss probabilities, tomography becomes unreliable due to the low count rates. (b) The erasure-channel is realized by consecutively inducing the same partial from |0 q followed by |1 q and post-selecting to both ancilla |0 a outcomes. The purity of the output state is again unaffected by loss for any of the probed input states. Errors correspond to one standard deviation of statistical uncertainty due to quantum projection noise.  Fig. 1b in the main text. Loss on the system qubit was induced from the imprinted states followed by two repeated detections using ancilla a 1 and a 2 . A Positive correlation refers to successfully detecting the same loss event twice, whereas faulty assignments can be separated in false-positive and false-negative events; shown in the lower figure part. Errors correspond to one standard deviation of statistical uncertainty due to quantum projection noise.
We switch our consideration from qubit to qutrit level and resume the discussion on the process tomography covering both ancilla qubit and system qurtrit from Fig. 6a in the main text. Thereby, all presented Choi-operators were postselected upon the ancilla outcome denoting the qutrit maps separated by both loss-cases. This has the advantage of unitary operators describing the full dynamics of the system qutrit in either loss case that moreover gave an estimation on the QND detection's dominant failure mode, namely false-positive and false-negative rates. As discussed in detail in the main part of the paper standard tomography restricted to qubit level prevents us from getting such fine-grained analysis for mainly two reasons: First, reliably assigning false-positive and false-negative events is not possible when post-selecting by the ancilla qubit's measurement outcome. Second, when tracing over the ancilla the loss state |2 q is incoherently added to the qubit state |1 q creating an unphysical bias under which tomography is likely to break as demonstrated in Fig. S5. Here, we distinguish between tracing before and after tomography reconstruction. On the one hand, when directly tracing on the raw data and subsequently reconstructing the map it includes coherences owing to the reconstruction technique forcing physical properties. On the other hand, when tracing after process reconstruction coherences on |01 q vanish. Both cases draw attention to potential risks on how commonly known process tomography fails to describe quantum instruments.
In the context of the numerical simulations covering implications on QEC however, we made use of the full map capturing the combined ancilla-qutrit dynamics together with the noise-models; further discussed below. We present experimentally estimated ancilla-qutrit Choi-operators for various loss probabilities in Fig. S6 using the elementary basis according to {|0000 a,q , ..., |1212 a,q }. The process tomography of every loss probability required 54 × 12 = 648 experimental settings. For the sake of clarity we plot ideal Choi-operators (left column) and the experimental ones (right column) for various loss probabilities separated by rows side by side. Color and saturation refer to argument and absolute value of the complex matrix entries. Process fidelities with the ideal Choi-operator from top to bottom read {0.91(1), 0.89(1), 0.85(1)} referring to the loss probabilities {0 %, 50 %, 85 %}. 100 cycles were taken for each experiment. In the no-loss case the expected controlledX a operation signaling a loss event whenever the system qubit occupies level |2 q is clearly reproduced as expressed by Eq. (S5) derived in the beginning of this section.
Finally, we present additional data on the system qutrit process tomography according to Fig. S4a and loss induced from |0 q and |1 q presented in Fig. S7 and Fig. S8 respectively. We emphasize that here similar to the qubit level certain coherences vanish when tracing over the ancilla, which is no longer covered by the process tomography. Still, the dynamics on the system qutrit clearly captures the population transfer from either basis state {|0 q , |1 q } to the loss level |2 q . Further, a change in the asymmetric behaviour between loss from |0 q and |1 q becomes distinctly visible in the qubit subspace.
For the sake of completeness we present similar Choi-operators on the repeated loss detection in Fig. S9 consecutively . Potential risks on system qubit process reconstruction when partial tracing the ancilla qubit. (left column) Partial tracing before reconstructing the map directly on the raw data, previously used in Fig. 6 of the main part. In this case, the loss level |2 q is incoherently added onto state |1 q . Coherences present in |01 q originate from the reconstruction technique forcing physical properties. (right column) Post-selecting from the already reconstructed qubit-qutrit maps presented in Fig. S6. In contrast to before coherences on |01 q vanish, whereas the unphysical bias remains.
mapping the same loss event to two different ancilla qubits; shown for loss from |0 q . As the reconstructed Choi-operators follow the expected behaviour previously observed, their fidelities turn out slightly lower compared to Fig. S7 as expected due to the more complex experiment.

III. NOISE MODEL ON QND LOSS DETECTION
Here, we study various noise models in order to find the best suitable description of the experimental limitations underlying our QND-detection. Although very small contributions will be precluded by state preparation and measurement errors (SPAM-errors) the resulting models give us a rough estimate as a guide for where to look at upon which a microscopic noise model for the numerical simulations can be developed. Getting more insights on these error mechanisms is essential when observing implications of the quantum instrument in context of QEC protocols and is further an essential building block towards fault-tolerant quantum computation; see implication on QEC section in the main text.
We refer to Eq. (S5) from above and express the action of the ideal QND map U under a given loss rate φ acting on the combined ancilla-qutrit system in terms of the Choi operator ρ CJ = 1 ⊗ U · |Φ + Φ + | · 1 ⊗ U † where |Φ + Φ + | is the maximally entangled state of two copies of the ancilla-qutrit system. An erroneous channel E noise transforms the Choi operator ρ CJ to ρ CJ noise = (1 ⊗ E noise )(ρ CJ ). Noise rates entering E noise for given model parameters are then extracted by minimizing the distance between modelled noisy Choi- Fig. S10: depolarizing error p depol. , dephasing error p deph. and correlated error p corr. according to Eq. (S15). Fig. S6. As a measure for the distance in the cost-function we minimize the infidelity: Our initial considerations covered the study of the QND detection's failure modes, i.e. false-positive and false-negative rates both quantified in the main part of the paper. Measuring process tomography however comes along with overhead in the form of preparation and measurement gates followed by two consecutive detections at the end of each experiment required for reading out the qutrit's state. Therefore SPAM errors are not to be neglected and lead to a significant bias on false-positive and false-negative rates. With this in mind we put the failure modes aside and focus on experimental limitations instead. In the following, we consider as model for E noise a depolarizing, a dephasing channel, and coherent two-and single-qubit overrotations.
Depolarizing and dephasing channels.-We start off by testing the agnostic models, namely depolarizing and dephasing channels as those represent error mechanisms typically considered in the field of quantum computation [64]. The effect of the latter can be understood by losing phase information between the quantum states involved. Coherences get lost and an arbitrary single qubit state in the Bloch sphere picture would finally shrink onto the Z-axis as no phase information is left. Depolarizing noise can be considered as simultaneous dephasing in X, Y and Z basis eventually leading to a complete mixed state which for a single qubit can be illustrated by shrinking the Bloch sphere towards its center. Note that, we implement those models such that they act both on the ancilla and the qutrit using only a single noise parameter [84]. The upper row of Fig. S10 depicts the fidelities (top part) for the individual models at the optimized parameters (bottom part). Both results indicate similar improvements compared to the fidelity with the ideal QND map from Eq. (S5). Numbers on fidelities and optimized parameters for depolarizing noise p depol. and dephasing noise p deph. are further summarized in Tab. S1. The parameters typically lie around 1% or below, yet the small increase in fidelity indicates other error mechanisms to be more dominant.
Correlated two-qubit overrotations.-The erroneous peaks in the experimentally estimated Choi-operators from Fig. S6 imply that additional rotations should be taken into account by the agnostic models. Those dominant error peaks are found originating from correlated rotations between ancilla and system qubit as illustratively labeled in Fig. S11a. Note that the error terms are restricted to qubit level and partial coherences are still present. Hence, if the system qutrit's state is |2 q no correlated error is induced on the ancilla qubit. Therefore, correlated errors are due to faulty entangling MS-gates. A potential noise model covering correlated rotations in such a way reads: where α describes the correlated under-/ overrotations and relates to the corresponding error probability via p corr. = sin(α/2) 2 . For comparison a value p corr. of 0.5 would induce a maximally entangling two-qubit operation on ancilla and system qubit. We first test the model alone followed by combining it with depolarizing and dephasing noise. The resulting fidelities (top part) at the optimized model parameters (bottom part) are shown in the second row of Fig. S10 and clearly overcome the ones on the agnostic models denoting correlated rotations to be our leading noise mechanism. The effect of the additional depolarizing and dephasing noise (bottom right) leads to slight improvements. The modeled Choi-operator on this combined noise model is plotted for the no-loss case in Fig. S11b showing strong similarities to the experimental one from part a underlining a good agreement between model and experiment. Numbers on fidelities and optimized parameters for all models are summarized in Tab. S1.  Correlated and single overrotations.-Finally, we combine the action of correlated rotations with single-qubit rotations on the ancilla and the qutrit and we consider the coherent error model given by where ρ is the state obtained after the application of the loss operation U of Eq. (S5) (see also Fig. 7a of the main text), U corr is a correlated two-qubit overrotation defined in Eq. (S15) and R = R X a (β )R X q (β ) with R X a (β ) = cos(β /2) − i sin(β /2)X a (S17) are overrotations with angle β of the ancilla and the qutrit system which corresponds to the single qubit flip error rate p single = sin(β /2) 2 . After the measurement of the ancilla, the quantum process arising from the erroneous channel in Eq. (S16) can be written as where ρ q is the state related to the qutrit only and the processes R 0 and R 1 describe the maps that transform the qutrit state in the case of no-loss detected (ancilla qubit in |0 a ) and of loss detected (ancilla qubit in |1 a ). The Choi operators Λ 0 and Λ 1 of the maps R 0 and R 1 can be computed for all values of the over-rotated angles α and β . In particular, if we consider small deviations for α and β , Λ 0 and Λ 1 read at second order FIG. S10. Noise-models QND-detection. Various noise-models describing the experimental limitations on the ancilla-qutrit Choioperator depicted in Fig. S6. The limitations are best described when combining correlated coherent rotations together with depolarizing and dephasing noise. Correlated errors clearly dominate as depolarizing and dephasing errors only lead to minor improvements. The error parameters on the bottom of each plot refer to depolarizing error p depol. , dephasing error p deph. and correlated error p corr. , the latter according to Eq. (S15). Lines are connecting the points for clarity. The comparison between the coherent channel in Eq. (S16) and the effective Clifford channel previously described is shown in Fig. S12 and in Fig. 9 of the main text.

IV. LOSSES IN THE 7-QUBIT CODE
In this section, we discuss the correction from losses for the 7-qubit color code, in the ideal scenario of perfect QND loss detection and stabilizer measurements. We also assume that losses occur on each qubit independently with loss probability p.
A loss event is correctable if the density matrix of the losses is fully mixed or, more generally, it does not contain any information on the encoded logical state. With this criterion, we can then check the loss events that can be corrected. Obviously, the event (happening with probability P 0 = (1 − p) 7 ) where no loss occurs is correctable. The events where one loss occurs are also correctable. For showing this, let us consider for instance the encoded |0 L state where S ( j) x are the stabilizer generators and let us suppose that the loss affects the qubit q 1 (see Fig. 7a of the main text). By introducing the two orthogonal states |χ 0 = P (2) x P (3) x |0 ⊗6 and |χ 1 = X 2 X 3 X 4 P (2) x P (3) x |0 ⊗6 (where P x ), the state |0 L can be written explicitly as |0 L ∼ |0 1 |χ 0 + |1 1 |χ 1 .
This can be shown by considering for instance four losses happening on the stabilizer [1,2,3,4]. A bit of algebra shows that the logical states |0 L and |1 L can be written as |0 L = |G |000 + X 2 X 3 |G |110 + X 3 X 4 |G |011 + X 2 X 4 |G |101 (S32) |1 L = |G |111 + X 2 X 3 |G |001 + X 3 X 4 |G |100 + X 2 X 4 |G |010 . (S33) where |G = |0000 + |1111 is a GHZ state of the qubits 1, 2, 3, 4 where the losses happen. Tracing on the qubits 5, 6, 7 transforms any logical state |ψ L = c 0 |0 L + c 1 |1 L into a mixture with equal probabilities of the four states {|G , X 2 X 3 |G , X 3 X 4 |G , X 2 X 4 |G } that is independent on the coefficients c 0 and c 1 . Finally, no event with five, six or seven losses can be corrected. The total probability of a successful correction is given by the sum of all the probabilities P j and reads