Abstract
Solidstate spin qubits is a promising platform for quantum computation and quantum networks^{1,2}. Recent experiments have demonstrated highquality control over multiqubit systems^{3,4,5,6,7,8}, elementary quantum algorithms^{8,9,10,11} and nonfaulttolerant error correction^{12,13,14}. Largescale systems will require using errorcorrected logical qubits that are operated fault tolerantly, so that reliable computation becomes possible despite noisy operations^{15,16,17,18}. Overcoming imperfections in this way remains an important outstanding challenge for quantum science^{15,19,20,21,22,23,24,25,26,27}. Here, we demonstrate faulttolerant operations on a logical qubit using spin qubits in diamond. Our approach is based on the fivequbit code with a recently discovered flag protocol that enables fault tolerance using a total of seven qubits^{28,29,30}. We encode the logical qubit using a new protocol based on repeated multiqubit measurements and show that it outperforms nonfaulttolerant encoding schemes. We then faulttolerantly manipulate the logical qubit through a complete set of singlequbit Clifford gates. Finally, we demonstrate flagged stabilizer measurements with realtime processing of the outcomes. Such measurements are a primitive for faulttolerant quantum error correction. Although future improvements in fidelity and the number of qubits will be required to suppress logical error rates below the physical error rates, our realization of faulttolerant protocols on the logicalqubit level is a key step towards quantum information processing based on solidstate spins.
Main
Largescale quantum computers and quantum networks will require quantum error correction to overcome inevitable imperfections^{15,16,17,18,19}. The central idea is to encode each logical qubit of information into several physical data qubits. Nondestructive multiqubit measurements, called stabilizer measurements, can then be used to identify and correct errors^{15,16,17,18}. If the error rates of all the components are below a certain threshold, it becomes possible to perform arbitrarily large quantum computations by encoding into increasingly more physical qubits^{15,17,18}. A crucial requirement is that all logical building blocks, including the errorsyndrome measurement, must be implemented fault tolerantly. At the lowest level, this implies that any single physical error should not cause a logical error.
Over the past several years, steps towards faulttolerant quantum error correction have been made using spin qubits in silicon^{6,7,8} and in diamond^{13,14}, as well as in various other hardware platforms, such as superconducting qubits^{23,24,25,26,27} and trappedion qubits^{20,21,31,32}. Pioneering experiments have demonstrated codes that can detect but not correct errors^{22,25,26,33}, quantum errorcorrection protocols that can correct only one type of error^{13,14,34}, as well as nonfaulttolerant quantum errorcorrection protocols^{20,24,34,35}. A recent experiment with trappedion qubits has demonstrated the faulttolerant operation of an errorcorrection code, albeit through destructive stabilizer measurements and postprocessing^{21}.
In this work, we realize faulttolerant encoding, gate operations and nondestructive stabilizer measurements for a logical qubit of a quantum errorcorrection code. Our logical qubit is based on the fivequbit code and we use a total of seven spin qubits in a diamond quantum processor (Fig. 1). Fault tolerance is made possible through the recently discovered paradigm of flag qubits^{28,29,30}. First, we demonstrate a new faulttolerant encoding protocol based on repeated multiqubit measurements, which herald the successful preparation of the logical state. Then, we realize the (nonuniversal) set of transversal singlequbit Clifford gates. Finally, we demonstrate stabilizer measurements on the logical qubit and include a flag qubit to ensure compatibility with fault tolerance. Our stabilizer measurements are nondestructive, the postmeasurement state is available in real time and we use feedforward based on the measurement outcomes. Although the logical qubit fidelities do not yet outperform the constituent physical qubits, these results demonstrate the key components of faulttolerant quantum error correction in a solidstate spinqubit processor.
The logical qubit
Stabilizer errorcorrection codes use auxiliary qubits to perform repeated stabilizer measurements that identify errors. A key requirement for fault tolerance is to prevent errors on the auxiliary qubits from spreading to the data qubits and causing logical errors^{18,28} (Fig. 1b). The paradigm of flag fault tolerance provides a solution with minimal qubit overhead^{28,29,30}. Auxiliary qubit errors that would cause logical errors are detected using extra flag qubits, so that they can be subsequently corrected (Fig. 1b).
Our logical qubit is based on the fivequbit code, the smallest distance3 code which can correct any singlequbit error^{35,36}. Any logical state is a simultaneous +1 eigenstate of the four stabilizers s_{1} = XXYIY, s_{2} = YXXYI, s_{3} = IYXXY and s_{4} = YIYXX, and the logical operators are X_{L} = XXXXX and Z_{L} = ZZZZZ. Because any error on a single data qubit corresponds to a unique 4bit syndrome, given as the eigenvalues of the stabilizers, arbitrary singlequbit errors can be identified and corrected. Combined with an auxiliary qubit for stabilizer measurements and a flag qubit to capture harmful auxiliary qubit errors, this makes faulttolerant error correction possible using seven qubits in total^{28}.
System: spin qubits in diamond
Our processor consists of a single nitrogenvacancy (NV) centre and its surrounding nuclearspin environment at 4 K (Fig. 1a). These spins are highquality qubits with coherence times up to seconds for the NV electron spin^{37} and minutes for the nuclear spins^{3}. The NV electron spin can be read out optically, couples strongly to all other spins and is used as an auxiliary qubit for stabilizer measurements^{3,14} (Methods). We use the intrinsic ^{14}N nuclear spin as the flag qubit. Unlike the other qubits, the flag qubit does not need to maintain coherence during the optical readout. In this device, 27 ^{13}C nuclearspin qubits and their lattice positions have been characterized, so that the 406 qubit–qubit interactions are known^{38}. Each ^{13}C qubit can be controlled individually owing to their distinct couplings to the NV electron spin (Methods). Here we use five of the ^{13}C spin qubits as the data qubits to encode the logical qubit.
A challenge for controlling such a quantum processor is that the spins continuously couple to each other. We realize selective control gates through various echo sequences that isolate interactions between the targeted spins, while also protecting them from environmental decoherence. For all twoqubit gates, we use previously developed electron–nuclear gates, which are based on decoupling sequences on the electron spin^{3} (Methods). Furthermore, we introduce interleaved and asynchronous echo stages that cancel unwanted couplings between the data qubits (Methods). These extra echo stages are essential for the relatively long gate sequences realized here.
Nondestructive stabilizer measurements
We start by demonstrating nondestructive fourqubit stabilizer measurements with realtime feedforward operations based on the measurement outcomes (Fig. 2). Despite the central role of such measurements in many errorcorrection codes, including the fivequbit code, the Steane code and the surface code^{15,16,17,18}, experimental implementations with feedforward have remained an outstanding challenge.
We benchmark the measurement by using it to deterministically create a fourqubit entangled state. We prepare the state \(0000\rangle \) and measure the operator XXXX. This projects the qubits into the Greenberger–Horne–Zeilinger (GHZ) state \(({ {\rm{\psi }}\rangle }_{\pm }=( 0000\rangle \pm  1111\rangle )/\sqrt{2}),\) with the sign determined by the measurement outcome. We process the measurement outcomes in real time using a microprocessor and apply the required correction to deterministically output the state \(({ {\rm{\psi }}\rangle }_{+})\) with a fidelity of 0.86(1). Because this result is obtained without any postselection, it highlights that the postmeasurement state is available for all measurement outcomes, satisfying one of the key requirements for error correction.
Faulttolerant encoding
To prepare the logical qubit, we introduce a new scheme that uses repeated stabilizer measurements and a flag qubit to herald successful preparation (Fig. 3a). In contrast to the scheme introduced by Chao and Reichardt^{28}, no direct twoqubit gates between the data qubits are required (fifth section of the Supplementary Information). We demonstrate the preparation of the logical state \(({\rangle }_{{\rm{L}}}=\frac{1}{\sqrt{2}}({0\rangle }_{{\rm{L}}}{1\rangle }_{{\rm{L}}})\). This state is the unique +1 eigenstate of five independent weight3 logical X operators, namely, p_{1} = IZXZI, p_{2} = ZIIZX, p_{3} = XZIIZ, p_{4} = ZXZII and p_{5} = IIZXZ. Therefore, one can prepare \({\rangle }_{{\rm{L}}}\) by initializing the data qubits into the product state \(00+0+\rangle \), which is an eigenstate of p_{1} and p_{2}, and subsequently measuring p_{3} to p_{5} (Fig. 3a). This preparation scheme is not fault tolerant because faults involving the auxiliary qubit can cause weight2 errors, which can result in logical errors (Fig. 3a). We refer to these steps as the nonFT encoding scheme.
We make the preparation circuit fault tolerant by adding two stabilizer measurements, T_{1} = p_{2}·p_{4}·p_{5} = IXIYY and T_{2} = p_{1}·p_{3}·p_{5} = XIYYI with a flag qubit (Fig. 3a). Successful preparation is heralded by the following conditions: (1) the measurement outcomes of T_{1} and T_{2} are compatible with the measurement outcomes m_{i} of the logical operators \({p}_{{\rm{i}}}\), that is, \({m}_{{T}_{1}}={m}_{2}{\times m}_{4}{\times m}_{5}\) and \({m}_{{T}_{2}}={m}_{1}{\times m}_{3}{\times m}_{5}\); (2) the flag is not raised (that is, the flag qubit is measured to be in \(0\rangle \)). Otherwise, the state is rejected. The order of twoqubit gates is carefully chosen to ensure fault tolerance while minimizing the number of operations. Further details and a proof of the fault tolerance of this scheme are given in the sixth section of the Supplementary Information. We refer to this preparation as the FT encoding scheme.
To reduce the impact of auxiliary qubit measurement errors^{10,14}, we also require all stabilizer measurement outcomes to be +1 (that is, the NV electron spin is measured to be in \(0\rangle \)). These outcomes are more reliable^{3} (Methods), increasing the fidelity of the state preparation, at the cost of a lower success probability (Supplementary Table 1).
We compare the nonFT and FT encoding schemes. We define the logical state fidelity F_{L} as (Methods)
in which ρ is the prepared state and \(\varepsilon =\left\{I,{X}_{i},{Y}_{i},{Z}_{i},{i}=\mathrm{1,2},\ldots ,5\right\}\) is the set of all singlequbit Pauli errors. The fidelity F_{L} gives the probability that there is at most a singlequbit error in the prepared state, that is, there is no logical error. We characterize the prepared state by measuring the 31 operators that define the target state (Extended Data Fig. 2 and Methods). We find that the FT encoding scheme (F_{L} = 95(2)%) outperforms the nonFT scheme (F_{L} = 81(2)%).
To understand this improvement, we analyse the underlying error probability distributions (Figs. 3b,c). For the fivequbit code, the \({\rangle }_{{\rm{L}}}\) state plus any number of Pauli errors is equivalent to either \({\rangle }_{{\rm{L}}}\) with at most one Pauli error (no logical error) or to \({+\rangle }_{{\rm{L}}}\) with at most one Pauli error (a logical error). We calculate the overlaps between the prepared state and those states. The results show that the FT scheme suppresses logical errors, consistent with fault tolerance preventing single faults propagating to multiqubit errors. The overall logical state fidelity F_{L} is improved, despite the higher probability of singlequbit errors owing to the increased complexity of the sequence.
Faulttolerant logical gates
The fivequbit code supports a complete set of transversal singlequbit Clifford gates, which are naturally fault tolerant^{16,39}. We apply four transversal logical gates to \({\rangle }_{{\rm{L}}}\) (Fig. 4): X_{L} = X_{1}X_{2}X_{3}X_{4}X_{5}, Y_{L} = Y_{1}Y_{2}Y_{3}Y_{4}Y_{5}, the Hadamard gate H_{L} = P_{π} H_{1}H_{2}H_{3}H_{4}H_{5} and the phase gate S_{L} = P_{π} S_{1}S_{2}S_{3}S_{4}S_{5}, in which P_{π} is a permutation of the data qubits^{16,39} (Fig. 4b). These permutations are fault tolerant because we realize them by relabelling the qubits rather than by using SWAP gates^{39}. For completeness, we note that universal computation requires further nontransversal gates, constructed—for example—with auxiliary logical qubits, which are not pursued here^{18}.
Our control system performs the underlying singlequbit gates by tracking basis rotations and compiling them with subsequent gates or measurements (Methods). In the sequence considered here (Fig. 4a), such compilation does not increase the physical operation count and there is no reduction of fidelity (Fig. 4c). For comparison, we also implement the ‘worstcase’ scenario, in which the logical gates are applied physically (Fig. 4c). This includes five singlequbit gates and the corresponding extra echo sequences between the state preparation and the measurement stage. Together, the demonstrated transversal logical gates enable the faulttolerant preparation of all six eigenstates of the logical Pauli operators.
Faulttolerant stabilizer measurements
Finally, we demonstrate and characterize a flagged stabilizer measurement on the encoded state (Fig. 5a). Such measurements are a primitive for faulttolerant quantum errorcorrection protocols^{28}. To ensure that the measurement is compatible with fault tolerance, the twoqubit gates are carefully ordered and a flag qubit is added to capture the auxiliary qubit errors that can propagate to logical errors^{28}.
We prepare the logical state \({\rangle }_{{\rm{L}}}\) and measure the stabilizer s_{1} = XXYIY (Fig. 5a). The resulting output consists of the postmeasurement state and two classical bits of information from the measurements of the auxiliary and flag qubits (Fig. 5b). The logical state fidelity F_{L} is given by the probability that the logical information can be correctly extracted (no logical error) when taking into account the flag measurement outcome. The interpretation of the error syndrome changes if the flag is raised (Methods). We find F_{L} = 0.77(4) for the postmeasurement state without any postselection. Higher logical state fidelities can be obtained by postselecting on favourable outcomes, but this is incompatible with error correction.
To illustrate the benefit of the flag qubit, we compare the logical state fidelities with and without taking the flag measurement outcome into account. Because auxiliary qubit errors that propagate to logical errors are naturally rare, no marked difference is observed (Fig. 5c). Therefore, we introduce a Pauli Y error on the auxiliary qubit (Fig. 5a). This error propagates to the twoqubit error Y_{3}Y_{5}. For the case without flag information, this error causes a logical flip Z_{L} (Methods) and the logical state fidelity drops below 0.5. By contrast, with the flag qubit, this nontrivial error is detected (Fig. 5b) and remains correctable, so that the logical state fidelity is partly recovered (Fig. 5c).
Conclusion
In conclusion, we have demonstrated encoding, gates and nondestructive stabilizer measurements for a logical qubit of an errorcorrection code in a faulttolerant way. Our results advance solidstate spin qubits from the physicalqubit level to the logicalqubit level, at which faulttolerant operations become possible. Such fault tolerance is a necessity for largescale quantum computation, in which error rates must ultimately be suppressed to extremely low levels.
Future challenges are to perform complete quantum errorcorrection cycles, encode several logical qubits, realize universal faulttolerant gates and—ultimately—suppress logical error rates exponentially below physical error rates. Although the demonstrated operations are of high fidelity—the experiments consist of up to 40 twoqubit gates and eight midcircuit auxiliary qubit readouts (Fig. 5a)—improvements in both the fidelities and the number of qubits will be required.
Improved gates might be realized through tailored optimal control schemes that leverage the precise knowledge of the system and its environment^{40} (Fig. 1a). Coupling to optical cavities can further improve readout fidelities^{1,41}. Scaling to large code distances and several logical qubits can be realized through alreadydemonstrated magnetic^{40} and optical^{42} NV–NV connections that enable modular, distributed, quantum computation based on the surface code and other errorcorrection codes^{19}. Therefore, our demonstration of the building blocks of faulttolerant quantum error correction is a key step towards quantum information processing based on solidstate spin qubits.
Methods
Sample
We use a naturally occurring NV centre in a homoepitaxially chemicalvapourdepositiongrown diamond with a 1.1% natural abundance of ^{13}C and a \(\langle 111\rangle \) crystal orientation (grown by Element Six). A solidimmersion lens is used to enhance the photoncollection efficiency^{43}. The NV centre has been selected for the absence of ^{13}C spins with hyperfine couplings >500 kHz. These experiments are performed at a temperature of 4 K, at which the electronspin relaxation is negligible (T_{1} = 3.6(3) × 10^{3} s)^{37}.
Qubits and coherence times
The NV electronspin auxiliary qubit is defined between the states m_{s} = 0 \((0\rangle )\) and m_{s} = −1 \((1\rangle )\). The NV electronspin coherence times are \({T}_{2}^{* }=4.9(2)\,{\rm{\mu }}{\rm{s}}\), T_{2} = 1.182(5) ms and up to seconds under dynamical decoupling^{37}. The ^{14}N nuclearspin flag qubit is defined between the states m_{I} = 0 \((0\rangle )\) and m_{I} = −1 \((1\rangle )\). The ^{13}C nuclearspin data qubits in this device have been characterized in detail in previous work^{3,38,44} (Fig. 1a). See Supplementary Tables 2–5 for the hyperfine parameters, coherence times and qubit–qubit interactions for the qubits used here.
Magnetic field
A magnetic field of about 403 G is applied using a roomtemperature permanent magnet on a XYZ translation stage. This applied field lifts the degeneracy of the m_{s} = ±1 states owing to the Zeeman term (first section of the Supplementary Information). We stabilize the magnetic field to <3 mG using temperature stabilization and an automatic recalibration procedure (every few hours). We align the magnetic field along the NV axis using thermal echo sequences with an uncertainty of 0.07° in the alignment^{38}.
Singlequbit and twoqubit gates
Singlequbit gates and echo pulses are applied using microwave pulses for the NV electron spin (m_{s} = 0 ↔ m_{s} = −1 transition, Hermite pulse shapes^{37,45}, Rabi frequency of about 15 MHz) and using radiofrequency (RF) pulses for the ^{13}C spin qubits (error function pulse shapes^{3}, typical Rabi frequency of about 500 Hz) and the ^{14}N spin qubit (error function pulse shapes, Rabi frequency of about 2 kHz).
The Hermite pulse envelopes of the microwave pulses are defined as
in which c = 0.956 for π pulses and c = 0.667 for π/2 pulses, μ = 0.5t_{pulse}, T = 0.1667t_{pulse}, t_{pulse} is the microwave pulse length and A is the pulse amplitude, which is experimentally calibrated to achieve a π or π/2 rotation. For this work, we use t_{pulse} = 168 ns for π pulses and t_{pulse} = 100 ns for π/2 pulses. The envelope of the RF pulses is defined as
in which Δt is the rise time, t_{0} is the start time of the pulse, t_{pulse} is the pulse length and erf(x) is the error function^{3}. We ensure that the RF pulses consisted of an integer number of periods of the RF waveform, that is, we ensure that ωt_{pulse} = 2πn for integer n. This ensures that any phase picked up on the electron spin owing to the RF pulse is cancelled. Note that the ^{13}C spin qubits (data qubits) are distinguishable in frequency owing to their hyperfine coupling to the NV electron spin (Supplementary Table 2).
Electron–nuclear twoqubit gates are realized using two different gate designs, depending on the properties of the targeted nuclear spin. For data qubits 1, 2, 4 and 5, twoqubit gates are realized through dynamical decoupling sequences of N equally spaced πpulses on the electron spin of the form^{3,46} (τ_{r} − π − τ_{r})^{N}. This design requires a notable hyperfine component perpendicular to the applied magnetic field^{46}. For data qubit 3 and the flag qubit (the ^{14}N spin), the perpendicular hyperfine coupling is small and we perform twoqubit gates by interleaving the dynamical decoupling sequence with RF pulses^{3}. Both gate designs simultaneously decouple the NV electron spin from the other qubits and the environment^{3}. The parameters and fidelities for the twoqubit gates are given in Supplementary Table 4. Note that direct nuclear–nuclear twoqubit gates can also be constructed^{47}, but because the natural interaction is much weaker than the electron–nuclear interaction, we don't use such gates here and designed the FT encoding circuit based on electron–nuclear gates only.
Compilation of gate sequences
Our native twoqubit gates are electroncontrolled nuclearspin rotations and are equivalent to the CNOT gate up to singlequbit rotations (Supplementary Fig. 4). To implement the sequences shown in the figures, we first translate all gates into these native gates and compile the resulting sequence. Afterwards, the circuit is translated into the actual pulse sequence. At the core of this compilation process is the tracking and synchronization of the qubit phases and the corresponding pulse timings. See Supplementary Information for the details of this compilation process (Supplementary Figs. 4–9 and pseudocode 1–8).
Echo sequences for the data qubits
To mitigate decoherence of the data qubits owing to their spin environment, we use echo sequences that are interleaved throughout the experiments. These echo sequences ensure that the data qubits rephase each time they are operated on. Furthermore, the sequence design minimizes the time that the auxiliary electronspin qubit is idling in superposition states, which are prone to dephasing. We use two echo stages between stabilizer measurements, as well as before and after the logical gates of Fig. 4, which provides a general and scalable solution for the timing of all gates and echoes (third section of the Supplementary Information).
An extra challenge is that, owing to the length of the sequences (up to 100 ms), we need to account for the small unwanted interactions between the nuclearspin data qubits. The measured coupling strengths show that the strongest couplings are between qubits 3 and 2 (16.90(4) Hz) and between qubits 3 and 5 (12.96(4) Hz)^{38} (Supplementary Table 5). Such interactions can introduce correlated twoqubit errors that are not correctable in the distance3 code considered here, which can only handle singlequbit errors in the code block.
To mitigate these qubit–qubit couplings, we decouple qubit 3 asynchronously from the other qubits (Supplementary Fig. 8). Ultimately, such local correlated errors can be suppressed entirely by larger distance codes.
Realtime control and feedforward operations
Realtime control and feedforward operations are implemented through a programmable microprocessor (Jaeger ADwin Pro II) operating on microsecond timescales. The microprocessor detects photon events coming from the detectors, infers the measurement outcomes and controls both the subsequent sequences in the arbitrary waveform generator (Tektronix AWG 5014c) and the lasers for the auxiliary qubit readout. The precise timing for quantum gates (1ns precision) is based on the clock of the arbitrary waveform generator. Furthermore, the microprocessor operates various control loops that prepare the NV centre in the negative charge state, on resonance with the lasers and in the focus of the laser beam (see second and third sections of the Supplementary Information).
Readout of the auxiliary qubit
The electron spin (auxiliary qubit) is read out by resonantly exciting the m_{s} = 0 to E_{x} optical transition^{43}. For one or more photons detected, we assign the m_{s} = 0 outcome; for zero photons, we assign m_{s} = ±1. The singleshot readout fidelities are F_{0} = 90.5(2)% and F_{1} = 98.6(2)% for m_{s} = 0 and m_{s} = −1, respectively (average fidelity 94.6(1)%).
Uncontrolled electronspin flips in the excited state cause dephasing of the nuclear spins through the hyperfine interaction. To minimize such spin flips, we avoid unnecessary excitations by using weak laser pulses, so that a feedback signal can be used to rapidly turn off the laser on detection of a photon (within 2 μs). The resulting probability that the electron spin is in state m_{s} = 0 after correctly assigning m_{s} = 0 in the measurement is 0.992 (ref. ^{14}).
For measurements that are used for heralded state preparation, that is, for which we only continue on a m_{s} = 0 outcome (see, for example, Fig. 3), we use shorter readout pulses. This improves the probability that a m_{s} = 0 outcome correctly heralds the m_{s} = 0 state, at the cost of reduced success probability (Supplementary Table 1).
System preparation and qubit initialization
At the start of the experiments, we first prepare the NV centre in its negative charge state and on resonance with the lasers. We then initialize the NV electron spin in the m_{s} = 0 state through a spin pumping process (fidelity > 99.7%)^{43}. We define the electronspin qubit between the states m_{s} = 0 \((0\rangle )\) and m_{s} = −1 \((1\rangle )\). We initialize the data qubits through SWAP sequences (Supplementary Fig. 6) into \(0\rangle \) and subsequent optical reset of the auxiliary qubit (initialization fidelities 96.5–98.5%; see Supplementary Table 4). The flag qubit is initialized through a projective measurement that heralds preparation in \(0\rangle \) (initialization fidelity 99.7%). Other product states are prepared by subsequent singlequbit gates.
Final readout of the data qubits
Measuring singlequbit and multiqubit operators of the data qubits is performed by mapping the required correlation to the auxiliary qubit (through controlled rotations) and then reading out the auxiliary qubit^{14}. To provide best estimates for the measurements, we correct the measured expectation values (Fig. 2 and Extended Data Figs. 1 and 2) for infidelities in the readout sequence; see Bradley et al.^{3} for the correction procedure.
Fidelity of the GHZ state
The fidelity of the prepared state ρ (in Fig. 2 and Extended Data Fig. 1) with respect to the target GHZ state \(({{\rm{\psi }}\rangle }_{+})\) is obtained as
Assessing the logical state fidelity
The logical state fidelity F_{L} is defined in equation (1) and gives the probability that the state is free of logical errors. Said differently, F_{L} is the fidelity with respect to the ideal fivequbit state after a round of perfect error correction, or the probability to obtain the correct outcome in a perfect faulttolerant logical measurement. Although faulttolerant circuits for logical measurement exist^{28}, we do not experimentally implement these here. Instead, we extract F_{L} from a set of measurements, as described in the following using \({\rangle }_{{\rm{L}}}\) as an example.
The logical state \({\rangle }_{{\rm{L}}}\) is the unique simultaneous eigenstate of the five weight3 operators \({p}_{{\rm{i}}}\) with eigenvalue +1. Thus, we can describe the state \(E{\rangle }_{{\rm{L}}}\) (with E a Pauli error) as the projector
in which m_{i} = ±1 is the measurement outcome of \({p}_{{\rm{i}}}\) and m_{i} = −1 when E anticommutes with \({p}_{{\rm{i}}}\). This projector can be expanded as a summation of 31 multiqubit Pauli operators (including a constant), which are listed in Extended Data Fig. 2. The logical state fidelity \({p}_{{\rm{i}}}\) in equation (1) can then be written as
Here \(\varepsilon =\left\{I,{X}_{i},{Y}_{i},{Z}_{i},{i}=\mathrm{1,2},\ldots ,5\right\}\) is the set of correctable errors for the fivequbit code. To obtain F_{L} experimentally, we measure this set of expectation values.
Logical state fidelity with flag
If the flag in the circuit in Fig. 5a is not raised, then a cycle of error correction would correct any singlequbit error on a logical state. The logical state fidelity is then given by equation (1), which we now refer to as \({F}_{{\rm{L}}}^{{\rm{not\; raised}}}\). A raised flag leads to a different interpretation of the error syndrome^{28} (Supplementary Table 7).
For example, the Y error on the auxiliary qubit in Fig. 5a leads to the output state \({Y}_{3}{Y}_{5}{\rangle }_{{\rm{L}}}\), for which the eigenvalues of s_{1} = XXYIY, s_{2} = YXXYI, s_{3} = IYXXY and s_{4} = YIYXX give the syndrome [+1, −1, −1, −1]. Without flag, the corresponding singlequbit recovery is Z_{4}, which changes the syndrome back to all +1 (Supplementary Table 7). This recovery leads to the remaining error Y_{3}Z_{4}Y_{5}, which is a logical Z error. However, taking the flag measurement outcome into account, the syndrome is interpreted differently and the recovery is Y_{3}Y_{5}, so that no error is left (Supplementary Table 7).
For the cases in which the flag is raised, the logical state fidelity with respect to \({\rangle }_{{\rm{L}}}\) is now given by:
with \({\varepsilon }^{{\prime} }\) being another set of correctable errors
A detailed derivation for this set of errors and their corresponding syndromes are given in the fifth section of the Supplementary Information.
The logical state fidelity after the stabilizer measurement (Fig. 5) is calculated as the weighted sum of the fidelities conditioned on the two flag outcomes:
with p_{f} being the probability that the flag is raised and \({F}_{{\rm{L}}}^{{\rm{raised}}}\) and \({F}_{{\rm{L}}}^{{\rm{not\; raised}}}\) are as defined above.
Finally, to construct the logical state fidelity as a function of p_{e} (Fig. 5c), we measure F_{L} with (p_{e} = 0) and without (p_{e} = 1) the auxiliary qubit error and calculate the outcomes for other error probabilities p_{e} from their weighted sum:
Error distribution in the prepared state
The overlaps between the prepared state ρ and the state \(E{\rangle }_{{\rm{L}}}\) with E identity or a singlequbit error are written as P_{0,−} and P_{1,−}, respectively. These correspond to the cases that there is no logical error. The overlaps between the prepared state ρ and the state \(E{+\rangle }_{{\rm{L}}}\) with E identity or a singlequbit error are written as P_{0,+} and P_{1,+}, respectively. In these cases, there is a logical error. These overlaps are shown in Fig. 3b,c and calculated as (\(\alpha =\pm \))
These overlaps can be explicitly expressed in terms of the 31 measured expectation values (see seventh section of the Supplementary Information).
Error analysis
The uncertainties in the measured fidelities, logical state fidelities and probabilities (P_{0/1,±}) are obtained from the uncertainties in the measured expectation values using error propagation. For example, the logical state fidelity F_{L} is calculated as
in which A_{i} are the 16 expectation values shown in equation (5). Assuming that the errors in the measured expectation values are independent, the standard deviation in F_{L} is:
in which \({\sigma }_{{A}_{i}}\) is the standard deviation of the expectation value A_{i} and is given by a binomial distribution^{42}. Note that \({\sigma }_{{A}_{i}}\) is also corrected for the readout correction process described in Bradley et al.^{3}.
Note added
While finalizing this manuscript, two related preprints appeared that demonstrate destructive stabilizer measurements with a flag qubit^{48} and flag faulttolerant quantum error correction^{49} with trappedion qubits. Furthermore, during the revision process, three related preprints appeared that demonstrate quantum error correction on a surface code using superconducting qubits^{50,51} and realize a flagbased universal faulttolerant gate set using trapped ions^{52}.
Data availability
The underlying data and software code for generating the plots presented in the main text and Supplementary Information are available at Zenodo https://doi.org/10.5281/zenodo.6461872.
References
Awschalom, D. D., Hanson, R., Wrachtrup, J. & Zhou, B. B. Quantum technologies with optically interfaced solidstate spins. Nat. Photonics 12, 516–527 (2018).
Chatterjee, A. et al. Semiconductor qubits in practice. Nat. Rev. Phys. 3, 157–177 (2021).
Bradley, C. E. et al. A tenqubit solidstate spin register with quantum memory up to one minute. Phys. Rev. X 9, 031045 (2019).
Nguyen, C. et al. Quantum network nodes based on diamond qubits with an efficient nanophotonic interface. Phys. Rev. Lett. 123, 183602 (2019).
Bourassa, A. et al. Entanglement and control of single nuclear spins in isotopically engineered silicon carbide. Nat. Mater. 19, 1319–1325 (2020).
Madzik, M. T. et al. Precision tomography of a threequbit donor quantum processor in silicon. Nature 601, 348–353 (2022).
He, Y. et al. A twoqubit gate between phosphorus donor electrons in silicon. Nature 571, 371–375 (2019).
Xue, X. et al. Quantum logic with spin qubits crossing the surface code threshold. Nature 601, 343–347 (2022).
Van der Sar, T. et al. Decoherenceprotected quantum gates for a hybrid solidstate spin register. Nature 484, 82–86 (2012).
van Dam, S. B., Cramer, J., Taminiau, T. H. & Hanson, R. Multipartite entanglement generation and contextuality tests using nondestructive threequbit parity measurements. Phys. Rev. Lett. 123, 050401 (2019).
Vorobyov, V. et al. Quantum Fourier transform for nanoscale quantum sensing. npj Quantum Inf. 7, 124 (2021).
Unden, T. et al. Quantum metrology enhanced by repetitive quantum error correction. Phys. Rev. Lett. 116, 230502 (2016).
Waldherr, G. et al. Quantum error correction in a solidstate hybrid spin register. Nature 506, 204–207 (2014).
Cramer, J. et al. Repeated quantum error correction on a continuously encoded qubit by realtime feedback. Nat. Commun. 7, 11526 (2016).
Preskill, J. Reliable quantum computers. Proc. R. Soc. A Math. Phys. Eng. Sci. 454, 385–410 (1998).
Gottesman, D. E. Stabilizer Codes and Quantum Error Correction. PhD thesis, California Institute of Technology (1997).
Aliferis, P., Gottesman, D. & Preskill, J. Quantum accuracy threshold for concatenated distance3 code. Quantum Inf. Comput. 6, 97–165 (2006).
Terhal, B. M. Quantum error correction for quantum memories. Rev. Mod. Phys. 87, 307–346 (2015).
Nickerson, N. H., Li, Y. & Benjamin, S. C. Topological quantum computing with a very noisy network and local error rates approaching one percent. Nat. Commun. 4, 1756 (2013).
Nigg, D. et al. Quantum computations on a topologically encoded qubit. Science 345, 302–305 (2014).
Egan, L. et al. Faulttolerant control of an errorcorrected qubit. Nature 598, 281–286 (2021).
Linke, N. M. et al. Faulttolerant quantum error detection. Sci. Adv. 3, e1701074 (2017).
Rosenblum, S. et al. Faulttolerant detection of a quantum error. Science 361, 266–270 (2018).
CampagneIbarcq, P. et al. Quantum error correction of a qubit encoded in grid states of an oscillator. Nature 584, 368–372 (2020).
Andersen, C. K. et al. Repeated quantum error detection in a surface code. Nat. Phys. 16, 875–880 (2020).
Marques, J. et al. Logicalqubit operations in an errordetecting surface code. Nat. Phys. 18, 80–86 (2021).
Google Quantum AI. Exponential suppression of bit or phase errors with cyclic error correction. Nature 595, 383–387 (2021).
Chao, R. & Reichardt, B. W. Quantum error correction with only two extra qubits. Phys. Rev. Lett. 121, 050502 (2018).
Chamberland, C. & Beverland, M. E. Flag faulttolerant error correction with arbitrary distance codes. Quantum 2, 53 (2018).
Chao, R. & Reichardt, B. W. Flag faulttolerant error correction for any stabilizer code. PRX Quantum 1, 010302 (2020).
Negnevitsky, V. et al. Repeated multiqubit readout and feedback with a mixedspecies trappedion register. Nature 563, 527–531 (2018).
Erhard, A. et al. Entangling logical qubits with lattice surgery. Nature 589, 220–224 (2021).
Takita, M., Cross, A. W., Córcoles, A. D., Chow, J. M. & Gambetta, J. M. Experimental demonstration of faulttolerant state preparation with superconducting qubits. Phys. Rev. Lett. 119, 180501 (2017).
Gong, M. et al. Experimental exploration of fivequbit quantum errorcorrecting code with superconducting qubits. Natl Sci. Rev. 9, nwab011 (2021).
Knill, E., Laflamme, R., Martinez, R. & Negrevergne, C. Benchmarking quantum computers: the fivequbit error correcting code. Phys. Rev. Lett. 86, 5811–5814 (2001).
Laflamme, R., Miquel, C., Paz, J. P. & Zurek, W. H. Perfect quantum error correcting code. Phys. Rev. Lett. 77, 198–201 (1996).
Abobeih, M. H. et al. Onesecond coherence for a single electron spin coupled to a multiqubit nuclearspin environment. Nat. Commun. 9, 2552 (2018).
Abobeih, M. H. et al. Atomicscale imaging of a 27nuclearspin cluster using a quantum sensor. Nature 576, 411–415 (2019).
Yoder, T. J., Takagi, R. & Chuang, I. L. Universal faulttolerant gates on concatenated stabilizer codes. Phys. Rev. X 6, 031039 (2016).
Dolde, F. et al. Highfidelity spin entanglement using optimal control. Nat. Commun. 5, 3371 (2014).
Bhaskar, M. K. et al. Experimental demonstration of memoryenhanced quantum communication. Nature 580, 60–64 (2020).
Pompili, M. et al. Realization of a multinode quantum network of remote solidstate qubits. Science 372, 259–264 (2021).
Robledo, L. et al. Highfidelity projective readout of a solidstate spin quantum register. Nature 477, 574–578 (2011).
Jung, K. et al. Deep learning enhanced individual nuclearspin detection. npj Quantum Inf. 7, 41 (2021).
Warren, W. S. Effects of arbitrary laser or NMR pulse shapes on population inversion and coherence. J. Chem. Phys. 81, 5437–5448 (1984).
Taminiau, T. H., Cramer, J., Sar, T. V. D., Dobrovitski, V. V. & Hanson, R. Universal control and error correction in multiqubit spin registers in diamond. Nat. Nanotechnol. 9, 171–176 (2014).
Randall, J. et al. Manybody–localized discrete time crystal with a programmable spinbased quantum simulator. Science 374, 1474–1478 (2021).
Hilder, J. et al. Faulttolerant parity readout on a shuttlingbased trappedion quantum computer. Phys. Rev. X 12, 011032 (2022).
RyanAnderson, C. et al. Realization of realtime faulttolerant quantum error correction. Phys. Rev. X 11, 041058 (2021).
Krinner, S. et al. Realizing repeated quantum error correction in a distancethree surface code. Nature 605, 669–674 (2022).
Zhao, Y. et al. Realization of an errorcorrecting surface code with superconducting qubits. Preprint at https://arxiv.org/abs/2112.13505 (2021).
Postler, L. et al. Demonstration of faulttolerant universal quantum gate operations. Nature 605, 675–680 (2022).
Acknowledgements
This work was supported by the Netherlands Organisation for Scientific Research (NWO/OCW) through a Vidi grant and the Quantum Software Consortium programme (project no. 024.003.037/3368). This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement no. 852410). We gratefully acknowledge support from the joint research programme ‘Modular quantum computers’ by Fujitsu Limited and Delft University of Technology, cofunded by the Netherlands Enterprise Agency under project number PPS2007. This project (QIA) has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement no. 820445. This work is part of the project QCDA (with project number 680.91.033) of the research programme QuantERA, which is (partly) financed by the Dutch Research Council (NWO). This publication is part of the QuTech NWO funding 2020–2024 – Part I ‘Fundamental Research’ with project number 601.QT.0011, which is financed by the NWO.
Author information
Authors and Affiliations
Contributions
M.H.A., Y.W. and T.H.T. devised the experiments. M.H.A. performed the experiments and collected the data. Y.W. and B.M.T. developed the faulttolerant preparation scheme and its analysis. M.H.A., Y.W., J.R., B.M.T. and T.H.T. analysed the data. M.H.A., J.R., S.J.H.L. and C.E.B. prepared the experimental apparatus. M.M. and D.J.T. grew the diamond sample. M.H.A., Y.W. and T.H.T. wrote the manuscript, with input from all authors. B.M.T. and T.H.T. supervised the project.
Corresponding author
Ethics declarations
Competing interests
The authors declare no competing interests.
Peer review
Peer review information
Nature thanks the anonymous reviewers for their contribution to the peer review of this work. Peer reviewer reports are available.
Additional information
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Extended data figures and tables
Extended Data Fig. 1 Nondestructive stabilizer measurements with a flag and realtime feedforward.
a, Circuit diagram for the deterministic preparation of a fourqubit GHZ entangled state \(({{\rm{\psi }}\rangle }_{+}=(0000\rangle +1111\rangle )/\sqrt{2})\) using a flagged measurement of the stabilizer XXXX. b, Measured expectation values of the 15 operators that define the ideal state. The average obtained fidelity is 0.79(1). c, Data postselected on the flag not being raised. The obtained fidelity with the target state is 0.82(1). d, When the flag is raised, the obtained fidelity is 0.47(5). Grey bars show the ideal expectation values. Note that we perform this measurement as a test of the circuit, but that the flag information in this case does not carry any specific significance.
Extended Data Fig. 2 Measured expectation values for the encoded state.
Measured expectation values of the 31 operators that define the encoded state (for the circuit in Fig. 3). Grey bars show the ideal expectation values.
Supplementary information
Supplementary Information
This file contains eight sections: System Hamiltonian; Experimental setup; Experimental sequence; Parameters of the nuclearspin qubits; Flag faulttolerant quantum error correction; Proof of fault tolerance of the preparation scheme; Error distribution in the prepared state; Pseudocode and references.
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Abobeih, M.H., Wang, Y., Randall, J. et al. Faulttolerant operation of a logical qubit in a diamond quantum processor. Nature 606, 884–889 (2022). https://doi.org/10.1038/s41586022048196
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1038/s41586022048196
This article is cited by

Ideal refocusing of an optically active spin qubit under strong hyperfine interactions
Nature Nanotechnology (2023)

Demonstrating multiround subsystem quantum error correction using matching and maximum likelihood decoders
Nature Communications (2023)

Realtime quantum error correction beyond breakeven
Nature (2023)

Beating the breakeven point with a discretevariableencoded logical qubit
Nature (2023)

Noisy intermediatescale quantum computers
Frontiers of Physics (2023)
Comments
By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.