# The performance of random bosonic rotation codes

Saurabh Totey  These two authors contributed equally.  Department of Physics,
University of Colorado, Boulder, Colorado 80309, USA  Department of Computer
Science, University of Colorado, Boulder, Colorado 80309, USA  Akira Kyle
These two authors contributed equally.  Department of Physics, University of
Colorado, Boulder, Colorado 80309, USA  Steven Liu  Department of Aerospace
Engineering, University of Colorado, Boulder, CO 80309  Pratik J. Barge
Hearne Institute for Theoretical Physics, Department of Physics and Astronomy,
Louisiana State University, Baton Rouge, Louisiana 70803, USA  Noah Lordi
Department of Physics, University of Colorado, Boulder, Colorado 80309, USA
Joshua Combes  Department of Electrical, Computer and Energy Engineering,
University of Colorado, Boulder, Colorado 80309, USA

###### Abstract

Bosonic error correcting codes utilize the infinite dimensional Hilbert space
of a harmonic oscillator to encode a qubit. Bosonic rotation codes are
characterized by a discrete rotation symmetry in their Wigner functions and
include codes such as the cat and binomial codes. We define two different
notions of random bosonic rotation codes and numerically explore their
performance against loss and dephasing. We find that the best random rotation
codes can outperform cat and binomial codes in a certain parameter regime
where loss is large and dephasing errors are small.

##  I Introduction

Since Shannon [1], error correction and randomness have been and continue to
be intertwined [2, 3, 4]. Similarly, in quantum information, random quantum
codes [5] have a long history of exploration, predominantly for qubits and
qudits (e.g. [6, 7, 8]), and they are currently being actively explored [9,
10].

Bosonic codes encode qubits or qudits into a subspace of the quantum harmonic
oscillator [11]. Bosonic error correcting codes have gained a lot of recent
attention due to experimental demonstrations of logical fidelities exceeding
physical fidelities [12, 13]. Indeed, much of the theoretical progress has
been spurred on by the rapid experimental progress in circuit QED [14, 15],
trapped ions [16, 17, 18, 19], and optics [20, 21, 22]. There are two major
kinds of bosonic codes: those with a translation symmetry [11] (e.g. GKP
codes), and those with a rotation symmetry [23] (e.g. cat and binomial codes
[24, 25, 26, 27]). These codes have a structure induced by the translation or
rotation symmetry and additionally they have a structure induced by the code
family e.g. cat codes have a possion distribution in the number basis. Little
has been done on bosonic random codes that are unsturctued in either way.
However in Ref. [28] the authors considered a continuous-variable bosonic
random encoding for quantum secret sharing protocols, while [29] introduced
the randomized construction of GKP codes using the NTRU cryptosystem for a
public key quantum communication scheme.

In this article, we construct two kinds of random bosonic codes that have the
rotation symmetry strucutre but derive their fock amplitudes from haar random
states. The codes have an $N$-fold rotation symmetry such that a phase space
rotation of $\pi/N$ acts as a logical $Z$ gate. In Section II, we briefly
describe rotation codes. Our random rotation codes are defined in Section III.
We introduce a two-parameter bosonic loss-dephasing channel in Section IV,
which are typically the dominant errors for oscillator systems. In Section V,
we compare the performance of our random codes to cat and binomial codes under
these error channels using a numerically optimized recovery. We show that
random codes can outperform both cat and binomial codes in certain regions of
loss and dephasing. Building on previous work by Leviant  _et al._ [30], we
plot a 2D phase diagram of the best code as a function of loss and dephasing,
which shows that, by and large, binomial codes are generally the most
performant for the majority of realistic noise channels, but random codes can
perform better under high loss and moderate dephasing.

##  II Rotation Codes

Rotation-symmetric codes, or “rotation codes”, are a type of bosonic code
where discrete rotational symmetries in phase-space are utilized to protect
against noise. Interestingly, the logical $Z$ gate for these codes is a
rotation by $\pi/N$. The phase space rotation symmetry imposes some
restrictions on the Fock coefficients of the code words. In order for a code
to have a rotation symmetry degree of $N$, the $\ket{0_{N}}$ and $\ket{1_{N}}$
codewords must be representable as

$\displaystyle\ket{0_{N}}={}$
$\displaystyle\sum_{k=0}^{\infty}f_{2kN}\ket{2kN},$ (1a)
$\displaystyle\ket{1_{N}}={}$
$\displaystyle\sum_{k=0}^{\infty}f_{(2k+1)N}\ket{(2k+1)N}\,,$ (1b)

where $\ket{k}$ is an eigenstate of the photon number operator $\hat{n}$. The
amplitudes $f_{2kN}$ and $f_{(2k+1)N}$ are the only things that specify a
class of rotation codes, so a class of codes is determined by the functional
form of these coefficients. The class of rotation code does not restrict the
possible rotation symmetry degrees.

The dual-basis codewords, $\ket{\pm_{N}}$, are constructed as usual via
superpositions of the computational basis codewords.
$\ket{\pm_{N}}=\frac{1}{\sqrt{2}}(\ket{0_{N}}\pm\ket{1_{N}})$, yielding Fock
space representations

$\displaystyle\ket{+_{N}}=$
$\displaystyle\frac{1}{\sqrt{2}}\sum_{k=0}^{\infty}f_{kN}\ket{kN},$ (2a)
$\displaystyle\ket{-_{N}}=$
$\displaystyle\frac{1}{\sqrt{2}}\sum_{k=0}^{\infty}(-1)^{k}f_{kN}\ket{kN}.$
(2b)

Both $\ket{\pm_{N}}$ have support on the full set of $\ket{kN}$ Fock states.
It is these dual basis codewords that have an $N$-fold rotational symmetry,
while the $Z$ basis code words in Eq. 1 have a $2N$-fold rotation symmetry.

