Optical demonstration of quantum fault-tolerant threshold

A major challenge in practical quantum computation is the ineludible errors caused by the interaction of quantum systems with their environment. Fault-tolerant schemes, in which logical qubits are encoded by several physical qubits, enable to the output of a higher probability of correct logical qubits under the presence of errors. However, strict requirements to encode qubits and operators render the implementation of a full fault-tolerant computation challenging even for the achievable noisy intermediate-scale quantum technology. Especially the threshold for fault-tolerant computation still lacks experimental verification. Here, based on an all-optical setup, we experimentally demonstrate the existence of the threshold for the fault-tolerant protocol. Four physical qubits are represented as the spatial modes of two entangled photons, which are used to encode two logical qubits. The experimental results clearly show that when the error rate is below the threshold, the probability of correct output in the circuit, formed with fault-tolerant gates, is higher than that in the corresponding non-encoded circuit. In contrast, when the error rate is above the threshold, no advantage is observed in the fault-tolerant implementation. The developed high-accuracy optical system may provide a reliable platform to investigate error propagation in more complex circuits with fault-tolerant gates.

Practical quantum advantage may be achievable even under the presence of errors by applying the noisy intermediate-scale quantum (NISQ) technology 30 . Although a complete fault-tolerant computation with practical application is still beyond the reach of NISQ technology, fault-tolerant quantum circuits could be demonstrated in a small system 21,31,32 to show the effectiveness of noise mitigation in logical qubits and even implement some practical applications with NISQ technology 33 .
In ref. 21 a special fault-tolerant protocol is proposed for a small system consisting of five qubits, of which one is regarded as an ancillary qubit and the others are used to encode logical qubits. In this protocol, encoding, decoding, and some gates, such as single-qubit Pauli operators σ x and σ Z , and the two-qubit controlled-not (CNOT) operator (these Clifford operators are not universal), can be implemented fault tolerantly in logical space with the help of post-selection. It is shown that errors in this protocol cannot be corrected. Following this protocol, faulttolerant error detection of encoding has been demonstrated in trapped ions 34 , superconducting qubits 35 , and the IBM quantum devices [36][37][38] . However, the key aspect of the quantum circuit implementing with fault-tolerant operations, that is, the existence of the threshold of error rate below which the circuit is realized in a fault-tolerant manner, has not been explicitly demonstrated.
In this work, we experimentally demonstrate the threshold of error rate for quantum circuits formed with fault-tolerant gates implemented in an all-optical setup. Based on the encoding method, we encode two logical qubits using four qubits which are mapped to the optical path information of two entangled photons. Besides the preparation stage, we experimentally implement a singlequbit Hadamard gate and a two-qubit CNOT gate in the logical space to form a complete quantum circuit in which error gates are imported based on the bit-flip error. When comparing the output probabilities of the encoded circuit and those of non-encoded circuit, we could determine the fault-tolerant threshold of the error rate. Our results clearly demonstrate that when the error rate remains below the threshold, the probability to obtain correct output results in the fault-tolerant circuit is higher than that of the corresponding non-encoded circuit. On the other side, if the error rate is above the threshold, no benefit is obtained from the fault-tolerant implementation.

