Introduction

Quantum computing offers exponential speeds-ups in solving certain computational problems, with wide-ranging consequences for information processing, information security, fundamental physics and chemistry, and more. Impressive progress has been achieved towards realizing quantum computing, including recent experimental demonstration of a quantum advantage over classical computation1. However, real devices are subject to noise and imperfections. As computations grow in size and complexity, errors accumulate and eventually destroy any quantum advantage unless mitigated. Achieving fault tolerance, where errors are corrected sufficiently fast to allow scalable computation, is a central challenge to making universal quantum computing practical.

Quantum error correction (QEC) enables large-scale quantum computing in the presence of noise by redundantly encoding logical qubits into a larger Hilbert space. In traditional discrete-variable QEC, many physical qubits make up a single logical qubit. However, in 2001, Gottesman, Kitaev, and Preskill (GKP) proposed encoding a logical qubit into the infinite-dimensional Hilbert space spanned by the continuous variables of a single bosonic mode2. With this encoding, small displacement errors of the bosonic mode can be detected and corrected using only simple Gaussian operations. Furthermore, recent results have shown that the GKP code also performs very well against boson loss3, in many cases outperforming other bosonic codes designed specifically against loss such as cat codes4,5 and binomial codes6,7. In fact, numerical optimization suggests that the hexagonal GKP code might be the optimal loss-resistant code among all bosonic codes8. In addition, GKP codes have recently been shown to have applications within continuous-variable QEC9 and quantum metrology10.

An ideal GKP code is embedded in an idealized grid state, which forms a lattice structure, consisting of an infinite superposition of position eigenstates. Such states require infinite energy and are hence unphysical. Importantly, however, it is possible to use approximate grid states with finite energy, composed of finitely squeezed states to achieve fault tolerance by concatenating the GKP code with discrete-variable error-correcting codes, provided that the grid states are sufficiently quadrature-squeezed. In 2014, a conservative threshold for fault tolerance of 20.5 dB squeezing was derived for a measurement-based quantum computing approach11. Later, this threshold was significantly reduced to <10 dB squeezing by exploiting the analog information contained in the syndrome measurements12,13. Other approaches such as concatenating the GKP code with the surface code14, the toric code15,16, and Knill’s C4/C6 code17 have recently been proposed. For any of these proposals, the squeezing threshold will depend not only on the involved codes, but also on the type and magnitude of the noise and experimental errors of the given system. It is therefore crucial to test the feasibility of these approaches with high-quality grid states experimentally. In addition, as with any quantum error-correcting code, one would ideally use grid states with squeezing levels well above the threshold to avoid impractical resource overheads associated with the repeated concatenation of the codes.

The preparation of grid states have, however, proven to be highly challenging. Recently, such states were prepared for the first time in ground-breaking experiments in the motional state of a trapped ion18 and in a microwave cavity field coupled to a superconducting circuit19. The states realized in these experiments clearly exhibit the required grid structure in phase space. However, the quality of the states needs to be improved for implementation with fault-tolerant schemes. The main experimental limitation is that during the preparation protocol, the states accumulate noise, e.g. from boson dephasing and losses, rendering the produced grid states noisy. To minimize this noise one has to increase the speed of the preparation protocol. The state-preparation protocols currently implemented in the experiments use oscillator-qubit couplings and rely on repeated measurements of the ancilla qubit. These measurements and their associated processing times constitute about half of the total preparation time. Therefore, to improve the quality of the GKP codes, it is crucial to replace the slow measurement-based approach with a faster approach.

It has previously been theoretically and experimentally established that arbitrary bosonic states can be deterministically prepared using a qubit coupling via the Jaynes-Cummings Hamiltonian20,21,22,23. These methods build up the state in the Fock basis and require a number of steps proportional to the number of Fock states supporting the target state. However, since noise such as qubit dephasing and boson loss is built up during each step23, such methods are ineffective for preparing large useful grid states, which require support on at least 25–100 photons to achieve 10–16 dB of effective squeezing.

In this work, we present a measurement-free grid state-preparation protocol, which is significantly faster than known methods, without introducing additional resources. The key interaction of our protocol is the Rabi interaction Hamiltonian between an oscillator and a two-level system24,25, which can be effectively simulated in trapped-ion and microwave systems. This interaction is also used in the experiments of refs. 18,19. Such interactions were recently shown to enable deterministic, non-Gaussian operations by using many weak interactions26,27. Here, we instead use only a few, but stronger interactions, to generate the highly non-Gaussian grid states. Our work thus provides further demonstration of Rabi interactions as a powerful and versatile non-Gaussian resource in trapped-ion and superconducting-circuit platforms.