A general logical state $\ket{\psi}_{L}=\alpha\ket{0_{N}}+\beta\ket{1_{N}}$ is
the $+1$ eigenstate of the stabilizer

$\bar{R}_{N}\equiv\exp\\!\left[i\frac{2\pi}{N}\hat{n}\right]\,.$ (3)

It turns out that the logical $\bar{Z}$ gate is given by

$\bar{Z}_{N}\equiv\sqrt{\hat{R}_{N}}=\hat{R}_{2N}$ (4)

which is a rotation by $\pi/N$ such that $\bar{Z}_{N}\ket{\pm_{N}}=(\pm
1)\ket{\pm_{N}}$. The corresponding logical $\bar{X}$ gate is code dependent.
However, rotations about $\bar{Z}$ by fractional angles can be constructed in
a code independent way [23, 31].

There are two natural errors for a rotation code to correct. The first kind
are shift errors, where a number state $\ket{n}$ gets shifted by $g$ i.e.
$\ket{n}\mapsto\ket{n\pm g}$ where $g$ is some integer. The second kind are
rotation errors which are induced by the operator $e^{i\phi\hat{n}}$. The set
of shift and rotation errors that are mutually correctable for an order-$N$
ideal phase code are given by [23, 32, 31]

$\displaystyle g$ $\displaystyle\in[0,N)\quad{\rm(number\ errors)}$ (5a)
$\displaystyle\phi$ $\displaystyle\in[0,\pi/N)\quad{\rm(phase\ errors)}.$ (5b)

There is a trade-off between the ability to correct number shift and phase
errors. For example, a higher rotation symmetry degree, i.e. $N$, allows for
rotation codes to protect against shift errors more effectively, but that, in
turn, adversely affects the ability to protect against phase errors. The
consequences of this trade-off are made apparent in Section V.

##  III Random Rotation codes

We start by considering rotation codes where the amplitudes of the code words
are generated with some random processes. We describe two kinds of random
rotation codes. Both of the following random generation methods rely on using
Haar random unitary matrices [33] applied to arbitrary states to get random
states. A $(K+1)\times(K+1)$ Haar random unitary is denoted as

$\mathbb{U}_{K+1}\in{\rm SU}(K+1)\,.$ (6)

The restriction to $K+1$ invokes a photon number cutoff of $K$, so the unitary
acts on Fock states from vacuum $\ket{0}$ through $\ket{K}$. It should be
noted that there are simple algorithms to generate Haar random samples from
the special unitary group [34]. All random states in this work were generated
by applying the Haar random unitary to the ground state of the quantum
harmonic oscillator i.e. $\ket{0}$.

###  III.1 Random codes with one random primitive state

Here we construct codes where the logical codewords $\ket{0_{N}}$ and
$\ket{1_{N}}$ use the same random state but are offset in Fock space. For
example, if the codewords are allowed to use 7 levels of the harmonic
oscillator, then a 7-dimensional random state is generated. The random state
is then ‘expanded’ into the code words by having the used levels of the
harmonic oscillator match the corresponding values of the random state vector.
This process is illustrated in Fig. 1.

Figure 1: Using one randomly generated primitive for both logical zero and
logical one codewords. In the center, we plot the real part of the fock
amplitudes of the randomly generated state i.e.
$\Re(\langle{k}|{\psi_{K}}\rangle)$. In practice, we allow these weights to be
complex. This state gets expanded separately into the $\ket{0_{N}}$ and
$\ket{1_{N}}$ spaces. Importantly, the primitive state only has as many
dimensions as will be used in the codewords.

In general, we can consider a $K+1$-dimensional random state that we call a
“primitive”

$\displaystyle\ket{\psi_{K}}=\mathbb{U}_{K+1}\ket{0}=\sum_{k=0}^{K}\psi_{k}\ket{k}\,,$
(7)

where $\ket{0}$ is the vacuum and $\ket{k}$ is the k’th Fock state. This state
gets “expanded” into the code words

$\displaystyle\ket{0_{N}}={}$
$\displaystyle\sum_{k=0}^{K}\psi_{k}\ket{2Nk}\,,$ (8a)
$\displaystyle\ket{1_{N}}={}$
$\displaystyle\sum_{k=0}^{K}\psi_{k}\ket{(2k+1)N}\,,$ (8b)

where $\psi_{k}=\langle{k}|{\psi_{K}}\rangle$ where $\ket{\psi_{K}}$ is
defined in Eq. 7. Even though the amplitude is the same on both code words,
the states are orthogonal (i.e. $\langle{0_{N}}|{1_{N}}\rangle=0$) due to
being constructed on non-overlapping Fock states. Moreover, we can
approximately control the average photon number in the code space by varying
the cutoff, $K$. If we naively assume flat amplitudes on average for the
random primitive state, the expected value of photon number for the code space
is $\langle{\hat{n}}\rangle=N(2K+1)/2$.

###  III.2 Random Codes with two random primitive states

Figure 2: Using two randomly generated primitive states for logical zero and
logical one codewords separately. Each logical codeword draws from its own
primitive state, and each primitive state is exactly as large as is needed by
the codeword. Again, we allow the weights on each Fock state to be complex,
but plot only the real part for simplicity.

These codes use two random states to construct the code, one for $\ket{0_{N}}$
and one for $\ket{1_{N}}$. For this reason we consider two $K+1$-dimensional
random primitives

$\displaystyle\ket{\psi_{K}}=\mathbb{U}_{K+1}\ket{0}=\sum_{k=0}^{K}\psi_{k}\ket{k}\,$
(9)
$\displaystyle\ket{\phi_{K}}=\mathbb{V}_{K+1}\ket{0}=\sum_{k=0}^{K}\phi_{k}\ket{k}\,,$
(10)