Results
Following the encoding protocol introduced in the Materials and Methods, two logical qubits are encoded with four physical qubits, where the encoded space only involves an even number of |1〉 in physical qubits. The four physical qubits are mapped to coincident modes of two entangled photons. This method of mapping the qubits to optical spatial modes could simulate the operation of the individual qubit with the evolution of spatial modes 39 . By coherently adjusting spatial modes, single-and two-qubit gates can be conveniently realized. Logical state 00 can be fault tolerantly prepared with post-selection following the circuit presented in Fig. 1b starting from the initial physical state |0000〉. In this protocol, a set of quantum gates, such as σ x , Hadamard, and CNOT gates, operated on logical qubits can be implemented in a fault-tolerant manner. As a result, a circuit, only formed by these fault-tolerant gates, is implemented fault tolerantly and there exists a threshold of the error rate. Our main task is to experimentally demonstrate the existence of the threshold in the fault-tolerant circuit.
A complete fault-tolerant circuit includes preparation, evolution (containing a set of gates), and measurement, and an error may occur at any stage of the circuit. For simplicity, in the Materials and Methods, we describe an operator with an error on qubits by its ideal quantum operation followed by an error gate E (assumed to be the same for all the operations). The noisy measurement can be decomposed into error operation E and the ideal measurement (IM). As illustrated in Fig. 1c (non-encoded circuit), the evolution stage consists of a Hadamard operation on the second logical qubit, H 2 , followed by a two-qubit CNOT operation CNOT 21 in which the first (target) qubit is controlled by the second qubit. Figure 1d shows the corresponding encoded circuit implementing these two logical operations.
Errors in preparation, evolution, and measurement, are considered in both non-encoded and encoded circuits, in  which the error gate is assumed to be E = σ x with error rate ϵ = 1 − p and p being the correct probability, thus establishing a coherent error. Experimentally controlling and identifying the error rate ϵ in each gate is the key process in our study. The probability of successful output can be defined as F p = Tr[ρ ideal . ρ exp ] (a function of p), where ρ ideal and ρ exp are ideal and experimental output states, respectively. To demonstrate the fault-tolerant circuit, we should confirm that the probability of successful output, F p , in a fault-tolerant circuit (Fig. 1d) is higher than that in a non-encoded circuit (Fig. 1c), f p , obtained with the same hardware when correct probability p is above a threshold. The detailed calculations of F p and f p are presented in the supplementary information.

