Thank you for visiting nature.com. You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

# Room-temperature photonic logical qubits via second-order nonlinearities

## Abstract

Recent progress in nonlinear optical materials and microresonators has brought quantum computing with bulk optical nonlinearities into the realm of possibility. This platform is of great interest, not only because photonics is an obvious choice for quantum networks, but also as a promising route to quantum information processing at room temperature. We propose an approach for reprogrammable room-temperature photonic quantum logic that significantly simplifies the realization of various quantum circuits, and in particular, of error correction. The key element is the programmable photonic multi-mode resonator that implements reprogrammable bosonic quantum logic gates, while using only the bulk χ(2) nonlinear susceptibility. We theoretically demonstrate that just two of these elements suffice for a complete, compact error-correction circuit on a bosonic code, without the need for measurement or feed-forward control. Encoding and logical operations on the code are also easily achieved with these reprogrammable quantum photonic processors. An extrapolation of current progress in nonlinear optical materials and photonic circuits indicates that such circuitry should be achievable within the next decade.

## 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.

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.

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.

### 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.

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.

## Data availability

The digitized control-pulse examples in this manuscript can be readily reproduced in most optimization toolkits (e.g., Qutip and Tensorflow under Python, or SciML and Flux under Julia). Upon request, the authors can provide these waveforms and example scripts under each of the aforementioned frameworks that produce equivalent waveforms.

## Code availability

As mentioned in the data availability statement, standard optimization toolkits were used for the creation of the control pulses and example scripts, using these frameworks can be provided upon request or found in the documentation of the aforementioned frameworks.

## References

1. Blumoff, J. Z. et al. Implementing and characterizing precise multiqubit measurements. Phys. Rev. X 6, 031041 (2016).

2. O’Malley, P. J. J. et al. Scalable quantum simulation of molecular energies. Phys. Rev. X 6, 031007 (2016).

3. Brown, K., Kim, J. & Monroe, C. Co-designing a scalable quantum computer with trapped atomic ions. npj Quantum Inf. 2, 16034 (2016).

4. Fu, K.-M. C. et al. Observation of the dynamic jahn-teller effect in the excited states of nitrogen-vacancy centers in diamond. Phys. Rev. Lett. 103, 256404 (2009).

5. Jahnke, K. D. et al. Electron–phonon processes of the silicon-vacancy centre in diamond. N. J. Phys. 17, 043011 (2015).

6. Plakhotnik, T., Doherty, M. W. & Manson, N. B. Electron-phonon processes of the nitrogen-vacancy center in diamond. Phys. Rev. B 92, 081203(R) (2015).

7. Jönsson, M. & Björk, G. Evaluating the performance of photon-number-resolving detectors. Phys. Rev. A 99, 043822 (2019).

8. Young, S. M., Sarovar, M. & Léonard, F. General modeling framework for quantum photodetectors. Phys. Rev. A 98, 063835 (2018).

9. Shi, F. et al. Room-temperature implementation of the deutsch-jozsa algorithm with a single electronic spin in diamond. Phys. Rev. Lett. 105, 040504 (2010).

10. Venkataraman, V., Saha, K. & Gaeta, A. L. Phase modulation at the few-photon level for weak-nonlinearity-based quantum computing. Nat. Photonics 7, 138 (2013).

11. Náfrádi, B., Choucair, M., Dinse, K.-P. & Forró, L. Room temperature manipulation of long lifetime spins in metallic-like carbon nanospheres. Nat. Commun. 7, 1–8 (2016).

12. Ivády, V. et al. Stabilization of point-defect spin qubits by quantum wells. Nat. Commun. 10, 1–8 (2019).

13. Shapiro, J. H. Single-photon Kerr nonlinearities do not help quantum computation. Phys. Rev. A 73, 062305 (2006).

14. Leung, P. M., Munro, W. J., Nemoto, K. & Ralph, T. C. Spectral effects of strong χ(2) nonlinearity for quantum processing. Phys. Rev. A 79, 042307 (2009).

15. Gea-Banacloche, J. Impossibility of large phase shifts via the giant kerr effect with single-photon wave packets. Phys. Rev. A 81, 043823 (2010).

16. He, B., MacRae, A., Han, Y., Lvovsky, A. I. & Simon, C. Transverse multimode effects on the performance of photon-photon gates. Phys. Rev. A 83, 022312 (2011).

17. Xu, S., Rephaeli, E. & Fan, S. Analytic properties of two-photon scattering matrix in integrated quantum systems determined by the cluster decomposition principle. Phys. Rev. Lett. 111, 223602 (2013).

18. Dove, J., Chudzicki, C. & Shapiro, J. H. Phase-noise limitations on single-photon cross-phase modulation with differing group velocities. Phys. Rev. A 90, 062314 (2014).

19. Hu, S. & Weiss, S. M. Design of photonic crystal cavities for extreme light concentration. ACS Photonics 3, 1647–1653 (2016).

20. Hu, S. et al. Experimental realization of deep-subwavelength confinement in dielectric optical resonators. Sci. Adv. 4, eaat2355 (2018).