where $\mathbb{U}_{K+1}$ and $\mathbb{V}_{K+1}$ are $(K+1)\times(K+1)$ random
unitaries. In principle, we could consider different cutoffs for the different
states, but for simplicity we do not. These states get expanded into the
codewords

$\displaystyle\ket{0_{N}}={}$ $\displaystyle\sum_{k=0}^{K}\psi_{k}\ket{2Nk},$
(11a) $\displaystyle\ket{1_{N}}={}$
$\displaystyle\sum_{k=0}^{K}\phi_{k}\ket{(2k+1)N}\,,$ (11b)

where $\psi_{k}$ and $\phi_{k}$ are amplitudes generated by different random
unitaries. The process of constructing these codes is depicted in Fig. 2. Note
that the codes are orthogonal due to the non-overlapping support on the Fock
states despite $|\psi_{K}\rangle$ and $|\phi_{K}\rangle$ generally not being
orthogonal.

The Wigner functions of an example random code with two random primitive
states is depicted in Fig. 3. Notice that the Wigner function for
$\ket{0_{N}}$ and $\ket{1_{N}}$ are different, which is normal in these kinds
of codes. This is unlike the codes presented in Section III.1, which will have
similar looking Wigner functions for $\ket{0_{N}}$ and $\ket{1_{N}}$.

It is worthwhile to pause and think about the set of codes from which we are
sampling. For a fixed value of rotation symmetry $N$ and Fock cutoff $K$, we
will call the set of all possible codes $\mathbb{S}(N,K)$. Random codes with
one primitive sample a subset of the space of all possible codes, but we
conjecture that the random codes with two primitives sample the complete space
of $\mathbb{S}(N,K)$. This means that any possible code that shares this
symmetry and cutoff could be generated by random codes with two primitives,
even binomial and cat codes, although this would be incredibly unlikely for
any single trial. We make an attempt to sample $\mathbb{S}(N,K)$ uniformly by
generating states from the Haar measure.

Figure 3: Wigner functions of a random code with two primitives described in
Section III.2 with rotation symmetry of $N=2$ and a cut-off of $K=5$. The
$\ket{\pm_{N}}$ states exhibit a 2-fold symmetry, while the $Z$ basis
codewords have a $2N$ symmetry i.e. a $4$-fold rotation symmetry.

##  IV Error Channels

The dominant physical error channels in most bosonic systems are loss and
dephasing. The noise channel we consider consists of simultaneous loss and
dephasing Specifically, the noise channel, $\mathcal{N}(\hat{\rho})$, is the
solution to the master equation

$\dot{\hat{\rho}}=\kappa_{l}\mathcal{D}[\hat{a}]\hat{\rho}+\kappa_{\phi}\mathcal{D}[\hat{n}]\hat{\rho}\;,$
(12)

where
$\mathcal{D}[\hat{L}]\hat{\rho}=\hat{L}\hat{\rho}\hat{L}^{\dagger}-\mbox{$\frac{1}{2}$}\hat{L}^{\dagger}\hat{L}\hat{\rho}-\mbox{$\frac{1}{2}$}\hat{\rho}\hat{L}^{\dagger}\hat{L}$.
Rather than numerically integrating Eq. 12 or finding a Kraus-operator
representation, we exponentiate the superoperator representation of the
Lindbladian. That is, we exponentiate $\mathcal{L}[\hat{L}]$, which is the
superoperator representation of $\mathcal{D}[\hat{L}]$, which is given as
$\mathcal{L}[\hat{L}]=\hat{L}^{*}\otimes\hat{L}-\mbox{$\frac{1}{2}$}\hat{I}\otimes\hat{L}^{\dagger}\hat{L}-\mbox{$\frac{1}{2}$}(\hat{L}^{\dagger}\hat{L})^{T}\otimes\hat{I}$.
We can then take advantage of the algorithm for sparse matrix exponentiation
in Refs. [35, 36] to efficiently solve Eq. 12 for some evolution time $t$,
thereby giving the noise channel as

$\mathcal{N}(\hat{\rho})=e^{t(\kappa_{l}\mathcal{L}[\hat{a}]+\kappa_{\phi}\mathcal{L}[\hat{n}])}\hat{\rho}\;.$
(13)

Thus $\kappa_{l}t$ and $\kappa_{\phi}t$ represent the unitless strengths of
the simultaneous loss and dephasing rates.

##  V Code performance

Figure 4:  Performance of $N=2$ (Row 1) and $N=3$ (Row 2) binomial codes.
Column 1. The performance (logical channel infidelity) of binomial codes as a
function of the average photon number of the code space projector when
$\kappa_{l}t=\kappa_{\phi}t=10^{-2}$. The minimum of this curve is plotted as
a single red marker. Column 2. Code performance as a function of equal loss
and dephasing $\kappa_{l}t=\kappa_{\phi}t$. Notice the minimum from column 1
shows up as a single point for $\kappa_{l}t=\kappa_{\phi}t=10^{-2}$. Column 3.
Code performance as a function of dephasing and loss. Note that the diagonal
part of this plot is the data from column 2 where
$\kappa_{l}t=\kappa_{\phi}t$.

In this section, we explore the performance of single-mode bosonic rotation
codes subject to loss and dephasing noise using the methods described in
Section IV. In Section V.1 we compare the performance of known rotation codes,
namely cat and binomial codes [24, 25, 27, 26]. In Section V.2 we explore the
performance of our new random rotation codes. In Section V.3 we compare the
performance of cat and binomial codes to random rotation codes. We now briefly
describe how these comparisons are performed.

Rather than assessing the performance of a particular error correction scheme,
we use a semidefinite program (SDP) to compute the recovery,
$\mathcal{R}^{\text{SDP}}$, that optimizes channel fidelity [37]. The channel
fidelity of a channel $\mathcal{E}$ to the identity channel is

