{'fraction_non_alphanumeric': 0.043027023177982696, 'fraction_numerical': 0.01878093067967387, 'mean_word_length': 4.2441187453323375, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 1, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A quantum-logic gate between two optical photons with an efficiency above 40%

Optical qubits uniquely combine information transfer in optical fibres with a good processing capability and are therefore attractive tools for quantum technologies [1–4]. A large challenge, however, is to overcome the low efficiency of twoqubit logic gates. The experimentally achieved efficiency in an optical controlled NOT (CNOT) gate reached approximately 11% in 2003 and has seen no increase since [5]. Here we report on a new platform that was designed to surpass this long-standing record. The new scheme avoids inherently probabilistic protocols and, instead, combines [6–8] aspects of two established quantum nonlinear systems: atom-cavity systems [9] and Rydberg electromagnetically induced transparency (EIT) [10]. We demonstrate a CNOT gate between two optical photons with an efficiency of 41.7(4)% at a postselected process fidelity of 79(2)%. Moreover, we extended the scheme to a CNOT gate with multiple target qubits and produce entangled states of presently up to 5 photons. All these achievements are promising and have the potential to advance optical quantum information processing in which almost all advanced protocols would profit from high-efficiency logic gates [1–4, 11–14]. The field of quantum information processing based on optical systems advanced impressively in the last two decades. A recent highlight is the experimental demonstration of quantum computational advantage in Gaussian boson sampling [15]. However, the low efficiency of optical two-qubit gates hampers many other developments in the field. The hitherto record for the experimentally achieved efficiency of approximately 11% was set in 2003 [5] with a scheme that uses only linear optics and postselection. Without additional resources, such inherently probabilistic schemes experience a fundamental upper bound for the efficiency of 1/9 [16]. Only with additional resources including deterministic single-photon sources, the KLM scheme [17] shows that it is hypothetically possible to get arbitrarily close to unity efficiency. In practice, however, and despite experimental progress regarding such improved schemes [18], the actually achieved efficiency of a CNOT gate between optical photons has not exceeded 1/9 yet. An alternative strategy focuses on CNOT gates based on quantum nonlinear systems that avoid inherently probabilistic protocols. Such gates were demonstrated in two recent experiments, one using an atom-cavity system [9], the other using Rydberg EIT [10]. However, the demonstrated efficiency in these two experiments remained below 5% for technical reasons. We combine key components of these two experiments in one cavity Rydberg EIT experiment. This new approach overcomes previous difficulties and, for the first time, outperforms the 1/9 bound of postselected linear optical systems. It improves the long-standing efficiency record for optical CNOT gates by a factor of 3.8, leaving a factor of 2.4 to 100% efficiency. An analysis of current imperfections shows that these can be overcome in the future. Moreover, theory predicts that much higher efficiencies and fidelities are realistic with our system. This opens up perspectives for applications in optical quantum computing [2], in distributed quantum computing [11], or in high-efficiency optical Bell-state detection [12], which would be useful for linear-optics quantum-repeater schemes [13] and for a future quantum internet [4]. Concepts might also be transferred to the microwave domain [19]. Our multiple-target CNOT gate is interesting for applications in quantum error correction [1], and multiphoton entangled states might become powerful resources for linear optical quantum computing [3] and for measurement based quantum computing [14].

Optical qubits uniquely combine information transfer in optical fibres with a good processing capability and are therefore attractive tools for quantum technologies [1][2][3][4]. A large challenge, however, is to overcome the low efficiency of twoqubit logic gates. The experimentally achieved efficiency in an optical controlled NOT (CNOT) gate reached approximately 11% in 2003 and has seen no increase since [5]. Here we report on a new platform that was designed to surpass this long-standing record. The new scheme avoids inherently probabilistic protocols and, instead, combines [6][7][8] aspects of two established quantum nonlinear systems: atom-cavity systems [9] and Rydberg electromagnetically induced transparency (EIT) [10]. We demonstrate a CNOT gate between two optical photons with an efficiency of 41.7(4)% at a postselected process fidelity of 79(2)%. Moreover, we extended the scheme to a CNOT gate with multiple target qubits and produce entangled states of presently up to 5 photons. All these achievements are promising and have the potential to advance optical quantum information processing in which almost all advanced protocols would profit from high-efficiency logic gates [1][2][3][4][11][12][13][14].
The field of quantum information processing based on optical systems advanced impressively in the last two decades. A recent highlight is the experimental demonstration of quantum computational advantage in Gaussian boson sampling [15]. However, the low efficiency of optical two-qubit gates hampers many other developments in the field. The hitherto record for the experimentally achieved efficiency of approximately 11% was set in 2003 [5] with a scheme that uses only linear optics and postselection. Without additional resources, such inherently probabilistic schemes experience a fundamental upper bound for the efficiency of 1/9 [16]. Only with additional resources including deterministic single-photon sources, the KLM scheme [17] shows that it is hypothetically possible to get arbitrarily close to unity efficiency. In practice, however, and despite experimental progress regarding such improved schemes [18], the actually achieved efficiency of a CNOT gate between optical photons has not exceeded 1/9 yet. An alternative strategy focuses on CNOT gates based on quantum nonlinear systems that avoid inherently probabilistic protocols. Such gates were demonstrated in two recent experiments, one using an atom-cavity system [9], the other using Rydberg EIT [10]. However, the demonstrated efficiency in these two experiments remained below 5% for technical reasons.
We combine key components of these two experiments in one cavity Rydberg EIT experiment. This new approach overcomes previous difficulties and, for the first time, outperforms the 1/9 bound of postselected linear optical systems. It improves the long-standing efficiency record for optical CNOT gates by a factor of 3.8, leaving a factor of 2.4 to 100% efficiency. An analysis of current imperfections shows that these can be overcome in the future. Moreover, theory predicts that much higher efficiencies and fidelities are realistic with our system. This opens up perspectives for applications in optical quantum computing [2], in distributed quantum computing [11], or in high-efficiency optical Bell-state detection [12], which would be useful for linear-optics quantum-repeater schemes [13] and for a future quantum internet [4]. Concepts might also be transferred to the microwave domain [19]. Our multiple-target CNOT gate is interesting for applications in quantum error correction [1], and multiphoton entangled states might become powerful resources for linear optical quantum computing [3] and for measurement based quantum computing [14].

Protocol
Rydberg EIT in an ultracold atomic gas essentially maps the giant dipole-dipole interaction between Rydberg atoms onto optical photons. This makes it possible to build a single-photon switch [20,21] in which the presence of a single photon toggles the transmission of another photon from on to off. To this end, it is advantageous to store the first photon, called control photon, in the atomic ensemble in the atomic Rydberg state |r using EIT-based storage [22]. Next, the second photon, called target photon, impinges onto the atomic ensemble. Finally, the control photon is retrieved. In the absence of a stored excitation in state |r , the target photon experiences Rydberg EIT with a Rydberg state |r resulting in high transmission. If an excitation in state |r is present, however, then the interaction between the two Rydberg states will shift the system away from the EIT two-photon resonance, thus causing low transmission of the target photon. Overall, this yields loss of the target photon conditioned on the presence of a single control photon.
Placing this system inside a one-sided optical resonator converts the conditional loss into a conditional π phase shift [23][24][25]. This is because, for large (small) intracavity loss, the cavity is undercoupled (overcoupled). This cavity approach offers an efficient way of harvesting the nonlinearity of Rydberg EIT and makes a highefficiency CNOT gate possible, similar to the proposals Polarising beam splitters (blue squares) map between incoming and outgoing polarisation qubits and internal dual-rail qubits. One rail of each qubit impinges onto the cavity, the other rail bypasses the cavity. If the control qubit impinges onto the cavity, it is stored in a Rydberg state. Subsequently, the target photon enters the system. A conditional π phase shift is experienced if both qubits are in their cavity rails. After the interaction with the target photon, the control photon is retrieved. The bypass rail of the control qubit is delayed in an optical fibre to match the delay resulting from storage. The octagon represents the vacuum chamber.
in Refs. [6,7]. Fig. 1 shows how we convert this conditional π phase shift into a controlled π phase gate for the polarisation qubits of two optical photons. Ideally, the gate should be a linear map of pure states onto pure states, characterised by |HH → |HH , |HV → e iπ |HV , |V H → |V H , and |V V → |V V . Here, the control qubit is listed first and H, V , D, and A denote the linear polarisations which are horizontal (H), vertical (V ), diagonal (D, 45 • ), and antidiagonal (A, −45 • ). In essence, the scheme in the figure temporarily converts the incoming polarisation qubits into dual-rail qubits. The quantum amplitude corresponding to the rails in which both qubits impinge onto the cavity experiences the conditional π phase shift.

Experimental Set-up
In our experiment, the incoming signal light pulses are derived from a laser and have a Poissonian photon number distribution with a mean photon number much below one. Some data in this paper are postselected upon the detection of exactly one control photon and exactly one target photon. Mostly, this removes cases in which an incoming pulse contains zero photons or in which an incoming pulse contains one photon which is lost. Note, however, that the gate does not use an inherently probabilistic scheme.
The core of the experiment is an ensemble of 260 87 Rb atoms at a temperature of 0.4 µK, held in an optical dipole trap, located in a bow-tie cavity with a finesse of 350. The coupled atom-cavity system is characterised by (g, κ, γ)/2π = (1.0, 2.3, 3.0) MHz, where g is half of the vacuum Rabi frequency for a maximally-coupled single atom, κ is the half width at half maximum (HWHM) cavity linewidth, and γ is the HWHM linewidth of the atomic transition. This results in a collective cooperativity of 21 (see methods). Each light pulse lasts 1 µs, thus roughly matching 2π/κ.

Results
Parts a and b of Fig. 2 show postselected truth tables measured in two different bases. To measure these data, one of the indicated states is used as an input, and the measured probabilities of obtaining the indicated output states in a measurement are displayed. The average fidelity of each truth table is the arithmetic mean of the four labelled probabilities. Parts c and d of the figure show the postselected output density matrix obtained in quantum state tomography [1] for the input state |DD . Ideally, the output state should be a Bell state. The fact that the postselected Bell state fidelity [26] exceeds 50% amounts to witnessing two-qubit entanglement.
We further analyse the performance using quantum process tomography [1]. Instead of characterising the output state for only a few selected input states, quantum process tomography gives a complete characterisation of the quantum process, i.e. it yields a map from the 4 × 4 density matrix ρ in at the input to the 4 × 4 density matrix ρ out at the output. This map is assumed to be linear. Hence, to characterise this map, it suffices to experimentally determine ρ out using quantum state to- mography for 16 linearly independent matrices ρ in . The thus reconstructed map from ρ in to ρ out can be characterised by a complex 16×16 process matrix χ (methods). The elements of χ are shown in Fig. 3 after postselection. Along with χ, a postselected process fidelity [26] of 79(2)% is inferred. This is clearly above the classical limit of 50%. As expected, the postselected Bell state fidelity in Fig. 2 equals the postselected process fidelity within the experimental uncertainties.
The efficiency of the gate is the probability that no photon is lost inside the gate, if one control and one target photon impinge onto the gate. The gate is the part of the setup which is shown in Fig. 1. The efficiency also includes optical elements like lenses and waveplates which are not drawn in Fig. 1 for simplicity. The only components which are not included in the efficiency are the light source and the detection setup. This makes sense because neither light sources nor detectors need to be cascaded in a sequence of gates. The efficiency depends on the input polarisation states (see methods). Averaging over the measured efficiencies of the four states of the CPHASE basis from photon pair (see methods). This number is factors of 520 and 1.3×10 4 larger than in Refs. [9] and [10], respectively, thus making much more demanding experiments possible in a realistic data acquisition time.
A key factor why the efficiency outperforms that reported in Ref. [9] is that more atoms create more conditional loss. This allows us to operate at higher collective cooperativity and at much lower cavity finesse, which both mitigate a variety of technical problems such as mirror absorption and scattering relative to mirror transmission. Compared to Ref. [10], the out-performance comes from the cavity that makes the light pass through the same Rydberg blockade volume many times. This enabled us to reduce the atomic density and, in consequence, the dephasing rate due to atomic collisions [27].
The efficiency we achieved is below 100% for technical reasons. The dominant limitation is dephasing, although of a different origin than in Ref. [10]. When EIT coupling light is on (off), dephasing is now dominated by laser phase noise (differential light shifts in the dipole trap). Reducing laser phase noise and operating the dipole trap at a different wavelength [27] is expected to massively reduce dephasing. In addition, the delay fibre could be replaced by a high-efficiency quantum memory. A detailed analysis based on the models of Refs. [7,22] predicts a two-qubit gate efficiency far above 90% along with a much improved postselected fidelity.
The two-photon gate implemented here is easily extended to a multiple-target CNOT gate [1], thus allowing us to directly produce multi-photon entanglement. This scalability provided by our scheme is advantageous because fewer resources are required compared to cases where several two-qubit gates are cascaded. In particular, an N -photon Greenberger-Horn-Zeilinger (GHZ) state |ψ N = (|H ⊗N + |V ⊗N )/ √ 2 can be generated by sending one control photon and N − 1 target photons onto the gate in an input state with polarisation |D ⊗N . We choose to assemble all target photons in one pulse. The target pulse lasts long enough that interactions among target photons are negligible. Hence, each target photon simply acquires a π phase shift conditioned on the presence of the same control photon. Hence, this input state is mapped onto the output state (|H |A ⊗(N −1) + |V |D ⊗(N −1) )/ √ 2. A simple singlequbit unitary applied to all outgoing target photons converts this into the above GHZ state |ψ N .
To detect an N -photon GHZ state, we again use input pulses with a Poissonian photon number distribution. But this time, we postselect upon the detection of exactly one control and exactly N − 1 target photons. To verify the N -photon entanglement, we study parity oscillations [28]. From the experimental data in Fig. 4, we calculate the coherence and obtain C 3 = 47.5(6)%, C 4 = 39.2(2)%, C 5 = 37(8)%, and C 6 = 21(4)%. Our data clearly rule out a completely incoherent mixture for all these values of N , because that would imply C N = 0. In addition, we measure the populations of the states |H ⊗N and |V ⊗N and use the results to calculate P N = (|H H|) ⊗N + (|V V |) ⊗N . Combining these results, we determine the postselected state fidelity [28] F N = ψ N |ρ out |ψ N = 1 2 (P N + C N ) and obtain F 3 = 62.3(4)%, F 4 = 54.6(1.4)%, F 5 = 55(5)%, and F 6 = 36(4)%. At least some of the F N lie significantly above the classical limit of 50%.

Conclusion
High-efficiency optical gates have the potential to become useful for many applications in optical quantum information. For example, high-efficiency gates could drastically reduce the resource cost [29] in a variety of optical quantum computing schemes. The fact that the first realisation of an optical photon-photon CNOT gate [5] already achieved an efficiency around 1/9 and that no improvement had been made in almost two decades might have narrowed the application perspective of optical quantum computing. Questions like which optical quantum computing schemes are most promising might find new answers, now that the present work makes much higher efficiencies in photon-photon quantum gates a reality.
After preparing this manuscript, we became aware of a measurement of a conditional π phase shift based on cavity Rydberg EIT [30].

Methods
Cavity As the vacuum system used in our previous experiments [10,20] did not offer enough room to house the cavity, we set up a new vacuum system. The cavity consists of four mirrors in bow-tie geometry (supplement) with an axial mode spacing of ∆ω ax /2π = 1.59 GHz, a finesse of F = 350, and a beam waist (1/e 2 radius of intensity) of w c = 8.5 µm. The cavity is one sided, i.e. it has an input-output coupler with a moderate reflectivity of 98.3% while each of the other cavity mirrors has a much higher reflectivity of 99.990%. These numbers refer to EIT signal light at a wavelength of 780 nm. For EIT coupling light at a wavelength of 480 nm, however, all mirrors have negligible reflectivity. A piezo actuator is used to stabilise the cavity length.

Atomic ensemble and transitions
The experiment begins with the preparation (supplement) of an ultracold gas of 87 Rb atoms in a crossedbeam optical dipole trap (ODT). The atomic ensemble is located at the beam waist of the cavity. We choose the z axis such that it points along the wave vector of the control signal light at the location of the atomic ensemble. We choose the y axis to be vertical. The atomic ensemble has a temperature of T = 0.44 µK and an atom number of N a = 260. With measured trapping frequencies of (ω x , ω y , ω z )/2π = (0.31, 0.23, 0.60) kHz, the root-mean square (rms) radii of the atomic ensemble are estimated to be (σ x , σ y , σ z ) = (3.3, 4.5, 1.7) µm. The atomic energy levels used in the experiment are the ground state |g = |5S 1/2 , F =2, m F =−2 , the first electronically excited state |e = |5P 3/2 , F =3, m F =−3 and two Rydberg states, namely |r = |48S 1/2 , F =2, m F =−2 for the control qubit and |r = |50S 1/2 , F =2, m F =−2 for the target qubit. Here, F, m F are hyperfine quantum numbers. All atoms are prepared in the stretched spin state |g . A magnetic hold field of 0.10 mT applied along the positive z axis suppresses the randomisation of the spin orientation by noise of the ambient magnetic field.
The rms cloud radii along all three dimensions are smaller than the Rydberg blockade radius of approximately 7 µm (supplement). This results in a superatom geometry [31], in which a single stored Rydberg excitation from the control pulse causes Rydberg blockade for all atoms during the target pulse. To address an electrically tuned Förster resonance [21], an electric field of 0.7 V/cm is applied along the positive z axis.

EIT
The EIT signal light is resonant with the |g ↔ |e transition. The EIT coupling light during the control (target) pulse is resonant with the |e ↔ |r (|e ↔ |r ) transition. As seen in Fig. 1, the EIT signal light beams for control and target light counterpropagate each other. The wave vector of each of the two EIT coupling beams is chosen to counterpropagate the corresponding EIT signal beam. This minimises the net photon recoil in the EIT two-photon transition. Hence, this minimises dephasing caused by thermal atomic motion [27]. The control (target) EIT coupling beam has a peak power of 30 mW (70 mW). At this value, the coupling Rabi frequency was measured to be 20 MHz (43 MHz) (supplement). From this, we estimate a beam waist of 21 µm (14 µm).
The incoming control signal light pulse has an intensity proportional to cos 2 (π(t−t c,in )/t c ) if |t−t c,in | ≤ t c /2 and 0 otherwise. Here, t c = 1.0 µs is the control pulse duration and t c,in is the centre of the control pulse. The outgoing control signal light pulse has the same pulse shape with the same duration t c but a delayed centre t c,out = t c,in + t c + t t . The incoming target signal light also has the same pulse shape with a target pulse duration t t = 1.0 µs and a centre of the incoming target pulse t t,in = t c,in +(t c +t t )/2. During storage and retrieval, the pulse shape of the control EIT coupling light is chosen according to the model of Ref. [22]. During the target pulse, however, the target EIT coupling light has a constant power, which is chosen to be the above-mentioned maximum.

Atom-cavity coupling
The coupled atom-cavity system is characterised by (g, κ, γ)/2π = (1.0, 2.3, 3.0) MHz, where g is half of the vacuum Rabi frequency for a maximally-coupled single atom, κ is the HWHM cavity linewidth, and γ is the HWHM linewidth of the atomic |g ↔ |e transition. An important figure of merit is the collective cooperativity where g i is half of the vacuum Rabi frequency of the ith atom, which depends on the position of the ith atom. A high-performance gate requires [6,7,22] C 1. While the single-atom cooperativity g 2 /(κγ) = 0.14 is below one, C can easily be made much larger than one because N a is large. All data in this paper are recorded with C = 21(1) (supplement).

Timing and dual rail set-up
We prepare a new atomic sample every 4.3 s. Once, a cold atomic ensemble has been prepared, we repeat the quantum gate experiment many times. Each repetition causes a tiny amount of photon-recoil heating and evaporative atom loss. To avoid large changes of N a and T , we discard the atomic ensemble after 10 4 repetitions of the experiment and we prepare a new atomic ensemble. The EIT coupling light creates a repulsive potential for the atoms [10,20]. To make its effect onto the atomic density distribution negligible, each repetition of the experiment which lasts 3 µs is followed by 97 µs of hold time with only the ODT applied, yielding a repetition rate of 10 kHz. Including the time needed to prepare the atomic ensemble, the average repetition rate is 2.3 kHz.
One quantum gate experiment consists of three steps. First, the control photon enters the setup, second, the target photon enters the setup and leaves it, and, third, the delayed control photon leaves the setup. The dark time between consecutive steps is negligible. Photons which leave the setup are readily detected.
During step one, the leftmost polarising beam splitter (PBS) in Fig. 1 converts the polarisation qubit of the incoming control light pulse into a dual-rail qubit. One rail impinges upon the cavity and is stored as a stationary Rydberg excitation in state |r during the first step of the experiment. During step three, this photon is retrieved. The storage and retrieval results in a delay of t c + t t . The rightmost PBS in Fig. 1 overlaps the retrieved control light with the control light from the other rail such that the dual-rail qubit is converted back into a polarisation qubit. To achieve high fidelity of the gate, the components from both rails must have the same delay. Hence, control light in the bypass rail is delayed in a 400-m long polarisation maintaining single mode fibre, which causes a delay of 2.0 µs. During step two, the polarisation qubit of the incoming target pulse is also converted into a dual-rail qubit. One rail is reflected from the cavity. Upon this reflection, a conditional π phase shift is acquired. A PBS overlaps the reflected target light with target light in the other rail, which simply bypasses the cavity. This overlap converts the dual-rail qubit back into a polarisation qubit and simultaneously separates the target light from the counterpropagating control light. Two of the mirrors shown in Fig. 1 are mounted on piezos, which are used to stabilise the path length differences between the rails for each qubit based on measurements with reference light. Quarter waveplates, omitted in Fig. 1, map between the linear polarisations H and V and the circular polarisations required for driving the desired atomic transitions.

Efficiency
The measured combined efficiency of storage and retrieval of the control photon is η sr = 39(1)%, in the absence of a target photon. This number is quite a bit lower than the theoretical expectation of 66% (supplement). This discrepancy is probably caused by laser phase noise during storage and during retrieval. The measured transmission of the control photon through the delay fibre is η f = 65%, including mode matching. This is compatible with the specified attenuation of −4.3 dB/km, which would suggest 67%.
The measured reflection coefficient for the target light is |R| 2 = 90(1)% in the absence of a control pulse. If, however, a control photon was previously stored in state |r , this causes Rydberg blockade and the reflectivity of the target light becomes |R b | 2 . At the same time, the fact that a target photon is reflected from the cavity reduces the combined efficiency of storage and retrieval of the control photon to η sr,t ≤ η sr . Most of the experimental data in this paper are not sensitive to η sr,t and |R b | 2 separately, but only to the product η sr,t |R b | 2 (supplement). We measure η sr,t |R b | 2 = 17(2)%. If we naively assumed η sr,t = η sr , this would correspond to |R b | 2 = 43(4)%.
Combining the above numbers and ignoring possible loss if the target photon bypasses the cavity, one expects the efficiencies (η f , η f |R| 2 , η sr , η sr,t |R b | 2 ) = (65%, 59%, 39% ,17%) for the CPHASE basis states. The arithmetic mean thereof is 45%, which is close to the measured average efficiency. The discrepancy comes from loss of pho-tons e.g. on imperfect anti-reflection coatings on waveplates, lenses, PBSs, etc., some of which are omitted in Fig. 1 for clarity.

Coincidence rate
The experimental apparatus includes two identical detection setups, one at each output port of the gate. To perform a polarisation resolved detection of signal photons, each detection setup consists of waveplates and one PBS. Each of the two output ports of each PBS is sent onto a superconducting nanowire single photon detector (SNSPD). Polarisation maintaining single mode fibres are used to transport the light to the SNSPDs. The fibre coupling efficiency of approximately 85% is caused partly by mode matching, partly by losses in the input-output couplers of the fibre, and partly by losses caused by a fibre splice. The quantum efficiency of each SNSPD is specified to be above 90%. Hence, if one control and one target photon leave the gate, the probability of detecting both is approximately (0.85 × 0.90) 2 = 0.59. Multiplying this with the 41.7% average efficiency of the gate, one obtains a 24% probability of detecting a two-photon coincidence per incoming photon pair. Multiplying this with the average repetition rate yields a two-photon coincidence rate of 560 s −1 per incoming photon pair. This is a factor of 1.3 × 10 4 larger (supplement) than in our previous apparatus [10], which is a tremendous improvement.
The mean photon numbern c (n t ) in the incoming control (target) pulse should not be too large because that would degrade the measured postselected fidelity due to events with more than one incoming control (target) photon. On the other hand,n c andn t should not be too small because that would increase the data acquisition time and make the system more sensitive to dark counts. The data in Figs. 2 and 3 are measured withn c = 0.14 andn t = 0.13. We multiplyn cnt with the two-photon coincidence rate per incoming photon pair and obtain a naive estimate for the two-photon coincidence rate of 10 s −1 . In daily alignment, we measure 9 s −1 . It is this high coincidence rate which makes it possible to perform demanding measurements in a reasonable data acquisition time. For example, the data acquisition time for the process tomography in Fig. 3 was 69 min.

Quantum process tomography
To characterise the map from ρ in onto ρ out , we write it as ρ out = 16 i,j=1 A i ρ in A † j χ i,j . The 4 × 4 matrices A i are chosen at will to form an orthonormal basis of operators, i.e. tr(A † i A j ) = δ i,j . Each χ i,j is a complex number. The collection of these numbers is regarded as a 16 × 16 matrix χ, called the process matrix [1]. Of course, the matrix representation χ i,j depends on the choice of the basis formed by the A i . χ is determined from a large enough collection of measurement outcomes by inverting a linear system. As soon as χ has been determined, one can predict ρ out for an arbitrary ρ in .
We choose the 16 matrices A i to be A i = 1 2 U ideal B i , where the unitary 4 × 4 matrix U ideal describes the oper-ation of the ideal two-qubit gate and where the 4 × 4 matrices B i are the 16 tensor products which can be formed from the single-qubit Pauli matrices I, X, Y , and Z, i.e. B 1 = II, B 2 = IX, B 3 = IY , B 4 = IZ, B 5 = XI, ..., B 16 = ZZ. The B i are used as labels in Fig. 3. This choice of the A i is beneficial insofar as the postselected process fidelity equals χ 1,1 . Ideally, this value should be unity and all other χ i,j should vanish. For completeness, we note that as input states, we choose the 16 tensor product states which can be formed from the single-qubit states H, V , D, and R. For the polarisation conventions, see supplement.

Parity oscillation
For simplicity, we fit S (N ) ϑ = p cos(N ϑ) with a free fit parameter p ∈ [0, 1] to the data in Fig. 4. This simple curve is expected, e.g. if ρ out = p|ψ N ψ N | + (1 − p)I, where I is the identity matrix. The measurements for N ∈ {3, 4, 5} use the same mean input photon numbers as above. The measurement for N = 6 usesn c = 0.28 andn t = 0.88. As an alternative to the direct calculation of C N as described above, one can insert the fit curve into this calculation. This yields C N = p and makes use of all the available data instead of only the points for ϑ = πk/N with k ∈ {0, 1, 2, . . . , N − 1}. We used this method only for processing the N = 6 data.

I. COOLING AND TRAPPING OF ATOMS
To prepare the atomic ensemble in our new vacuum system, a two-dimensional magneto-optical trap (MOT) generates a continuous cold beam of 87 Rb atoms, which is captured in a three-dimensional (3D) MOT. The latter is overlapped with the crossed-beam ODT with a light wavelength of 1064 nm. One ODT beam has a power of 0.45 W, a horizontal wave vector, and beam waists of w y = 15 µm and w z = 11 µm. The other ODT beam has a power of 0.10 W, a vertical wave vector, and beam waists of w x = w z = 12.5 µm. After collecting atoms in the 3D MOT for 0.5 s, the parameters of the 3D MOT are altered similar to Ref. [S1] to increase the atom number in the ODT. In particular, the power of the repumping laser is much reduced. 30 ms later, both MOTs are switched off and polarisation gradient cooling is applied for 50 ms. After this, the atoms are held in the ODT.
The atomic ensemble in the ODT is further cooled by applying the first two stages of Raman cooling described in Ref. [S2] but in a crossed-beam ODT. This Raman cooling lasts 0.5 s and it spin polarises the atoms by optically pumping them into the state |g . During the cooling, the powers of both ODT beams are progressively lowered. For a cold dilute ensemble in a deep ODT, we measured a 1/e lifetime of the atom number of 30 s, which sets a limit to background gas collisions. After the Raman cooling, the power of the ODT is lowered to 4.5 mW (5 mW) for the ODT beam with horizontal (vertical) wave vector to reach T = 0.44 µK and N a = 260.
This corresponds to a peak density of peak = 6 × 10 11 cm −3 and a peak phase space density of 0.014. Note that density-dependent dephasing resulting from collisions of a Rydberg atom with surrounding ground state atoms is less of an issue than it was in Ref. [S3] because we operate at a much lower principal quantum number. For signal light at λ = 780 nm driving a cycling transition, the cross section for absorption of a photon is σ cyc = 3λ 2 /(2π) and the maximal on-axis (x = y = 0) on-resonance optical depth is d t,peak = σ cyc dz = 0.8.

II. IMPROVED COINCIDENCE RATE
Here, we discuss the physical origin of the factor of 1.3 × 10 4 improvement of the coincidence rate per incoming photon pair compared to our previous apparatus [S4], in which the two-photon coincidence rate was 1.3×10 −5 ×0.56 kHz/(0.33×0.50) = 0.044 s −1 per incoming photon pair. An obvious contribution comes from the higher average repetition rate, which was 10 4 /(18 s) = 0.56 kHz in Ref. [S4]. Another contribution comes from the higher efficiency of collecting and detecting an outgoing signal photon, which was 25% in Ref. [S5], caused partly by the different fibre coupling efficiency and partly by the different efficiency of the single photon detec-tor, which was 50% in Ref. [S4]. Yet another contribution comes from the higher average efficiency of the gate, which in Ref. [S4] included only loss in the atomic ensemble and was (7.7, 2.3, 1.5, 0.45)% for the CPHASE basis states with an average of 3.0%. When creating a Bell state, the polarisations with higher gate efficiency were attenuated in the first interferometer in Ref. [S4] before the light impinged onto the atoms. On the upside, these imbalanced input intensities resulted in wellbalanced output intensities, which boosted the postselected Bell state fidelity. On the downside, most of the light experienced an efficiency near 0.45% instead of the average 3.0%. Such imbalanced input intensities are not used in our present work. The contributions listed so far explain a factor of 2. The remaining factor of approximately 3.6 comes from three contributions. First, the second interferometer, which was needed to remove a frequency shift, contributed to loss of photons between the atomic ensemble and the detector in Ref. [S4]. Second, the light was coupled into a fibre in front of this interferometer and into a second fibre behind this interferometer so that two fibre coupling efficiencies occurred between the atoms and the detector. This interferometer is no longer needed in the new apparatus and now light passes through only one fibre between the atoms and the detector. Third, the data acquisition time for quantum state tomography of one Bell state in Ref. [S4] was long. These data were accumulated from several nonconsecutive days. Some components were not perfectly kept at optimal performance over this full time span.
For comparison, the single-atom experiment in Ref.
[S6] measured a two-photon coincidence rate of 0.033 s −1 in daily alignment. Division byn cnt withn c =n t = 0.17 yields a two-photon coincidence rate of 1.1 s −1 per incoming photon pair. This is a factor of 25 higher than in our previous experiment [S4] and a factor of 520 lower than our present experiment.

A. Theory
The one-sided cavity is characterised by the complex reflection coefficient r in of the input-output (I/O) coupler and by the product r H of the complex reflection coefficients of all three highly reflective (HR) cavity mirrors. We use these quantities to define Here, the decay rate coefficient κ in (κ H ) describes the decay of the intracavity field caused by the I/O coupler (HR mirrors), κ = κ in +κ H is the total decay rate, and F is the empty-cavity (i.e. N a = 0) finesse. For simplicity, the I/O coupler is assumed to be lossless. In the absence of Rydberg blockade, the reflection of the signal light field impinging onto the cavity is described by the complex coefficient [S7] where ∆ c = ω − ω c is the detuning of the angular frequency ω of the signal light from the nearest cavity resonance ω c . In addition, we abbreviated an effective cooperativity where 1 Γe = 1 2γ is the 1/e lifetime for population decay of state |e and where γ rg describes decay of the density matrix element ρ rg according to (∂ t + 1 2 γ rg )ρ rg = 0, which is typically dominated by dephasing [S8]. ∆ s = ω − ω ge (∆ co = ω co −ω er ) is the detuning of the angular frequency ω (ω co ) of the EIT signal (coupling) light from the atomic resonance ω ge (ω er ). Ω is the Rabi frequency of the EIT coupling light.
The model of Eqs. (S4) and (S5) relies on neglecting all but one of the axial cavity modes. This is a good approximation, if F 1, |∆ c | ∆ω ax , and |C eff | F/π. The last condition is equivalent to saying that the transversely averaged optical depth in a single cavity round trip must be small. In addition, Eq. (S4) assumes perfect matching of the incoming light to the fundamental transverse mode of the cavity. Moreover, if the ensemble is small in the transverse direction, this might result in a fairly large on-axis optical depth d t,peak . Hence, some part of the atoms might experience a noticeable shadow cast by other atoms upon a single passage of the light through the medium. The model of Eqs. (S4) and (S5) with C = Na i=1 |g i | 2 /(κγ) does not take a possible transverse inhomogeneity of such a shadow effect into account.

B. Experiment
With a standard method, based on light transmitted through the cavity, we extract a mode matching of 99.1% of the incoming light to the fundamental transverse cavity mode. With an alternative method, based on light reflected from the cavity, we extract a mode matching of 98.0%.
Measurements of ∆ω ax and κ yield F = 350. Combining this with the measured resonant empty-cavity reflection coefficient |R empty | 2 = 0.932 and with Eq. (S4) with C eff = 0 yields F H = 2.0 × 10 4 . From this we obtain |r in | 2 = 98.3% for the I/O coupler and |r H | 2/3 = 99.990% FIG. S1: Cavity Rydberg EIT spectra. a, the relative intensity and b the phase of the light reflected from the cavity is shown as a function of the signal detuning ∆c/2π. Red (blue) data were recorded in the absence (presence) of EIT coupling light. The experiment is obviously deeply in the regime of large normal-mode splitting. The blue data clearly show an EIT feature at zero detuning. Fits (lines) to the data (dots) reveal important experimental parameters, namely the collective cooperativity C, the EIT coupling Rabi frequency Ω, and the coherence time 1/γrg. for each of the three HR mirrors. The latter is consistent with the finesse measured in a test resonator made of four HR mirrors from the same coating run.
For calibration purposes, we perform measurements without the control photon. Parts a and b of Fig. S1 show the relative intensity and the phase of target signal light reflected from the cavity as a function of the detuning ∆ c /2π of the signal light from the cavity resonance. The measurement is performed with ∆ co ≈ 0, and with ω c ≈ ω ge so that ∆ c ≈ ∆ s , see Sec. VI. The red data are taken in the absence of EIT coupling light, Ω = 0. The intensity clearly exhibits a normal-mode splitting, which is much larger than the linewidth. The phase shows two dispersive features with small amplitude, one at each normal mode. The blue data are taken in the presence of EIT coupling light. The resulting cavity EIT causes the intensity to exhibit a narrow EIT feature centred at ∆ c = 0. In addition, the normal-mode splitting is somewhat increased. When tuning ∆ c through zero, cavity EIT causes a 2π phase boost.
At resonance, ∆ c = 0, the phase is 0 (π) in the absence (presence) of EIT coupling light. This shows the origin of the conditional π phase shift on which the gate is built in a nutshell, much like in Ref. [S5]. This is because if a stationary Rydberg excitation is added, then Rydberg blockade will detune the EIT coupling light so far that the presence of the EIT coupling light becomes irrelevant. Hence, the presence (absence) of a stationary Rydberg excitation is expected to be equivalent to the absence (presence) of EIT coupling light.
To characterise the parameter values of the cavity Rydberg EIT system, we fit the above analytic model Eqs. (S4) and (S5) simultaneously to the data in parts a and b of Fig. S1. The fit to the red data in Fig. S1 yields the collective cooperativity C = 21.4 (2), where the values of F, κ, and κ in are taken from previously described measurements and the value of the atomic linewidth Γ e /2π = 6.0666 MHz is taken from the literature. A subsequent fit to the blue data yields the EIT coupling Rabi frequency Ω/2π = 42.7(3) MHz and the coherence time 1/γ rg = 0.22(5) µs, where the previous values of F, κ, κ in , Γ e , and C are used.
Apart fromn c = 0,n t = 0.19, and scanning ω, this measurement is performed at the same settings as for the process tomography in Fig. 3, e.g. with the same target pulse shape, the same target pulse duration, the same Rydberg state |r = |50S 1/2 , F =2, m F =−2 , and the same electric field of 0.7 V/cm.
If N a = 260 atoms were maximally coupled, then we would expect to measure C = 37. The discrepancy from the experimental observation is mostly due to the nonzero transverse sample size which reduces the expectation for C by a factor of [1 + (2σ x /w c ) 2 ] −1/2 × [1 + (2σ y /w c ) 2 ] −1/2 = 0.54 to C = 20. Including the transversely inhomogeneous shadow, discussed below Eq. (S5), reduces this expectation to C = 19. Additional contributions might come from imperfect alignment of the cloud center relative to the cavity mode and uncertainties in the calibration of the measurement of the atom number based on absorption imaging. The overall factor resulting from these additional contributions seems to be small.

IV. MODELLING STORAGE AND RETRIEVAL
In the adiabatic limit of slowly varying pulse envelopes, the combined efficiency of storage and retrieval can be modelled analytically, yielding [S9] η sr = κ in κ where t dark is the dark time between the end of storage and the beginning of retrieval. The atoms are not truly in the dark during this so-called dark time because the crossed-beam ODT is always on continuously in our present work. We vary t dark and measure the corresponding value of η sr . This yields an approximately Gaussian decay with a 1/e time of 7 µs, which is fairly close to the expectation inside the ODT based on a minor extension of the model of Ref. [S8]. Following Ref. [S9], we model this as an exponential decay and, for simplicity, we choose the same 1/e time 1/γ rg = 7 µs. Combining this with C = 21 and t c + t dark = 2.0 µs, Eq. (S6) predicts η sr = 66.1%. In the limit γ rg → 0, Eq. (S6) would predict η sr = 88.0%. Hence, according to the model, γ rg gives rise to more than half of the imperfections in η sr . To test the quality of the adiabatic approximation used to derive Eq. (S6), we numerically solve the differential equations in Ref. [S9] without approximations. This yields η sr = 64.7%. We conclude that the adiabatic approximation works well in this parameter regime. Note that, for simplicity, γ rg is assumed to be time independent when deriving Eq. (S6). This is not necessarily realistic because issues like laser phase noise or like fluctuations of the ambient magnetic or electric field can effectively increase [S10] γ rg during storage and retrieval, while they do not contribute to the decay of η sr as a function of the dark time [S8].
Reflecting one target photon from the cavity during the dark time decreases the combined efficiency of storage and retrieval from η sr to η sr,t . Measuring η sr,t is nontrivial because we do not use a single-photon source for the target photon. Hence, to learn something about η sr,t we rely on postselecting data upon detection of a reflected target photon. Essentially, this means that we measure a coincidence rate which reveals the product η sr,t |R b | 2 but not η sr,t and |R b | 2 separately. Likewise, when aiming at measuring |R b | 2 , we do not use a single-photon source for the control photon. Hence, we rely on postselecting data upon detection of a retrieved control photon. Essentially, this means that we measure the same coincidence rate as above.

V. POLARISATION CONVENTIONS
All the input and output polarisations refer to the polarisation at the points at which the qubits enter and leave the gate, which is the part of the setup shown in Fig. 1. For a plane light wave with wave vector k, the electric field is given by E(x, t) = 1 2 E 0 ue ik·x−iωt + c.c., where E 0 is a complex amplitude, ω > 0 is the angular frequency, and u is the complex polarisation unit vector. If k is along the positive z axis, then for horizontal (vertical) polarisation u = e x (u = e y ), where (e x , e y , e z ) is the righthanded Cartesian basis. The polarisation bases used here are connected by |D = (|H + |V )/ √ 2, |A = (|H − |V )/ √ 2, |R = (|H − i|V )/ √ 2, and |L = (|H + i|V )/ √ 2, where R and L denote righthand and lefthand circular polarisations. These conventions for R and L are consistent with Ref. [S11].
The basis for the matrix representation of the density matrices ρ in and ρ out needed in quantum process tomography is chosen such that the Pauli matrix Z has the property Z|H = |H . Hence, the Pauli matrices X and Y have the properties X|D = |D and Y |L = |L .

VI. CAVITY GEOMETRY
We choose a ring resonator to minimise dephasing resulting from the combination of photon recoil and thermal atomic motion [S8]. To achieve this minimisation, the signal light and coupling light in Rydberg EIT must counterpropagate each other. In a standing wave resonator, the two travelling wave components of the signal light standing wave could never simultaneously counterpropagate the coupling light. Hence, a standing wave resonator would lead to fast dephasing of at least one of the travelling wave components. A ring resonator solves this problem.
Using a ring resonator brings the additional advantage that one can use the novel scheme shown in Fig. 1 for converting the conditional π phase shift into a two-photon gate for polarisation qubits. In a one-sided standing wave resonator, however, the light reflected from the cavity would exactly counterpropagate the impinging light, thus requiring an additional effort to separate the beams.
In ring resonators, light is reflected from curved mirrors at a nonzero angle of incidence. This causes the resonator mode to develop an undesired astigmatism. To mitigate this problem, it is advantageous to use small angles of incidence which is possible, e.g., in a four-mirror bow-tie geometry.
In addition, the vacuum Rabi frequency g for one maximally coupled atom should not be too small. In principle, one could compensate for small g by increasing the atom number N a or by decreasing the cavity linewidth κ. However, in order to maintain a superatom geometry, the size of the atomic ensemble should be smaller than the blockade radius and the atomic density should not be too large because otherwise collisions between a Rydberg atom and the surrounding ground state atoms would result in density-dependent dephasing [S3]. Reducing κ is not desirable either because that would make the experiment more susceptible to laser phase noise and to pulse bandwidth effects, which both deteriorate the postselected fidelity.
We note that g i = d eg v(x i ) ω/(2h 0 ), where d eg is the electric dipole moment on the |g ↔ |e transition, where x i is the position of the ith atom, and where v(x) is the cavity mode function, normalised to d 3 x|v(x)| 2 = 1. In a travelling wave cavity |v(0)| = 2/(πw 2 c L c ), where the coordinate origin is at the cavity mode waist and where L c = 2πc/∆ω ax is the cavity round trip length. Hence, a short cavity with small waist is desirable.
To realise a short bow-tie cavity with small waist, one needs two concave mirrors with small radii of curvature not too far from the waist together with two convex mirrors, much like in Ref. [S12]. By varying the radii of curvature of the convex mirrors, one can also vary the frequency splittings to higher transverse modes, thus avoiding degenerate modes, which might lower the cavity finesse, a problem often encountered in near-concentric Fabry-Pérot resonators [S13, S14].
If the cavity mirrors had a non-negligible reflectivity for the 480 nm EIT coupling light, then one would need a triply resonant cavity, which is resonant with the signal light, the control coupling light, and the target coupling light. We evade this problem by choosing dielectric coatings with small reflectivities at 480 nm.
The bow-tie geometry of the cavity is shown in Fig. S2. The geometry and the dimensions resemble the set-up in Ref. [S12]. For fixed L 2 and fixed angle of incidence, the resonator is stable for 30.34 mm ≤ L 1 ≤ 31.24 mm. If the Rydberg atoms were too close to a surface, then that might cause rapid dephasing of the Rydberg states. The geometry chosen here places the nearest surface approximately 15 mm from the atomic ensemble which seems to be safe [S12]. The EIT signal light drives the |g ↔ |e transition, which requires σ − polarised light. The polarisation convention for σ − is relative to the positive z axis (see Fig.  S2) and essentially represents the direction of the atomic spins. The polarisation convention for L and R, however, is relative to the wave vector of the light. As the control (target) signal light has a wave vector parallel (antiparallel) to the positive z axis, it is R (L) polarised.
One can show that in the absence of birefringence the resonance frequency of the L polarised cavity mode is independent of the propagation direction of the light. The same applies to the R polarised cavity mode. As the two counterpropagating EIT signal light beams for control and target pulse should both be resonant with the atomic transition and with the cavity, the L and R polarised cavity modes should have negligible frequency splitting. Otherwise it is impossible to make both cavity modes resonant with the same atomic resonance. Among other things, this requires the cavity to be planar, i.e. this requires all the wave vectors of the cavity mode to lie in one plane. This is a nontrivial condition for the fine alignment for a resonator with more than three mirrors [S15]. Our cavity has polarisation eigenmodes with measured polarisations which are to a good approximation R and L with a measured frequency splitting of ω R −ω L = 2π×0.9 MHz, which is smaller than κ and Γ e but unfortunately not much smaller. It is expected that this splitting can be reduced considerably in future experiments.
We choose the signal light during the control and the target pulse to be resonant with their respective cavity resonances. We choose the control signal light to be res-onant with the atomic transition ∆ s = 0. Hence, in the absence of target coupling light, the target signal light has a detuning of ∆ s /2π = −0.9 MHz from the atomic transition. In the presence of target coupling light, the atomic ground state experiences a light shift of 0.18 MHz resulting in ∆ s /2π = −0.7 MHz. We optimise the target coupling detuning to obtain a conditional π phase shift, which turns out to be close to the two-photon resonance.

VII. BLOCKADE RADIUS
In principle, one could calculate the blockade radius in cavity Rydberg EIT near a Förster resonance as with C, Ω, and Γ e as in Eq. (S5). Here, the signal and coupling light are assumed to be resonant with the atomic transitions ∆ s = ∆ co = 0 and the signal light is assumed to be resonant with the cavity ∆ c = 0.
The Förster resonance comes about because the electric dipole-dipole interaction V dd couples the atom pair states |γ, J, M = |48 2 S 1/2 , 50 2 S 1/2 , J, M and |γ , J , M = |48 2 P 1/2 , 49 2 P 1/2 , J , M , where J, M and J , M are the quantum numbers of the total angular momentum and where the z axis is chosen along the internuclear axis. This coupling is described by a matrix element γ, 1, ±1|V dd |γ , 1, ±1 = −C 3 /R 3 , where R is the internuclear distance, where the C 3 coefficient is C 3 = 1.2 × 10 6 a.u., and where one atomic unit is 6.460 × 10 −49 Jm 3 . The rate coefficient γ F describes off-diagonal decay of the density matrix according to (∂ t + 1 2 γ F ) g, r |ρ|γ = 0. For R → ∞, the energies of states |γ and |γ differ by the Förster defecth∆ F . In our experiment, this value vanishes by virtue of a static electric field which is applied using electrodes inside the vacuum chamber.
One can generalise this model to accommodate the random distribution of the angle included by the internuclear axes and the wave vector of the EIT signal light. One can combine this with the anisotropy of V dd characterised by γ, 1, 0|V dd |γ , 1, 0 = 2C 3 /R 3 . To a good approximation, this yields an increase of R block by a factor of (4/3) 1/6 ≈ 1.05, which we neglect.
Really, γ rg is not dominated by electric field noise because repeating the measurement of Fig. S1b at approximately zero electric field, so that the sensitivity to electric field fluctuations is much reduced, yields no big improvement regarding γ rg . However, the value of γ F extracted from the above estimate is so large that it seems unlikely that other mechanisms produce a larger value of γ F . Hence, we obtain the worst-case estimates 1/γ F ≥ 25(6) ns and R block ≥ 7 µm.

VIII. POSTSELECTED FIDELITY
Several effects contribute to the measured value of the postselected fidelity. First, while the measurement in the CPHASE basis in Fig. 2a shows that the qubit values H and V are very well preserved upon propagation through the gate, superpositions thereof are not quite as well preserved. This can be quantified using the visibility [S4] of the single qubits. From measured values of the singlequbit visibilities, we estimate an upper bound for the postselected fidelity of 87%. Second, the efficiencies of the gate for the CPHASE basis states differ (methods). This imbalance alone sets an upper bound for the postselected fidelity of 95%. Third, there is a small but nonzero probability that there might be more than one incoming control or target photon. This alone sets an upper bound for the postselected fidelity of 98%. Fourth, the mean value of the conditional phase shift is not perfectly set to π. This alone sets an upper bound for the postselected fidelity of 99%. To a good approximation, the combined upper bound of all these experimental imperfections together can be estimated by multiplying these four upper bounds. This yields a total upper bound for the postselected fidelity of 80%, which agrees with the measured value within the experimental uncertainties. The limitations discussed here have a variety of physical origins, such as laser phase noise, a small target pulse delay which depends on the value of the control qubit, imbalanced efficiencies for the CPHASE basis states, etc. Further improvements of these limitations are possible.