The speed-up obtained with our approach is large enough to prepare grid states with >10 dB of effective squeezing in practical systems that are readily available in both trapped-ion and microwave cavity platforms. Compared with current experiments this is an improvement of 3–6 dB under the same amounts of physical noise. With a further reduction of noise levels in future experiments, our protocol enables the generation of grid states with squeezing levels well above the fault-tolerance threshold levels, thus facilitating scalable quantum computing.

Results

Preliminaries

In this section, we review the basic structure of grid states and the figures of merit used in this article. For a more extensive review, see e.g. ref. 28.

Bosonic modes of harmonic oscillators are associated with the creation and annihilation operators \(\hat{a}\) and \({\hat{a}}^{\dagger }\) and the corresponding dimensionless quadrature operators \(\hat{X}=\frac{1}{\sqrt{2}}(\hat{a}+{\hat{a}}^{\dagger })\) and \(\hat{P}=\frac{1}{\sqrt{2}i}(\hat{a}-{\hat{a}}^{\dagger })\) satisfying \([\hat{X},\hat{P}]=i\). The two-dimensional code space of the GKP code is defined in the common +1 eigenspace of the stabilizer operators

$${\hat{S}}_{z}=\hat{D}(\alpha )\qquad {\rm{and}}\qquad {\hat{S}}_{x}=\hat{D}(\beta ).$$
(1)

Here, \(\hat{D}(x)={e}^{x{\hat{a}}^{\dagger }-{x}^{* }\hat{a}}={e}^{i\sqrt{2}(-{\rm{Re}}(x)\hat{P}+{\rm{Im}}(x)\hat{X})}\) is the displacement operator with displacement amplitude x, satisfying the commutation relation

$$[\hat{D}(\alpha ),\hat{D}(\beta )]=2i\sin ({\rm{Im}} (\alpha {\beta }^{* }))\hat{D}(\alpha +\beta ).$$
(2)

By choosing Im(αβ*) = 2π, we ensure that the stabilizers commute, which enables the existence of simultaneous eigenstates. Furthermore, we can define logical operators

$${\hat{Z}}_{L}=\hat{D}\left(\frac{\alpha }{2}\right),\,{\hat{X}}_{L}=\hat{D}\left(\frac{\beta }{2}\right),\,{\rm{and}}\,{\hat{Y}}_{L}=\hat{D}\left(\frac{\alpha +\beta }{2}\right),$$
(3)

which commute with the stabilizers and anti-commute with each other. The logical GKP qubit states, \({\left|0\right\rangle }_{{\rm{GKP}}}\) and \({\left|1\right\rangle }_{{\rm{GKP}}}\), are then defined as the ±1 eigenstates of \({\hat{Z}}_{L}\). These satisfy the expected logic \({\hat{X}}_{L}{\left|0\right\rangle }_{{\rm{GKP}}}={\left|1\right\rangle }_{{\rm{GKP}}}\) and \({\hat{X}}_{L}{\left|1\right\rangle }_{{\rm{GKP}}}={\left|0\right\rangle }_{{\rm{GKP}}}\).

The relative directions and magnitudes of α and β determine the lattice of the corresponding grid states. For example, rectangular grid states are generated by α = i2π/β*. Further choosing \(\beta =\sqrt{2\pi }\) yields the square grid states for which the code space is symmetric with respect to X and P. Alternatively, choosing \(\alpha =i\sqrt{\frac{4}{\sqrt{3}}\pi }\) and \(\beta ={e}^{-i\frac{\pi }{3}}\alpha\) yields the hexagonal grid states. In the following, we will consider only the square grid, returning to the case of rectangular and hexagonals grids afterwards. The (unnormalizable) ideal square grid states can be written as:

$$\begin{array}{ll}{\left|0\right\rangle }_{{\rm{GKP}}}\,=\mathop{\sum}\limits_{s\in {\mathbb{Z}}}\hat{D}\left(s\sqrt{2\pi }\right)\left|X=0\right\rangle \\ {\left|1\right\rangle }_{{\rm{GKP}}}\,=\mathop{\sum}\limits_{s\in {\mathbb{Z}}}\hat{D}\left(\left(s+\frac{1}{2}\right)\sqrt{2\pi }\right)\left|X=0\right\rangle \end{array}$$
(4)

where \(\left|X=0\right\rangle\) denotes the eigenstate of \(\hat{X}\) with eigenvalue 0 and \({\mathbb{Z}}\) denotes the set of integers. The ideal grid states are thus infinite superpositions of equidistant position eigenstates and their Wigner functions are an infinite grid of two-dimensional delta-functions (see Fig. 2b). Ideal grid states can be approximated by finite energy states in several ways. The most commonly used representation for deriving fault tolerance thresholds is a superposition of finitely squeezed states of width er under a Gaussian envelope of width κ−1:

$$\begin{array}{ll}&{\left|\tilde{0}\right\rangle }_{{\rm{GKP}}}\propto \sum \limits_{s\in {\mathbb{Z}}}{e}^{-\frac{{\left(2\sqrt{\pi }s\right)}^{2}}{2{\kappa }^{-2}}}\hat{D}\left(s\sqrt{2\pi }\right){\hat{S}}_{r}\left|{\rm{vac}}\right\rangle \\ &{\left|\tilde{1}\right\rangle }_{{\rm{GKP}}}\propto \sum\limits _{s\in {\mathbb{Z}}}{e}^{-\frac{{\left(2\sqrt{\pi }\left(s+\frac{1}{2}\right)\right)}^{2}}{2{\kappa }^{-2}}}\hat{D}\left(\left(s+\frac{1}{2}\right)\sqrt{2\pi }\right){\hat{S}}_{r}\left|{\rm{vac}}\right\rangle ,\end{array}$$
(5)

where \({\hat{S}}_{r}={e}^{-\frac{1}{2}r({\hat{a}}^{2}-{\hat{a}}^{\dagger 2})}\) is the squeezing operator (not to be confused with the stabilizers \({\hat{S}}_{x}\) and \({\hat{S}}_{z}\)). The squeezing parameter r and envelope κ characterizes the quality of the states in the X- and P-quadratures, respectively, and in the limit (er, κ) → (0, 0) the approximate states converge to the exact states of equation (4). For κ = er the states can correct noise equally well in X and P.

However, physical grid states will never exactly be of the form given in equation (5). First, physical states are not pure and are generally described by a density matrix \(\hat{\rho }\). Second, the exact Gaussian envelope can be difficult to obtain and most preparation protocols yield a finite sum of squeezed states. Therefore, the parameters r and κ are not well defined for practically realizable states. Instead, more generic figures of merit, the effective squeezing parameters, have been suggested in ref. 10. They quantify the effective degree of squeezing in each quadrature of the peaks constituting the grid state and are defined as:

$${{{\Delta }}}_{X}=\sqrt{\frac{1}{2\pi }\mathrm{ln}\,\left(\frac{1}{| \langle \hat{D}(i\sqrt{2\pi })\rangle {| }^{2}}\right)}$$
(6)
$${{{\Delta }}}_{P}=\sqrt{\frac{1}{2\pi }\mathrm{ln}\,\left(\frac{1}{| \langle \hat{D}(\sqrt{2\pi })\rangle {| }^{2}}\right)},$$
(7)

where the effective squeezing levels in units of dB are given by \({{{\Delta }}}_{{\rm{dB}}}=-10{\mathrm{log}\,}_{10}({{{\Delta }}}^{2})\). The expectation values in these definitions are exactly the expectation values of the stabilizers \({\hat{S}}_{z}\) and \({\hat{S}}_{x}\) for square GKP states. High-quality grid states should therefore have \(| \langle {\hat{S}}_{z/x}\rangle | \approx 1\), in which case ΔX/P →  dB. These definitions also have the nice property that for squeezed states they reproduce the squeezing parameter, i.e., \({{{\Delta }}}_{X}({\hat{S}}_{r}\left|{\rm{vac}}\right\rangle )={e}^{-r}\) and \({{{\Delta }}}_{P}({\hat{S}}_{r}\left|{\rm{vac}}\right\rangle )={e}^{r}\). Furthermore, for the approximate square lattice grid states of Eq. (5) we extract the parameters \({{{\Delta }}}_{X}({\left|\tilde{0}\right\rangle }_{{\rm{GKP}}})={e}^{-r}\) and \({{{\Delta }}}_{P}({\left|\tilde{0}\right\rangle }_{{\rm{GKP}}})\approx \kappa\). The last approximation is very accurate for er, κ > 10 dB. Thus, if the state resembles a grid state consisting of a grid of squeezed peaks in phase space, the effective squeezing parameters approximately quantify the squeezing of these peaks in each quadrature direction.

However, it is important to note that effective squeezing is not directly related to the fault-tolerance thresholds. Most GKP-based fault-tolerance thresholds are derived based on the specific, approximate states given in Eq. (5) and refer to r and κ. Any other state can therefore in general not be guaranteed to enable fault-tolerant computations, even when the effective squeezing parameters are both above these thresholds. Moreover, the effective squeezing parameters say nothing about the logic state of the GKP qubit, e.g., a mixed code state might be strongly squeezed, but might not necessarily be useful for quantum computing.

