Introduction

Any attempt to build coherent quantum hardware is met with the relentless deleterious influence of the environment. To combat it, all of today’s nascent quantum computers must be cooled to cryogenic temperatures. Superconducting quantum circuits require dilution refrigerators to eliminate thermal noise1,2, and ion trap processors are cooled to <10 K to reduce collisions with stray gas molecules3. This need for cooling poses a problem for many potential applications of quantum information processing; it greatly reduces the prospects for portable devices, and significantly impacts the cost and practicality of large-scale deployment as repeaters and routers for communication networks. Even optical circuits that employ single-site defects (e.g., color centers or rare-earth impurities) require cryogenic temperatures to reduce thermal line broadening4,5,6. So too do linear optics schemes that employ detectors as their sole nonlinear element (in this case to avoid the overhead incurred by inefficient detection)7,8.

At present, there are only a few platforms that appear to have the potential for quantum processing at both room temperature and pressure9,10,11,12. We explore photonic circuits that employ bulk optical nonlinearities as their nonlinear element is a particularly promising one. Bulk nonlinear elements not only do not suffer from thermal excitation, but due to their size they are less affected by thermal broadening. Until recently, the possibility of realizing quantum devices with bulk nonlinearities seemed remote, due both to the weakness of these nonlinearities and the problem of wave-packet distortion13,14,15,16,17,18. Substantial progress in the effective strength of the material nonlinearities, the introduction of ultra-confining cavities19,20,21, and a relatively simple solution to wave-packet distortions22,23,24 have changed that outlook.

Achieving the physical technology to implement nonlinear photonic quantum circuits is not the only challenge to realizing room-temperature quantum logic. For practicality, one must implement this logic using the strongest available nonlinearity, the leading-order χ(2) nonlinear susceptibility, and for efficient room-temperature operation the logic and error correction circuits should avoid measurements or feed-forward control. Two basic approaches to information processing with photons are possible. The first is the use of single- or dual-rail encoding in which each mode contains no more than one photon25. While this has the advantage that all circuit constructions from the well-developed qubit model can be employed, this leads to complex circuits even for correcting the loss of a single photon. The smallest code for this purpose uses five modes (ten for dual-rail encoding)26,27. While there is little work on minimal circuits for correcting the five-qubit code, from circuits for the seven-qubit Steane code, we estimate that it requires a least nine additional modes and >30 CNOT gates. The alternative is to use bosonic codes that employ multiple photons per mode, but in this case it is far from obvious what gates and circuits are required to implement the error correction, let alone how to realize these gates with a χ(2) interaction. While explicit error correction procedures for bosonic codes have been elucidated28,29,30,31,32, they all involve non-demolition or photon-number-resolving measurements. It is not yet known how to construct the unitary multiphoton operations required to replace such measurement using only a χ(2) nonlinearity, or the complexity of doing so. The only unitary circuit that has been explicitly constructed to date to correct a bosonic code is in the form of a 40-layer neural network using an idealized χ(3) medium33.

Here, we propose an approach for implementing all-unitary, and thus room-temperature, quantum logic on multimode multiphoton states using only a fixed χ(2) nonlinearity. This paradigm, which employs as its basic module a single triply-resonant cavity with a time-dependent drive, significantly reduces the complexity of the physical circuits required to implement multiphoton quantum logic in general, and error correction in particular. The joint operation performed on the three modes by the module is controlled by the time-dependent drive. In this way, the module is able to perform a wide range of three-mode multiphoton gates. We demonstrate the power of this approach by explicitly constructing a measurement-free error-correcting circuit for a two-mode bosonic code. This circuit requires just two of our three-mode modules, along with some controllable linear elements. Our compact unitary circuits do not employ any measurements or feed-forward control, which makes them particularly useful for fast quantum routers and repeaters. However, measurements will certainly be required to read out a message or the results of a computation. Fortunately, it is straightforward to use unitary circuits in general, and our processor in particular, to enable high-fidelity measurements at room temperature, even when only inefficient detectors are available. To do so, it is enough to use a unitary circuit to map a single photon to a sufficiently large number of photons that can then be detected. This amplification can be implemented rapidly using a doubling process. First a χ(2) nonlinearity is used to convert one photon in one mode 1 to two photons in a second mode via down-conversion. Second, a frequency conversion process (which employs a χ(2) and a classical pump) is then used to transfer each of the two photons back to the first mode. Repeating this photon-doubling cycle provides exponentially fast amplification. Since measurements are only to be used at the end of a computation, the additional overhead for amplification remains small. Thus, while we do not analyze this measurement method in detail here, it is clear that the lack of efficient photon detectors is not an obstacle to room-temperature quantum information processing.

In the next section, we describe the control Hamiltonian realized by the driven triply-resonant cavity that forms our basic processing module and give examples of important gates that can be implemented by the module. Then we show how a full error correction process can be built from a small number of these multiphoton gates. Lastly, we discuss the materials science and fabrication challenges that must be addressed, in order to realize our loss-correction circuit. By extrapolating the rate of progress in these areas over the past decade, we estimate a timeline for demonstrating this circuit.

Results

A controllable three-mode cavity

We consider three resonant modes of a cavity in a χ(2) medium, with respective mode operators \(\hat{a}\), \(\hat{b}\), and \(\hat{c}\), and frequencies ωa, ωb, and ωc. We neglect any dissipative dynamics until later sections, where we discuss hardware implementations. The cavity is driven by a coherent classical pump with frequency ωp. We depict it in Fig. 1, in which the pump may be a microwave frequency electric field or an optical drive. By choosing the frequencies to satisfy