$F(\mathcal{I},\mathcal{E})=\frac{1}{d(d+1)}\left(\mathrm{Tr}\left[\sum_{k}\hat{M}_{k}^{\dagger}\hat{M}_{k}\right]+\sum_{k}|\mathrm{Tr}[\hat{M}_{k}]|^{2}\right)\,,$
(14)

where $\\{\hat{M}_{k}\\}$ are the Kraus operators for $\mathcal{E}$ and $d$ is
the dimension of the Hilbert space [38].

Thus the total quantum channel we consider is

$\mathcal{D}_{\rm
dec}\circ\mathcal{R}^{\text{SDP}}\circ\mathcal{N}\circ\mathcal{S},$ (15)

where $\mathcal{S}:\mathcal{H}_{2}\to\mathcal{H}_{\mathbb{N}}$ is the ideal
encoding map for a given code,
$\mathcal{N}:\mathcal{H}_{\mathbb{N}}\to\mathcal{H}_{\mathbb{N}}$ is the noise
map (Eq. 13),
$\mathcal{R}^{\text{SDP}}:\mathcal{H}_{\mathbb{N}}\to\mathcal{H}_{\mathbb{N}}$
is the optimal recovery that maximizes the channel fidelity [37], and finally
$\mathcal{D}:\mathcal{H}_{\mathbb{N}}\to\mathcal{H}_{2}$ is the ideal decoding
map for a given code. The encoder superoperator is given by
$\mathcal{S}[\hat{S}]\hat{\rho}=\hat{S}\hat{\rho}\hat{S}^{\dagger}$ where
$\hat{S}=\ket{0_{N}}\bra{0}+\ket{1_{N}}\bra{1}$ while the decoder is given by
$\mathcal{D}_{\rm dec}[\hat{S}^{\dagger}]\hat{\rho}$. Thus the total channel
is a logical channel with qubit input and qubit output.

To this end, we compute the channel fidelity (to the identity channel) for the
channels in Section IV for different rotation codes
$\mathcal{C}\in[\textsc{cat},\textsc{bin},\textsc{1-rand},\textsc{2-rand}]$
and different rotation symmetries $N\in[2,3,4]$. As we are considering a
logical channel with qubit input and qubit output, $d=2$ in Eq. 14. Moreover,
we prefer the infidelity (i.e. $1-F$), as it is a measure of error.

When comparing the performance of codes, it has been customary [39] to rank
codes by the average photon number of the code space. This is done by defining
the code space projector as

$\hat{P}_{\rm code}=\ket{0_{N}}\\!\bra{0_{N}}+\ket{1_{N}}\\!\bra{1_{N}}\,,$
(16)

so then the average photon number in the code space is

$\bar{n}_{\rm code}=\frac{1}{2}\mathrm{Tr}[\hat{n}\hat{P}_{\rm code}]\,.$ (17)

The other important benchmark is to see when encoding into a code results in a
lower channel infidelity than the “naive” encoding. The naive encoding is
called the trivial code, and it is where the logical zero and one codewords
are respectively the ground and first excited state of the harmonic
oscillator,

$\ket{0_{\textsc{triv}}}=\ket{0},\quad{\rm
and}\quad\ket{1_{\textsc{triv}}}=\ket{1}\,.$ (18)

This is a useful comparison when the loss channel is involved, as states with
higher photon number e.g. $\ket{K}$ will decay at a rate of $\kappa_{l}K$
which is much faster than that of $\ket{1}$ which decays at a rate
$\kappa_{l}$. That is, we expect the triv encoding to be good.

When we present diagrams of code performance as a function of $\kappa_{l}t$
and $\kappa_{\phi}t$, the plots will be log-space with 5 points per decade and
the range is

$\kappa_{l}t,\kappa_{\phi}t\in[10^{-3},0.25]$ (19)

We cut off infidelities below $1\times 10^{-7}$ due to the trade off between
tolerances and runtime of the SDP solver.

###  V.1 Exploration of cat and binomial

There are several rotation codes that we could study: polygon codes, squeezed
cat codes, Pegg-Barnett codes etc. We examine the two most popular rotation
codes, cat codes [24, 25, 26] and binomial codes [27], because they have the
most theoretical and experimental work about them.

The Fock-grid coefficients $f_{kN}$ from Eq. 1 for these codes are

$\displaystyle f_{kN}$ $\displaystyle=\sqrt{\frac{1}{2^{K-1}}\binom{K}{k}}$
$\displaystyle{\rm(\textsc{bin})}$ (20a) $\displaystyle f_{kN}$
$\displaystyle=\sqrt{\frac{2}{\mathcal{N}_{i}}}\frac{e^{-|\alpha|^{2}/2}\alpha^{kN}}{\sqrt{(kN)!}}$
$\displaystyle{\rm(\textsc{cat})}$ (20b)

where, for cat codes, $\mathcal{N}_{i}$ is the Fock-space normalization factor
such that $\mathcal{N}_{0}$ is used for even values of $k$ and
$\mathcal{N}_{1}$ is used for odd values of $k$.

In row 1 of Fig. 4, we plot the channel fidelity of the $N=2$ binomal code
while in row 2, we plot the $N=3$ codes. In column 1 we sweep the code
parameter $K$ in Eq. 20a which controls the average photon number of the code
space. A generic feature is that there is typically an optimal value of $K$
for a given noise value. Also, note that only some values of $K$ result in
channel infidelities below the trial encoding. The filled red point indicates
the point with the smallest channel infidelity.

In column 2 of Fig. 4, we plot the best-performing code (optimized over the
binomial code parameter $K$) as a function of noise strength for the case
where loss is equal to dephasing i.e. $\kappa_{l}t=\kappa_{\phi}t$. Again we
are interested in when the codes are beating the triv infidelity, which
appears to be $5\times 10^{-2}$ for $N=2$ and $7\times 10^{-2}$ for $N=3$
codes. The optimal point from the previous plot now appears as one point on
these plots.