21. Choi, H., Heuck, M. & Englund, D. Self-similar nanocavity design with ultrasmall mode volume for single-photon nonlinearities. Phys. Rev. Lett. 118, 223605 (2017).

22. Heuck, M., Jacobs, K. & Englund, D. R. Controlled-phase gate using dynamically coupled cavities and optical nonlinearities. Phys. Rev. Lett. 124, 160501 (2019).

23. Heuck, M., Jacobs, K. & Englund, D. R. Photon-photon interactions in dynamically coupled cavities. Phys. Rev. A 101, 042322 (2019).

24. Li, M. et al. Photon-photon quantum phase gate in a photonic molecule with χ2 nonlinearity. Phys. Rev. Applied 13, 044013 (2019).

25. Kok, P. et al. Linear optical quantum computing with photonic qubits. Rev. Mod. Phys. 79, 135–174 (2007).

26. Laflamme, R., Miquel, C., Paz, J. P. & Zurek, W. H. Perfect quantum error correcting code. Phys. Rev. Lett. 77, 198–201 (1996).

27. DiVincenzo, D. P. & Shor, P. W. Fault-tolerant error correction with efficient quantum codes. Phys. Rev. Lett. 77, 3260 (1996).

28. Niu, M. Y., Chuang, I. L. & Shapiro, J. H. Qudit-basis universal quantum computation using χ (2) interactions. Phys. Rev. Lett. 120, 160502 (2018).

29. Niu, M. Y., Chuang, I. L. & Shapiro, J. H. Hardware-efficient bosonic quantum error-correcting codes based on symmetry operators. Phys. Rev. A 97, 032323 (2018).

30. Michael, M. H. et al. New class of quantum error-correcting codes for a bosonic mode. Phys. Rev. X 6, 031006 (2016).

31. Albert, V. V. et al. Performance and structure of single-mode bosonic codes. Phys. Rev. A 97, 032346 (2018).

32. Bergmann, M. & van Loock, P. Quantum error correction against photon loss using NOON states. Phys. Rev. A 94, 012311 (2016).

33. Steinbrecher, G. R., Olson, J. P., Englund, D. & Carolan, J. Quantum optical neural networks. npj Quantum Inf. 5, 1–9 (2019).

34. Weedbrook, C. et al. Gaussian quantum information. Rev. Mod. Phys. 84, 621 (2012).

35. Bartlett, S. D., Sanders, B. C., Braunstein, S. L. & Nemoto, K. Efficient classical simulation of continuous variable quantum information processes. Phys. Rev. Lett. 88, 097904 (2002).

36. Lloyd, S. & Braunstein, S. L. in Quantum Information with Continuous Variables, 9–17 (Springer, 1999).

37. Jacobs, K. Engineering quantum states of a nanoresonator via a simple auxiliary system. Phys. Rev. Lett. 99, 117203 (2007).

38. Krastanov, S. et al. Universal control of an oscillator with dispersive coupling to a qubit. Phys. Rev. A 92, 040303(R) (2015).

39. Krastanov, S. Symbolic and numerical tools for quantum optimal control (in prep., 2020).

40. Khaneja, N., Reiss, T., Kehlet, C., Schulte-Herbrüggen, T. & Glaser, S. J. Optimal control of coupled spin dynamics: design of nmr pulse sequences by gradient ascent algorithms. J. Magn. Reson. 172, 296–305 (2005).

41. Heeres, R. W. et al. Implementing a universal gate set on a logical qubit encoded in an oscillator. Nat. Commun. 8, 94 (2017).

42. Shi, Y. Both toffoli and controlled-not need little help to do universal quantum computation. Preprint at https://arxiv.org/abs/quant-ph/0205115 (2002).

43. Aharonov, D. A simple proof that toffoli and hadamard are quantum universal. Preprint at https://arxiv.org/abs/quant-ph/0301040 (2003).

44. Barenco, A. et al. Elementary gates for quantum computation. Phys. Rev. A 52, 3457 (1995).

45. Shende, V. V. & Markov, I. L. On the cnot-cost of toffoli gates. Quant. Inf. Comp. 9, 461–486 (2008).

46. Lloyd, S. Coherent quantum feedback. Phys. Rev. A 62, 022108 (2000).

47. Jacobs, K., Wang, X. & Wiseman, H. M. Coherent feedback that beats all measurement-based feedback protocols. N. J. Phys. 16, 073036 (2014).

48. Crow, D., Joynt, R. & Saffman, M. Improved error thresholds for measurement-free error correction. Phys. Rev. Lett. 117, 130503 (2016).

49. Premakumar, V. N., Saffman, M. & Joynt, R. Measurement-free error correction with coherent ancillas. Preprint at https://arxiv.org/abs/2007.09804 (2020).

50. Li, C.-K., Nakahara, M., Poon, Y., Sze, N.-S. & Tomita, H. Recovery in quantum error correction for general noise without measurement. Quantum Inf. Comput. 12, 0149 (2011).

51. Cruikshank, B. & Jacobs, K. High-threshold low-overhead fault-tolerant classical computation and the replacement of measurements with unitary quantum gates. Phys. Rev. Lett. 119, 030503 (2017).