$${\omega }_{{\rm{a}}}=2{\omega }_{{\rm{b}}},$$
(1)
$${\omega }_{{\rm{c}}}+{\omega }_{{\rm{p}}}={\omega }_{{\rm{b}}},$$
(2)

the χ(2) medium couples the modes via the Hamiltonian

$${\hat{H}}_{\text{nl}}(t)=\hslash \left[\chi \hat{a}{\hat{b}}^{\dagger 2}+g(t){\hat{b}}^{\dagger }\hat{c}+{\rm{H}}.{\rm{c}}.\right],$$
(3)

in which χ is the coupling rate of the χ(2) nonlinearity, g(t) is the coherent amplitude of the classical pump, and we have moved to the rotating frame of the oscillators. Since Schrödinger’s equation contains H/, it is the rates χ and g(t) that determine the dynamics. If we measure time in units of 1/χ then all rates are divided by χ, and the dynamics is determined by

$$\frac{{\hat{H}}_{\text{nl}}(t)}{\hslash \chi }=\hat{a}{\hat{b}}^{\dagger 2}+p(t){\hat{b}}^{\dagger }\hat{c}+{\rm{H}}.{\rm{c}}.,$$
(4)

in which we have defined p(t) = g(t)/χ. Thus up to a scaling of time, the dynamics is entirely determined by the rate parameter p(t). We will not have to introduce any additional rate parameters (and thus any additional timescales) until we consider loss in the section on hardware considerations. In that section, we will express our rate parameters in terms of the physical parameters of realistic devices.

Fig. 1: The triply-resonant nonlinear cavity.
figure 1

The χ(2) medium enables the joint control of three modes. We denote the mode operators respectively by \(\hat{a}\), \(\hat{b}\), and \(\hat{c}\). The χ(2) medium enables frequency doubling from \(\hat{b}\) to \(\hat{a}\), and a three-way interaction between modes \(\hat{b}\), \(\hat{c}\), and the control field. The control field is either a a classical microwave drive, Ep(t), or b a classical optical drive of envelope p(t). This three-way interaction is effectively a linear interaction between modes \(\hat{b}\) and \(\hat{c}\) that is controlled by the classical drive. The combination of the fixed frequency-doubling interaction and the controlled linear interaction allows extensive control of the joint nonlinear evolution. This evolution conserves the quantity 2na + nb + nc, in which na, nb, and nc are the occupation numbers of the respective modes. We also depict the relative values of the frequencies of the three modes; in a, the frequencies of modes \(\hat{b}\) and \(\hat{c}\) are separated by the much smaller frequency of the microwave drive.

Note that the second term in \({\hat{H}}_{\text{nl}}(t)\), which is controlled via the amplitude of the pump, is merely a linear coupling between modes \(\hat{b}\) and \(\hat{c}\). This interaction cannot by itself generate a universal set of quantum gates34,35. It turns out, however, that it can do so when combined with the time-independent frequency-doubling interaction.

We denote the number of photons in the three modes respectively by na, nb, and nc, and the corresponding operators for the photon number by \({\hat{n}}_{a}\), \({\hat{n}}_{b}\), and \({\hat{n}}_{c}\). Since the Hamiltonian commutes with \(2{\hat{n}}_{a}+{\hat{n}}_{b}+{\hat{n}}_{c}\), the value of that observable is preserved. The Hamiltonian cannot, therefore, mix subspaces defined by different integer values of 2na + nb + nc. Nevertheless, it does provide complete control within each subspace by virtue of the fact that the repeated commutators of \(\hat{a}{\hat{b}}^{\dagger 2}\) and \({\hat{b}}^{\dagger }\hat{c}\) generate a complete Lie algebra for all such subspaces28,36,37,38. It is this fact that provides the power of our processing unit.

In general, to implement quantum gates between the three modes, we will need to generate a set of distinct evolutions, one for each of the \(2{\hat{n}}_{a}+{\hat{n}}_{b}+{\hat{n}}_{c}={\rm{const}}\) subspaces. We can do that with a single control pulse, as for each subspace, there are many choices for p(t) that generate the same unitary operation. We can use numerical search methods to find a control function p(t) that simultaneously generates the required evolution for each of the set of subspaces. Naturally, we wish to find the control that implements a given gate in the shortest time, a challenge solved as described below.

Lastly, the modes of this quantum processor will need to be actively coupled to the waveguides that carry the quantum states to be processed. Otherwise, the process of capturing the content of the waveguides will be too slow due to the necessarily high quality factor of the modes of the processor. To actively couple the cavity modes to the waveguides, we envision using the method given in Heuck et al.23.

Compiling unitary operations

To find the control pulse p(t) required to implement a given unitary operation, we employ numerical search methods, an approach often referred to as optimal control39,40,41. We introduce a parameterization for p(t) as a piecewise-constant signal in which the duration of each interval is variable. This parameterization is essential because the always-on frequency-doubling component of the Hamiltonian necessitates optimizing the length of the pulse. In order to avoid unphysical pulses, we constrain both the duration and amplitude of each interval by the use of sigmoid functions. The full expression for the resulting unitary operation is

$$\hat{U}({\bf{v}})=\mathop{\prod }\limits_{l = 1}^{s}\exp \left\{-i\left[{\rm{f}}({X}_{l},{P}_{l}){\hat{b}}^{\dagger }\hat{c}+\sigma ({T}_{l})\hat{a}{\hat{b}}^{\dagger 2}+{\rm{H}}.{\rm{c}}.\right]\right\},$$
(5)

where