In column 3 of Fig. 4, we plot the best-performing code as a function of loss
$\kappa_{l}t$ and dephasing $\kappa_{\phi}t$. The optimal codes from column 2
are now the diagonal line along this plot. A general trend we note is that, as
either $\kappa_{\phi}t$ or $\kappa_{l}t$ decrease, the infidelity decreases.
That is to say, as the noise strength decreases, the code performance
increases.

Cat codes have similar performance as these binomial codes and the equivalent
plot for cat codes can be found in the Appendix A see Fig. 10. In Section V.3,
we directly compare bin and cat codes.

Figure 5: Channel infidelity as a function for photon number for
$\kappa_{l}t=10^{-0.8}$ and $\kappa_{\phi}t=10^{-1.8}$ and $N=3$. Binomial,
and cat codes are shown as solid lines. While both 2-rand codes and 1-rand
codes outperform binomial and cat codes at high photon number, the best
performance from any code is achieved by a 2-rand code for this noise channel.
Figure 6:  Channel infidelity as a function for photon number for
$\kappa_{l}t=10^{-1.8}$ and $\kappa_{\phi}t=10^{-1.2}$ and $N=2$. Binomial,
and cat codes are shown as solid lines. For this noise channel the random
codes only rarely beat the trivial encoding and never beat the most performant
binomial or cat codes.

###  V.2 Exploration of random codes

In this section, we begin to explore the performance of the random codes
described in Section III. Fig. 5 and Fig. 6 show the performance of these
random codes for two different noise channels, one with large loss and
moderate dephasing (Fig. 5), and one with large dephasing and moderate loss
(Fig. 6). These plots provide some basic intuition for the performance of
random codes.

The first interesting feature from Fig. 5 is that, for certain noise channels
where loss dominates dephasing, we see 2-rand codes that outperform binomial
codes, even with a modest number of random trials. For certain average photon
numbers, almost all random codes perform better than both binomial and cat
codes. This is explored more in Section V.3 and in particular Fig. 8.

The second interesting feature in Fig. 5 is that, for channels with low
dephasing, the infidelity of 1-rand codes appear to follow a smooth curve
relating average photon number to performance. Further numerical studies (not
presented here) suggest that, in the presence of no dephasing, the performance
of 1-rand codes depends solely on average photon number despite the random
coefficients of the code.

Channels with low loss and high dephasing, such as the one used in Fig. 6,
have poor performance from both types of random codes. This is evident because
only very few random codes beat the trivial code, with the exception of a few
at $\bar{n}_{code}\approx 3$. Interestingly, the 1-rand codes seem to be
performing statistically better than the 2-rand codes. For many channels,
especially those where heuristics imply that structured codes like cat and
binomial codes are very good, generating a random code that outperforms these
existing codes should be very rare.

The number of trials used in these simulations is insufficient to make claims
about average performance or the limits of performance. Naively, one might
expect that the best possible 2-rand codes must perform as good or better than
both binomial and cat codes for any channel because the set of codes that are
randomly sampled include the known codes. We caution that randomly recreating
known codes is very unlikely. This suggests it may also be possible to
increase the likelihood of generating these exceptional random codes by
sampling a distribution other than the Haar measure. This is left as future
work.

###  V.3 Code comparison

In this section, we compare rotation codes in the set
$\mathcal{C}\in[\textsc{cat},\textsc{bin},\textsc{1-rand},\textsc{2-rand}]$
with respect to their ability to correct errors and their optimal code
parameters, namely average photon number and rotational symmetry.

Fig. 7 provides a side-by-side comparison of all four codes across many values
of both loss and dephasing. In row 1 we plot the average photon number of the
code space projector, i.e. Eq. 17, for the best code as a function of
dephasing $\kappa_{\phi}t$ and loss $\kappa_{l}t$. One trend that stands out
is that high loss encourages low photon number codes. At about
$\kappa_{l}t\approx 4\times 10^{-2}$ we see the photon numbers starting to
increase. The best “structured” codes, i.e. bin and cat codes, have increasing
photon as the noise decreases. While the 1-rand and 2-rand codes seem to have
generically have lower photon numbers.

Figure 7: For each class of codes (bin, cat, 1-rand, 2-rand) and each noise
channel (parameterized by $\kappa_{\phi}t$ and $\kappa_{l}t$), we find the
optimal code parameters and plot the performance of the code as the channel
infidelity. Row 1 The best performing average photon number of the code space
projector (colorbar) and rotation symmetry (region) are plotted as a function
of noise channel parameters. Row 2 Channel infidelity, $1-F$, of the best
performing code as a function of loss and dephasing.

The overlay on row 1 indicates the rotation symmetry of the best code for
$N\in[2,3,4]$. This overlay reveals another apparent trend for the structured
codes i.e. bin and cat codes. Notice the almost horizontal striation at
$\kappa_{\phi}t\approx 2\times 10^{-2}$ that appears because the optimal code
switches from an $N=2$ to an $N=3$ code which necessitates a higher photon
number. A similar diagonal feature can be seen at $\kappa_{\phi}t\approx
2.5\times 10^{-3}$, which occurs when the optimal code becomes $N=4$. The
1-rand and 2-rand codes seem to have more diagonal striations, this could be
due to insufficient sampling of higher photon number random codes. Naively
this may imply that the set of all performant codes does not scale with photon
number as quickly as the set of all possible codes.