Nevertheless, it is reasonable to assume that states with a high degree of effective squeezing can be used for fault tolerance if they otherwise closely resemble the approximate pure grid states of Eq. (5), e.g., in terms of their fidelity with the approximate states. In further analysis, we therefore compliment the effective squeezing parameters with the fidelity to verify the appropriateness of using the effective squeezing parameters as quantifiers of the protocol performance. Moreover, we also verify that the produced states have the expected grid structure in terms of their Wigner function. Another alternative figure of merit is the effective shift error29, which is discussed and calculated in Supplementary Note 1.

Preparation protocol

Several proposals exist for the preparation of approximate grid states2,19,30,31,32,33,34,35,36,37,38. The original GKP paper2 includes a proposal based on a radiation-pressure-like interaction between two bosonic modes under the Hamiltonian \({\hat{X}}_{1}{\hat{a}}_{2}^{\dagger }{\hat{a}}_{2}\) in the quantum nonlinear regime. However, experimental realization of the required strongly nonlinear coupling has proven highly challenging and has not yet been achieved.

In ref. 30, a preparation protocol based on the Rabi interaction Hamiltonian \(\hat{P}{\hat{\sigma }}_{x}\) (where \({\hat{\sigma }}_{x}\) is the Pauli-x matrix), between the bosonic mode and a two-level system was proposed. Such an interaction can be realized in trapped ions39 and microwave cavities19. This protocol, however, has three main drawbacks: first it is probabilistic, with a success probability inversely proportional to the mean photon number of the generated state. Second, the output states have a box-shaped envelope rather than the Gaussian envelope of equation (5). This means that the effective squeezing parameters are suboptimal given the number of steps required to prepare the states. Hence, excessively large states need to be generated to obtain useful effective squeezing. Finally, the protocol requires qubit measurements, which in realistic systems will constitute a significant contribution to the total preparation time during which the state decoheres.

The two first issues were solved by Terhal and Weigand in ref. 31: by adding a single measurement-based feed-forward displacement operation as well as suitable qubit rotations, the protocol is made deterministic. Furthermore, by using a different strength of the Rabi interactions, the envelope of the output state is made nearly Gaussian, making the protocol much more efficient. However, their protocol still relies on qubit measurements, which limits the quality of the states that can be realistically generated in the laboratory today.

Our protocol addresses all the above-mentioned problems by adding additional short Rabi interactions of the form \(\hat{X}{\hat{\sigma }}_{y}\), which effectively act as "deterministic measurements” by disentangling the bosonic mode and the qubit and further enable us to shape the envelope of the state. This interaction can be obtained from the \(\hat{P}{\hat{\sigma }}_{x}\) Hamiltonian by simple rotations of the qubit and the bosonic mode, i.e., \({\hat{\sigma }}_{y}={e}^{-i\pi /4{\hat{\sigma }}_{z}}{\hat{\sigma }}_{x}{e}^{i\pi /4{\hat{\sigma }}_{z}}\) and \(\hat{X}={e}^{-i\pi /2\hat{n}}\hat{P}{e}^{i\pi /2\hat{n}}\). Similarly, both interaction types can be obtained from the more commonly considered Rabi Hamiltonian \(\hat{X}{\hat{\sigma }}_{x}\). Fig. 1a shows a circuit diagram of the protocol. It consists of N groups of interactions, each consisting of three gates:

  • a preparation gate, \({\hat{U}}_{k}={e}^{i{u}_{k}\hat{X}{\hat{\sigma }}_{y}}\).

  • a displacement gate, \({\hat{V}}_{k}={e}^{i{v}_{k}\hat{P}{\hat{\sigma }}_{x}}\).

  • a disentangling gate, \({\hat{W}}_{k}={e}^{i{w}_{k}\hat{X}{\hat{\sigma }}_{y}}\).

These interactions can be interpreted as either conditional displacements of the bosonic mode or conditional rotations of the qubit, as illustrated in Fig. 1b. As the preparation and disentangling gates are of the same type, i.e., \(\hat{X}{\hat{\sigma }}_{y}\), the preparation gate of round k can be combined with the disentangling gate of round k − 1 into a single gate. The interaction strengths of the displacement and disentangling gates are given by