$${\rm{f}}({X}_{l},{P}_{l})=\arctan ({X}_{l})+i\arctan ({P}_{l}),$$
(6)
$$\sigma ({T}_{l})=\frac{\Delta \tau }{1+\exp (-{T}_{l})},$$
(7)

and v = {XlPlTll = 1, …, N} is the set of parameters that defines the pulse. The parameters \(\{{X}_{l}:{X}_{l}\in {\Bbb{R}}\}\) and \(\{{P}_{l}:{P}_{l}\in {\Bbb{R}}\}\) are related to the quadrature of the pulse, which is constrained to the interval [−1, 1] by \(\arctan\), while the \(\{{T}_{l}:{T}_{l}\in {\Bbb{R}}\}\) are related to the duration of each segment, which is constrained to the interval [0, Δτ]. We fix the number of piecewise-constant intervals, s, as well as the relative unitless time scale Δτ.

Consistently good performance is obtained even with s < 60. This permits the use of standard automatic differentiation tools, without the need for approximations, such as GRAPE40. Our parameterization also has the advantage that it does not allow for pathological pulses. Once we have obtained a piecewise constant control function for a given gate, we use GRAPE and standard regularization techniques to smooth out the pulse, ensuring it has both reasonable bandwidth and power. Throughout the optimization, the robustness of the control to calibration errors is verified. The time scale Δτ is shortened until a threshhold is reached at which the control pulse is no longer robust. The above approach to generating control functions, together with a number of symbolic optimizations, will be presented in detail in a related tutorial39.

Examples of programmable gates

Through the use of our implicitly constrained optimal control method, we can perform with high fidelity any gate that keeps 2na + nb + nc constant. If the length of the control pulse is unconstrained, and dissipation is neglected, we can achieve fidelities arbitrary close to unity. For gates reported here, we constrain the duration of the control pulses as much as possible before reaching unitary fidelities <0.999. In later sections considering hardware implementations, we also describe the effects of dissipation. Here, we describe a number of important unitary operations that fulfill that constraint, some of which are also depicted in Fig. 2. More general unitary operations can be performed by reshuffling the modes of the three-mode processors, as seen in later sections. Given the long cavity lifetimes requires for these operations, reshuffling necessitates rapid catch, and release of photons from and into the connected waveguides, e.g., by using active control as done in Heuck et al.23.

Fig. 2: The control pulses implementing the three gates that are used to build our error correction circuit.
figure 2

The top row shows the real and imaginary parts of the control pulses for each gate. The following rows show how the populations of the modes evolve under each gate for a given initial state. The optimizer produces pulses p(t) such that each of the desired transformations leads to constructive interference at the exact same time. Shorter pulses are possible, at the expense of higher power and bandwidth requirements39, up to a point at which the pulse is too short to perform even a single complete oscillation in a subspace defined by an integer value of 2na + nb + nc.

Throughout the following paragraphs, we will use the notation \(\left|{n}_{{\rm{a}}}{n}_{{\rm{b}}}{n}_{{\rm{c}}}\right\rangle\) to denote a Fock state with na, nb, and nc photons in modes \(\hat{a}\), \(\hat{b}\), and \(\hat{c}\), respectively.

We begin with the Toffoli Gate, which is a three-qubit non-Clifford gate, distinguished by the fact that together with just the single-qubit Hadamard gate it enables universal quantum circuits42,43. Of particular relevance for our purposes is the fact that it usually requires six two-qubit CNOT gates to implement44,45, while our realization requires only a single application of the three-mode processor. We realize the gate in the Hadamard basis (i.e., our gate is a phase gate with two control qubits) for photonic qubits encoded in a single- or dual-rail configuration. In this basis, the Toffoli unitary maps all joint Fock states to themselves except for the state \(\left|111\right\rangle\) to which it applies a π phase.

We also define a conditional routing gate as one that swaps the state of two modes depending on the state of a third mode. This class of gates is useful for breaking down conditional multi-qudit operations into smaller units. We first route the target mode to a particular waveguide, based on the state of the control mode, and we perform the appropriate single-mode quantum operation in the new physical location of the target mode. Such routing is indispensable, if our goal is to avoid measurements in error-correcting circuits, as measurements usually require hardware at cryogenic temperatures. Typically, a non-demolition measurement is performed by entangling the required information with an ancilla, and performing a demolition measurement on the ancilla. The result, a classical bit, is then fed forward through a classical computer that decides what quantum operation to perform next. We avoid the measurement and classical decisions through coherent quantum feedback46,47, where we simply perform a multimode quantum gate conditioned on the ancilla. The realization for the routing gate suggested below is what we use in our bosonic error-correcting circuit, but other setups are feasible as well. Below \(\left|{n}_{{\rm{a}}}{n}_{{\rm{b}}}{n}_{{\rm{c}}}\right\rangle\) denotes a Fock state with na, nb, and nc photons in modes \(\hat{a}\), \(\hat{b}\), and \(\hat{c}\), respectively. The \(\hat{c}\) mode is the control, the \(\hat{b}\) mode is the input, and \(\hat{a}\) and \(\hat{b}\) are the possible outputs:

$$\left|040\right\rangle \mapsto \left|200\right\rangle,$$
(8)
$$\left|020\right\rangle \mapsto \left|100\right\rangle,$$
(9)
$$\left|041\right\rangle \mapsto \left|041\right\rangle,$$
(10)
$$\left|021\right\rangle \mapsto \left|021\right\rangle,$$
(11)
$$\left|001\right\rangle \mapsto \left|001\right\rangle.$$
(12)

When used in the error-correcting circuits described in later sections, mode \(\hat{c}\) will contain an ancillary photon on which routing will be conditioned, while mode \(\hat{b}\) will contain one of the two modes of our multimode bosonic code. A second processor will be used for other modes.