In row 2 of Fig. 7, we plot the channel infidelity of the best code. The
channel infidelity is presented as a function of dephasing $\kappa_{\phi}t$
and loss $\kappa_{l}t$. We see, as expected, that as the noise decreases, the
error (infidelity) decreases. Generally, binomial codes outperform all the
other codes, but cat codes have a somewhat comparable behavior. This is
because binomial codes were designed [27] to correct a finite number of loss
and dephasing events. Thus we expect them to be good codes for loss and
dephasing channel. From the infidelity contours, it is evident that the 1-rand
and 2-rand codes don’t perform well in the low noise regime when compared to
the structured codes.

Figure 8: Percent difference in fidelity between the optimal bin code and best
2-rand code for each noise channel
$(F_{\textsc{bin}}-F_{\textsc{2-rand}})/\max\\{F_{\textsc{bin}},F_{\textsc{2-rand}}\\}$.
All the regions in blue represent noise channels where a random code
outperformed binomial codes and all regions in grey denote regions where
neither code beat the trivial code. This demonstrates that the random codes we
implemented are most useful in a regime of high loss and moderate dephasing.
Note: the scaling on the blue and red colors is unequal, this is necessary for
visual clarity.

There is another interesting trend that is most obvious by comparing the
rotation symmetry to the channel fidelity for cat and binomial codes. Rotation
codes have a well known tradeoff between code distance or “protection” against
number errors which is $d_{n}=N$ and the code distance for phase errors
$d_{\phi}=\pi/N$ such that

$\displaystyle d_{n}d_{\phi}$ $\displaystyle=\pi$ (21)

where $d_{n}-1$ is the number of loss or gain errors can be detected [23, 32,
31]. This tradeoff is apparent in cat and binomial codes of Fig. 7 where we
observe that, for high dephasing, $N=2$ codes perform the best. As dephasing
decreases, the rotation symmetry increases. It is important to note that we
have not included $N=1$ codes or the triv code. This trend seems to be much
weaker in 1-rand and 2-rand codes, which again, could be due to insufficient
sampling.

In Fig. 8 we plot the difference in channel fidelity between the best binomial
code and the best 2-rand code. Specifically we plot

$\frac{F_{\textsc{bin}}-F_{\textsc{2-rand}}}{\max\\{F_{\textsc{bin}},F_{\textsc{2-rand}}\\}}$
(22)

The gray region indicates when the trivial code performs the best. When the
plot is red, binomial codes beat 2-rand codes, which is generally the case.
When the plot is blue, 2-rand codes beat binomial codes. For loss around
$1\times 10^{-1}$, we see several points where 2-rand codes outperform
binomial codes. The improvement is modest, we see at most a $10\%$ improvement
over binomial codes. There is a trade off between the amount of time spent
searching for exceptional random codes and code performance. Here we focus on
exploring trends across many noise channels with a relatively small number of
samples per noise channel. The relative performance of random codes would
increase with more sampling, but it is unclear if this performance would
increase uniformly across all channels.

In Fig. 11 of Appendix A, we compare cat and bin codes in the same way.
Interestingly, when we compare cat to 2-rand codes we find a larger region
where 2-rand codes outperform cat codes.

Figure 9:  Best rotation code as a function of loss $\kappa_{l}t$ and
dephasing $\kappa_{\phi}t$ noise. Row 1. The best performing rotation code as
a function of loss $\kappa_{l}t$ and dephasing $\kappa_{\phi}t$. We note that
1-rand codes were never optimal in our investigation. Row 2. Average code
space photon number of the best performing code as a function of loss and
dephasing. The best rotation code symmetry values are also delineated. Row 3.
Channel infidelity of the best performing code.

In Fig. 9, the best performing code in the set
$\mathcal{C}\in[\textsc{triv},\textsc{cat},\textsc{bin},\textsc{1-rand},\textsc{2-rand}]$
is found and plotted as a function of loss and dephasing. The first row 1 of
the figure indicates which code is the best performing in the set of codes we
looked at as a function of loss and dephasing. It is clear that bin codes are
typically the best performing rotation code that we investigated. That
suggests most of the features observed on the subsequent plots will be similar
to the binomial plots except in the large loss or large dephasing regime. This
is evident in row 2 of Fig. 9 shows similar striation to those in Fig. 7 in
photon number which are explain by changes in rotation symmetry of the optimal
code. While the channel infidelity in row 3 will see modest improvements at
large loss due to 2-rand and cat codes.

##  VI Conclusions

We have introduced random rotation codes and systematically studied their
performance as a function of loss and dephasing strength. By comparing the
performance of these new codes to cat and binomial codes, we were able to find
a region in our parameter space where random codes outperformed cat and
binomial codes. Such results were found with relatively few samples, but it is
expected that, with enough samples, random rotation codes could be at least as
good as any known rotation code. Thus the numerics presented here are a proof
of concept, and we hope it encourages further research using random bosonic
codes.

As a byproduct of our study on random codes, we have produced the first
systematic numerical study of cat and binomial codes, which has revealed some
interesting trends. The rotation symmetry, $N$, is strongly correlated with
dephasing. This can be explained by the well known trade off between
protection for phase errors and protection for number shift errors [27, 32,
31]. In particular, as dephasing decreases, the rotation symmetry of the best
code increases. Moreover, the binomial code was the code that took up most of
the “phase diagram” in Fig. 9 of the optimal code for a given noise strength.
This is to be expected as binomial codes were specifically designed for loss
and dephasing errors.

We are presently focusing on exploring various notions of random translation
codes and random bosonic codes in general. However, we think there are several
interesting open questions that remain. Perhaps the most tantalizing would be
changing the distribution of states that is being sampled. There is no reason
to believe choosing codewords from the Haar measure will result in good codes.
In fact this article provides evidence that they are not. A better idea might
be to sample distributions that close to known good codes.