$${v}_{k}=\left\{\begin{array}{ll}-\sqrt{\pi }{2}^{N-1},&\,\text{if}\,\ k=1,\\ \sqrt{\pi }{2}^{N-k}&\,\text{if}\,\ k>1\end{array}.\right.$$
(8)
$${w}_{k}=\left\{\begin{array}{ll}-\frac{\sqrt{\pi }}{4}{2}^{-(N-k)},&\,\text{if}\,\ k<N,\\ \frac{\sqrt{\pi }}{4}&\,\text{if}\,\ k=N\end{array}.\right.$$
(9)

while the interaction strengths of the preparation gates, uk, are found numerically (see Supplementary Note 2). In the first round, the optimal preparation gate strength is u1 = 0, i.e., \({\hat{U}}_{1}={\mathbb{1}}\) so \({\hat{U}}_{1}\) is thus ignored in Fig. 1a. The input state is a squeezed vacuum state \({\hat{S}}_{r}\left|{\rm{vac}}\right\rangle\) and the output state is an approximation to the state \({\left|1\right\rangle }_{{\rm{GKP}}}\), which can subsequently be transformed into an arbitrary grid state, as will be discussed later. Note that all gates commute with \(\hat{D}(i\sqrt{2\pi })={e}^{i2\sqrt{\pi }\hat{X}}\). Therefore, ΔX is left invariant under the protocol, i.e. the effective squeezing of the output state in the X-quadrature is ΔX = er. The effect of the protocol is thus to create a superposition of 2N squeezed states and thereby improve ΔP. The effect of each gate is illustrated in Fig. 1c for the case of N = 3, but the procedure can be extended for arbitrary N.

Fig. 1: Overview of the grid state-preparation protocol.
figure 1

a Circuit diagram of the measurement-free grid state generation protocol. The bosonic mode interacts with the qubit through a sequence of Rabi gates with interaction Hamiltonians of the form \(\hat{P}{\hat{\sigma }}_{x}\) and \(\hat{X}{\hat{\sigma }}_{y}\) to produce an approximate GKP 1 logic state without measurements. b The Rabi gates can be viewed either as conditional displacements on the bosonic mode depending on the qubit state or conditional rotations of the qubit depending on the bosonic state. c Illustration of the protocol for N = 3 for an infinitely squeezed input state. The ket above each peak in the wave function represents the state of the qubit entangled with the given peak. The displacement gates \(\hat{V}\) split each peak in two, creating an entangled state. The disentangling gates \(\hat{W}\) then rotate the qubit depending on the boson state to remove the entanglement. The preparation gates \(\hat{U}\) rotate the qubit before the displacement gates to control the envelope of the resulting state.

Infinitely squeezed input states

To illustrate the functionality of the gates, we first consider an infinitely squeezed input state, \(\left|X=0\right\rangle\). For brevity, we will use the notation \(\left|X={x}_{0}\right\rangle ={\left|{x}_{0}\right\rangle }_{x}\) in the following. The first operation is the displacement gate \({\hat{V}}_{1}\), which creates an entangled boson-qubit state:

$$\hat{{V}_{1}}{\left|0\right\rangle }_{x}\left|0\right\rangle =\frac{1}{\sqrt{2}}\left({\left|{2}^{N-1}\sqrt{\pi }\right\rangle }_{x}\left|+\right\rangle +{\left|-{2}^{N-1}\sqrt{\pi }\right\rangle }_{x}\left|-\right\rangle \right),$$
(10)

where \(\left|\pm \right\rangle =(\left|0\right\rangle \pm \left|1\right\rangle )/\sqrt{2}\). The disentangling gate then rotates the qubit to erase the entanglement:

$$\hat{{W}_{1}}\hat{{V}_{1}}{\left|0\right\rangle }_{x}\left|0\right\rangle =\frac{1}{\sqrt{2}}\left({\left|{2}^{N-1}\sqrt{\pi }\right\rangle }_{x}-{\left|-{2}^{N-1}\sqrt{\pi }\right\rangle }_{x}\right)\left|1\right\rangle .$$
(11)

We have thus created a superposition between two squeezed states. The second round splits each of these peaks in two, creating a total of four peaks:

$$\begin{array}{ll}&(\hat{{W}_{2}}\hat{{V}_{2}}\hat{{U}_{2}})(\hat{{W}_{1}}\hat{{V}_{1}}){\left|0\right\rangle }_{x}\left|0\right\rangle \\ =&\frac{1}{\sqrt{2}}\left(\right.-{b}_{1}{\left|-3\cdot {2}^{N-2}\sqrt{\pi }\right\rangle }_{x}+{a}_{1}{\left|-{2}^{N-2}\sqrt{\pi }\right\rangle }_{x}\\ &-{a}_{1}{\left|{2}^{N-2}\sqrt{\pi }\right\rangle }_{x}+{b}_{1}{\left|3\cdot {2}^{N-2}\sqrt{\pi }\right\rangle }_{x}\left)\right.\left|1\right\rangle .\end{array}$$
(12)

The coefficients are controlled by the preparation gate and are given by \({a}_{1}=\sin (\pi /4+{2}^{N-1}\sqrt{\pi }{u}_{2})\) and \({b}_{1}=\cos (\pi /4+{2}^{N-1}\sqrt{\pi }{u}_{2})\). The third round creates eight peaks and so on for a total of 2N peaks after N rounds. Thus, the resulting state is

$$\left(\frac{1}{\sqrt{2}}\mathop{\sum }\limits_{k=1}^{{2}^{N}}{c}_{k}{\left|\left(2k-{2}^{N}-1\right)\sqrt{\pi }\right\rangle }_{x}\right)\left|0\right\rangle ,$$
(13)

where the coefficients ck can be optimized by tuning the strengths of the preparation gates (see Supplementary Note 2). For these infinitely squeezed input states, we can obtain ΔP = {6.6, 11.6, 16.6, 20.6} dB, for N = {1, 2, 3, 4}, and ΔX =  dB as ΔX is determined solely by the initial squeezing of the input state.

Finitely squeezed input states

For a finitely squeezed input state, the protocol outlined above is not exact, and in particular, the disentangling operation is not exact. Thus, after tracing out the qubit the resulting state is mixed, but the effect on ΔP of the output state is very small. This can be seen in Fig. 2a, which shows ΔP as a function of the input squeezing. As ΔX = er is preserved during the protocol, high effective squeezing can be obtained simultaneously in both quadratures even with finitely squeezed input states.

Fig. 2: Quality of states generated with finite squeezing.
figure 2

a Effective squeezing in the P quadrature, ΔP, as a function of squeezing in the X-quadrature of the input state after N rounds. ΔX is invariant under the protocol. The dashed line is ΔP = ΔX = er. b Left: Wigner functions of the generated states for N = 2 and N = 3 with 11.5 dB and 16.6 dB input squeezing respectively. The plotted states are marked with (i) and (ii) in (a). Right: Wigner functions of the target approximate GKP states given by equation (5).

Note that, as seen from Fig. 2, even with vacuum input a significant amount of effective squeezing can be obtained. By applying the protocol twice, once in each quadrature direction, we can therefore generate grid-like states with high degrees of effective squeezing in both quadratures. However, a careful analysis (presented in Supplementary Note 3) shows that these states are not well-defined pure states in the GKP basis, and therefore, seemingly, unsuitable for GKP-based computations.

In Fig. 2b, (left) we present the Wigner functions of the generated states for N = 2 and N = 3 with input squeezing of 11.5 dB and 16.6 dB respectively, in which case equal effective squeezing in X and P is obtained. For comparison, we also plot the Wigner functions of the corresponding target approximate grid states given by equation (5) with the same amount of squeezing (right plots in Fig. 2b). For N = 2, we observe very small differences in the edges of the states, which are caused by the cutoff in the number of squeezed states in the superposition of the generated state. Despite these differences, the resulting fidelity is already 93.5%. For N = 3, the differences become much less pronounced and the fidelity increases to 99.3%. Thus, very few rounds of operations are required to make grid states with high effective squeezing and near unity fidelity to the commonly considered approximate grid states of equation (5).

Preparation of arbitrary logical states

The state generated so far is the logical \(\left|1\right\rangle\) state of the square GKP code. It is, however, important to be able to generate an arbitrary logical grid state, i.e., of the form \({c}_{0}{\left|0\right\rangle }_{{\rm{GKP}}}+{c}_{1}{\left|1\right\rangle }_{{\rm{GKP}}}\). In particular, magic states, such as \(\left|H\right\rangle =\cos (\pi /8){\left|0\right\rangle }_{{\rm{GKP}}}+\sin (\pi /8){\left|1\right\rangle }_{{\rm{GKP}}}\) are highly important as they serve as resources for performing non-Clifford operations via gate teleportation40.

Furthermore, non-square rectangular grid states–which are equivalent to squeezed square grid states–are also a useful resource, as they remove the need for in-line squeezing using a newly developed modified Glancy and Knill error recovery scheme41. In the following, we thus discuss how to generate the arbitrary logical grid state with both rectangular and hexagonal lattices.

We first note that rectangular lattices map onto square lattices simply by scaling the quadratures, i.e., \(\hat{X}\to C\hat{X}\) and \(\hat{P}\to {C}^{-1}\hat{P}\), where C is the scale factor. These scalings can consequently be straightforwardly implemented by appropriate scaling of the interaction parameters, i.e., u → Cu, v → C−1v, and w → Cw. To generate hexagonal states we utilize the fact that the hexagonal logical \(\left|1\right\rangle\) state is identical to the logical \(\left|1\right\rangle\) state of the rectangular lattice with \(\alpha =i\sqrt{\frac{4}{\sqrt{3}}\pi }\) and \(\beta =\sqrt{\sqrt{3}\pi }\). We can thus also initialize the logical \(\left|1\right\rangle\) state of the hexagonal lattice.

The circuit diagram shown in Fig. 3a shows how to map the logical \(\left|1\right\rangle\) state into arbitrary logic states using three Rabi interactions \(\hat{u}\), \(\hat{v}\), and \(\hat{w}\). The idea is to proceed with the scheme for generating the logical \(\left|1\right\rangle\) state, but exploiting the linearity of the protocol and the fact that the effect of the displacement gate depends on the state of the qubit. Therefore, by initializing the qubit in the state \({c}_{0}\left|-\right\rangle -{c}_{1}\left|+\right\rangle\), we effectively transfer the coefficients of the qubit onto the grid state, leaving the qubit in the \(\left|0\right\rangle\) state. The additional two, unconditional, displacement operations ensure that the resulting state is on the lattice. The first operation \(\hat{D}(\alpha /4)\) can be effectively implemented during the preparation protocol by inverting the sign of wN, whereas the second unconditional operation \(\hat{D}(\beta /4)\) simply shifts the lattice for all states and can therefore be virtually implemented by a shift of reference frame. The strength of the first conditional operation \(u^{\prime}\), and the qubit-dependence ϕ of the preparation gate \(\hat{u}\) depends on the target logical state and are found by numerical optimization (\({\hat{\sigma }}_{\phi }=\cos (\phi ){\hat{\sigma }}_{x}+\sin (\phi ){\hat{\sigma }}_{y}\) represents a generalized Pauli operator in the xz plane). The gate \(\hat{u}\) is not crucial for the scheme, but only improves the quality of the output states by allowing a degree of control over the envelope of the output state. The strength of the disentangling gate \(\hat{w}\) is \(w^{\prime} =-\pi /(\sqrt{2}{\rm{Re}}(\beta ))\).

Fig. 3: Preparation of arbitrary logical GKP state.
figure 3

a Circuit diagram for preparing arbitrary logical GKP states. b Wigner functions for various logical square grid states numerically generated using our scheme with N = 3 and 16.6 dB input squeezing. c Wigner functions for various logical hexagonal grid states generated using N = 3 and 15 dB input squeezing. The arrows in the top plot of (b) and (c) show the directions and magnitude of the stabilizer displacements \({\hat{S}}_{z}\) and \({\hat{S}}_{x}\).

Figure 3b, c show the Wigner functions of various logical states with square and hexagonal lattices, respectively, numerically generated using this protocol, showing clear, well-defined grid structures.

Effects of noise

We now consider the effect of relevant noise sources on our protocol. To include noise effects in our model, we consider each gate as being implemented with a specific Hamiltonian for a set duration, e.g., the gate \({e}^{ic\hat{X}{\hat{\sigma }}_{y}}\) is implemented via the Hamiltonian \(\hat{H}=\frac{1}{T}\hat{X}{\hat{\sigma }}_{y}\) within the time t = cT. To simulate the added noise, we use a master equation approach in which noise is included in the Lindblad terms \(\hat{L}\):

$$\frac{{\rm{d}}\rho }{{\rm{d}}t}=-\frac{i}{\hslash }[\hat{H},\rho ]+\hat{L}\rho {\hat{L}}^{\dagger }-\frac{1}{2}\left({\hat{L}}^{\dagger }\hat{L}\rho +\rho {\hat{L}}^{\dagger }\hat{L}\right),$$
(14)

where ρ is the density matrix of the composite boson-qubit system. We consider four common noise channels:

  • Boson loss: \(\hat{L}=\sqrt{\gamma }\hat{a}\)

  • Boson dephasing: \(\hat{L}=\sqrt{\gamma }(\hat{a}{\hat{a}}^{\dagger }+{\hat{a}}^{\dagger }\hat{a})\)

  • Boson heating: \({\hat{L}}_{1}=\sqrt{{\gamma }_{c}(\bar{n}+1)}\hat{a},{\hat{L}}_{2}=\sqrt{{\gamma }_{c}\bar{n}}{\hat{a}}^{\dagger }\)

  • Qubit dephasing: \(\hat{L}=\sqrt{\gamma }{\hat{\sigma }}_{z}\)

  • Qubit decay: \(\hat{L}=\sqrt{\gamma }({\hat{\sigma }}_{x}+i{\hat{\sigma }}_{y})/2\)

For the boson heating, Lindbladian \(\bar{n}\) is the mean occupation of the environment which couples to the system with rate γc. Here we consider the case of large \(\bar{n}\), such that \(\sqrt{{\gamma }_{c}(\bar{n}+1)}\approx \sqrt{{\gamma }_{c}\bar{n}}\equiv \gamma\), such that the heating rate of the system is constant. The effect of these noise sources on the effective squeezing of the output states is shown by the solid lines in Fig. 4. For each noise source, we consider N = 2 and N = 3 rounds with 11.5 dB and 16.6 dB squeezed input states, respectively. It is clear that our protocol is sensitive to all types of noise. By increasing N, we also increase the implementation time of the protocol, thus increasing the effect of noise. Therefore, there exists an optimal number of rounds that depends on the magnitude and type of noise. For example, for large noise contributions, two rounds (N = 2) of the scheme produces states with higher effective squeezing degrees than three rounds (N = 3), and this is simply a result of the extended time over which noise can accumulate. This clearly illustrates the importance of a fast preparation protocol.

Fig. 4: Effects of physical noise sources.
figure 4

Effective squeezing in X and P for a square grid state as a function of noise rate for different noise sources during the preparation protocol. γ is the noise rate and T is the time required to implement \({e}^{i\hat{X}{\hat{\sigma }}_{y}}\) and \({e}^{i\hat{P}{\hat{\sigma }}_{x}}\).

Even though the quality of the generated states is limited by qubit and bosonic errors, the effect of qubit errors can be significantly suppressed by adding a few qubit measurements, after each of the disentangling gates \(\hat{W}\). In the noiseless case, the qubit should be in a known state, disentangled from the bosonic mode at these points, as illustrated in the rightmost windows of Fig. 1c. Therefore, if we measure the qubit in a different state, we know that an error has occurred, and the realization should be discarded and the protocol restarted. The result of such a postselection strategy is shown by the dashed lines in Fig. 4, demonstrating that we can improve the effective squeezing of the output state by several dB. Bosonic errors, on the other hand, are largely unaffected by the postselection strategy. Thus, when these errors are dominating the only way to improve the output states is to increase the interaction speed or reduce the rate of the noise. For the calculation of Fig. 4, we assumed instantaneous measurements to isolate the effect of qubit projections. In real systems the measurements will take time, during which noise accumulates thus resulting in lower effective squeezing parameters. However, compared with the measurement-based schemes, e.g., phase-estimation31, we require exponentially fewer measurements and therefore still attain a significant speed-up.

Using realistic noise parameters and operation speeds from recent experiments with trapped ions18 and microwave cavities19, we find that grid states with effective squeezing parameters above 10 dB in both quadratures can be realistically generated in both platforms using input states squeezed by 11 dB (see Supplementary Note 4). Squeezing levels of 12.6 dB in trapped ions42 and 10 dB in microwave cavities43 have been experimentally generated. The method used for generating squeezed states in trapped ions has been experimentally demonstrated to be compatible with further manipulation using Rabi gates18, whereas the method used in the microwave regime requires specialized structures, which could compromise the quality of subsequent gates. However, it has recently been shown that Rabi gates can be used to deterministically generate the required squeezed vacuum states starting from vacuum44. Thus the protocol presented in this work can readily be implemented in any qubit-oscillator system where Rabi interactions can be efficiently implemented.

Discussion

In conclusion, we have presented a measurement-free protocol to deterministically prepare GKP states using only few interactions of the type \(\hat{X}{\hat{\sigma }}_{y}\) and \(\hat{P}{\hat{\sigma }}_{x}\), which are readily available in trapped-ion and microwave-cavity platforms. Our protocol requires no measurements, resulting in a speed-up over previous methods, which enables the generation of grid states with high effective squeezing levels. Furthermore, by adding a few measurements, we can partly detect qubit errors, thus making the protocol robust against qubit noise. Although the exact requirements for general CV states (i.e., states not exactly on the form of Eq. (5)) to enable fault-tolerance with the GKP encoding are yet unknown, it seems reasonable that states generated using this protocol suffice, due to their high fidelity with the commonly considered approximate grid states of Eq. (5).

Finally, our protocol exemplifies the versatility of sequential applications of non-commuting Rabi Hamiltonians, e.g., \(\hat{P}{\hat{\sigma }}_{x}\) and \(\hat{X}{\hat{\sigma }}_{y}\), demonstrating that highly non-Gaussian states can be deterministically engineered with only a few of these interactions. The full power of such repeated combination of Rabi interactions still remains relatively unexplored, but we expect that many other interesting applications are possible using this technique.

During the publication of this manuscript, the protocol was experimentally implemented in a trapped-ion system45.