Focusing further on the error-correcting functionality, we need a gate that can correct for photon loss in a codeword. For the code we employ, we require the gate to preserve the states \(\left|001\right\rangle\), \(\left|021\right\rangle\), and \(\left|041\right\rangle\), and accomplish the mapping

$$\left|031\right\rangle \mapsto \left|040\right\rangle ,$$
(13)
$$\left|011\right\rangle \mapsto \left|020\right\rangle .$$
(14)

This operation is necessary for reverting photon loss in the code mode stored in \(\hat{b}\), while storing information about the occurrence of that loss in mode \(\hat{c}\). Again, we will need two three-mode processors, each acting on one of the modes making up our error-correcting code. Each of the physical modes of the code will be stored in the corresponding \(\hat{b}\) oscillators.

To complete our error correction circuit, we use a gate that entangles two modes. We require this operation because one of the code words is an entangled state, and the loss of a photon breaks this entanglement. This gate provides the mapping

$$\left|011\right\rangle \mapsto \left|011\right\rangle,$$
(15)
$$\left|020\right\rangle \mapsto \frac{\left|020\right\rangle +\left|002\right\rangle }{\sqrt{2}}.$$
(16)

This gate is also a symmetrizing operation for the state of the modes \(\hat{b}\) and \(\hat{c}\). It is these two oscillators \(\hat{b}\) and \(\hat{c}\) that will contain the two modes of our error-correcting code.

The above gates are only a few of the many operations that the triply-resonant cavity processor can perform. Among these gates are those important for the processing of unprotected single-photon states, and operations that enable unitary modification and number-resolved measurements on modes with more than one photons, including bosonic codes. Importantly, these operations are performed with a single use of the triply-resonant cavity, while otherwise they would require complete circuits with multiple discrete operations. This leads to drastically simpler overall circuits, at the expense of requiring this more sophisticated and difficult to fabricate triply-resonant optical resonator.

Measurement-free error correction

We demonstrate the versatility of our control protocol by constructing an error-correcting circuit around the three-mode processor. The circuit we obtain is not only simple and short, but it also does not require any measurement operations or classical feed-forward control.

We choose the following code, encoding a single qubit in two separate (spatial) bosonic modes, whose logical states are given by

$${\left|1\right\rangle }_{\text{L}}=\left|22\right\rangle ,$$
(17)
$${\left|0\right\rangle }_{\text{L}}=\frac{\left|40\right\rangle +\left|04\right\rangle }{\sqrt{2}}.$$
(18)

This two-mode code allows correction for the loss of a single photon from either mode. For a channel that has a 10% probability of a single-photon loss for each mode this implies an 81% chance of transmission without error, 18% chance of transmission with a correctable error, and a 1% chance of transmission with an uncorrectable error. We choose this code because it is possible to perform the correction process with operations that conserve the quantity 2na + nb + nc, so long as one is judicious in choosing these operations.

We must first consider the effect of a photon loss on the code. The loss of a photon on the first mode is described by the action of \(\hat{a}\hat{I}\). This transforms the initial code state \(\left|C\right\rangle =\alpha {\left|0\right\rangle }_{\text{L}}+\beta {\left|1\right\rangle }_{\text{L}}\) into the error state \(\left|{E}_{{\rm{1}}}\right\rangle =\alpha \left|12\right\rangle +\beta \left|30\right\rangle\). Similarly, the loss of a photon from the second mode produces the error state \(\left|{E}_{{\rm{2}}}\right\rangle =\alpha \left|21\right\rangle +\beta \left|03\right\rangle\). For each of these two errors, we need to perform a different correction procedure. Typically, this is achieved by a non-demolition measurement that projects the state of the system onto either the logical subspace or one of the error subspaces, followed by a unitary correction operation conditioned on the measurement result. We sidestep these requirements by using coherent control. We employ two quantum ancillas, initialized to contain single photons, on which routing gates will be conditioned. Thus, our correction procedure involves the following steps. First, we put the information about the presence of an error in the ancillas by using two conditional pumping gates acting in parallel (the code modes are each placed in a \(\hat{b}\) mode, while the ancillary photons are in the corresponding \(\hat{c}\) modes), resulting in the following transformation of the overall ancillas-code state:

$$\left|11\right\rangle \otimes \left|C\right\rangle \,\mapsto \left|11\right\rangle \otimes \left|C\right\rangle,$$
(19)
$$\left|11\right\rangle \otimes \left|{E}_{{\rm{1}}}\right\rangle \mapsto \left|01\right\rangle \otimes \left|{F}_{1}\right\rangle,$$
(20)
$$\left|11\right\rangle \otimes \left|{E}_{{\rm{2}}}\right\rangle \mapsto \left|10\right\rangle \otimes \left|{F}_{2}\right\rangle ,$$
(21)

where \(\left|{F}_{1}\right\rangle =\alpha \left|22\right\rangle +\beta \left|40\right\rangle\) and \(\left|{F}_{2}\right\rangle =\alpha \left|22\right\rangle +\beta \left|04\right\rangle\). The feed-forward solution would have measured the ancillas and performed different operations depending on the measurement, but as already mentioned that would be slow and require additional cooled hardware and classical decision circuitry. Instead, we perform the following unitary operation (as before, the left multiplier in the tensor product \(\left|{c}_{1}{c}_{2}\right\rangle\) denotes the content of the ancillary \(\hat{c}\) modes of each of the two processors, and \(\left|C\right\rangle\) denotes the two modes of the error-correcting code, stored in the \(\hat{b}\) oscillators of the two processor):