Acknowledgments: The authors acknowledge helpful discussions with Joshua
Grochow, Rebecca Morrison, and Orit Peleg. AK, NL, and JC were supported by
the Army Research Office through W911NF-23-1-0376 and National Science
Foundation through a CAREER award ECCS-2240129 and Quantum Leap Challenge
Institutes (QLCI) award OMA-2016244.

## References

  * Shannon [1948] C. E. Shannon, A mathematical theory of communication, The Bell System Technical Journal 27, 379 (1948).
  * Gallager [1973] R. Gallager, The random coding bound is tight for the average code (corresp.), IEEE Transactions on Information Theory 19, 244 (1973).
  * Barg and Forney [2002] A. Barg and G. Forney, Random codes: minimum distances and error exponents, IEEE Transactions on Information Theory 48, 2568 (2002).
  * Truong  _et al._ [2023] L. V. Truong, G. Cocco, J. Font-Segura, and A. G. i. Fàbregas, Concentration properties of random codes, IEEE Transactions on Information Theory , 1 (2023).
  * Holevo [1998] A. S. Holevo, Quantum coding theorems, Russian Mathematical Surveys 53, 1295 (1998).
  * Klesse [2008] R. Klesse, A random coding based proof for the quantum coding theorem, Open Systems & Information Dynamics 15, 21 (2008).
  * Hayden  _et al._ [2008] P. Hayden, P. W. Shor, and A. Winter, Random quantum codes from gaussian ensembles and an uncertainty relation, Open Systems & Information Dynamics 15, 71 (2008).
  * Brown and Fawzi [2013] W. Brown and O. Fawzi, Short random circuits define good quantum error correcting codes, in  _2013 IEEE International Symposium on Information Theory_ (2013) pp. 346–350.
  * Faist  _et al._ [2020] P. Faist, S. Nezami, V. V. Albert, G. Salton, F. Pastawski, P. Hayden, and J. Preskill, Continuous symmetries and approximate quantum error correction, Phys. Rev. X 10, 041018 (2020).
  * Kong and Liu [2022] L. Kong and Z.-W. Liu, Near-optimal covariant quantum error-correcting codes from random unitaries with symmetries, PRX Quantum 3, 020314 (2022).
  * Gottesman  _et al._ [2001] D. Gottesman, A. Kitaev, and J. Preskill, Encoding a qubit in an oscillator, Phys. Rev. A 64, 012310 (2001).
  * Sivak  _et al._ [2023] V. V. Sivak, A. Eickbusch, B. Royer, S. Singh, I. Tsioutsios, S. Ganjam, A. Miano, B. L. Brock, A. Z. Ding, L. Frunzio, S. M. Girvin, R. J. Schoelkopf, and M. H. Devoret, Real-time quantum error correction beyond break-even, Nature 616, 50 (2023).
  * Ni  _et al._ [2023] Z. Ni, S. Li, X. Deng, Y. Cai, L. Zhang, W. Wang, Z.-B. Yang, H. Yu, F. Yan, S. Liu, C.-L. Zou, L. Sun, S.-B. Zheng, Y. Xu, and D. Yu, Beating the break-even point with a discrete-variable-encoded logical qubit, Nature 616, 56 (2023).
  * Ofek  _et al._ [2016] N. Ofek, A. Petrenko, R. Heeres, P. Reinhold, Z. Leghtas, B. Vlastakis, Y. Liu, L. Frunzio, S. M. Girvin, L. Jiang, M. Mirrahimi, M. H. Devoret, and R. J. Schoelkopf, Extending the lifetime of a quantum bit with error correction in superconducting circuits, Nature 536, 441 (2016).
  * Hu  _et al._ [2019] L. Hu, Y. Ma, W. Cai, X. Mu, Y. Xu, W. Wang, Y. Wu, H. Wang, Y. P. Song, C. L. Zou, S. M. Girvin, L.-M. Duan, and L. Sun, Quantum error correction and universal gate set operation on a binomial bosonic logical qubit, Nature Physics 15, 503 (2019).
  * Flühmann  _et al._ [2018] C. Flühmann, V. Negnevitsky, M. Marinelli, and J. P. Home, Sequential modular position and momentum measurements of a trapped ion mechanical oscillator, Phys. Rev. X 8, 021001 (2018).
  * Flühmann  _et al._ [2019] C. Flühmann, T. L. Nguyen, M. Marinelli, V. Negnevitsky, K. Mehta, and J. P. Home, Encoding a qubit in a trapped-ion mechanical oscillator, Nature 566, 513 (2019).
  * Burd  _et al._ [2021] S. C. Burd, R. Srinivas, H. M. Knaack, W. Ge, A. C. Wilson, D. J. Wineland, D. Leibfried, J. J. Bollinger, D. T. C. Allcock, and D. H. Slichter, Quantum amplification of boson-mediated interactions, Nature Physics 17, 898 (2021).
  * de Neeve  _et al._ [2022] B. de Neeve, T.-L. Nguyen, T. Behrle, and J. P. Home, Error correction of a logical grid state qubit by dissipative pumping, Nature Physics 18, 296 (2022).
  * Larsen  _et al._ [2021] M. V. Larsen, X. Guo, C. R. Breum, J. S. Neergaard-Nielsen, and U. L. Andersen, Deterministic multi-mode gates on a scalable photonic quantum computing platform, Nature Physics 17, 1018 (2021).
  * Asavanant  _et al._ [2021] W. Asavanant, B. Charoensombutamon, S. Yokoyama, T. Ebihara, T. Nakamura, R. N. Alexander, M. Endo, J.-i. Yoshikawa, N. C. Menicucci, H. Yonezawa, and A. Furusawa, Time-domain-multiplexed measurement-based quantum operations with 25-mhz clock frequency, Phys. Rev. Appl. 16, 034005 (2021).
  * Sakaguchi  _et al._ [2023] A. Sakaguchi, S. Konno, F. Hanamura, W. Asavanant, K. Takase, H. Ogawa, P. Marek, R. Filip, J.-i. Yoshikawa, E. Huntington, H. Yonezawa, and A. Furusawa, Nonlinear feedforward enabling quantum computation, Nature Communications 14, 3817 (2023).
  * Grimsmo  _et al._ [2020] A. L. Grimsmo, J. Combes, and B. Q. Baragiola, Quantum computing with rotation-symmetric bosonic codes, Phys. Rev. X 10, 011058 (2020).
  * Cochrane  _et al._ [1999] P. T. Cochrane, G. J. Milburn, and W. J. Munro, Macroscopically distinct quantum-superposition states as a bosonic code for amplitude damping, Phys. Rev. A 59, 2631 (1999).
  * Ralph  _et al._ [2003] T. C. Ralph, A. Gilchrist, G. J. Milburn, W. J. Munro, and S. Glancy, Quantum computation with optical coherent states, Phys. Rev. A 68, 042319 (2003).
  * Leghtas  _et al._ [2013] Z. Leghtas, G. Kirchmair, B. Vlastakis, R. J. Schoelkopf, M. H. Devoret, and M. Mirrahimi, Hardware-efficient autonomous quantum memory protection, Phys. Rev. Lett. 111, 120501 (2013).
  * Michael  _et al._ [2016] M. H. Michael, M. Silveri, R. T. Brierley, V. V. Albert, J. Salmilehto, L. Jiang, and S. M. Girvin, New class of quantum error-correcting codes for a bosonic mode, Phys. Rev. X 6, 031006 (2016).
  * Arzani  _et al._ [2019] F. Arzani, G. Ferrini, F. Grosshans, and D. Markham, Random coding for sharing bosonic quantum secrets, Phys. Rev. A 100, 022303 (2019).
  * Conrad  _et al._ [2023] J. Conrad, J. Eisert, and J.-P. Seifert, Good Gottesman-Kitaev-Preskill codes from the NTRU cryptosystem (2023), arXiv:2303.02432 [quant-ph].
  * Leviant  _et al._ [2022] P. Leviant, Q. Xu, L. Jiang, and S. Rosenblum, Quantum capacity and codes for the bosonic loss-dephasing channel, Quantum 6, 821 (2022).
  * Marinoff  _et al._ [2023] B. Marinoff, M. Bush, and J. Combes, An explicit error correction scheme for bosonic codes with rotational symmetry, arXiv:2311.13670 (2023).
  * Ouyang and Campbell [2021] Y. Ouyang and E. T. Campbell, Trade-offs on number and phase shift resilience in bosonic quantum codes, IEEE Transactions on Information Theory , 1 (2021).
  * Spengler  _et al._ [2012] C. Spengler, M. Huber, and B. C. Hiesmayr, Composite parameterization and Haar measure for all unitary and special unitary groups, Journal of Mathematical Physics 53, 013501 (2012).
  * Mezzadri [2007] F. Mezzadri, How to generate random matrices from the classical compact groups, Notices of the American Mathematical Society 54, 592 (2007).
  * Hogben  _et al._ [2011] H. J. Hogben, M. Krzystyniak, G. T. P. Charnock, P. J. Hore, and S. I. Kuprov, A software library for simulation of spin dynamics in large spin systems, J. Magn. Reson. 208, 179 (2011).
  * Kuprov [2011] I. Kuprov, Diagonalization-free implementation of spin relaxation theory for large spin systems, J. Magn. Reson. 209, 31 (2011).
  * Fletcher  _et al._ [2007] A. S. Fletcher, P. W. Shor, and M. Z. Win, Optimum quantum error recovery using semidefinite programming, Phys. Rev. A 75, 012338 (2007).
  * Pedersen  _et al._ [2007] L. H. Pedersen, N. M. Møller, and K. Mølmer, Fidelity of quantum operations, Physics Letters A 367, 47 (2007).
  * Albert  _et al._ [2018] V. V. Albert, K. Noh, K. Duivenvoorden, D. J. Young, R. T. Brierley, P. Reinhold, C. Vuillot, L. Li, C. Shen, S. M. Girvin, B. M. Terhal, and L. Jiang, Performance and structure of single-mode bosonic codes, Phys. Rev. A 97, 032346 (2018).