Experimental setup
On each side of two regions A and B, optical spatial modes, as shown in Fig. 2a, are prepared by using a group of calcite beam displacers (BDs) that separate a beam into two parallel beams with orthogonal polarizations 40,41 . Using the classical entanglement between the polarization and spatial modes of the single photon 42 on each side, amplitudes between different spatial modes change accordingly by adjusting angles of related half-wave plates (HWPs). To generate the logical state |00〉 l , spatial modes are prepared to be |00〉 and |11〉 on both sides A and B. In order to realize coincidences between |00〉 A and |00〉 B , | 11〉 A and |11〉 B , initial entangled photons , where |H〉 (|V〉) denotes horizontal (vertical) polarization of photons, are imported into A and B, respectively. With the polarization of every mode adjusted as |00〉 A = |00〉 B = |H〉 and |11〉 A = |11〉 B = |V〉, 00 is achieved, and more details are introduced in Materials and Methods.
In an experiment, as shown in Fig. 2b, a continuous-wave diode laser with a wavelength of 404 nm and a bandwidth of 0.048 nm is used to pump a 20-mm-long periodically poled KTP (PPKTP) crystal with the help of a polarized Sagnac interferometer 43 to generate polarization-entangled photons |Φ〉. Based on this entangled source, Fig. 2c shows |00〉 l could be achieved with several BDs and HWPs which are adjusted along the preparation circuit shown in Fig. 1d. Similar implementation of logical operations H 2 and CNOT 21 is introduced in the supplementary information. In the measurement stage which is constructed to measure outputs of preparation and evolution (H 2 and CNOT 21 ), four spatial modes on ea0ch side are stepwise combined together with a group of BDs and HWPs. By rotating those HWPs, related spatial modes are selected to detect with the help of a polarization analysis unit (PAU) consisting of a quarter-wave plate, an HWP, and a polarization beam splitter. At last, photons on each side are counted by a single-photon detector (SPD), and signals of two SPDs are dealt by a coincidence device. Note that during the combination process, large optical path differences occur among several beams due to the unbalanced displacement, which are compensated with birefringent crystals (see Materials and Methods).
In an experiment, the error gate is realized by adjusting the deviation of HWPs' angles. To determine the error rate ϵ = 1 − p in every stage, we detect probability distributions of output spatial modes directly by a two- The unit to prepare entangled photon pairs. c Spatial mode evolutions of fault-tolerant circuits including the stages of preparation, logical operations (H 2 and CNOT 21 ), and measurement. Output spatial modes on each side of every stage are detected with removable detectors (RDs), which are built with single-photon detectors (SPD) placed on two-dimensional movable platforms, for coincidence counts to estimate the imported error rate. Final spatial modes on each side are combined together, where optical path differences among the modes on each side are offset by compensation crystals (CC), and then measured with a quarter-wave plate (QWP), an HWP, and a polarization beam splitter (PBS). The coincidence device deals with the detected signals from two sides and outputs the coincidence count dimensional movable SPD. Error rate ϵ is then estimated by comparing experimental probability distributions of all modes with the ideal prediction calculated through the error model (see Materials and Methods). The probability of successful output, F p , can be obtained by projecting the output state onto an ideal logical state basis. Concretely, we first obtain the total coincidence count N t which is the sum of eight modes with an even number of |1〉 on a physical basis, i.e., the total count in the encoded space. Output spatial modes are then projected to the ideal logical state with achieving the photon count N i . The successful probability F p is thus given by F p = N i /N t . Note that as both two counts are obtained in the same measured port, photon losses of optical elements are ignored.
We first demonstrate the high performance of Hadamard and CNOT gates on physical qubits in the experiment. Quantum process tomography is performed 44,45 (see Materials and Methods), and real parts of the experimentally reconstructed density matrix of both gates are shown in Fig. 3a, b, with fidelities of operational matrices 97.59 ± 0.01% and 99.19 ± 0.02%, respectively. The corresponding imaginary parts are small, which are illustrated in the supplementary information.
To investigate fault-tolerant circuits, we prepare a logical basis |00〉 l starting from the initial state |0000〉 along the circuit shown in Fig. 1b. Without importing error gates artificially, detected probabilities of complete basis are shown in Fig. 3c. Experimental results agree well with theoretical predictions. We deduce the inherent experimental error rate to be ϵ = 0.0007 ± 0.0001 (i.e., p = 0.9993 ± 0.0001).
The output state, 00 which could be treated as a single qubit, is reconstructed by quantum state tomography and depicted in the Bloch sphere on a basis {|0000〉, |1111〉} with a probability of correct output 99.53 ± 0.07% (Fig. 3d). In the evolution stage consisting of operations H 2 and CNOT 21 , the correct output probability of H 2 reaches 99.17 ± 0.26% with success probability p = 0.9963 ± 0.0001. The correct output probability of CNOT 21 ·H 2 reaches 97.98 ± 0.29% with success probability p = 0.9945 ± 0.0001.
Experimental results show that operations in this platform are extremely accurate, allowing us to observe the threshold effect in the fault-tolerant protocol. According to the introduced methods, the error rate ϵ = 1 − p is estimated based on experimental probability distributions of all modes. The illustrated results of ϵ = 0.034 for logical operation H 2 and ϵ = 0.032 for CNOT 21 ·H 2 are shown in Fig. 4a, b, respectively. For the circuit implementing logical operation H 2 , the threshold is p = 0.978 in theory. This threshold is consistent with Fig. 4c, in which the experimental probability of correct output, F p , is larger than the prediction f p of a non-encoded circuit detected in the same experimental platform (see more details in supplementary information) for p > 0.978, i.e., the right yellow region. On the other hand, when p < 0.978, we obtain F p < f p . Experimental results of logical operation   Fig. 4d, in which the predicted threshold is p = 0.968. The experimentally obtained F p is higher (lower) than the corresponding f p for p above (below) the threshold.
It is worthy to point out that multiphoton components in prepared photon pairs would reduce the successful output probability. We also investigate the fault-tolerant threshold based on 16 spatial modes of a single photon, with detailed experimental results introduced in supplementary. Comparing results obtained by using a single photon and two entangled photons, the best probabilities of successful output states in the single-photon framework, are about F p = 99.66 ± 0.07% for operation H 2 , and F p = 99.33 ± 0.02% for CNOT 21 , are higher than above results. Also, error bars reduce since total counts increase in the single-photon experiment. Still and all, the faulttolerant threshold is observed to be the same in both single-photon and two-entangled-photon experiments. Superior to the single-photon framework, the twoentangled-photon work reveals much better scalable properties of the experimental platform and provides the potential to investigate more complex fault-tolerant quantum computation.