$$\left|11\right\rangle \otimes \left|C\right\rangle \,\mapsto \left|11\right\rangle \otimes \left|C\right\rangle,$$
(22)
$$\left|01\right\rangle \otimes \left|{F}_{1}\right\rangle \mapsto \left|01\right\rangle \otimes \left|C\right\rangle,$$
(23)
$$\left|10\right\rangle \otimes \left|{F}_{2}\right\rangle \mapsto \left|10\right\rangle \otimes \left|C\right\rangle.$$
(24)

Without the ancillas, this operation would be impossible as it would break the bijectivity of the unitary operator by mapping many states to one. The conditional routing gates are crucial for the performance of this operation—depending on the ancillas, they route the modes containing the code to different spatial modes that perform \(\left|{F}_{1}\right\rangle \mapsto \left|C\right\rangle\) and \(\left|{F}_{2}\right\rangle \mapsto \left|C\right\rangle\) independently and in parallel. The conditional routing gates then ensure that all three paths end up in the same spatial modes at the end of the circuit. The error-correcting circuit can be seen in Fig. 3 as a suggested physical layout, and in Fig. 4 as a sequence of abstract gates.

Fig. 3: Our minimal architecture for error correction of bosonic codes, readily expandable to larger tasks.
figure 3

The circuit depicted can be used to correct a single-photon loss using a two-mode bosonic code. The circuit consists of two cavity processors, which for the most part process each mode of the code separately, and a small network of reprogrammable beam splitters and delay lines. These are used to reroute states between the modes of processors as necessary. Each cavity processor is also capable of performing many multi-qubit gates for single- and dual-rail encoded qubits, as well as preparing and manipulating higher-number Fock states. The network of programmable beam splitters between the processors and the delay lines can also be expanded to a fully connected network, enabling universal rerouting between the three modes of each processor for general-purpose quantum computation. The programmable beam splitters can be implemented as Mach–Zehnder interferometers (as shown in the inset) with two 50/50 beam splitters and a programmable delay (the orange medium in the diagram). Classical electronics will be necessary to ensure the pacing of various operations in this device, but no feedback or decision circuitry is necessary, as the approach is measurement free.

Fig. 4: The error-correcting circuit, unrolled in time.
figure 4

The horizontal axis represents the flow of time, depicting how a pair of triply-resonant cavities is being used. This circuit would be executed on the hardware depicted in Fig. 3. The main drawing is the sequence of operations that we need to perform in parallel in the two triply-resonant cavities, in order to perform the error correction. After placing the code and ancilla modes in the appropriate cavity modes, we accomplish the initial pumping and routing gates. After that, we need to shuffle the ancillary modes by releasing them in the appropriate waveguides. The spatial modes into which the code states are moved depend on the state of the ancillas, thanks to the conditional routing gates. As the ancillas contain information about the presence of photon-loss errors, this lets us perform operations conditioned on the loss of a photon, by performing the two conditional branches in parallel in different physical locations of the circuit. The conditional routing gates then act in reverse, ensuring that all spatial modes end in the same location, without breaking the bijectivity required for any quantum circuit. The various spatial modes employed can be seen in the bottom insets of the figure. Supplementary Figure 1 provides a more detailed rendition. Importantly, as seen in Fig. 3, we do not need 12 triply-resonant cavities as depicted above, rather only 2 cavities with a network of waveguides and programmable beam splitters72 that can route the spatial modes as necessary, so that each cavity can be used repeatedly. The gate pictographs are taken from the Font Awesome icon set.

Encoding operation

Encoding a qubit in the two-mode code is particularly simple using the three-mode processor. To do so we have to perform the operation

$$\left|00\right\rangle \mapsto \left|22\right\rangle ,$$
(25)
$$\left|10\right\rangle \mapsto \frac{\left|40\right\rangle +\left|04\right\rangle }{\sqrt{2}}.$$
(26)

Given that we already have access to the entangling gate, encoding can be done by putting the unprotected photonic qubit in cavity \(\hat{c}\) and putting ancilla photons in cavities \(\hat{a}\) and \(\hat{b}\). Then, we perform the partial encoding gate

$$\left|111\right\rangle \mapsto \left|200\right\rangle$$
(27)
$$\left|110\right\rangle \mapsto \left|110\right\rangle ,$$
(28)

thus mapping the state \(\alpha \left|1\right\rangle +\beta \left|0\right\rangle\) in \(\hat{c}\) to the precursor of the two-mode code \(\alpha \left|11\right\rangle +\beta \left|20\right\rangle\) in \(\hat{a}\) and \(\hat{b}\). As before, here \(\left|{n}_{{\rm{a}}}{n}_{{\rm{b}}}{n}_{{\rm{c}}}\right\rangle\) denotes a Fock state with na, nb, and nc photons the modes \(\hat{a}\), \(\hat{b}\), and \(\hat{c}\) of a single processor. Turning this into the complete code state requires a simple application of the entangling operation already discussed above. These two operations preserve the constant of motion \(2{\hat{n}}_{a}+{\hat{n}}_{b}+{\hat{n}}_{c}\) and as such can be compiled to a single control pulse performed in a single triply-resonant cavity.

Two-qubit logical operations

Single-qubit rotations in the logical space of the two-mode code can be realized by using our three-mode processors, as such rotations do preserve 2na + nb + nc. Moreover, two-qubit logical operations can also be performed. For instance, consider a CPHASE gate, which together with the single-qubit rotations form a universal set. We need to perform the operation