52. Cruikshank, B. & Jacobs, K. The role of quantum measurements in physical processes and protocols. Quantum Sci. Technol. 2, 033001 (2017).

53. Paz, J. P. & Zurek, W. H. Continuous error correction. Proc. R. Soc. Lond. Ser. A 454, 355–364 (1998).

54. Kapit, E. Hardware-efficient and fully autonomous quantum error correction in superconducting circuits. Phys. Rev. Lett. 116, 150501 (2016).

55. Kapit, E. The upside of noise: engineered dissipation as a resource in superconducting circuits. Quantum Sci. Technol. 2, 033002 (2017).

56. Lihm, J.-M., Noh, K. & Fischer, U. R. Implementation-independent sufficient condition of the Knill-Laflamme type for the autonomous protection of logical qudits by strong engineered dissipation. Phys. Rev. A 98, 012317 (2018).

57. Lescanne, R. et al. Exponential suppression of bit-flips in a qubit encoded in an oscillator. Nat. Phys. 16, 509–513 (2020).

58. Sipe, J. E., Bhat, N. A. R., Chak, P. & Pereira, S. Effective field theory for the nonlinear optical properties of photonic crystals. Phys. Rev. E 69, 016604 (2004).

59. Bhat, N. A. R. & Sipe, J. E. Hamiltonian treatment of the electromagnetic field in dispersive and absorptive structured media. Phys. Rev. A 73, 063808 (2006).

60. Quesada, N. & Sipe, J. Why you should not use the electric field to quantize in nonlinear optics. Opt. Lett. 42, 3443–3446 (2017).

61. Lin, J. et al. Highly-efficient second and third harmonic generation in a monocrystalline lithium niobate microresonator. Preprint at https://arxiv.org/abs/1809.04523 (2018).

62. Zhang, M., Wang, C., Cheng, R., Shams-Ansari, A. & Lončar, M. Monolithic ultra-high-q lithium niobate microring resonator. Optica 4, 1536–1537 (2017).

63. Lu, J. et al. Periodically poled thin-film lithium niobate microring resonators with a second-harmonic generation efficiency of 250,000%/w. Optica 6, 1455–1460 (2019).

64. Lu, J., Li, M., Zou, C.-L., Sayem, A. A. & Tang, H. X. Towards 1% single photon nonlinearity with periodically-poled lithium niobate microring resonators. Preprint at https://arxiv.org/abs/2007.07411 (2020).

65. Jiang, H. et al. Nonlinear frequency conversion in one dimensional lithium niobate photonic crystal nanocavities. Appl. Phys. Lett. 113, 021104 (2018).

66. Guo, X., Zou, C.-L. & Tang, H. X. Second-harmonic generation in aluminum nitride microrings with 2500%/w conversion efficiency. Optica 3, 1126–1131 (2016).

67. Panuski, C., Englund, D. & Hamerly, R. Fundamental thermal noise limits for optical microcavities. Phys. Rev. X 10, 041046. https://doi.org/10.1103/PhysRevX.10.041046 (2020).

68. Lin, Z., Liang, X., Lončar, M., Johnson, S. G. & Rodriguez, A. W. Cavity-enhanced second-harmonic generation via nonlinear-overlap optimization. Optica 3, 233–238 (2016).

69. Wang, C. et al. Integrated lithium niobate electro-optic modulators operating at cmos-compatible voltages. Nature 562, 101–104 (2018).

70. Weiner, A. M. Ultrafast optical pulse shaping: a tutorial review. Opt. Commun. 284, 3669–3692 (2011).

71. Chen, P., Hosseini, M. & Babakhani, A. An integrated germanium-based thz impulse radiator with an optical waveguide coupled photoconductive switch in silicon. Micromachines 10, 367 (2019).

72. Carolan, J. et al. Universal linear optics. Science 349, 711–716 (2015).

## Acknowledgements

We thank Christopher Panuski and Ryan Hamerly for many helpful conversations. Harvard Research Computing enabled much of the computational work. The SciPy, Tensorflow, and Julia open source communities provided invaluable research software. SK and MH are grateful for the funding provided by the MITRE Quantum Moonshot Programme. K.J., D.R.E., and M.H. acknowledge support from a CCDC Army Research Laboratory ECI grant.

## Author information

Authors

### Contributions

The design of the control protocol was performed jointly by the authors. S.K. wrote the optimization and analysis software, and performed the simulations. The manuscript was written by S.K. with contributions from the other authors.

### Corresponding author

Correspondence to Stefan Krastanov.

## Ethics declarations

### Competing interests

The authors declare no competing interests.

Peer review information Nature Communications thanks Chang-Ling Zou, Eilon Poem and the other anonymous reviewer(s) for their contribution to the peer review of this work. Peer reviewer reports are available.

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

## Rights and permissions

Reprints and Permissions

Krastanov, S., Heuck, M., Shapiro, J.H. et al. Room-temperature photonic logical qubits via second-order nonlinearities. Nat Commun 12, 191 (2021). https://doi.org/10.1038/s41467-020-20417-4

• Accepted:

• Published:

• DOI: https://doi.org/10.1038/s41467-020-20417-4