Discussion
Using a concise fault-tolerant protocol, we experimentally demonstrate the threshold of a complete faulttolerant circuit with a Hadamard gate and a CNOT gate on logical qubits, besides preparing and measuring processes, with the bit-flip error in each operator. Generally, to verify a fault-tolerant protocol, the successful output probability of any circuit, formed with fault-tolerant gates, should be higher than that of the corresponding nonencoded circuit when the error rate is below a threshold. Note that rich encoding paths in the experimental setup enable different circuits for physical qubits to realize the same operations in logical space. However, only some configurations are fault-tolerant (see more analyses in supplementary information). Besides the circuit realized in this work, to implement another different circuit, we just need to rotate BDs and HWPs. And for some complicated cases, we need simply to add more sets of BDs and HWPs.
To completely demonstrate a universal fault-tolerant quantum computation remains a long-standing challenge. High-accuracy operations that can be achieved using optical systems establish an appropriate platform to  Also, based on this experimental platform, nonlocal errors affecting the entangled property could be further investigated under this encoding framework. Moreover, despite the limitation of the scale of an optical system, this work facilitates the potential investigation of fault-tolerant protocols with breakthroughs of large-scale experimental implementations of quantum technology based on silicon devices [13][14][15] , ion-trap 46 , superconductor [47][48][49] , and ultra-cold atoms 50 . Furthermore, the logical qubits constructed by physical qubits in the encoded space provide a possible method to accomplish many quantum information tasks. For example, the entanglement purification, which is able to distill the high-fidelity entangled states from the noisy lowquality entangled source [51][52][53] , could be achieved with the logic-qubit entanglement against bit-flip and phase-flip errors 54,55 . Another illustration is the long-distance quantum communication with logical qubits in which the fault-tolerant Calderbank-Shor-Steane encoding method is exploited to implement the ultrafast quantum communication across long distances [56][57][58] .

Materials and methods
The strategy of encoding logical qubits According to the FT protocol in ref. 21 , two logical qubits are encoded with four physical qubits as follows: where {|00〉 l , |01〉 l , |10〉 l , |11〉 l } represent the logical bases, and {|0000〉, |0011〉, |0101〉, |0110〉, |1001〉, |1010〉, | 1100〉, |1111〉} represent the bases of four physical qubits (the encoded space only involves even number of |1〉 in physical qubits). The four physical qubits are mapped to coincident modes of two entangled photons. As shown in Fig. 1a, with optical spatial modes on each side marked as |00〉, |01〉, |10〉, and |11〉, the basis of four physical qubits is denoted as the coincidence count between two spatial modes from the side A and B, respectively. As an illustration, the coincident mode |mnij〉 ≡ |mn〉 A ⊗ |ij〉 B (m, n ∈ {0, 1} A and i, j ∈ {0, 1} B ), i.e., the intensity and phase of basis |mnij〉 are related to the coincidence count between modes |mn〉 A and |ij〉 B .