$$\left|22\right\rangle \otimes \left|22\right\rangle \mapsto -\left|22\right\rangle \otimes \left|22\right\rangle ,$$
(29)

while mapping all other combinations of \({\left\{\left|22\right\rangle ,\frac{\left|40\right\rangle +\left|04\right\rangle }{\sqrt{2}}\right\}}^{\otimes 2}\) to themselves. Our three-mode processor can perform this operation by acting on just two of the four modes making up the two logical qubits. If we index each mode as, e.g., \(|{2}_{i}{2}_{j}\rangle \otimes |{2}_{k}{2}_{l}\rangle\), we need to act only on modes j and k, by first transferring them to modes b and c of the cavity, and designing a pulse to perform the operation

$$\left|022\right\rangle \mapsto -\left|022\right\rangle ,$$
(30)

while mapping all of \(\left|000\right\rangle\), \(\left|002\right\rangle\), \(\left|020\right\rangle\), \(\left|004\right\rangle\), \(\left|040\right\rangle\), \(\left|024\right\rangle\), \(\left|042\right\rangle\), and \(\left|044\right\rangle\) to themselves. The overall CPHASE operation on the four physical modes forming the two logical qubits takes the form,

$$\left|2\underline{2}\right\rangle \otimes \left|\underline{2}2\right\rangle \mapsto -\left|2\underline{2}\right\rangle \otimes \left|\underline{2}2\right\rangle ,$$
(31)
$$\frac{\left|4\underline{0}\right\rangle +\left|0\underline{4}\right\rangle }{\sqrt{2}}\otimes \left|\underline{2}2\right\rangle \mapsto \frac{\left|4\underline{0}\right\rangle +\left|0\underline{4}\right\rangle }{\sqrt{2}}\otimes \left|\underline{2}2\right\rangle ,$$
(32)
$$\left|2\underline{2}\right\rangle \otimes \frac{\left|\underline{4}0\right\rangle +\left|\underline{0}4\right\rangle }{\sqrt{2}}\mapsto \left|2\underline{2}\right\rangle \otimes \frac{\left|\underline{4}0\right\rangle +\left|\underline{0}4\right\rangle }{\sqrt{2}},$$
(33)
$$\frac{\left|4\underline{0}\right\rangle +\left|0\underline{4}\right\rangle }{\sqrt{2}}\otimes \frac{\left|\underline{4}0\right\rangle +\left|\underline{0}4\right\rangle }{\sqrt{2}}\ \mapsto \ \frac{\left|4\underline{0}\right\rangle +\left|0\underline{4}\right\rangle }{\sqrt{2}}\otimes \frac{\left|\underline{4}0\right\rangle +\left|\underline{0}4\right\rangle }{\sqrt{2}},$$
(34)

where the underlined modes are the ones that are manipulated inside of a three-mode processor. Notice that a phase is gained only in the first row, where both of the modes in the processor (the underlined modes) have two photons. Such an operation can be performed directly by our processors or, if shorter and simpler control pulses are desired, by first using the χ(2) interaction to upconvert them to lower photon numbers.

Comparison with other approaches

Comparisons with other codes and types of hardware require care because the various systems have significant differences. Nevertheless, we elucidate how our control protocol substantially reduces the depth of a typical circuit and removes the need for entire classes of expensive operations. As discussed in the introduction, error correction procedures have been proposed for bosonic codes, but these require non-demolition or photon-number-resolving measurements, and it has not yet been described how such measurements can be replaced by unitary operations generated by a χ(2) nonlinearity. We can however, compare our circuit to the explicit correction circuit presented in Steinbrecher et al.33.

One way to compare the efficiency of circuits is to examine how long each takes relative to the characteristic unit of time for the given hardware. The circuit we have constructed above requires six gates, for a total of 40 units of time (relative to the χ(2) coupling strength), and four transfers in and out of cavities. The correction circuit employing the quantum optical neural network (QONN) architecture33, which is the closest analog of our hardware, requires 40 layers, resulting also in 40 units of time, but since it uses a χ(3) rather than a χ(2) medium, the nonlinearity is significantly weaker, so that the circuit takes longer in real time. Furthermore, the QONN circuit requires 40 transfers in and out of the nonlinear cavities (one for each layer), ten times more than our architecture.

One can instead implement photonic quantum logic by using only the vacuum and one-photon Fock states to encode qubits (i.e., a single- or dual-rail encoding). The smallest error-correcting code in this setting requires five physical qubits26. The logic required to determine the error syndrome for this code requires 16 CNOT gates and 4 auxiliary qubits27. The auxiliary qubits can either be measured, in which case the error can be determined using a classical computer, or a unitary circuit could process the auxiliary qubits and perform the correction48,49,50,51,52. For each of the 16 different values of the four-bit syndrome, a unitary correction circuit would need to perform a different correction operation. This requires quite a large number of ancillas and CNOT gates, as discussed in the introduction. Our room-temperature design thus represents a dramatic reduction in circuit size and duration. We also emphasize that using all-unitary processes, which is the approach we take here, provides a practical advantage; doing so avoids the need to introduce additional amplification and classical feedback circuitry.

Competing with “active” gate-based approaches to measurement-fee error correction, is the use of continuous autonomous QEC53,54,55,56,57. In that family of protocols, one needs to design an exotic dissipator, usually through reservoir engineering, which provides an irreversible evolution from the error-space back the code space.

Hardware prospects