##  Appendix A Additional plots for code comparison

Figure 10:  Performance of $N=2$ (Row 1) and $N=3$ (Row 2) cat codes. Column
1. The performance (logical channel infidelity) of cat codes as a function of
the average photon number of the code space projector when
$\kappa_{l}t=\kappa_{\phi}t=10^{-2}$. The minimum of this curve is plotted as
a single red marker. Column 2. Code performance as a function of equal loss
and dephasing $\kappa_{l}t=\kappa_{\phi}t$. Notice that the minimum infidelity
from column 1 is plotted as a red marker for
$\kappa_{l}t=\kappa_{\phi}t=10^{-2}$. Column 3. Code performance as a function
of dephasing and loss. Note that the diagonal part of this plot is the data
from column two where $\kappa_{l}t=\kappa_{\phi}t$.  Figure 11: Difference in
infidelity between codes as a function of loss and dephasing $(F_{\rm
code1}-F_{\rm code2})/\max\\{F_{\rm code1},F_{\rm code2}\\}$. The regions in
blue represent noise channels where “code 2” outperformed “code 1”. Grey
regions are when no code beats the trivial encoding. Be mindful that the color
bar scale changes from plot to plot. Column 1.
$F_{\textsc{bin}}-F_{\textsc{cat}}$. Column 2.
$F_{\textsc{bin}}-F_{\textsc{2-rand}}$. Column 3.
$F_{\textsc{cat}}-F_{\textsc{2-rand}}$. Notice here that random codes can have
$50\%$ improvement over cat codes in some cases.