Analysis of circuits with error gates
We introduce the detailed method of dealing with the error gates in the complete circuit. Here, taking the Hadamard operation on the second qubit in the logical space, as an illustration, the calculation is presented below. The Hadamard gate operation on the second logical qubit H 2 is written as, with σ I ¼ 1 0 0 1 being the identical operation and Denoting the state before H 2 as ρ hin , and after the operation H 2 , the state becomes Then the error gate E 2 acts on the second logical qubit and the final state is Similar methods are employed to analyze the other error gates in the complete circuit which are introduced in the supplementary information. Also, for the fault-tolerant circuit in the physical space shown in Fig. 1b, we use the same method to calculate the corresponding result. And during the evolutions, the probability distribution of every mode can be calculated step by step.
Using the above method, we can obtain the final state after all the quantum gates including the desired gates and error gates until the stage of ideal measurement. By denoting the final experimental output state as ρ out , the success probability is achieved by projecting ρ out to the ideal output state ρ ideal which is the theoretical prediction in the ideal circuit without the error gates. That means the success probability is Tr[ρ out .ρ ideal ].
For example, for the H 2 operation, the success probabilities are f p = p − 2p 2 + 2p 3 for the non-encoded circuit and for the fault-tolerant encoded circuit. Comparing f p and F p , it's easy to find that when p > 0.978, F p > f p , which means the corresponding success threshold is p = 0.978 and the error rate threshold is 1 − 0.978 = 0.022.
The preparation of logical state |00〉 l from two entangled photons The initial state of the optical spatial modes is in |0000〉 which equals |00〉 A ⊗ |00〉 B sharing the maximal polarization-entangled state Φ on both sides. Following the parallel but inherently different method of the quantum walk of correlated photons 59,60 , with the help of ancillary qubit -polarization, the preparation of logical state |00〉 l starting from initial | 0000〉 is introduced below.
For the initial state |0000〉 = |00〉 A ⊗ |00〉 B , the polarization of the photons in the modes of |00〉 A and |00〉 B are both along horizontal (|H〉) and vertical (|V〉).

Compensation of the interferometer
In the combination of optical modes, BDs are used to constitute the interferometer. For a balanced interferometer constructed by two BDs with an HWP inserted at 45°, the two beams have the same optical lengths. Since these two beams are close to each other and suffer the same environmental noise, this kind of interferometer is inherently stable. While for an unbalanced interferometer, a compensation crystal (CC) is placed on the path with a shorter optical length. In an experiment, the optical path difference between two beams from a BD with a length of 28.3 mm is about 2.28 mm. A length of 4-mm Lithium niobate (LiNbO3) crystal and several quartz plates are exploited as the CC inserted in the deflected beam to compensate for the different optical lengths. In our work, the visibility of the interferometer is very high to ensure that experimental measurement is implemented with a successful probability of 99.2-99.8% compared with the ideal project measurement. Note that, the part caused by the error rate is not compensated in the measurement and as a result, the decoherence between this error part and other successful modes will exist to match the error mode introduced in section I of supplementary information.

Estimation of the value ϵ
In the experiment, the error rate ϵ is imported by adjusting the deviation of HWPs' angle. All intensities of the 16 coincident modes are detected with the twodimensional movable detector on each side, which is shown in Figs. 3c, 4a, b, to obtain the corresponding probability distributions. The experimental probability distributions of all coincident modes are used to estimate the error rate ϵ by comparing with the ideal prediction calculated through the error model introduced in section I of supplementary information.

Details to perform the quantum process tomography
For the detailed tomography for a quantum process ε with denoting the process density matrices χ, the output of this process could be represented as ε(ρ) = ∑ m,n χ mn E-mρEn † for the input state ρ, where E m is one of the Pauli operators {I, X, Y, Z}. For the n-qubit density matrices, the number of elements χ mn is 2 2n . Scanning the input state ρ and performing the state tomography on the corresponding output state ε(ρ), we can reconstruct the density matrices χ with the maximum-likelihood method. In detail, for a single-qubit quantum gate, first, we prepare the six eigenstates of Pauli vectors, i.e., the states |H〉, |V〉, , as the input states. Then, for every input state, we perform the state tomographic measurement on the output state. At last, with the complete information of input and output states, we reconstruct the density matrices χ of the quantum gate based on the Pauli operators {I, X, Y, Z} using the maximum-likelihood technique. For a two-qubit quantum gate, the input states are set as the product states |A〉|B〉, where |A〉 and |B〉 are the six Pauli eigenstates on the regions of A and B, respectively. And the other steps are similar to the above description. Comparing the experimentally reconstructed density matrices χ exp with the theoretical prediction χ theo , we can achieve the fidelity Fide = Tr[χ exp .χ theo ].