We will introduce a less abstract model of our triply-resonant cavity design, in order to better describe the materials science and fabrication challenges it faces. This model also lets us give physical values for the unitless durations we have found above for our control pulses. We will start by describing the physical realization for the \(\hat{a}{\hat{b}}^{\dagger 2}\) and \(p(t){\hat{b}}^{\dagger }\hat{c}\) terms in the Hamiltonian. Naturally, these terms requires the presence of eigenmodes \(\hat{a}\), \(\hat{b}\), and \(\hat{c}\). The corresponding field operators would be (e.g., for the \(\hat{a}\) mode)

$${\hat{{\bf{B}}}}_{{\rm{a}}}({\bf{r}})=\sqrt{\frac{\hslash {\omega }_{{\rm{a}}}}{2}}\hat{a}{{\bf{b}}}_{{\rm{a}}}({\bf{r}})+{\rm{H}}.{\rm{c}}.,$$
(35)
$${\hat{{\bf{D}}}}_{{\rm{a}}}({\bf{r}})=\sqrt{\frac{\hslash {\omega }_{{\rm{a}}}}{2}}\hat{a}{{\bf{d}}}_{{\rm{a}}}({\bf{r}})+{\rm{H}}.{\rm{c}}.,$$
(36)

where we used the magnetic field and the electric displacement in order to keep the quantization consistent in the nonlinear regime58,59,60. The b(r) and d(r) eigenmodes can be computed from classical electromagnetism and are normalized to \(\int {\mu }_{0}^{-1}| {\bf{b}}{| }^{2}{\rm{d}}{\bf{r}}=1\) and \(\int {\varepsilon }_{{\rm{0}}}^{-1}{n}^{-2}| {\bf{d}}{| }^{2}{\rm{d}}{\bf{r}}=1\). The overall Hamiltonian of the system will be

$$\hat{H}=\int {\rm{d}}{\bf{r}}\left(\frac{{\hat{{\bf{B}}}}^{2}}{2{\mu }_{o}}+\frac{{\hat{{\bf{D}}}}^{2}}{2{\varepsilon }_{{\rm{0}}}{n}^{2}}-\frac{{\chi }^{(2)}{\hat{{\bf{D}}}}^{3}}{3{\varepsilon }_{{\rm{0}}}^{2}{n}^{6}}\right),$$
(37)

where n is the index of refraction (consult60 for its complete treatment as a tensor with dispersion). The field operators are the sum of field operators for the modes \(\hat{a}\), \(\hat{b}\), and \(\hat{c}\), as well as the field from the classical laser pulse p(t). The first two terms from the Hamiltonian simply give us the harmonic oscillator terms, which we eliminate by moving to the corresponding rotating reference frames. The last term provides the nonlinear interactions in which we are interested. For simplicity, we first consider the undriven case, i.e., p(t) = 0. The driven case is discussed in Supplementary Note 3. Expanding the nonlinear term and eliminating the nonresonant terms leaves us with

$${\hat{H}}_{\text{nl}}=-\frac{{\chi }^{(2)}}{\sqrt{{\varepsilon }_{{\rm{0}}}}{n}^{3}\sqrt{{V}_{{\rm{shg}}}}}\,\sqrt{\frac{{\hslash }^{3}{\omega }_{{\rm{a}}}{\omega }_{{\rm{b}}}^{2}}{8}}\,\hat{a}{\hat{b}}^{\dagger 2}+{\rm{H}}.{\rm{c}}.,$$
(38)
$$\frac{1}{\sqrt{{V}_{{\rm{shg}}}}}=\frac{{\int}_{\text{nl}}{d}_{{\rm{a}}}^{i}{d}_{{\rm{b}}}^{j* }{d}_{{\rm{b}}}^{k* }{\rm{d}}{\bf{r}}}{\sqrt{{\left(\int| {{\bf{d}}}_{{\rm{b}}}{| }^{2}{\rm{d}}{\bf{r}}\right)}^{2}\int | {{\bf{d}}}_{{\rm{a}}}{| }^{2}{\rm{d}}{\bf{r}}}},$$
(39)

where ∫nl denotes integration only over the nonlinear medium and i, j, and k denote the appropriate field components to integrate, depending on the nonlinear material being employed. Thus, Vshg is the mode volume considered in second-harmonic generation (SHG) experiments. For simplicity, we are not acknowledging frequency and space dependencies in the refractive index n, and we are not specifying the components of the χ(2) tensor being employed. This does not change the result we are pursuing.

The coupling rate in this nonlinear Hamiltonian imposes the units of time for the control pulses described in the previous section. This characteristic time needs to be compared to the cavity lifetimes, typically expressed through the Q factor as \(\tau =\frac{2Q}{{\omega }_{{\rm{a}}}}\). This lets us introduce the following figure of merit for the characteristic number of operations before the environment destroys our quantum state

$$N=\sqrt{\frac{\hslash }{8{\varepsilon }_{{\rm{0}}}}}\frac{\sqrt{{\omega }_{{\rm{a}}}}}{{n}^{3}}\frac{Q{\chi }^{(2)}}{\sqrt{{V}_{{\rm{shg}}}}}.$$
(40)

Considering some recent SHG on-chip experiments (a Q ~ 107 in refs. 61,62 and a \({V}_{{\rm{shg}}} \sim 800\,\upmu {{\rm{m}}}^{3} \sim 2000\frac{{\lambda }^{3}}{{n}^{3}}\) with a 70 μm-radius micro-ring in refs. 63,64, at λa ≈ 750 nm) in a typical nonlinear optics material like lithium niobate (\({\chi }^{(2)} \sim 31\frac{{\rm{pm}}}{{\rm{V}}}\)), we obtain values N ~ 0.03, which is still too low for practical use. With Q factors and mode overlaps in SHG experiments following a Moore’s law (the recent progress is explored in Supplementary Note 4) and new designs lowering mode volumes by orders of magnitude19,20,21,65, N—the number of elementary quantum operations within the cavity lifetime—could very well grow by orders of magnitude and reach tens to hundreds over the next decade. N is related to a typical figure of merit in SHG experiments—the conversion efficiency66 \(\eta =\frac{{P}_{{\rm{out}}}}{{P}_{{\rm{in}}}^{2}}\propto \frac{{Q}^{3}{({\chi }^{(2)})}^{2}}{{V}_{{\rm{shg}}}}\), which has seen impressive improvements in the last decade (see Supplementary Note 4). With a Q ~ 2 × 108, which is achievable in principle67, a mode volume of \(V \sim 1{0}^{-3}\frac{{\lambda }^{3}}{{n}^{3}}\), (see refs. 20,68 for progress in mode confinement), and \({\chi }^{(2)} \sim 100\frac{{\rm{pm}}}{{\rm{V}}}\), which is between the values for lithium niobate and gallium arsenide, we achieve N ~ 2000 which is enough for error correction. Moreover, new fabrication techniques for thin-film materials enable much stronger effective nonlinearities than what has otherwise been achieved on-chip. While such techniques have not been explored extensively in the optical regime, these results are an encouraging indication that similar progress may well be possible for nonlinear optical materials.

To explore how such future hardware may perform, we compare the lifetime of an encoded (protected) photonic qubit to an unprotected single-rail qubit living in the same hardware. The time scale will be set by the Q factor of the cavities under consideration; however, in order to present physical values for the parameters we will set Q ~ 2 × 108 at λa ~ 750 nm, which is well within the thermorefractive theoretical limit67. In Fig. 5, we compare the performance of our error-correcting protocol to that of an unprotected single-rail qubit, and see that the error-correcting threshold is N ~ 2000, a very demanding value which we are nonetheless optimistic about given the experimental results cited earlier. Typically for non-asymptotic codes, to achieve fault tolerance this lower-level code will have to be concatenated with an asymptotically growing stabilizer code, akin to the surface code or quantum LDPC codes and one of the many techniques for achieving non-Clifford gates (e.g., through magic states) will have to be employed. The versatility of our control protocol provides for a system agnostic to these higher-level architectural decisions.

Fig. 5: Logical qubit lifetime at the “break even” regime where it begins to outperform unprotected qubits.
figure 5

In blue, we see the decay of a single photon, i.e., an unprotected single-rail qubit. In orange, we see the decay of our two-mode code if we do not perform any correction operations—it decays faster as it contains a higher number of photons. The green line represents the decay of the encoded qubit in the presence of periodic correction operations. The infidelity of the correction operations due to photon loss that can happen during the operation is taken into account. The figure represents a lower bound for the performance of our protocol, with beneficial higher order effects being neglected in order to simplify the simulation. The “break even” point is achieved at \({V}_{{\rm{shg}}} \sim 1{0}^{-3}\frac{{\lambda }^{3}}{{n}^{3}}\), Q ~ 2 × 108, and \({\chi }^{(2)} \sim 100\frac{{\rm{pm}}}{{\rm{V}}}\) for λa ~ 750 nm. Waveguide losses are neglected, as they would be insignificant compared to the rest of the operations.

Lastly, we need to consider the implementation of the time-dependent control pulses. In the electrical regime, the control pulse can be modulated by standard microwave electronics in CMOS-compatible hardware69. In the optical regime, the control pulse would have to be modulated by wave shaping through expressing the pulse in terms of its Fourier decomposition70. Intermediate regimes are also possible, in which we can modulate a THz electric field, by placing optically actuated Auston switches next to our triply-resonant cavities71. Active control will be necessary for loading and unloading photons from these long-lived cavities, e.g., by following methods proposed in Heuck et al.23.

It is important to note that one can balance the three considerations discussed in this section: the duration, power, and bandwidth of the control pulse. When the values of all these quantities can be expressed in characteristic units close to unity, the optimization problem is well conditioned and easier to solve. Such are the control pulses we have shown (e.g., their amplitudes, bandwidths, and durations are 10). However, if our hardware requires short pulses (e.g., due to low Q factor), but permits high power, we can nudge the solution in this direction by reparameterizing the optimization problem39.

Discussion

It is accepted in the quantum computing community that any prospective purely photonic architecture for quantum information processing would face significant challenges due to the weak photon–photon interactions available even in the best materials and resonators. Nonetheless, the present work, building upon more than a decade of theory developments on cavity-enhanced optical nonlinear interactions, shows that the monumental hardware requirements have already been nearly achieved in disparate experiments. It is an outstanding challenge to incorporate, in a single device, a record-high Q-factor cavity, together with extremely confined mode volumes, and fabrication-enhanced χ(2) materials. However, progress over the last decade—for example, the 108-fold improvement in the efficiencies of SHG—inspires confidence that this herculean task can very well be achieved within the next decade.

Moreover, our work, for the first time, shows that a single elementary photonic device can be reprogrammed on the fly to perform a set of diverse unitary operations, drastically lowering circuit complexity and depth. We have shown its applicability for typical single- and dual-rail encoded qubits, as well as its versatility in processing multiphoton Fock states. We showcased the flexibility of our control paradigm by devising an explicit error-correcting circuit for a bosonic code and the application of multi-qubit logic gates on top of that code. This is the first proposal for photonic logical qubits that includes compact encoding and correcting circuitry. Furthermore, the circuit we have designed does not require any measurement operations or feed-forward classical control, offering significant simplifications compared to a typical small stabilizer code, and opening the door for extremely fast, compact, room-temperature quantum repeaters.