# Suppressing quantum errors by scaling a surface code logical qubit

Google Quantum AI<EMAIL_ADDRESS>
###### Abstract

Practical quantum computing will require error rates that are well below what
is achievable with physical qubits. Quantum error correction [1, 2] offers a
path to algorithmically-relevant error rates by encoding logical qubits within
many physical qubits, where increasing the number of physical qubits enhances
protection against physical errors. However, introducing more qubits also
increases the number of error sources, so the density of errors must be
sufficiently low in order for logical performance to improve with increasing
code size. Here, we report the measurement of logical qubit performance
scaling across multiple code sizes, and demonstrate that our system of
superconducting qubits has sufficient performance to overcome the additional
errors from increasing qubit number. We find our distance-5 surface code
logical qubit modestly outperforms an ensemble of distance-3 logical qubits on
average, both in terms of logical error probability over 25 cycles and logical
error per cycle (2.914%±0.016% compared to 3.028%±0.023%). To investigate
damaging, low-probability error sources, we run a distance-25 repetition code
and observe a $1.7\times 10^{-6}$ logical error per round floor set by a
single high-energy event ($1.6\times 10^{-7}$ when excluding this event). We
are able to accurately model our experiment, and from this model we can
extract error budgets that highlight the biggest challenges for future
systems. These results mark the first experimental demonstration where quantum
error correction begins to improve performance with increasing qubit number,
illuminating the path to reaching the logical error rates required for
computation.

##  I Introduction

Since Feynman’s proposal to compute using quantum mechanics [3], many
potential applications have emerged, including factoring [4], optimization
[5], machine learning [6], quantum simulation [7], and quantum chemistry [8].
These applications often require billions of quantum operations [9, 10, 11]
while state-of-the-art quantum processors typically have error rates around
$10^{-3}$ per gate [12, 13, 14, 15, 16, 17], far too high to execute such
large circuits. Fortunately, quantum error correction can exponentially
suppress the operational error rates in a quantum processor, at the expense of
physical qubit overhead [18, 19].

Several works have reported quantum error correction on small codes able to
correct a single error [20, 21, 22, 23, 24, 25, 26] and in continuous variable
codes [27, 28, 29, 30]. However, a crucial question remains: will scaling up
the error-correcting code size reduce logical error rates in a real device? In
theory, logical errors should be reduced if physical errors are sufficiently
sparse in the quantum processor. In practice, demonstrating reduced logical
error requires scaling up a device to support a code which can correct at
least two errors, without sacrificing state-of-the-art performance. In this
work, we report a 72-qubit superconducting device supporting a 49-qubit
distance-5 ($d=5$) surface code that narrowly outperforms its average subset
17-qubit distance-3 surface code, demonstrating a critical step towards
scalable quantum error correction.

##  II Surface codes with superconducting qubits

Figure 1:  Implementing surface code logical qubits. a, Schematic of a
72-qubit Sycamore device with a distance-5 surface code embedded, consisting
of 25 data qubits (gold) and 24 measure qubits (blue). Each measure qubit is
associated with a stabiliser (blue colored tile, dark: $X$, light: $Z$).
Representative logical operators $Z_{L}$ (black) and $X_{L}$ (green) traverse
the array, intersecting at the lower-left data qubit. The upper-right quadrant
(red outline) is one of four subset distance-3 codes (the four quadrants) we
compare to distance-5. b, Illustration of a stabiliser measurement, focusing
on one data qubit (gold) and one measure qubit (blue), in perspective view
with time progressing to the right. Each qubit participates in four
controlled-Z (CZ) gates with its four nearest neighbours, interspersed with
Hadamard gates (H), and finally, the measure qubit is measured and reset to
$|0\rangle$. Data qubits perform dynamical decoupling (DD) while waiting for
the measurement and reset. All stabilisers are measured in this manner
concurrently. Cycle duration is 921 ns, including 500 ns measurement and 160
ns reset. c, Cumulative distributions of errors for single-qubit gates, CZ
gates, measurement, and data qubit DD (idle during measurement and reset).
Benchmarked in simultaneous operation using random circuit techniques, on the
49 qubits used in distance-5 and the four CZ layers from the stabiliser
circuit [31, 32]. Vertical lines are means.

Surface codes [33, 34, 35, 36, 26] are a family of quantum error-correcting
codes which encode a logical qubit into the joint entangled state of a
$d\times d$ square of physical qubits, referred to as _data qubit_ s. The
logical qubit states are defined by a pair of anti-commuting logical
observables $X_{L}$ and $Z_{L}$. For the example shown in Fig. 1a, a $Z_{L}$
observable is encoded in the joint $Z$-basis parity of a line of qubits which
traverse the lattice from top-to-bottom, and likewise an $X_{L}$ observable is
encoded in the joint $X$-basis parity traversing left-to-right. This non-local
encoding of information protects the logical qubit from local physical errors,
provided we can detect and correct them.

To detect errors, we periodically measure $X$ and $Z$ parities of adjacent
clusters of data qubits with the aid of $d^{2}-1$ _measure qubits_
interspersed throughout the lattice. As shown in Fig. 1b, each measure qubit
interacts with its neighbouring data qubits in order to map the joint data
qubit parity onto the measure qubit state, which is then measured. These
parity measurements, or _stabilisers_ , are laid out so that each one commutes
with the logical observables of the encoded qubit as well as every other
stabiliser. Consequently, we can detect errors when parity measurements change
unexpectedly, without disturbing the logical qubit state.

A _decoder_ uses the history of stabiliser measurement outcomes to infer
likely configurations of physical errors on the device. We can then determine
the overall effect of these inferred errors on the logical qubit, thus
preserving the logical state. Most surface code logical gates can be
implemented by maintaining logical memory and executing different sequences of
measurements on the code boundary [37, 38]. Thus, we focus on preserving
logical memory, the core technical challenge in operating the surface code.

We implement the surface code on an expanded Sycamore device [32] with 72
transmon qubits [39] and 121 tunable couplers [40, 41]. Each qubit is coupled
to four nearest neighbours except on the boundaries, with mean qubit coherence
times $T_{1}$ = 20 $\mu$s and $T_{2,\textrm{CPMG}}$ = 30 $\mu$s. As in Ref.
[42], we implement single-qubit rotations, controlled-Z (CZ) gates, reset, and
measurement, demonstrating similar or improved simultaneous performance as
shown in Fig. 1c.

The distance-5 surface code logical qubit is encoded on a 49-qubit subset of
the device, with 25 data qubits and 24 measure qubits. Each measure qubit
corresponds to one stabiliser, classified by its basis ($X$ or $Z$) and the
number of data qubits involved (weight, 2 or 4). Ideally, to assess how
logical performance scales with code size, we would compare distance-5 and
distance-3 logical qubits under identical noise. Although device inhomogeneity
makes this comparison difficult, we can compare the distance-5 logical qubit
to the average of four distance-3 logical qubit subgrids, each containing 9
data qubits and 8 measure qubits. These distance-3 logical qubits cover the
four quadrants of the distance-5 code with minimal qubit overlap, capturing
the average performance of the full distance-5 grid.

In a single instance of the experiment, we initialise the logical qubit state,
run several cycles of error correction, then measure the final logical state.
We show an example in Fig. 2a. To prepare a $Z_{L}$ eigenstate, we first
prepare the data qubits in $|0\rangle$’s and $|1\rangle$’s, an eigenstate of
the $Z$ stabilisers. The first cycle of stabiliser measurements then projects
the data qubits into an entangled state that is also an eigenstate of the $X$
stabilisers. Each cycle contains CZ and Hadamard gates sequenced to extract
$X$ and $Z$ stabilisers simultaneously, and ends with the measurement and
reset of the measure qubits. In the final cycle, we also measure the data
qubits in the $Z$ basis, yielding both parity information and a measurement of
the logical state. Preparing and measuring $X_{L}$ eigenstates proceeds
analogously. The instance succeeds if the corrected logical measurement agrees
with the known initial state; otherwise, a logical error has occurred.

Our stabiliser circuits contain a few modifications [43] to the standard gate
sequence described above, including phase corrections to correct for
unintended qubit frequency shifts [44] and dynamical decoupling gates during
qubit idles. We also remove certain Hadamard gates to implement the _ZXXZ_
variant of the surface code [45, 46], helping to symmetrise the $X$\- and
$Z$-basis logical error rates. Finally, during initialization, the data qubits
are prepared into randomly selected bitstrings. This ensures that we do not
preferentially measure even parities in the first few rounds of the code,
which could artificially lower logical error rates due to bias in measurement
error.

##  III Error detectors

Figure 2:  Error detection in the surface code. a, Illustration of a surface
code experiment, in perspective view with time progressing to the right. We
begin with an initial data qubit state which has known parities in one
stabiliser basis (here, $Z$). We show example errors that manifest in
detection pairs: a $Z$ error (red) on a data qubit (spacelike pair), a
measurement error (purple) on a measure qubit (timelike pair), an $X$ error
(blue) during the CZ gates (diagonal pair), and a measurement error (green) on
a data qubit (detected in the final inferred $Z$ parities). b, Detection
probability for each stabiliser over a 25-cycle distance-5 experiment (50,000
repetitions). Darker lines: average over all stabilisers with the same weight.
There are fewer detections at $t=0$ because there is no preceding data idling,
and at $t=25$ because the final parities are calculated from data qubit
measurements. c, Detection probability heatmap, averaging over $t=1$ to 24.
d-e, Similar to b-c for four separate distance-3 experiments covering the four
quadrants of the distance-5 code. f-g, Similar to b-c using a simulation with
Pauli errors plus leakage, crosstalk, and stray interactions (_Pauli+_). h,
Bar chart summarising the detection correlation matrix $p_{ij}$, comparing the
distance-5 experiment from b to the simulation in f (_Pauli+_) and a simpler
simulation with only Pauli errors. We aggregate four groups of correlations:
timelike pairs; spacelike pairs; diagonal pairs expected for Pauli noise; and
diagonal pairs unexpected for Pauli noise (“Unexp.”), including correlations
over two timesteps. Each bar shows a mean and standard deviation of
correlations from a 25-cycle, 50,000-repetition dataset.

After initialisation, parity measurements should produce the same value in
each cycle, up to known flips applied by the circuit. If we compare a parity
measurement to the corresponding measurement in the preceding cycle and their
values are inconsistent, a _detection event_ has occurred, indicating an
error. We refer to these comparisons as _detectors_.

The detection event probabilities for each detector indicate the distribution
of physical errors in space and time while running the surface code. In Fig.
2, we show the detection event probabilities in the distance-5 code (b, c) and
the distance-3 codes (d, e) running for 25 rounds, as measured over 50,000
experimental instances. For the weight-4 stabilisers, the average detection
probability is $0.185\pm 0.018$ ($1\sigma$) in the distance-5 code and
$0.175\pm 0.017$ averaged over the distance-3 codes. The weight-2 stabilisers
interact with fewer qubits and hence detect fewer errors. Correspondingly,
they yield a lower average detection probability of $0.119\pm 0.012$ in the
distance-5 code and $0.115\pm 0.008$ averaged over the distance-3 codes. The
relative consistency between code distances suggests that growing the lattice
does not substantially increase the component error rates during error
correction.

The average detection probabilities exhibit a relative rise of 12% for
distance-5 and 8% for distance-3 over 25 cycles, with a typical characteristic
risetime of roughly 5 cycles [43]. We attribute this rise to data qubits
leaking into non-computational excited states and anticipate that the
inclusion of leakage-removal techniques on data qubits would help to mitigate
this rise [47, 48, 49, 42]. We hypothesise that the greater increase in
detection probability in the distance-5 code is due to increased stray
interactions or leakage from simultaneously operating more gates and
measurements.

We test our understanding of the physical noise in our system by comparing the
experimental data to a simulation. We begin with a Pauli simulation based on
the component error information in Fig. 1c in a probabilistic Clifford
simulator, then incorporate coherence information, transitions to leaked
states, and crosstalk errors from unwanted coupling (_Pauli+_). Fig. 2f shows
that this second simulator accurately predicts the average detection
probabilities, finding $0.180\pm 0.013$ for the weight-4 stabilisers and
$0.116\pm 0.011$ for the weight-2 stabilisers, with average detection
probabilities increasing 7% over 25 rounds (distance-5).

##  IV Understanding errors through correlations

We next examine pairwise correlations between detection events, which give us
fine-grained information about which types of errors are occurring during
error correction. Fig. 2a illustrates a few examples of pairwise detections
which are generated by $X$ or $Z$ errors in the surface code. Measurement and
reset errors are detected by the same stabiliser in two consecutive rounds,
which we classify as a _timelike_ pair. Data qubits may experience an $X$
($Z$) error while idling during measurement which is detected by its
neighbouring $Z$ ($X$) stabilisers in the same round, forming a _spacelike_
pair. Errors during CZ gates may cause a variety of pairwise detections to
occur, including _diagonal_ pairs which are separated in both space and time.
More complex clusters of detection events arise when a $Y$ error occurs, which
generates detection events for both $X$ and $Z$ errors.

To estimate probabilities of detection event pairs from our data, we compute
an appropriately normalised correlation $p_{ij}$ between detection events
occurring on any two detectors $i$ and $j$ [42]. In Fig. 2h, we show the
estimated probabilities for experimental and simulated distance-5 data,
aggregated and averaged according to the different classes of pairs. In
addition to the expected pairs, we also quantify how often detection pairs
occur which are unexpected from component Pauli errors. Overall, the Pauli
simulation systematically underpredicts these probabilities compared to
experimental data, while the _Pauli+_ simulation is closer and predicts the
presence of unexpected pairs, which we surmise are related to leakage and
stray interactions. These errors can be especially harmful to the surface code
because they can generate multiple detection events distantly separated in
space or time, which a decoder might wrongly interpret as multiple independent
component errors. We expect that mitigating leakage and stray interactions
will become increasingly important as error rates decrease.

##  V Decoding and logical error probabilities

Figure 3:  Logical error reduction. a, Logical error probability $p_{L}$ vs.
cycle comparing distance-5 (blue) to distance-3 (pink: four separate
quadrants, red: average), all averaged over $Z_{L}$ and $X_{L}$. Each
individual datapoint represents 100,000 repetitions. Solid line: fit to
experimental average, $t=3$ to 25 (see main text). Dotted line: comparison to
_Pauli+_ simulation. b, Logical fidelity $F=1-2p_{L}$ vs. cycle, semilog plot.
Same experimental averages and fits from a. c, Summary of experimental
progression comparing logical error per round $\varepsilon_{d}$ (specifically
plotting $1-\varepsilon_{d}$) between distance-3 and $5$, where system
improvements lead to faster improvement for distance-5 (see main text). Each
open circle is a comparison to a specific distance-3 code, and filled circles
average over multiple distance-3 codes measured in the same session. Markers
are colored chronologically from light to dark. Typical $1\sigma$ statistical
and fit uncertainty is $0.02\%$, smaller than the points.

We next examine the logical performance of our surface code qubits. To infer
the error-corrected logical measurement, the decoder requires a probability
model for physical error events. This information may be expressed as an
_error hypergraph_ : detectors are vertices, physical error mechanisms are
hyperedges connecting the detectors they trigger, and each hyperedge is
assigned its corresponding error mechanism probability. We use a
generalisation of $p_{ij}$ to determine these probabilities [42, 50].

Given the error hypergraph, we implement two different decoders: belief-
matching, an efficient combination of belief propagation and minimum-weight
perfect matching [51]; and tensor network decoding, a slow but accurate
approximate maximum-likelihood decoder. The belief-matching decoder first runs
belief propagation on the error hypergraph to update hyperedge error
probabilities based on nearby detection events [52, 51]. The updated error
hypergraph is then decomposed into a pair of disjoint error graphs, one each
for $X$ and $Z$ errors [34]. These graphs are decoded efficiently using
minimum-weight perfect matching [53] to select a single probable set of
errors.

By contrast, a maximum-likelihood decoder considers all possible sets of
errors consistent with the detection events, splits them into two groups based
on whether they flip the logical measurement, and chooses the group with the
greater total likelihood. The two likelihoods are each expressed as a tensor
network contraction [54, 55, 51] that exhaustively sums the probabilities of
all sets of errors within each group. We can contract the network
approximately, and verify that the approximation converges. This yields a
decoder which is nearly optimal given the hypergraph error priors, but is
considerably slower. Further improvements could come from a more accurate
prior, or incorporating more fine-grained measurement information [48, 56].

Figure 3 compares the logical error performance of the distance-3 and
distance-5 codes using the approximate maximum-likelihood decoder. Because the
_ZXXZ_ variant of the surface code symmetrises the $X$ and $Z$ bases,
differences between the two bases’ logical error per round are small and
attributable to spatial variations in physical error rates. Thus, for visual
clarity, we report logical error probabilities averaged between the $X$ and
$Z$ basis; the full data set may be found in the supplement. Note that we do
not post-select on leakage or high-energy events in order to capture the
effects of realistic non-idealities on logical performance. Over all 25 cycles
of error correction, the distance-5 code realises lower logical error
probabilities $p_{L}$ than the average of the subset distance-3 codes.

We fit the logical fidelity $F=1-2p_{L}$ to an exponential decay, starting at
$t=3$ to avoid time-boundary effects that are advantageous to the distance-5
code. We obtain a logical error per cycle $\varepsilon_{5}=(2.914\pm 0.016)$%
($1\sigma$ statistical and fit uncertainty) for the distance-5 code, compared
to an average of $\varepsilon_{3}=(3.028\pm 0.023)$% for the subset distance-3
codes, a relative error reduction of about 4%. When decoding with the faster
belief-matching decoder, we fit a logical error per cycle of $(3.056\pm
0.015)$% for the distance-5 code, compared to an average of $(3.118\pm
0.025)$% for the distance-3 codes, a relative error reduction of about 2%. We
note that the distance-5 logical error per cycle is slightly higher than two
of the distance-3 codes individually, and that leakage accumulation may cause
distance-5 performance to degrade faster than distance-3 as logical error
probability approaches 50%.

In principle, the logical performance of a distance-5 code should improve
faster than a distance-3 code as physical error rates decrease [36]. Over
time, we improved our physical error rates, for example by optimising single
and two qubit gates, measurement, and data qubit idling [43]. In Fig. 3c, we
show the corresponding performance progression of distance-5 and distance-3
codes. The larger code improved about twice as fast until finally overtaking
the smaller code, validating the benefit of increased-distance protection in
practice.

To understand the contributions of individual components to our logical error
performance, we follow Ref. [42] and simulate the distance-5 and distance-3
codes while varying the physical error rates of the various circuit
components. Because the logical error-suppression factor
$\Lambda_{d/(d+2)}=\varepsilon_{d}/\varepsilon_{d+2}$ is approximately
inversely proportional to the physical error rate, we can budget how much each
physical error mechanism contributes to $1/\Lambda$ as shown in Fig. 4a to
assess scaling. This error budget shows that CZ error and data qubit
decoherence during measurement and reset are dominant contributors.

##  VI Algorithmically-relevant error rates with repetition codes

Figure 4:  Towards algorithmically-relevant error rates. a, Estimated error
budgets for the surface code, based on operation errors (see Fig. 1c) and
_Pauli+_ simulations. $\Lambda_{3/5}=\varepsilon_{3}/\varepsilon_{5}$. CZ:
contributions from CZ error (excluding leakage and stray interactions). CZ
stray int: CZ error from unwanted interactions. DD: dynamical decoupling, data
qubit idle error during measurement and reset. Measure: measurement and reset
error. Leakage: leakage during CZs and due to heating. 1Q: single-qubit gate
error. b, Logical error for repetition codes. Inset: schematic of the
distance-25 repetition code, using the same data and measure qubits as the
distance-5 surface code. Smaller codes are subsampled from the same
distance-25 data [42]. A high-energy event resulted in an apparent error floor
around $10^{-6}$. After removing the instances nearby (light blue), error
decreases more rapidly with code distance. 50 cycles, $5\times 10^{5}$
repetitions. We also plot the surface code error per cycle from Fig. 3b in
black. c, Contour plot of simulated surface code logical error per round
$\varepsilon_{d}$ as a function of code distance $d$ and a scale factor $s$ on
the error model in Fig. 1c (Pauli simulation, $s=1.0$ corresponds to the
current device error model). d, Horizontal slices from c, each for a value of
error model scale factor $s$. $s=1.3$ is above threshold (larger codes are
worse), while $s=1.2$ to $1.0$ represent the crossover regime, where
progressively larger codes get better until a turnaround. $s=0.9$ is below
threshold (larger codes are better).

Even as known error sources are suppressed in future devices, new dominant
error mechanisms may arise as lower logical error rates are realised. To test
the behaviour of codes with substantially lower error rates, we employ the
bit-flip repetition code, a 1D version of the surface code. The bit-flip
repetition code does not correct for phase flip errors and is thus unsuitable
for quantum algorithms. However, correcting only bit-flip errors allows it to
achieve much lower logical error probabilities.

Without post-selection, we achieve a logical error per cycle of $(1.7\pm
0.3)\times 10^{-6}$ using a distance-25 repetition code decoded with minimum-
weight perfect matching. We attribute many of these high-distance logical
errors to a high-energy impact, which can temporarily impart widespread
correlated errors to the system [57]. These events may be identified by spikes
in detection-event counts [42], and such error mechanisms must be mitigated
for scalable quantum error correction to succeed. In this case, there was one
such event; after removing it (0.15% of trials), we observe a logical error
per cycle of $(1.6\pm 0.8)\times 10^{-7}$ [43]. The repetition code results
demonstrate that low logical error rates are possible in a superconducting
system, but finding and mitigating highly correlated errors such as cosmic ray
impacts will be an important area of research moving forward.

##  VII Towards large-scale quantum error correction

To understand how our surface code results project forward to future devices,
we simulate the logical error performance of surface codes ranging from
distance-3 to 25, while also scaling the physical error rates shown in Fig.
1c. For efficiency, the simulation considers only Pauli errors. Figures 4c-d
illustrate the contours of this parameter space, which has three distinct
regions. When the physical error rate is high (for example, the initial runs
of our surface code in the inset of Fig. 3), logical error probability
increases with increasing system size ($\varepsilon_{d+2}>\varepsilon_{d}$).
On the other hand, low physical error rates show the desired exponential
suppression of logical error ($\varepsilon_{d+2}<\varepsilon_{d}$). Our
experiment lies in a crossover regime where, due to finite-size effects,
increasing system size initially suppresses the logical error rate before
later increasing it.

While our device is close to threshold, reaching algorithmically-relevant
logical error rates with manageable resources will require an error-
suppression factor $\Lambda\gg 1$. Based on the error budget and simulations
in Fig. 4, we estimate that component performance must improve by at least 20%
to move below threshold, and significantly improve beyond that to achieve
practical scaling. However, these projections rely on simplified models and
must be validated experimentally, testing larger code sizes with longer
durations to eventually realise the desired logical performance. This work
demonstrates the first step in that process, suppressing logical errors by
scaling a quantum error-correcting code – the foundation of a fault-tolerant
quantum computer.

##  VIII Author Contributions

The Google Quantum AI team conceived and designed the experiment. The theory
and experimental teams at Google Quantum AI developed data analysis, modeling
and metrological tools that enabled the experiment, built the system,
performed the calibrations, and collected the data. The modeling was done
jointly with collaborators outside Google Quantum AI. All authors wrote and
revised the manuscript and the Supplementary Information.

##  IX Acknowledgements

We are grateful to S. Brin, S. Pichai, R. Porat, J. Dean, E. Collins, and J.
Yagnik for their executive sponsorship of the Google Quantum AI team, and for
their continued engagement and support. A portion of this work was performed
in the UCSB Nanofabrication Facility, an open access laboratory. J. Marshall
acknowledges support from NASA Ames Research Center (NASA-Google SAA 403512),
NASA Advanced Supercomputing Division for access to NASA HPC systems, and NASA
Academic Mission Services (NNA16BD14C). D. Bacon is a CIFAR Associate Fellow
in the Quantum Information Science Program.

##  X Data availability

The data that support the plots within this paper and other findings of this
study are available upon reasonable request, or at 10.5281/zenodo.6804040.

Google Quantum AI:

Rajeev Acharya1, Igor Aleiner1,2, Richard Allen1, Trond I. Andersen1, Markus
Ansmann1, Frank Arute1, Kunal Arya1, Abraham Asfaw1, Juan Atalaya1, Ryan
Babbush1, Dave Bacon1, Joseph C. Bardin1,3, Joao Basso1, Andreas Bengtsson1,
Sergio Boixo1, Gina Bortoli1, Alexandre Bourassa1, Jenna Bovaird1, Leon
Brill1, Michael Broughton1, Bob B. Buckley1, David A. Buell1, Tim Burger1,
Brian Burkett1, Nicholas Bushnell1, Yu Chen1, Zijun Chen1, Ben Chiaro1, Josh
Cogan1, Roberto Collins1, Paul Conner1, William Courtney1, Alexander L.
Crook1, Ben Curtin1, Dripto M. Debroy1, Alexander Del Toro Barba1, Sean
Demura1, Andrew Dunsworth1, Daniel Eppens1, Catherine Erickson1, Lara Faoro1,
Edward Farhi1, Reza Fatemi1, Leslie Flores Burgos1, Ebrahim Forati1, Austin G.
Fowler1, Brooks Foxen1, William Giang1, Craig Gidney1, Dar Gilboa1, Marissa
Giustina1, Alejandro Grajales Dau1, Jonathan A. Gross1, Steve Habegger1,
Michael C. Hamilton1,4, Matthew P. Harrigan1, Sean D. Harrington1, Oscar
Higgott1, Jeremy Hilton1, Markus Hoffmann1, Sabrina Hong1, Trent Huang1,
Ashley Huff1, William J. Huggins1, Lev B. Ioffe1, Sergei V. Isakov1, Justin
Iveland1, Evan Jeffrey1, Zhang Jiang1, Cody Jones1, Pavol Juhas1, Dvir Kafri1,
Kostyantyn Kechedzhi1, Julian Kelly1, Tanuj Khattar1, Mostafa Khezri1, Mária
Kieferová1,5, Seon Kim1, Alexei Kitaev1,6, Paul V. Klimov1, Andrey R. Klots1,
Alexander N. Korotkov1,7, Fedor Kostritsa1, John Mark Kreikebaum1, David
Landhuis1, Pavel Laptev1, Kim-Ming Lau1, Lily Laws1, Joonho Lee1, Kenny Lee1,
Brian J. Lester1, Alexander Lill1, Wayne Liu1, Aditya Locharla1, Erik Lucero1,
Fionn D. Malone1, Jeffrey Marshall8,9, Orion Martin1, Jarrod R. McClean1,
Trevor McCourt1, Matt McEwen1,10, Anthony Megrant1, Bernardo Meurer Costa1,
Xiao Mi1, Kevin C. Miao1, Masoud Mohseni1, Shirin Montazeri1, Alexis Morvan1,
Emily Mount1, Wojciech Mruczkiewicz1, Ofer Naaman1, Matthew Neeley1, Charles
Neill1, Ani Nersisyan1, Hartmut Neven1, Michael Newman1, Jiun How Ng1, Anthony
Nguyen1, Murray Nguyen1, Murphy Yuezhen Niu1, Thomas E. O’Brien1, Alex
Opremcak1, John Platt1, Andre Petukhov1, Rebecca Potter1, Leonid P.
Pryadko11,1, Chris Quintana1, Pedram Roushan1, Nicholas C. Rubin1, Negar
Saei1, Daniel Sank1, Kannan Sankaragomathi1, Kevin J. Satzinger1, Henry F.
Schurkus1, Christopher Schuster1, Michael J. Shearn1, Aaron Shorter1, Vladimir
Shvarts1, Jindra Skruzny1, Vadim Smelyanskiy1, W. Clarke Smith1, George
Sterling1, Doug Strain1, Marco Szalay1, Alfredo Torres1, Guifre Vidal1,
Benjamin Villalonga1, Catherine Vollgraff Heidweiller1, Theodore White1, Cheng
Xing1, Z. Jamie Yao1, Ping Yeh1, Juhwan Yoo1, Grayson Young1, Adam Zalcman1,
Yaxing Zhang1, Ningfeng Zhu1

${}^{\textrm{\scriptsize 1}}$ Google Research
${}^{\textrm{\scriptsize 2}}$ Department of Physics, Columbia University, New
York, NY
${}^{\textrm{\scriptsize 3}}$ Department of Electrical and Computer
Engineering, University of Massachusetts, Amherst, MA
${}^{\textrm{\scriptsize 4}}$ Department of Electrical and Computer
Engineering, Auburn University, Auburn, AL
${}^{\textrm{\scriptsize 5}}$ Centre for Quantum Computation and Communication
Technology, Centre for Quantum Software and Information, Faculty of
Engineering and Information Technology, University of Technology Sydney, NSW
2007, Australia
${}^{\textrm{\scriptsize 6}}$ Department of Physics, Institute for Quantum
Information and Matter, and Walter Burke Institute for Theoretical Physics,
California Institute of Technology, Pasadena, CA
${}^{\textrm{\scriptsize 7}}$ Department of Electrical and Computer
Engineering, University of California, Riverside, CA
${}^{\textrm{\scriptsize 8}}$ USRA Research Institute for Advanced Computer
Science, Mountain View, CA
${}^{\textrm{\scriptsize 9}}$ QuAIL, NASA Ames Research Center, Moffett Field,
CA
${}^{\textrm{\scriptsize 10}}$ Department of Physics, University of
California, Santa Barbara, CA
${}^{\textrm{\scriptsize 11}}$ Department of Physics and Astronomy, University
of California, Riverside, CA

## References

  * [1] Shor, P. W.  Scheme for reducing decoherence in quantum computer memory.  _Physical Review A_ 52, R2493 (1995).
  * [2] Gottesman, D.  _Stabilizer codes and quantum error correction_.  Ph.D. thesis, California Institute of Technology, Pasadena, CA (1997).
  * [3] Feynman, R. P.  Simulating physics with computers.  _International Journal of Theoretical Physics_ 21 (1982).
  * [4] Shor, P. W.  Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer.  _SIAM review_ 41, 303–332 (1999).
  * [5] Farhi, E. _et al._ A quantum adiabatic evolution algorithm applied to random instances of an NP-complete problem.  _Science_ 292, 472–475 (2001).
  * [6] Biamonte, J. _et al._ Quantum machine learning.  _Nature_ 549, 195–202 (2017).
  * [7] Lloyd, S.  Universal quantum simulators.  _Science_ 273, 1073–1078 (1996).
  * [8] Aspuru-Guzik, A., Dutoi, A. D., Love, P. J. & Head-Gordon, M.  Simulated quantum computation of molecular energies.  _Science_ 309, 1704–1707 (2005).
  * [9] Reiher, M., Wiebe, N., Svore, K. M., Wecker, D. & Troyer, M.  Elucidating reaction mechanisms on quantum computers.  _Proceedings of the National Academy of Sciences_ 114, 7555–7560 (2017).  URL https://www.pnas.org/doi/abs/10.1073/pnas.1619152114.
  * [10] Gidney, C. & Ekera, M.  How to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits.  _Quantum_ 5, 433 (2021).
  * [11] Kivlichan, I. D. _et al._ Improved fault-tolerant quantum simulation of condensed-phase correlated electrons via trotterization.  _Quantum_ 4, 296 (2020).
  * [12] Ballance, C., Harty, T., Linke, N., Sepiol, M. & Lucas, D.  High-fidelity quantum logic gates using trapped-ion hyperfine qubits.  _Physical Review Letters_ 117, 060504 (2016).
  * [13] Huang, W. _et al._ Fidelity benchmarks for two-qubit gates in silicon.  _Nature_ 569, 532–536 (2019).
  * [14] Rol, M. _et al._ Fast, high-fidelity conditional-phase gate exploiting leakage interference in weakly anharmonic superconducting qubits.  _Physical Review Letters_ 123, 120502 (2019).
  * [15] Jurcevic, P. _et al._ Demonstration of quantum volume 64 on a superconducting quantum computing system.  _arXiv preprint arXiv:2008.08571_ (2020).
  * [16] Foxen, B. _et al._ Demonstrating a continuous set of two-qubit gates for near-term quantum algorithms.  _Physical Review Letters_ 125, 120504 (2020).
  * [17] Wu, Y. _et al._ Strong quantum computational advantage using a superconducting quantum processor.  _Phys. Rev. Lett._ 127, 180501 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevLett.127.180501.
  * [18] Knill, E., Laflamme, R. & Zurek, W. H.  Resilient quantum computation.  _Science_ 279, 342–345 (1998).
  * [19] Aharonov, D. & Ben-Or, M.  Fault-tolerant quantum computation with constant error rate.  _SIAM Journal on Computing_ (2008).
  * [20] Ryan-Anderson, C. _et al._ Realization of real-time fault-tolerant quantum error correction.  _Physical Review X_ 11, 041058 (2021).
  * [21] Egan, L. _et al._ Fault-tolerant control of an error-corrected qubit.  _Nature_ 598, 281–286 (2021).
  * [22] Krinner, S. _et al._ Realizing repeated quantum error correction in a distance-three surface code.  _Nature_ 605, 669–674 (2022).
  * [23] Sundaresan, N. _et al._ Matching and maximum likelihood decoding of a multi-round subsystem quantum error correction experiment.  _arXiv preprint arXiv:2203.07205_ (2022).
  * [24] Zhao, Y. _et al._ Realization of an error-correcting surface code with superconducting qubits.  _Phys. Rev. Lett._ 129, 030501 (2022).  URL https://link.aps.org/doi/10.1103/PhysRevLett.129.030501.
  * [25] Abobeih, M. _et al._ Fault-tolerant operation of a logical qubit in a diamond quantum processor.  _Nature_ 606, 884–889 (2022).
  * [26] Satzinger, K. _et al._ Realizing topologically ordered states on a quantum processor.  _Science_ 374, 1237–1241 (2021).
  * [27] Ofek, N. _et al._ Extending the lifetime of a quantum bit with error correction in superconducting circuits.  _Nature_ 536, 441–445 (2016).
  * [28] Flühmann, C. _et al._ Encoding a qubit in a trapped-ion mechanical oscillator.  _Nature_ 566, 513–517 (2019).
  * [29] Campagne-Ibarcq, P. _et al._ Quantum error correction of a qubit encoded in grid states of an oscillator.  _Nature_ 584, 368–372 (2020).
  * [30] Grimm, A. _et al._ Stabilization and operation of a Kerr-cat qubit.  _Nature_ 584, 205–209 (2020).
  * [31] Emerson, J., Alicki, R. & Życzkowski, K.  Scalable noise estimation with random unitary operators.  _Journal of Optics B: Quantum and Semiclassical Optics_ 7, S347 (2005).
  * [32] Arute, F. _et al._ Quantum supremacy using a programmable superconducting processor.  _Nature_ 574, 505–510 (2019).
  * [33] Kitaev, A. Y.  Fault-tolerant quantum computation by anyons.  _Annals of Physics_ 303, 2–30 (2003).
  * [34] Dennis, E., Kitaev, A., Landahl, A. & Preskill, J.  Topological quantum memory.  _Journal of Mathematical Physics_ 43, 4452–4505 (2002).  URL https://doi.org/10.1063/1.1499754.
  * [35] Raussendorf, R. & Harrington, J.  Fault-tolerant quantum computation with high threshold in two dimensions.  _Physical Review Letters_ 98, 190504 (2007).
  * [36] Fowler, A. G., Mariantoni, M., Martinis, J. M. & Cleland, A. N.  Surface codes: Towards practical large-scale quantum computation.  _Physical Review A_ 86, 032324 (2012).
  * [37] Horsman, C., Fowler, A. G., Devitt, S. & Meter, R. V.  Surface code quantum computing by lattice surgery.  _New Journal of Physics_ 14, 123011 (2012).
  * [38] Fowler, A. G. & Gidney, C.  Low overhead quantum computation using lattice surgery.  _arXiv preprint arXiv:1808.06709_ (2018).
  * [39] Koch, J. _et al._ Charge-insensitive qubit design derived from the Cooper pair box.  _Physical Review A_ 76, 042319 (2007).
  * [40] C. Neill.  _A path towards quantum supremacy with superconducting qubits_.  Ph.D. thesis, University of California Santa Barbara, Santa Barbara, CA (2017).
  * [41] Yan, F. _et al._ Tunable coupling scheme for implementing high-fidelity two-qubit gates.  _Phys. Rev. Applied_ 10, 054062 (2018).  URL https://link.aps.org/doi/10.1103/PhysRevApplied.10.054062.
  * [42] Chen, Z. _et al._ Exponential suppression of bit or phase errors with cyclic error correction.  _Nature_ 595, 383–387 (2021).
  * [43] See supplementary information.
  * [44] Kelly, J. _et al._ Scalable in situ qubit calibration during repetitive error detection.  _Physical Review A_ 94, 032321 (2016).
  * [45] Wen, X.-G.  Quantum orders in an exact soluble model.  _Physical Review Letters_ 90, 016803 (2003).
  * [46] Bonilla Ataides, J. P., Tuckett, D. K., Bartlett, S. D., Flammia, S. T. & Brown, B. J.  The XZZX surface code.  _Nature Communications_ 12, 1–12 (2021).
  * [47] Aliferis, P. & Terhal, B. M.  Fault-tolerant quantum computation for local leakage faults.  _arXiv preprint quant-ph/0511065_ (2005).
  * [48] Suchara, M., Cross, A. W. & Gambetta, J. M.  Leakage suppression in the toric code.  In _2015 IEEE International Symposium on Information Theory (ISIT)_ , 1119–1123 (IEEE, 2015).
  * [49] McEwen, M. _et al._ Removing leakage-induced correlated errors in superconducting quantum error correction.  _Nature Communications_ 12, 1–7 (2021).
  * [50] Chen, E. H. _et al._ Calibrated decoders for experimental quantum error correction.  _Physical Review Letters_ 128, 110504 (2022).
  * [51] Higgott, O., Bohdanowicz, T. C., Kubica, A., Flammia, S. T. & Campbell, E. T.  Fragile boundaries of tailored surface codes and improved decoding of circuit-level noise.  _arXiv preprint arXiv:2203.04948_ (2022).
  * [52] Criger, B. & Ashraf, I.  Multi-path summation for decoding 2D topological codes.  _Quantum_ 2, 102 (2018).
  * [53] Fowler, A. G., Whiteside, A. C. & Hollenberg, L. C.  Towards practical classical processing for the surface code.  _Physical Review Letters_ 108, 180501 (2012).
  * [54] Bravyi, S., Suchara, M. & Vargo, A.  Efficient algorithms for maximum likelihood decoding in the surface code.  _Phys. Rev. A_ 90, 032326 (2014).  URL https://link.aps.org/doi/10.1103/PhysRevA.90.032326.
  * [55] Chubb, C. T. & Flammia, S. T.  Statistical mechanical models for quantum codes with correlated noise.  _Annales de l’Institut Henri Poincaré D_ 8, 269–321 (2021).
  * [56] Pattison, C. A., Beverland, M. E., da Silva, M. P. & Delfosse, N.  Improved quantum error correction using soft information.  _arXiv preprint arXiv:2107.13589_ (2021).
  * [57] McEwen, M. _et al._ Resolving catastrophic error bursts from cosmic rays in large arrays of superconducting qubits.  _Nature Physics_ 18, 107–111 (2022).
  * [58] Klimov, P. V., Kelly, J., Martinis, J. M. & Neven, H.  The snake optimizer for learning quantum processor control parameters.  _arXiv:2006.04594_ (2020).  URL https://arxiv.org/abs/2006.04594.
  * [59] Klimov, P. V. _et al._ Fluctuations of energy-relaxation times in superconducting qubits.  _Phys. Rev. Lett._ 121, 090502 (2018).  URL https://link.aps.org/doi/10.1103/PhysRevLett.121.090502.
  * [60] Sank, D. _et al._ Measurement-induced state transitions in a superconducting qubit: Beyond the rotating wave approximation.  _Physical Review Letters_ 117, 190503 (2016).
  * [61] Kelly, J. _et al._ State preservation by repetitive error detection in a superconducting quantum circuit.  _Nature_ 519, 66–69 (2015).
  * [62] Gidney, C.  Stim: a fast stabilizer circuit simulator.  _Quantum_ 5, 497 (2021).  URL https://doi.org/10.22331/q-2021-07-06-497.
  * [63] Fowler, A. G.  Optimal complexity correction of correlated errors in the surface code.  _arXiv preprint arXiv:1310.0863_ (2013).
  * [64] Zhang, J. & Fossorier, M.  Shuffled iterative decoding.  _IEEE Transactions on Communications_ 53, 209–213 (2005).
  * [65] Panteleev, P. & Kalachev, G.  Degenerate Quantum LDPC Codes With Good Finite Length Performance.  _Quantum_ 5, 585 (2021).  URL https://doi.org/10.22331/q-2021-11-22-585.
  * [66] Kuo, K.-Y. & Lai, C.-Y.  Refined belief propagation decoding of sparse-graph quantum codes.  _IEEE Journal on Selected Areas in Information Theory_ 1, 487–498 (2020).
  * [67] Poulin, D. & Chung, Y.  On the iterative decoding of sparse quantum codes.  _Quantum Info. Comput._ 8, 987–1000 (2008).
  * [68] Higgott, O. & Breuckmann, N. P.  Improved single-shot decoding of higher dimensional hypergraph product codes.  _arXiv preprint arXiv:2206.03122_ (2022).
  * [69] Chen, J., Dholakia, A., Eleftheriou, E., Fossorier, M. & Hu, X.-Y.  Reduced-complexity decoding of LDPC codes.  _IEEE Transactions on Communications_ 53, 1288–1299 (2005).
  * [70] Huang, S., Newman, M. & Brown, K. R.  Fault-tolerant weighted union-find decoding on the toric code.  _Phys. Rev. A_ 102, 012419 (2020).  URL https://link.aps.org/doi/10.1103/PhysRevA.102.012419.
  * [71] Delfosse, N. & Nickerson, N. H.  Almost-linear time decoding algorithm for topological codes.  _Quantum_ 5, 595 (2021).  URL https://doi.org/10.22331/q-2021-12-02-595.
  * [72] Gray, J.  quimb: A python package for quantum information and many-body calculations.  _Journal of Open Source Software_ 3, 819 (2018).
  * [73] Tomita, Y. & Svore, K. M.  Low-distance surface codes under realistic quantum noise.  _Physical Review A_ 90, 062320 (2014).
  * [74] Isakov, S. V. _et al._ Simulations of quantum circuits with approximate noise using qsim and cirq.  _arXiv preprint arXiv:2111.02396_ (2021).
  * [75] Geller, M. R. & Zhou, Z.  Efficient error models for fault-tolerant architectures and the Pauli twirling approximation.  _Physical Review A_ 88, 012314 (2013).
  * [76] Chen, Z. _et al._ Measuring and suppressing quantum state leakage in a superconducting qubit.  _Physical review letters_ 116, 020501 (2016).
  * [77] Wilde, M. M.  _Quantum information theory_ (Cambridge University Press, 2013).
  * [78] Battistel, F., Varbanov, B. M. & Terhal, B. M.  Hardware-efficient leakage-reduction scheme for quantum error correction with superconducting transmon qubits.  _PRX Quantum_ 2, 030314 (2021).
  * [79] Sung, Y. _et al._ Realization of high-fidelity CZ and $ZZ$-free iSWAP gates with a tunable coupler.  _Phys. Rev. X_ 11, 021058 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevX.11.021058.
  * [80] Note that the ordering of operations is swapped compared to the typical interaction picture definition $U_{lab}=U_{0}U_{I}$. This is to retain consistency with the other noise models, for which we append error channels after (instead of before) each ideal gate operation.
  * [81] Pedersen, L. H., Møller, N. M. & Mølmer, K.  Fidelity of quantum operations.  _Physics Letters A_ 367, 47–51 (2007).
  * [82] Quantum AI team & collaborators.  qsim (2020).  URL https://doi.org/10.5281/zenodo.4023103.
  * [83] O’Brien, T., Tarasinski, B. & DiCarlo, L.  Density-matrix simulation of small surface codes under current and projected experimental noise.  _npj Quantum Information_ 3, 39 (2017).
  * [84] Details of this approximation are deferred to a future work.
  * [85] Gottesman, D.  The Heisenberg representation of quantum computers.  In Corney, S. P., Delbourgo, R. & Jarvis, P. D. (eds.) _Proceedings of the XXII International Colloquium on Group Theoretical Methods in Physics_ , 32–43 (International Press, Cambridge, MA, 1999).
  * [86] Steane, A. M.  Overhead and noise threshold of fault-tolerant quantum error correction.  _Phys. Rev. A_ 68, 042322 (2003).  URL http://dx.doi.org/10.1103/PhysRevA.68.042322.
  * [87] Fowler, A. G., Hill, C. D. & Hollenberg, L. C. L.  Quantum-error correction on linear-nearest-neighbor qubit arrays.  _Phys. Rev. A_ 69, 042314 (2004).  URL http://link.aps.org/abstract/PRA/v69/e042314.
  * [88] Wang, D. S., Fowler, A. G., Stephens, A. M. & Hollenberg, L. C. L.  Threshold error rates for the toric and planar codes.  _Quantum Inf. Comput._ 10, 456–469 (2010).
  * [89] Wang, D. S., Fowler, A. G. & Hollenberg, L. C. L.  Surface code quantum computing with error rates over $1\%$.  _Phys. Rev. A_ 83, 020302 (2011).  URL http://link.aps.org/doi/10.1103/PhysRevA.83.020302.
  * [90] Landahl, A. J., Anderson, J. T. & Rice, P. R.  Fault-tolerant quantum computing with color codes (2011).  Presented at QIP 2012, December 12 to December 16.
  * [91] Brown, B. J., Nickerson, N. H. & Browne, D. E.  Fault-tolerant error correction with the gauge color code.  _Nature Communications_ 7, 12302 (2016).  URL https://doi.org/10.1038/ncomms12302.
  * [92] Tuckett, D. K., Bartlett, S. D. & Flammia, S. T.  Ultrahigh error threshold for surface codes with biased noise.  _Phys. Rev. Lett._ 120, 050505 (2018).  URL https://link.aps.org/doi/10.1103/PhysRevLett.120.050505.
  * [93] Gutiérrez, M., Svec, L., Vargo, A. & Brown, K. R.  Approximation of realistic errors by Clifford channels and Pauli measurements.  _Phys. Rev. A_ 87, 030302 (2013).  URL https://link.aps.org/doi/10.1103/PhysRevA.87.030302.
  * [94] Bravyi, S. & Gosset, D.  Improved classical simulation of quantum circuits dominated by Clifford gates.  _Phys. Rev. Lett._ 116, 250501 (2016).  URL https://link.aps.org/doi/10.1103/PhysRevLett.116.250501.
  * [95] Bravyi, S. _et al._ Simulation of quantum circuits by low-rank stabilizer decompositions.  _Quantum_ 3, 181 (2019).
  * [96] Fowler, A. G.  Coping with qubit leakage in topological codes.  _Physical Review A_ 88, 042308 (2013).
  * [97] Fattal, D., Cubitt, T. S., Yamamoto, Y., Bravyi, S. & Chuang, I. L.  Entanglement in the stabilizer formalism (2004).  URL http://arXiv.org/abs/quant-ph/0406168.  [unpublished].
  * [98] Note that the qsim backend for the kraus_sim simulator has not been optimized for performance on these system sizes.
  * [99] Cai, Z. & Benjamin, S. C.  Constructing smaller Pauli twirling sets for arbitrary error channels.  _Scientific reports_ 9, 1–11 (2019).
  * [100] Bravyi, S., Englbrecht, M., König, R. & Peard, N.  Correcting coherent errors with surface codes.  _NPJ Quantum Information_ 4, 55 (2018).  URL https://doi.org/10.1038/s41534-018-0106-y.
  * [101] Katabarwa, A. & Geller, M. R.  Logical error rate in the Pauli twirling approximation.  _Scientific reports_ 5, 1–6 (2015).
  * [102] Cory, D. G. _et al._ Experimental quantum error correction.  _Physical Review Letters_ 81, 2152 (1998).
  * [103] Knill, E., Laflamme, R., Martinez, R. & Negrevergne, C.  Benchmarking quantum computers: the five-qubit error correcting code.  _Physical Review Letters_ 86, 5811 (2001).
  * [104] Schindler, P. _et al._ Experimental repetitive quantum error correction.  _Science_ 332, 1059–1061 (2011).
  * [105] Moussa, O., Baugh, J., Ryan, C. A. & Laflamme, R.  Demonstration of sufficient control for two rounds of quantum error correction in a solid state ensemble quantum information processor.  _Physical Review Letters_ 107, 160501 (2011).
  * [106] Zhang, J., Gangloff, D., Moussa, O. & Laflamme, R.  Experimental quantum error correction with high fidelity.  _Physical Review A_ 84, 034303 (2011).
  * [107] Reed, M. D. _et al._ Realization of three-qubit quantum error correction with superconducting circuits.  _Nature_ 482, 382–385 (2012).
  * [108] Zhang, J., Laflamme, R. & Suter, D.  Experimental implementation of encoded logical qubit operations in a perfect quantum error correcting code.  _Physical Review Letters_ 109, 100503 (2012).
  * [109] Bell, B. _et al._ Experimental demonstration of a graph state quantum error-correction code.  _Nature Communications_ 5, 1–10 (2014).
  * [110] Nigg, D. _et al._ Quantum computations on a topologically encoded qubit.  _Science_ 345, 302–305 (2014).
  * [111] Waldherr, G. _et al._ Quantum error correction in a solid-state hybrid spin register.  _Nature_ 506, 204–207 (2014).
  * [112] Riste, D. _et al._ Detecting bit-flip errors in a logical qubit using stabilizer measurements.  _Nature Communications_ 6, 1–6 (2015).
  * [113] Córcoles, A. D. _et al._ Demonstration of a quantum error detection code using a square lattice of four superconducting qubits.  _Nature Communications_ 6, 1–10 (2015).
  * [114] Cramer, J. _et al._ Repeated quantum error correction on a continuously encoded qubit by real-time feedback.  _Nature Communications_ 7, 1–7 (2016).
  * [115] Takita, M., Cross, A. W., Córcoles, A., Chow, J. M. & Gambetta, J. M.  Experimental demonstration of fault-tolerant state preparation with superconducting qubits.  _Physical Review Letters_ 119, 180501 (2017).
  * [116] Linke, N. M. _et al._ Fault-tolerant quantum error detection.  _Science Advances_ 3, e1701074 (2017).
  * [117] Wootton, J. R. & Loss, D.  Repetition code of 15 qubits.  _Physical Review A_ 97, 052313 (2018).
  * [118] Andersen, C. K. _et al._ Entanglement stabilization using ancilla-based parity detection and real-time feedback in superconducting circuits.  _npj Quantum Information_ 5, 1–7 (2019).
  * [119] Gong, M. _et al._ Experimental exploration of five-qubit quantum error-correcting code with superconducting qubits.  _National Science Review_ 9 (2021).  URL https://doi.org/10.1093/nsr/nwab011.
  * [120] Hu, L. _et al._ Quantum error correction and universal gate set operation on a binomial bosonic logical qubit.  _Nature Physics_ 15, 503–508 (2019).
  * [121] Wootton, J. R.  Benchmarking near-term devices with quantum error correction.  _Quantum Science and Technology_ 5, 044004 (2020).
  * [122] Andersen, C. K. _et al._ Repeated quantum error detection in a surface code.  _Nature Physics_ 16, 875–880 (2020).
  * [123] Bultink, C. _et al._ Protecting quantum entanglement from leakage and qubit errors via repetitive parity measurements.  _Science Advances_ 6 (2020).
  * [124] Luo, Y.-H. _et al._ Quantum teleportation of physical qubits into logical code spaces.  _Proceedings of the National Academy of Sciences_ 118 (2021).
  * [125] Marques, J. _et al._ Logical-qubit operations in an error-detecting surface code.  _Nature Physics_ 18, 80–86 (2022).
  * [126] Bluvstein, D. _et al._ A quantum processor based on coherent transport of entangled atom arrays.  _Nature_ 604, 451–456 (2022).

Supplemental materials for _Suppressing quantum errors by scaling a surface
code logical qubit_ Google Quantum AI

Supplemental materials for _Suppressing quantum errors by scaling a surface
code logical qubit_

Google Quantum AI
---
(Dated: )

###### Contents

  1. I Introduction
  2. II Surface codes with superconducting qubits
  3. III Error detectors
  4. IV Understanding errors through correlations
  5. V Decoding and logical error probabilities
  6. VI Algorithmically-relevant error rates with repetition codes
  7. VII Towards large-scale quantum error correction
  8. VIII Author Contributions
  9. IX Acknowledgements
  10. X Data availability
  11. XI Experimental details
    1. XI.1 Idling errors
    2. XI.2 Optimizing gate parameters
    3. XI.3 Single qubit gates
    4. XI.4 Two qubit gates
    5. XI.5 Measurement and reset
    6. XI.6 Microwave crosstalk induced leakage mitigation
    7. XI.7 Surface code experimental details
      1. XI.7.1 Surface code circuits
      2. XI.7.2 Choice of $d=3$ grids
      3. XI.7.3 Order of experiments
      4. XI.7.4 Initial states
  12. XII Decoding
    1. XII.1 Setting the prior distribution
    2. XII.2 Correlated minimum-weight perfect matching
    3. XII.3 Belief-matching
    4. XII.4 Tensor network decoding
  13. XIII Fitting error versus rounds to extract logical error per cycle
  14. XIV Simulation of logical memory experiment
    1. XIV.1 Noise models
      1. XIV.1.1 Decay, dephasing, and leakage heating
      2. XIV.1.2 Readout and reset error
      3. XIV.1.3 Leakage
      4. XIV.1.4 Crosstalk
      5. XIV.1.5 Depolarizing errors
    2. XIV.2 Simulator details
      1. XIV.2.1 kraus_sim - noisy circuit compiler and quantum simulator
      2. XIV.2.2 Pauli$+$ simulator implementation
      3. XIV.2.3 Generalized twirling approximation
    3. XIV.3 Comparison of Pauli$+$ and quantum simulations
  15. XV Sensitivity of logical error per cycle to physical errors
    1. XV.1 Experimental operation point
    2. XV.2 Logical error rate sensitivities for $d=3$, 5 surface codes
  16. XVI $p_{ij}$ diagnostics of surface codes
    1. XVI.1 Experiment vs. Pauli$+$ correlation matrices $p_{ij}$
    2. XVI.2 $p_{ij}$ probability of main error edges in the surface code
      1. XVI.2.1 Timelike edges
      2. XVI.2.2 Spacelike edges
      3. XVI.2.3 Spacetimelike edges
    3. XVI.3 Probability of clusters of detection events using generalized $p_{ij}$
  17. XVII Surface code $1/\Lambda$ error budget
  18. XVIII Overview of error correction experiments
  19. XIX Additional plots of surface code data

Figure S5:  Qubit coordinates. Left: Distance-5 surface code as presented in
the main text, with an $(x,y)$ coordinate system indicated. Right: Rotated
coordinate system used for heatmap plots in the supplement, using (row,
column).

##  XI Experimental details

###  XI.1 Idling errors

A significant contribution to the logical error budget is data qubit
decoherence during the readout and reset of the measure qubits. The primary
decoherence mechanism is dephasing induced by low frequency flux noise. We
mitigate dephasing through dynamical decoupling with XY-4 phase cycling, which
compensates first-order pulse errors and protects arbitrary quantum states
equally. As mentioned in the main text, the specific dynamical decoupling
sequence is chosen on a per-qubit basis in order to tailor the sequence filter
function to each qubit’s unique noise environment.

###  XI.2 Optimizing gate parameters

Figure S6: Idle (top) and interaction (bottom) frequencies found by our Snake
optimizer as error mechanisms are progressively enabled. Readout parameters
are not shown. Starting from an unconstrained processor, enabling pulse
distortions results in an idle checkerboard with nearly-degenerate
interactions. This configuration minimizes frequency-sweeps during CZ gates.
Enabling crosstalk results in idle and interaction patterns that resemble
multi-layer checkerboards. This configuration minimizes frequency collisions
over the surface-code. Finally, enabling dephasing, relaxation, and other
error mechanisms leads to frequency configurations with no obvious structure.
After optimization, random error events can render arbitrary gates unusable
(red). In such scenarios, we locally reoptimize parameters and stitch
solutions. Color scales were chosen to maximize contrast.

Our quantum processor employs frequency-tunable qubits on a two-dimensional
lattice with coupler-mediated nearest-neighbor coupling and dispersive
readout. Quantum logic is implemented via single-qubit (SQ), two-qubit (CZ),
and readout (RO) gates. SQ gates are implemented via resonant microwave pulses
at qubits’ respective $f_{10}$ idle frequencies. CZ gates are implemented by
sweeping qubit pairs into $f_{10}/f_{21}$ resonance at respective interaction
frequencies and actuating respective couplers. RO gates are implemented by
sweeping qubits’ $f_{10}$ frequencies to respective readout frequencies and
measuring them via variable-amplitude and -length readout pulses. Most error
mechanisms depend strongly on gate frequencies and readout-pulse parameters,
which we refer to collectively as gate parameters. Optimizing gate parameters
is a critical error mitigation strategy necessary for state-of-the-art
surface-code performance [32, 42].

To optimize gate parameters, we developed a surface-code objective through
benchmarking and machine learning. It includes error contributions from
relaxation, dephasing, crosstalk, and pulse distortion, along with various
heuristics. Furthermore, it embeds the surface code circuit and it’s mapping
onto our processor. To offer a sense of scale, the distance-5 objective
incorporates $O(10^{4})$ error terms and is defined over 49 idle, 49 readout,
and 80 interaction frequencies, and 49 readout pulse amplitudes and 49
lengths. It is noisy, non-convex, and all parameters are explicitly or
implicitly intertwined due to engineered interactions and/or crosstalk.
Furthermore, since each parameter is constrained to $\sim 10^{2}$ values by
the control electronics, processor circuit, and gate parameters, the search-
space is $\sim 10^{552}$. This space is intractable to search exhaustively and
traditional global optimizers do not perform well on the objective. Therefore,
we invented the Snake optimizer to address it [58].

The Snake leverages concepts in graph optimization and dynamic programming to
split complex high-dimensional optimization problems into simpler lower-
dimensional subproblems. One key hyperparameter of the Snake is the subproblem
dimension, which enables us to trade optimization complexity for accessible
solutions. We operate the Snake in an intermediate dimensional regime that
benefits from the speed of local search and non-locality of global search.
This strategy outperforms local and global optimization in convergence rate
and error on the distance-5 objective. Furthermore, we believe it will scale
towards fault-tolerant processors.

To illustrate how the Snake trades between error mechanisms, we plot optimized
idle and interaction frequencies as error mechanisms are progressively enabled
in Fig. S6. Readout parameters experience similar tradeoffs but are not shown.
After optimization, some gates unexpectedly experience uncharacteristically
large error rates. These events happen randomly and are often due to spurious
resonances, for example due to two-level-system defects, moving into the path
of SQ and/or CZ gates [59]. Reoptimizing all gates after such failures is
unscalable due to considerations including calibration runtime. Instead, we
use the Snake to locally reoptimize failing gates and stitch solutions. To
improve the quality and longevity of our solutions, we employ higher
dimensional optimization and embed historical data into our objective.

###  XI.3 Single qubit gates

Single qubit gates are implemented through a combination of microwave $XY$
rotations and virtual $Z$ rotations. All microwave pulses utilize DRAG pulse
shaping to mitigate leakage from off-resonant driving of the
$|1\rangle\leftrightarrow|2\rangle$ transition, as detailed in [42]. We assess
our single qubit gate performance through randomized benchmarking, acting on
all qubits simultaneously. A summary of our single qubit device parameters,
including operating frequencies, coherence times, and gate errors can be found
in S7.

Figure S7: Heatmaps of various single qubit parameters: a, ground to first
excited state transition frequency. b, Qubit anharmonicity at the operating
frequency. c, Maximum achievable qubit frequencies. d, Qubit relaxation time.
e, Qubit decoherence time as measured by CPMG. f, Simultaneous single-qubit
gate error.

###  XI.4 Two qubit gates

The two qubit gate utilized in this work is the controlled-Z (CZ) gate. CZ
gates in the sycamore architecture arise from a state-selective dispersive
shift on the two qubit state $|11\rangle$, which is introduced through a
tunable coupling in the two excitation manifold, as detailed in [16]. We
assess our CZ gate performance by performing cross-entropy benchmarking (XEB).
In a single round of error correction in the surface code, CZ gates are
applied in layers which correspond to their position in a given stabilizer.
Therefore, to more accurately represent the CZ performance in the surface
code, we perform simultaneous XEB on pairs using their respective CZ layers.
We summarize our CZ gate parameters and measured errors in S8

Figure S8: Heatmaps of various two qubit gate parameters: a, frequency where
two coupled qubits interact to perform a CZ gate. b, The effective coupling
efficiency between two qubits. c, CZ gate error as measured by XEB and in the
surface code layers.

###  XI.5 Measurement and reset

Every qubit on the Sycamore processor has a dedicated resonator used for
measurement and reset of the qubit state, see details in Refs. [32, 42, 49].
In S9 (a-d) we summarize various parameters related to the resonators and the
measurement chain. Feeding those parameters into models for different readout
and reset error mechanisms, we optimize three readout parameters (qubit
frequenecy during readout, readout pulse length, and readout pulse power)
individually for each qubit. The total readout time is kept at 500 ns for each
qubit; however for measure qubits we need the respective resonators to be
empty before reset starts so we include time (equal to 500 ns minus the
readout pulse length) for the resonators to ring down. The optimization is
done using the Snake optimizer, see XI.2. For instance, we model errors due to
finite signal-to-noise ratio, qubit relaxation during readout, swapping
between neighboring qubits, and qubit state transition due to the resonator
drive [60]. The optimized values are found in S9 (e-g). In the end, we
benchmark readout by preparing and measuring a random set of qubit states,
summarized in S9 (h).

Figure S9: Heatmaps of various readout parameters: a, bare frequency of each
readout resonator. b, Ringdown time (equal to $1/\kappa$) of each resonator.
c, The coupling efficiency between resonator and qubit. d, Efficiency of the
measurement chain close to the readout frequency. e, Optimized qubit frequency
during readout (in the absence of a readout drive). f, Optimized readout pulse
lengths. g, Optimized readout pulse power referenced to the input of the
readout resonator and calibrated using the AC-Stark shift. h, Measured average
readout error over $\left|0\right>$ and $\left|1\right>$ when preparing a
random set of qubit states across all 49 qubits.

###  XI.6 Microwave crosstalk induced leakage mitigation

Figure S10: Mitigation of microwave crosstalk induced leakage. a, The Ramsey
error filter pulse sequence consists of $\pi$ rotations separated by a
variable delay $t$. We repeat this several times to amplify the coherent
leakage, which we observe by direct measurement of $\left|2\right>$. b,
Leakage probability $p2$ vs $t$ during the Ramsey error filter. This data is
taken with all sources operating in parallel. The $t$ that maximizes leakage
is held fixed throughout the remainder of the calibration sequence. c, $p2$ vs
source qubit during pairwise operation at optimal $t$. The peak identifies the
dominant source. d, $p2$ after Ramsey error filter during pairwise operation
with the dominant source vs r and $\theta$, the magnitude and phase of the
compensation tone used to null the crosstalk leakage. The red star indicates
the optimal $r$ and $\theta$.

Leakage out of the computational subspace is an important error class as it
leads to correlated error patterns during error detection. Microwave crosstalk
is one mechanism that causes leakage during single qubit gates. If the drive
frequency is near f21 of the receiver qubit, a parasitic
$\left|1\right>\rightarrow\left|2\right>$ leakage error can result.

To mitigate this leakage channel we apply a compensation pulse, out of phase
with the parasitic drive, directly to the receiver qubit to null this leakage.
We apply a signal $V^{\prime}\left(t\right)=V\left(t\right)re^{i\theta}$ for
$V^{\prime}$ the applied compensation, $V$ the source signal. In this section
we outline our procedure for calibrating the parameters $r$ and $\theta$.

We use a procedure based on the Ramsey error filter pulse sequence, Fig. S10a,
to calibrate the magnitude and phase of the compensation tone. For certain
delay times $t$, this sequence amplifies the coherent crosstalk leakage to
facilitate the calibration. This amplification can be understood as a result
of constructive interference between the leakage amplitudes induced by
successive pulses.

Fig. S10b shows representative data from the Ramsey error filter vs delay time
$t$. This data is taken while driving all qubits in parallel to minimize data
acquisition time. In the following calibration steps, $t$ is held fixed at the
value that maximizes the leakage population $p2$. In Fig. S10c, we show the
output of the Ramsey error filter at optimal $t$ during pairwise operation for
all possible pairs that include the receiver qubit. This data identifies the
source of the parasitic drive.

Fig. S10d shows $p2$ on the receiver qubit during pairwise operation with the
dominant source qubit at optimal $t$ vs the amplitude $r$ and phase $\theta$
of the compensation tone. The red star indicates the optimal $r$ and $\theta$
to mitigate crosstalk induced leakage.

###  XI.7 Surface code experimental details

####  XI.7.1 Surface code circuits

We present the surface code circuit in Fig. 1b (main text), focusing primarily
on two qubits. The circuit generalises across the surface code, which we show
here for clarity in Fig. S11. We also clarify the ZXXZ stabilisers and how
they relate to other stabilisers in Fig. S12.

Figure S11:  Distance-5 surface code circuits. Expanded version of Fig. 1b
(main text) showing the full sequence of operations. 1. We reset all qubits to
$|0\rangle$ and then prepare an initial bitstring state on the data qubits
using $X$ gates. 2. We apply $H$ (Hadamard) gates to some of the data qubits
to convert the initial bitstring (eigenstate of all $Z$ operators) into an
eigenstate of half the ZXXZ stabilisers, the half matching to logical operator
of interest ($X_{L}$ or $Z_{L}$) for the specific experiment. Note steps (1)
and (2) could be combined into a single moment of Clifford gates, but for
simplicity we execute them in two moments as shown. 3. QEC cycle, as in Fig.
1b (main text), showing the explicit gate patterns. Note although all
stabilisers measure ZXXZ, the "$X$" stabilizers and "$Z$" stabilizers apply
their CZs in a different order (specifically in 3d and f). This pattern is
carefully designed to manage “hook” errors. As mentioned in the main text, we
modify this gate sequence with additional “echo” or “dynamical decoupling”
gates _within_ the unitary part of the circuit. This amounts to adding $X$
gates to the data qubits in 3a and 3i, to the measure qubits in 3c and 3g, and
to all qubits in 3e (inserted between the middle two CZ moments). 4. For the
final measurement, we replace 3i-j with a different Hadamard pattern
(transforming the data qubit state to the appropriate basis for logical
measurement) and measure all qubits simultaneously. This final measurement is
used for detectors for the penultimate round (measure qubit results) and the
final round (data qubit results, converted to parities in the relevant basis).
Figure S12:  ZXXZ stabilisers. a, Illustration of measuring a ZZZZ stabiliser
including compilation into CZ gates. b, Similar for XXXX. c, Similar for ZXXZ
which we use for all stabilisers in our experiments.

In addition to individual-gate calibrations to track how qubit phases are
affected by each gate, we add additional corrections within the surface code
circuit, empirically optimized to minimize detection probabilities [61, 42].
These catch-all corrections allow us to mitigate the impact of a variety of
noise sources which all effectively act as a single qubit phase shift. We
place a “virtual $Z^{\alpha}$” correction preceding each Hadamard gate, and
then tune the value of $\alpha$ for each correction to minimize the detection
rate of the detectors that the correction impacts.

The measure qubit case is simpler because they are reset to $|0\rangle$ to
start each round, meaning that the initial Hadamard does not need a
correction. As a result, each measure qubit only has a single correction per
error correction cycle. Data qubits, which are assumed to be in a non-trivial
state throughout, require two corrections per cycle. In case there are
“warmup” effects, we give each measure qubit a special correction value for
the first cycle, and then each uses another value for the rest of the cycles,
while data qubit corrections have unique values for the first cycle and the
bulk cycle for each correction. Data qubits also have a single extra
correction in the last round, to correct for errors which occur right before
logical measurement.

These corrections $\\{\alpha\\}$, typically small (< 0.1), are optimized using
separate surface code experiments. We can divide the corrections into ten
groupings of compatible corrections for any distance of surface code, meaning
that the corrections impact different detectors and can therefore be optimized
simultaneously. We then find the value for each correction which minimized the
detection rate in parallel. Since the number of groupings is constant for any
distance of surface code, we expect this method to scale well as we increase
the sizes of our system.

####  XI.7.2 Choice of $d=3$ grids

Figure S13: Heatmaps of CZ and qubit involvements in the four distance-3 grids
considered in this work.

In total, there are 10 possible distance-3 grids whose footprint lies within
the footprint of the distance-5 surface code grid. The four grids chosen were
picked such that their overlap was minimized, in order to reduce
susceptibility to bias. There is still non-trivial overlap at the boundaries
of the distance-3 grids, as well as the center qubit, which is included in all
4 of the smaller codes as seen in Fig. S13. Since the distance-3 codes are
more susceptible to outlier qubits, the performance of the center qubit is
essential to a fair measurement of $\Lambda_{35}$.

In Fig. S14, we show a dataset where the center qubit was experiencing excess
phase errors, dramatically impacting the performance of the distance-3 codes.
In the inset, we can see that although this dataset does land in the desired
region, it is clear that it is due to outlier performance. We can also see
this by comparing to our models and observing that the logical error per cycle
does not match where our models would expect such a crossover to occur. By
looking at the detection event fractions in Fig. 2 of the main text, we can
see that the performance around the center of the chip was within the standard
range for the experiment presented, so we have no reason to believe that our
measurement of $\Lambda$ was skewed.

Figure S14: Plots in the style of Fig. 3 in the main text, but for a dataset
where the center qubit in the grid was experiencing performance issues. In a
and b, we present the logical error probability versus round, while in the
inset c, we present the same progression shown in the main text, but with this
outlier set plotted in red.

####  XI.7.3 Order of experiments

We interleave the experiments in Fig. 3 (main text). Specifically, we acquire
one (number of cycles, basis, code) dataset at a time. Each dataset consists
of 50000 total surface code runs (10 initial bitstring states times 5000
repetitions).

We shuffle the order in which we acquire each (number of cycles) group of
datasets. We begin with an extra 25-cycle experiment which we use for some
decoder “training” (see decoding section) and then proceed with the other
numbers of cycles in random order, in particular (25 (extra), 15, 17, 21, 13,
1, 19, 5, 23, 25, 7, 9, 3, 11).

Additionally, after each 5 cycles, we run a “frequency update” calibration on
all the qubits. This is a simultaneous Ramsey experiment to quickly check the
qubit frequency and update the flux bias values to tune the qubits to the
desired frequencies if needed.

The pseudocode below describes the specific order in which the (number of
cycles, basis, code) datasets were acquired.

``

`num_cycles = (25, 15, 17, ...) # see text`

`codes = (`

`d5,`

`upper_left,`

`lower_right,`

`upper_right,`

`lower_left,`

`)`

`for idx, n in enumerate(num_cycles):`

`if should_run_frequency_update(idx):`

`run_frequency_update()`

`for basis in (Z, X):`

`for code in codes:`

`take_data(n, basis, code)`

####  XI.7.4 Initial states

As discussed in the main text, we use random bitstrings as the initial data
qubit states. This avoids a situation where we start with a bias to more
$|0\rangle$ measurement outcomes: if all the data qubits start in $|0\rangle$,
about 3/4 of the measure qubits will see $|0\rangle$ in the first cycle, as
opposed to 1/2, and there would be an asymmetry in measurement fidelity. This
would artificially lower the error for the first several rounds as the code
“warms up” to the steady state.

For the data in Fig. 3 (main text), we choose to initialize with 10 different
bitstrings, 5 with each logical value. To accomplish this, for $N$ qubits, we
generate 5 integers between 0 (inclusive) and $2^{N-1}$ (exclusive) and then
interleave them with their $N$-bit bitwise complements (for odd surface code
distance, bitwise complements have opposite logical values).

Specifically, the bit-packed decimal integers we use for distance-5 are
(1497382, 32057049, 12984827, 20569604, 10981887, 22572544, 7363158, 26191273,
7264790, 26289641), and for distance-3, (22, 489, 198, 313, 167, 344, 112,
399, 110, 401).

The 25-bit representation of 1497382 is 0b0000101101101100100100110. Referring
to Fig. S5, this is assigned to the data qubits in a big-endian fashion using
the (row, column) coordinate system, with the most significant bit being
(row=1, column=5), followed by (2, 4) and (2, 6) and ending with the least
significant bit (9, 5). 1497382 is followed by its 25-bit complement, 32057049
or 0b1111010010010011011011001.

##  XII Decoding

###  XII.1 Setting the prior distribution

Each decoder requires a prior distribution on the set of errors occurring in
the device. However, there are many sets of errors which trigger the same set
of detectors. Because our decoder only depends on the detection events
themselves, we group error probabilities collectively into bins according to
the set of detectors they activate. This is done using Stim’s detector error
model functionality [62], which tracks Pauli errors to perform this binning
automatically. Specifically, we use a simple depolarizing circuit noise model,
derived from Stim circuit descriptions of the experimental circuits, to
generate an initial set of bins of detectors and their collective
probabilities. This information represents an initial error hypergraph -
detectors are vertices, bins act as hyperedges connecting those detectors they
activate, and hyperedge weights are defined from the collective error
probabilities of the errors contained in each bin. Note that this is a
slightly restricted model of decoding, and that more general models may be
employed to increase the probability of success [56].

From here, we use a higher-order extension of the $p_{ij}$ method to assign
probabilities to this initial ansatz of hyperedges using device-level data
[42, 50]. We compute the highest-order correlations present in the standard
depolarizing circuit model, which are weight-$4$. We then continue to lower-
order correlations, subtracting the probabilities of higher-order correlations
that contain them to avoid double counting. However, this procedure can
underestimate probabilities due to over-subtracting when the detection event
data exhibits additional correlations that are not captured in the initial
ansatz [50]. This is most common in one- and two-body correlations, which may
be contained in many three- or four-body correlations. To account for this, we
enforce a simple averaged depolarizing $T_{1}/T_{2}$ noise probability floor
for one-body and spacelike two-body correlations to avoid unphysically small
(or even negative) probabilities.

Because we use device-level data to calibrate the decoder, we must be careful
not to fit the parameters of the decoder to the specific data that must be
decoded. This can happen e.g. when optimizing minimum-weight perfect matching
edge weights using gradient descent with the logical error per cycle as an
objective function [61]. To avoid this issue, we decode an even subset of
experimental trials by computing $p_{ij}$ on the odd subset, and vice versa,
similar to [61], and then average the two. This sidesteps the potential
concern of having computed $p_{ij}$ on the same data set as decoding (although
in practice, we observe a negligible advantage when decoding with $p_{ij}$
computed from the decoded data set directly, as there is no optimization
step). Without perfect statistics, this leads to a mild interdependence
between the two individual decoding problems.

We validate the assumption that the interdependence is negligible by decoding
half of a single experiment via this averaging method, and then decoding it
again with $p_{ij}$ computed from another quarter of the data independent from
the half we decode. This ensures that each $p_{ij}$ is given the same amount
of statistics, so that the only additional difference between the two decoding
pathways are statistical fluctuations. We perform an abbreviated (due to the
computational cost of the tensor network) distance-3 decoding experiment using
5, 9, and 13 rounds with this method. With the tensor network decoder and
belief-matching decoder, averaged over round, we observe a _relative_ change
of average logical error probability by $0.2\%$ and $0.1\%$, respectively,
when using the independently computed $p_{ij}$ compared to averaging. These
relatively weak dependencies of performance on the precise edge weights
(rather than their general features) provide evidence that any interdependence
between the two data sets due to statistical fluctuation is small.

For real-time decoding, it is also important that a decoder is robust to
imperfections in the prior distribution e.g. caused by device drift. Although
the tensor network decoder will likely be too slow to keep up with the
throughput of a surface code processor, belief-matching is a promising
candidate for building such a real-time decoder. To test belief-matching’s
sensitivity to an imperfect prior, we additionally use it to decode the
experimental data with $p_{ij}$ computed from earlier data generated by the
device. We observe a very small increase in logical error per cycle from
$3.118\%$ to $3.129\%$ for distance-3 and $3.056\%$ to $3.059\%$ for
distance-5. This robustness reinforces belief-matching as a promising
candidate for real-time decoding.

###  XII.2 Correlated minimum-weight perfect matching

For simulations involving larger scans through parameter space (e.g. for error
budgeting), we employ a minimum-weight perfect matching decoder that uses a
variant of the two-pass correlation strategy detailed in [63]. Because the
time cost of this decoder is essentially twice the time cost of minimum-weight
perfect matching, we can leverage a fast custom matching engine to perform
these larger scans quickly. Matching is also used to decode the repetition
code, which does not require a two-pass strategy.

###  XII.3 Belief-matching

The minimum-weight perfect matching (MWPM) decoder often used for surface
codes is efficient, but only considers edge-like fault mechanisms in the error
hypergraph, ignoring hyperedge fault mechanisms that include more than two
detectors [34]. Like the correlated MWPM decoder, the belief-matching decoder
exploits information about hyperedge fault mechanisms, but in a different way
- by combining belief propagation (BP) with MWPM [51, 52]. In terms of
efficiency, it has the same average and worst-case asymptotic running time as
the conventional MWPM decoder [53].

Figure S15: Comparison of different variants of BP used as a subroutine in the
belief-matching decoder for a distance-5 surface code with simulated circuit-
level depolarising noise over 5 rounds of syndrome measurement. We compare a
parallel and serial schedule using the tanh update rule, as well as a serial
schedule using the min-sum approximation of BP with a scaling factor of $0.7$.
The $x$-axis shows the maximum number of iterations used for BP. The black and
red dashed lines show the performance of an uncorrelated [34] and correlated
[63] MWPM decoder, respectively. All decoders were run on the same simulated
data set of 50,000 shots.

In the first stage of belief-matching, BP is used to estimate the posterior
marginal probability that each hyperedge fault mechanism has occurred, based
on the prior probability of each hyperedge in the error hypergraph, as well as
the set of detection events that have occurred in the experiment. In the
second stage, the error hypergraph is decomposed into two error graphs, using
the BP posterior marginal probabilities to set the edge weights. These two
error graphs are then decoded using a MWPM decoder [34]. We refer the reader
to Ref. [51] for a more detailed description.

The main difference between our implementation of belief-matching and that of
Ref. [51] is that we use a serial (rather than a parallel) schedule for BP and
a maximum of 5 iterations. This choice of parameters is motivated by our
analysis of different variants of BP in belief-matching for simulated surface
code data, shown in S15. The serial schedule increases the rate of convergence
of BP by roughly a factor of two [64, 65, 66], and we also find that it
improves the accuracy of belief-matching relative to using a parallel
schedule, which we attribute to the serial schedule mitigating against the
problem of split-beliefs caused by quantum degeneracy [67]. We find that using
more than 5 iterations for BP did not improve the accuracy of belief-matching
for our simulations, and increasing the number of iterations can even degrade
performance. We expect this is due to short loops in the Tanner graph bounding
information spread beyond some local region [68] and leading to unreasonably
confident log-likelihood ratios when the number of iterations is increased
beyond the length of these short loops. Although we use the standard “tanh”
rule for BP in our belief-matching implementation for the experiment, in S15
we also show the performance of belief-matching when using the min-sum
approximation of BP. The min-sum algorithm is an approximation of BP that is
more efficient to implement in hardware. Despite its relative simplicity, we
find that the accuracy of the min-sum algorithm with a serial schedule is only
slightly worse than that of BP using the tanh rule with the same serial
schedule, and is comparable to that of the tanh rule with a parallel schedule.
A review of the tanh rule and min-sum algorithm can be found in Ref. [69].

Practically, this decoder holds promise for scaling to the $\sim 1$ $\mu$s per
round throughput required by a real-time superconducting quantum computer. In
addition to using the min-sum approximation and a small number of iterations,
the BP subroutine can be made even faster through the use of parallelisation.
Furthermore, by using belief-find, which uses weighted union-find [70, 71]
instead of MWPM for post-processing, further speedups might be achieved with
only a very small reduction in accuracy [51].

###  XII.4 Tensor network decoding

We implement a close-to-optimal decoder mapping the prior distribution defined
in Sec. XII.1 to a tensor network. Given a configuration of detection events
and a choice of logical frame change, the contraction of this tensor network
estimates its probability. It does so by summing the probabilities of all
error configurations compatible with the set of detection events and logical
frame change considered. This decoder guesses the more plausible logical frame
change by comparing the likelihood of both outcomes. Unlike similar previous
approaches [54, 55, 51], our protocol takes as input device level noise
specified by $p_{ij}$ correlations rather than gate-level noise.

The contraction complexity of the resulting tensor network grows exponentially
in $d^{2}$, where $d$ is the distance of the code. In practice, we contract it
approximately as a matrix product state evolution with a finite maximum bond
dimension, $\chi$. The complexity of this approximate contraction grows with
$\chi^{3}$. In order to guarantee that the value of $\chi$ used achieves
convergence, we study the logical error probability of a distance-5 $Z$-basis
experiment over 25 rounds - the largest experiment run. We show in Fig. S16
that the logical error probability already converges at $\chi=30$, which we
use to decode. Our implementation of this decoder uses the tensor network
library quimb as a backend [72].

Figure S16: Logical error probability of a distance-5, $Z$-basis, 25-round
experiment with 50,000 shots as a function of the maximum bond dimension
$\chi$ used in the tensor network contraction. Error bars denote standard
error of the mean. We observe that the logical error probability stabilizes at
$\chi=30$.

##  XIII Fitting error versus rounds to extract logical error per cycle

Figure S17: A figure demonstrating our fitting procedure on the Z-basis
distance-5 data from the run presented in the main text, decoded with the
tensor network decoder. a, The logical fidelity data as a function of rounds,
with error bars pulled from the binomial distribution (in this figure, all
error bars shown at $10\sigma$ to help with visibility.) b, The same data
after a base-10 logarithm has been applied to it, with the error bars
transformed appropriately, along with a two-parameter linear fit. c, The data
transformed back into the original coordinates, along with the transformed
fit.

There are many ways to fit the data for error versus rounds to extract the
logical error per cycle, which can yield slightly different results. In this
section we lay out the procedure followed for this work.

We start with logical fidelities $F_{\text{L}}(r)=1-2P_{\text{err}}(r)$,
discarding the first round as it decreases the quality of our fits due to the
unique nature of its errors, which disproportionately favor distance-5. Our
goal is to find some logical error per cycle $\varepsilon$ such that

$\displaystyle\begin{split}P_{\text{err}}(r+1)&=(1-\varepsilon)P_{\text{err}}(r)+\varepsilon\big{(}1-P_{\text{err}}(r)\big{)}\\\
&=\varepsilon+(1-2\varepsilon)P_{\text{err}}(r)\end{split}$ (1)

which corresponds to exponential decay in the fidelity:

$\displaystyle F_{\text{L}}(r+1)$
$\displaystyle=(1-2\varepsilon)F_{\text{L}}(r).$ (2)

To do this, we first take our $F_{\text{L}}(r)$ data and append error bars
from a binomial distribution, meaning that the variance at each point is given
by

$\displaystyle\sigma^{2}$
$\displaystyle=\frac{P_{\text{err}}(r)\big{(}1-P_{\text{err}}(r)\big{)}}{N}.$
(3)

We then take the base-10 logarithm of each of these points, transforming the
error bars as appropriate, before fitting to simple two-parameter linear fit
using least squares, weighting the squared errors by the transformed variances
to approximate a maximum-likelihood estimate. We then exponentiate this linear
fit in order to get the fit in the original coordinates. In S17 we show this
process applied to the Z-basis distance-5 dataset presented in the main text.
When combining data from multiple experiments, such as when considering data
from multiple logical bases, this process is done on each dataset separately,
and the final $\varepsilon$’s are averaged.

We additionally quantify out-of-model errors (such as leakage and device
drift) by comparing the residuals of the fit to the residuals we would expect
from binomial sampling errors alone. As the residuals are roughly three times
larger than what we expect from sampling noise alone, we scale up the
uncertainty calculated for sampling noise by this factor to account for the
additional variance in our estimates from these out-of-model factors. As a
final conservative measure, we upper bound our uncertainty by combining
uncertainties from individual fits (from different initial-state bases and
different distance-3 configurations) via averaging, which accounts for the
possibility that these out-of-model errors might be correlated across
different subsets of experiments.

Figure S18: Results of fitting to an extended model with fluctuating
$\varepsilon$. Fits are performed for all subintervals of rounds containing at
least three points, and the result of the fit is presented as the difference
in logical error per cycle between distance-3 and distance-5 measured in the
average of the uncertainties of logical error per cycle for each distance
given the extended model. Fits starting from round 1 clearly favor distance-5
disproportionately, and are not used for our quoted results. Fits starting
from rounds 3–11 show consistent significant separation between the estimates
for logical error per cycle. The fit from rounds 3–25, the range used for our
quoted logical error per cycles, shows a separation of $5.7\sigma$ between
distance-3 and distance-5, which is consistent with the $5.8\sigma$ separation
we get from our original fits when scaling our error bars by the excess
residual factor.

As a check that this can appropriately account for additional errors, we also
fit an extended model in which the residuals in our fits come primarily from
fluctuations in the logical error per cycle $\varepsilon$ itself instead of
binomial sampling noise. This model results in near identical separation
between the logical error per cycle for distance-3 and distance-5, as measured
in standard deviations of the estimate. The results of this fit are
illustrated in S18 for all potential subintervals, demonstrating the
robustness of our findings to out-of-model errors and fitting choices.

##  XIV Simulation of logical memory experiment

We consider multiple simulation strategies for the the logical memory
experiment. The simplest approach, labeled "Pauli" in the main text, is
implemented as a standard Pauli frame simulation. This simulation is based on
the _Stim_ open source library[62]. The associated error model corresponds to
adding one and two-qubit depolarizing channels each device operation, matched
to experimentally characterized fidelities.

A more sophisticated simulation approach is labeled "Pauli$+$". This is still
a classical simulation in the sense that the cost grows polynomially in the
number of qubits, though its performance is not as heavily optimized. The
advantage of this simulation is that it explicitly accounts for correlated
errors such as qubit leakage and parallel gate crosstalk.

Finally, we do a "brute force" quantum simulation of the distance-3
experiment. This is a quantum trajectories simulation [73, 74], meaning that
each experimental sample corresponds to propagating the noisy evolution of the
full quantum state vector. Unlike the previous approaches, the quantum
simulation is "exact" in the sense that all noise is modeled using explicit
quantum channels derived from physical considerations. The previous approaches
must represent noise using Pauli channels, which can be derived from the more
general quantum channels through approximations (detailed below). While the
quantum simulation is not scalable to large code distances, we can use it to
validate the approximations required for the Pauli$+$ simulator.

Below we outline the general procedure to simulate the logical memory
experiment.

  1. 1.

The "ideal" experiment is represented as a noiseless quantum circuit. Each
layer of gate, idle, measure, or reset Operations is encoded as a _Circuit_
object of the Cirq open source library [74]. Simultaneous Operations are
organized into Moments.

  2. 2.

The "ideal" circuit is mapped to a "noisy" circuit. This corresponds to
inserting additional moments into the circuit composed of operations
representing noise. (The noise models used are described below.) Each noise
operation is a quantum noise channel encoded using Kraus operators. Such a
representation is sufficient for the quantum simulator. Both noisy circuit
processing and quantum trajectories simulation are implemented using the
kraus_sim library (Section XIV.2.1).

  3. 3.

Additional processing of the noise is required for the "Pauli$+$" simulator.
As detailed in section XIV.2.3, we apply a generalization of the Pauli
Twirling Approximation [75] to construct Generalized Pauli Channels (GPC’s)
capable of including leakage.

  4. 4.

The chosen simulator generates many measurement samples of the experiment
represented by the noisy circuit. The initial data qubit states are matched to
those used in experiment, and the results are then processed in the same way
as experimental measurement data.

In the following sections, we discuss details of the simulated noise models as
well as the Pauli$+$ simulator and the Generalized Pauli Twirling
Approximation. We conclude with a comparison of results between the "Pauli$+$"
and quantum simulations for a distance-3 experiment.

###  XIV.1 Noise models

Below we give a brief summary of all noise models included in our simulations.
These models are accounted for using Kraus operators, which define quantum
channels that are applied to each qubit after their respective gate or idling
operations. In the Pauli$+$ simulation, these channels are first converted
into corresponding Generalized Pauli Channels (GPC’s) so that the noisy
experiment is amenable to efficient simulation.

####  XIV.1.1 Decay, dephasing, and leakage heating

We consider the effects of qubit decay, white noise dephasing, and passive
leakage to state $\left|2\right>$ for an idling transmon qubit. We assume
decay into a large, zero temperature environment with characteristic decay
time $T_{1}$. Each transmon (both measure and data qubits) couples to the
environment through its charge operator $q$. This induces a decay (in the
energy eigenbasis) through the $|j\rangle\\!\langle j+1|$ elements of the
charge operator, which we assume scale as $q_{j,j+1}\propto\sqrt{j+1}$.
Fermi’s Golden rule predicts a $j+1\rightarrow j$ decay rate proportional to
$|q_{j+1,j}|^{2}\propto(j+1)$ , so we expect the state $\left|2\right>$ to
decay twice as fast as state $\left|1\right>$. Similarly, one can derive
dephasing as arising from a weak measurement of the number operator $n$, with
information leaking at a rate $1/T_{\phi}$. Finally, we include a
phenomenological leakage heating rate $\Gamma_{1\rightarrow 2}$ described by
the Linbladian operator $\sqrt{\Gamma_{1\rightarrow 2}}|2\rangle\\!\langle
1|$. The dynamics of an idle transmon in the presence of these processes is
described through the master equation,

$\displaystyle\partial_{t}\rho$ $\displaystyle=$
$\displaystyle-\frac{i}{\hbar}[H^{\text{idle}},\rho]+\mathcal{L}[\rho]$ (4)
$\displaystyle=$ $\displaystyle-\frac{i}{\hbar}[H^{\text{idle}},\rho]$
$\displaystyle+\frac{1}{T_{1}}\left(a\,\rho\>a^{\dagger}-\frac{1}{2}\\{n,\rho\\}\right)+\frac{2}{T_{\phi}}\left(n\rho\,n-\frac{1}{2}\\{n^{2},\rho\\}\right)$
$\displaystyle+\Gamma_{1\rightarrow 2}\left(|2\rangle\\!\langle
1|\rho|1\rangle\\!\langle 2|-\frac{1}{2}\\{|1\rangle\\!\langle
1|,\rho\\}\right),$ $\displaystyle a$ $\displaystyle=$
$\displaystyle\sum_{j\geq 0}\sqrt{j+1}|j\rangle\\!\langle j+1|,$
$\displaystyle n$ $\displaystyle=$ $\displaystyle\sum_{j\geq
0}j|j\rangle\\!\langle j|=a^{\dagger}a.$

The values for $T_{1}$ and $T_{\phi}$ used in our simulations are both qubit
specific. They are extracted from experimental decay and CPMG data. For
$\Gamma_{1\rightarrow 2}$ we use a homogeneous value of $1/(700\mu\text{s})$,
which is in agreement with typical numbers for both our current device and
past experiments[76].

We use the dissipative dynamics in (4) to extract corresponding discrete
quantum noise channels. These are applied on each qubit following every idle
or gate operation. For an operation of duration $t$, evolution under the
master equation can be approximately decomposed as
$\mathcal{E}\circ\hat{U}_{0}$, where $\hat{U}_{0}$ represents the ideal
unitary evolution and

$\mathcal{E}=\exp\left(t\mathcal{L}\right)$ (5)

represents the effect of decoherence. We solve for $\mathcal{E}$ by
representing $\mathcal{L}$ as a linear operator and doing the direct matrix
exponentiation; this ignores a correction due to weak non-linearity of the
spectrum of $H^{\rm idle}$. From this we follow the standard prescription to
extract the Kraus operators of $\mathcal{E}$[77].

####  XIV.1.2 Readout and reset error

Readout error is assumed to be a classical process. Accordingly, our
simulations in fact implement perfect readout in the standard basis (including
leaked states $\left|2\right>$ and $\left|3\right>$) and errors are added
using a Markov transition matrix in post-processing. To populate this matrix
we use the calibrated readout fidelities in the device. Measure qubit
fidelities are calibrated during parallel measurement of all measure qubits,
while for data qubits we use fidelities calibrated during parallel measurement
of _all_ qubits. Since the experiment does not actually implement readout that
distinguishes the leaked states, we assume that both state $\left|2\right>$
and $\left|3\right>$ are read out as $\left|0\right>$ or $\left|1\right>$ with
equal probability. Additionally, we account for measure qubit reset error by
adding this probability to the average readout error of the measure qubits.
This is justified as a reset error on a measure qubit at the beginning of an
error correction round has the same effect as a measurement error at the end
of the round.

####  XIV.1.3 Leakage

Leakage outside the computational subspace is caused by three mechanisms
included in our models.

  1. 1.

Heating: Passive heating from state $\left|1\right>$ to $\left|2\right>$, as
included in the decoherence model above.

  2. 2.

CZ gate dephasing: Since our CZ gates are diabatic (implemented as two
complete Rabi swaps) dephasing processes may cause transitions between states
$\left|11\right>$ and $\left|02\right>$. To model this process, after each CZ
gate we include a channel with Kraus operators

$\displaystyle K_{1}$ $\displaystyle=$
$\displaystyle\sqrt{p_{t}}\left(|02\rangle\\!\langle 11|+|11\rangle\\!\langle
02|\right)$ $\displaystyle K_{0}$ $\displaystyle=$
$\displaystyle\sqrt{I-K_{1}^{\dagger}K_{1}}\,.$ (6)

The value $p_{t}=8\times 10^{-4}$ used matches the median value observed in
characterization of isolated CZ gates. The qubit ordering above matches the
$f_{10}$ transition frequencies of the qubits, so that only the higher
frequency qubit leaks [42].

  3. 3.

CZ crosstalk: As discussed below, coupling crosstalk between independent CZ
pairs or idling qubits may lead to leakage transitions.

Along with affecting measurement outcomes, we also account for the effect of
leakage on our CZ gates. This is captured by two processes:

  1. 1.

Controlled phases: When one of two qubits is in a leaked state
$\left|j\right>$ during the CZ gate, the applied Z phase on the other,
$\phi_{j}$, will typically not be $0$ or $\pi$. When the non-leaked qubit is a
measure qubit, this will have a randomizing effect on the observed stabilizer
measurement [78]. Under the twirling approximation, this effect is mapped to a
$\sigma_{z}$ Pauli channel applied conditionally on the non-leaked qubit.

  2. 2.

Higher level transitions: The physical implementation of the diabatic CZ gate
leads to resonances between higher energy states (e.g. $\left|22\right>$ and
$\left|13\right>$). Accordingly, this leads to coherent transitions between
these states and effective transport of leakage between measure and data
qubits[49].

In order to accurately capture the above processes, we numerically calibrated
then simulated the CZ gate matching the experimental qubit and coupler control
schedules. The observed values for $\phi_{j}$, as well as the transition
amplitudes (specifically between states
$\left|22\right>\Longleftrightarrow\left|13\right>$ and
$\left|21\right>\leftrightarrow\left|03\right>$) were extracted.

####  XIV.1.4 Crosstalk

We model coupling crosstalk between qubits undergoing parallel CZ or idling
operations. This crosstalk error is caused by two effects. First, the
_inactive_ couplers (i.e those not implementing a CZ gate) used to mediate the
qubit-qubit couplings at idle are unable to cancel all effective couplings
over all fixed excitation subspaces[79]. Second, diagonal capacitive couplings
(e.g., between next-nearest-neighbor qubits) are also present throughout the
device, with $\left|01\right>\leftrightarrow\left|10\right>$ swap rates on the
order of $200$ kHz. To account for both of these effects, we consider all
pairs of simultaneous gates (either single qubit idle or two-qubit CZ). For
each pair of gates containing a diagonal or nearest neighbor, we simulate the
parallel operation of both gates in the lab frame (while including the
undesired couplings above). The full 3- or 4- qubit unitary $U_{lab}$ is then
re-expressed in the "interaction picture"

$U_{lab}U_{0}^{\dagger}=U_{I}$ (7)

where $U_{0}$ represents the "ideal" evolution in the absence of the unwanted
couplings111Note that the ordering of operations is swapped compared to the
typical interaction picture definition $U_{lab}=U_{0}U_{I}$. This is to retain
consistency with the other noise models, for which we append error channels
after (instead of before) each ideal gate operation.. (This ideal evolution
can be computed as a tensor product of unitaries acting on the two subsystems
involved in each gate.) Note that the simulations are carried out using
4-level qubits, so that leakage-related effects are explicitly included.
Details of these simulations are deferred to a later work. The $U_{I}$
unitaries for all pairs of neighboring gates are included as error channels in
representation of the noisy circuit.

####  XIV.1.5 Depolarizing errors

While the models above account for a majority of errors in the experiment,
they typically under-predict the experimentally calibrated decay of fidelity.
To compensate for this missing error, we append additional depolarizing errors
after each gate. In all cases, the fidelity decay curves are converted to an
inferred Pauli error. This error is compared to the sum of Pauli errors
accumulated over the error models described above. The effect of leakage
transitions on the Pauli error are explicitly accounted for as in ref. [81].
Single qubit gates are characterized using parallel randomized
benchmarking[31], while CZ gates are characterized with parallel cross-entropy
benchmarking (XEB)[32]. Additionally, the data qubit idles (during measure
qubit measurement and reset) are characterized using interleaved single qubit
XEB.

###  XIV.2 Simulator details

####  XIV.2.1 kraus_sim - noisy circuit compiler and quantum simulator

The kraus_sim library serves as an intermediate layer between the Cirq (used
to represent the circuit) and _qsim_ (used for high-performance qubit state
evolution)[32, 82] libraries. At the interface to Cirq, it processes the ideal
circuit to generate the noisy circuit (as described in Section XIV.1). These
noisy circuits are then consumed by kraus_sim’s quantum trajectories
simulator. A single quantum trajectory is equivalent to consecutively sampling
the Kraus operators of each applied quantum channel using Born’s rule for
POVMs[77], then applying the Kraus operator to the state vector and
normalizing the result[74]. Below, we highlight unique features of the
library, which necessitate a custom simulator backend based on the the _qsim_
library.

The kraus_sim analog of Cirq’s Operation is the KrausOperation. It is used to
encode all quantum channels (both gates and errors) applied to the system.
These channels are encoded as Kraus operators, each of which is represented as
a multi-dimensional tensor. While typical Kraus operators are "square"
matrices, KrausOperations allow these tensors to have an arbitrary shape. This
means that channels can be defined which "create" or "destroy" degrees of
freedom in the system. Accordingly, in many cases it is possible to reorder
the application of commuting KrausOperations to greatly speed up calculations
by decreasing the size of the state vector. Specifically, the structure of the
surface code and bit flip code circuits means that operations can be ordered
so that a "destructive" measurement of a single measure qubit is following by
a "creative" reset of another measure qubit[83]. Thus, only a single measure
qubit ever needs to be represented in memory. This allows for noisy
simulations of up to a distance-5 surface code (25 data + 24 measure qubits)
while keeping at most 25+1 qubits in memory. However, this technique is not
possible in the presence of 3- and 4-local crosstalk errors, since if two
measure qubits are affected by such error they must both exist concurrently in
the simulation. We therefore focus only on distance-3 simulations (requiring
only 9+8=17 qubits in memory).

kraus_sim also implements functionality to represent classical degrees of
freedom (registers), which are updated using stochastic matrices.
KrausOperations can be conditioned on the values of these registers, which
allows the registers to affect the quantum state evolution. Analogously, the
index of the sample Kraus operator for a given KrausOperation can be used to
apply conditional stochastic matrices to classical registers. This is relevant
for simulations of leakage, as in our models we approximate all leakage
transitions as incoherent. This means that no superposition is ever formed
between the computational and leakage subspaces of any qubit, and we therefore
are never required to keep more than two levels per qubit in our state vector.
Instead we use classical registers to track the leakage status of each qubit,
applying only the parts of our Kraus operators that act in the current
computational subspace222Details of this approximation are deferred to a
future work..

####  XIV.2.2 Pauli$+$ simulator implementation

Pauli$+$ carries out a classical simulation of the logical memory experiment.
The term “classical” here denotes the fact that the simulation cost scales
quadratically with the number of qubits and linearly with the number of error
correction rounds, so it is amenable to classical computers. For a system of
qubits, polynomial scaling of simulation cost for an arbitrary Clifford
circuit with Pauli-channel errors is a consequence of the Gottesmann-Knill
theorem [85]. Related methods have long been used for accuracy threshold
calculations [86, 87, 35, 88, 89, 90, 91, 92] and non-Pauli errors [93], and
even for simulating circuits with a small fraction of non-Clifford gates[94,
95].

In the presence of leakage, we achieve such a scaling in a Markov-chain
simulation by using an approximate Generalized Pauli Channel (GPC) error model
similar to that used in Pauli-frame simulations by Fowler[96]. In our case, to
ensure correct correlations between measurement events in an arbitrary
Clifford circuit, the state of the system is described by a vector of device
leakage labels and an $m$-qubit stabilizer state for the devices in the
computational (qubit) subspace.

The noisy circuit is modified for Pauli$+$ simulations by decomposing each
noisy gate as a product of an ideal Clifford gate and a sequence of residual
error channels. The error channels are then approximated as a GPC. As a
result, the entire simulation consists of four operation types:

  1. 1.

A unitary that acts as a perfect Clifford gate in the computational subspace
and identity on its complement.

  2. 2.

A perfect measurement (all leakage levels resolved) in the computational
basis.

  3. 3.

A perfect reset to a single-device $\left|0\right>$ state in the computational
basis.

  4. 4.

An error channel, represented as a Generalized Pauli (GP) channel.

(As noted previously, classical readout error is handled through post-
processing of measurement data). We describe how each of these operations are
handled by the simulator below.

The full Hilbert space of the $n$-device system is approximated as a
$q^{n}$-dimensional space, where each device has $q=4$ energy levels, with
$\left|0\right>$ and $\left|1\right>$ forming the computational subspace.
Further, because the corresponding phases are not being tracked, the states
$\left|2\right>$ and $\left|3\right>$ are subject to rapid dephasing. As a
result, the full Hilbert space is separated into mutually incoherent leakage
subspaces given by Kronecker products,

${\cal H}_{\bar{a}}={\cal H}_{a[1]}\otimes{\cal
H}_{a[2]}\otimes\ldots\otimes{\cal H}_{a[n]},$ (8)

where the local subspace ${\cal H}_{a[j]}$ of the $j$ th device with leakage
state label $a[j]\in\\{c,2,3\\}$ is selected from

${\cal H}_{c}=\mathop{\rm Span}\\{\left|0\right>,\left|1\right>\\},\quad{\cal
H}_{2}=\mathop{\rm Span}\\{\left|2\right>\\},\quad{\cal H}_{3}=\mathop{\rm
Span}\\{\left|3\right>\\}.$ (9)

Each GP channel acting on $k$ devices in the index set
$J=\\{j_{1},j_{2},\ldots,j_{k}\\}$ is represented by a collection of possible
transitions between leakage subspaces:

$\bar{a}[J]\equiv\left(a[j_{1}],a[j_{2}],\ldots,a[j_{k}]\right)\to\bar{b}[J]\equiv\left(b[j_{1}],b[j_{2}],\ldots,b[j_{k}]\right).$
(10)

For each transition $\bar{a}\rightarrow\bar{b}$, the set of devices in $J$ are
partitioned into four categories, depending on their initial and final leakage
status. The devices which begin and _remain_ in the computational subspace are
denoted

$R\equiv\\{j\in J\mid a[j]=b[j]=c\\}.$ (11)

These devices will receive a standard Pauli channel. The devices that
transition _up_ to leakage are denoted by

$U\equiv\\{j\in J\mid a[j]=c,b[j]\neq c\\}.$ (12)

Leaked devices are not modified after the transition. Conversely, devices
which transition _down_ to the computational subspace are labeled

$D\equiv\\{j\in J\mid a[j]\neq b[j]=c\\}.$ (13)

We assume that such devices are fully disordered, meaning that they receive a
maximally depolarizing Pauli channel. Finally, the remaining devices are those
which start and end _leaked_ ,

$L\equiv\\{j\in J\mid a[j]\neq c,b[j]\neq c\\}.$ (14)

Like the devices in $U$, no Pauli channel is applied for these devices.
However, transitions between different leakage subspaces are allowed. As
detailed below, approximating quantum error channels in terms of GP channels
is premised on the assumption that the input is a highly-entangled stabilizer
state, that the output is eventually projected to such a state, e.g., at the
end of a measurement cycle, and that a “large” part of evolution during any
gate is factored out as a Clifford rotation, while the remaining error channel
is in some sense close to identity.

Each transition (denoted by the initial and final subspace vectors
$\bar{\imath}$, $\bar{f}$ supported on $J$) is assigned a conditional
probability $P(\bar{f}\mid\bar{\imath})\equiv P(\bar{\imath}\to\bar{f})$.
Whenever the GP channel is applied to the system initially in subspace ${\cal
H}_{\bar{a}}$, there is a unique subspace label $\bar{\imath}\equiv\bar{a}[J]$
which is updated according to the distribution $P(\bar{f}\mid\bar{\imath})$.
Additionally, each transition is associated with a standard Pauli channel
acting on the qubits in $R$. Initial state of the qubits in $U$ is traced
over, while the final state for each qubit in $D$ is a randomly selected
$\left|0\right>$ or $\left|1\right>$ with equal probability. Overall, each GP
channel acting on devices in the index set $J$ is represented by compound data

$\left\\{\left(P(\bar{\imath}\rightarrow\bar{f}),\,p(\sigma_{\bar{\mu}}|\bar{\imath}\rightarrow\bar{f})\right)\right\\}_{\bar{\imath},\bar{f}},$
(15)

where the Pauli operators $\bar{\sigma}_{\mu}$ act only on the qubits in the
set $R$, see Eq. (11).

The simulator takes as input a quantum circuit (a sequential list of
operations of the four types above) and returns corresponding experimental
measurement samples. The simulator is implemented as a Markov chain whose
internal states are specified by the leakage space label vector $\bar{a}$ and
(with $m=m_{\bar{a}}\leq n$ devices in the computational subspace) an
$m$-qubit stabilizer state specified in terms of $m$ Hermitian generators of
the corresponding stabilizer group ${\cal
S}=\langle\hat{G}_{1},\ldots,\hat{G}_{m}\rangle$, an abelian subgroup of the
$m$-qubit Pauli group ${\cal P}_{m}$ which does not include $-\hat{I}$. Notice
that it is the stabilizer group but not the particular generators that
represent the state, thus at any point the set of generators can be changed by
an arbitrary sequence of _row transformations_
$\hat{G}_{i}\to\hat{G}_{i}\hat{G}_{j}$, $j\neq i$.

To collect a single sample, the simulation begins by initializing all $n$
components of the leakage state label $\bar{a}$ to $c$ and the $m=n$ qubits in
the product state $\left|00\ldots 0\right>$, by selecting the stabilizer
generators $\hat{G}_{i}=\sigma_{z}^{(i)}$, $i=1,2,\ldots,m$, where a single-
qubit state $\left|0\right>$ is a $+1$ eigenstate of $\sigma_{z}$.
Subsequently, the simulator iterates over the operations in the circuit, at
each step updating the stabilizer generators and possibly the leakage state
label $\bar{a}$:

  1. 1.

clifford: a Clifford unitary $\hat{U}$ acting on devices in the index set
$J\subset\\{1,2,\ldots,n\\}$.

    1. (i)

if any of the devices in $J$ are outside of the computational state, do
nothing;

    2. (ii)

otherwise, replace each stabilizer generator $\hat{G}_{i}$ with a Pauli
operator $\hat{G}_{i}^{\prime}=\hat{U}\hat{G}_{i}\hat{U}^{\dagger}$.

  2. 2.

measure: an ideal computational-basis measurement of qubit $j$.

    1. (i)

If the device $j$ is leaked, return the leakage label $a[j]$.

    2. (ii)

Otherwise, use row transformations to select a set of generators with (a) only
$\hat{G}_{1}$ supported on the qubit $j$ if it is unentangled, or (b) only
$\hat{G}_{1}$ and $\hat{G}_{2}$ supported on $j$, where
$\hat{G}_{1}[j]=\sigma_{x}$ and $\hat{G}_{2}[j]=\sigma_{z}$.

    3. (iii)

In case (a), if $\hat{G}_{1}[j]\in\\{\sigma_{x},\sigma_{y}\\}$, or in case
(b), select the result $\alpha\in\\{0,1\\}$ randomly with equal probabilities
and replace the 1st generator with
$\hat{G}_{1}^{\prime}=(-1)^{\alpha}\sigma_{z}^{(j)}$; return $\alpha$.

    4. (iv)

Otherwise, in case (a) with $\hat{G}_{1}[j]=\sigma_{z}$, do full row reduction
of the generator matrix to separate the independent generator
$\hat{G}_{1}^{\prime}=\pm\sigma_{z}\equiv(-1)^{\alpha}\sigma_{z}$ supported
only on the qubit $j$, return the sign bit $\alpha$.

  3. 3.

reset: an ideal reset of device $j$ to the state $\left|0\right>$.

    1. (i)

If the device $j$ is leaked, set the label $a[j]=c$ and add an extra generator
$\hat{G}_{m+1}=\sigma_{z}^{(j)}$; increment $m$.

    2. (ii)

Otherwise, do partial row reduction as in step 2(ii) above, and replace the
first generator with $\hat{G}_{1}^{\prime}=+\sigma_{z}^{(j)}$.

  4. 4.

paulichannel: Generalized Pauli (GP) channel acting on devices in the index
set $J$.

    1. (i)

Construct the initial subspace vector $\bar{\imath}=\bar{a}[J]$ and choose the
final subspace vector $\bar{f}$ according to the probability distribution
$P(\bar{\imath}\to\bar{f})$.

    2. (ii)

For this outcome, select the set of devices $U$ transitioning upward from the
computational subspace. For each $j\in U$:  (a) do partial row reduction as in
step 2(ii);  (b) drop the first generator $G_{1}$ (swap it with $G_{m}$ and
decrement $m$);  (c) if the qubit $j$ was entangled with the rest of the
system, replace $G_{2}[j]=\sigma_{z}$ with the identity operator;  (d) with
probability $p=1/2$, flip the sign of $G_{2}$;  (e) set leakage label $a[j]$
according to its value in $\bar{f}$.

    3. (iii)

Select the Pauli error operator $\hat{E}=\bar{\sigma}_{\mu}$ according to the
conditional distribution $p(\bar{\sigma}_{\mu}|\bar{\imath}\to\bar{f})$
supported on the set $R$ of devices remaining in the computational subspace,
and flip the signs of all the generators $G_{i}$ which anticommute with the
error $E$, $G_{i}^{\prime}\equiv EG_{i}E^{\dagger}=\pm G_{i}$.

    4. (iv)

For every device $j\in D$ coming down from leakage,  (a) add a generator
$G_{m+1}=\pm\sigma_{z}^{(j)}$ with a random sign;  (b) set $a[j]:=c$; and  (c)
increment $m$.

Once the last operation in the circuit is reached, a record of all measurement
results is kept for each sample.

The validity of operations described follow from general theory of
entanglement for stabilizer states[97].

####  XIV.2.3 Generalized twirling approximation

Given an arbitrary quantum channel $\mathcal{E}$ with Kraus operators $K_{j}$
acting on devices $J$, the Generalized Pauli Twirling approximation allows us
to define a corresponding GP channel. This mapping corresponds to the
following physical process:

  1. 1.

For a given initial subspace $\mathcal{H}_{\bar{\imath}}$, double the number
of degrees of freedom and prepare a maximally entangled state over the product
$\mathcal{H}_{\bar{\imath}}\otimes\mathcal{H}_{\bar{\imath}}$, a direct
product of EPR pairs. Namely, the devices whose index in $\bar{\imath}$ match
the computational subspace and their matching ancillary pairs should be set as
the $+1$ eigenstates of $\sigma_{x}\otimes\sigma_{x}$ and
$\sigma_{z}\otimes\sigma_{z}$.

  2. 2.

Apply $\mathcal{E}$ to the first subsystem.

  3. 3.

Measure the leakage status of each device in the first subsystem, thereby
determining the final subspace $\bar{f}$. This can be represented by the
single-device projective measurement with elements

$\displaystyle P_{c}$ $\displaystyle=$ $\displaystyle|0\rangle\\!\langle
0|+|1\rangle\\!\langle 1|$ $\displaystyle P_{2}$ $\displaystyle=$
$\displaystyle|2\rangle\\!\langle 2|$ $\displaystyle P_{3}$ $\displaystyle=$
$\displaystyle|3\rangle\\!\langle 3|$

  4. 4.

For the devices that remained in the computational subspace ($R$), measure the
commuting stabilizers $\sigma_{x}\otimes\sigma_{x}$ and
$\sigma_{z}\otimes\sigma_{z}$ acting on them and their entangled pair.
Associate the resulting stabilizer eigenvalue pairs $(1,1)$, $(1,-1)$,
$(-1,1)$, $(-1,-1)$ with the Pauli operators $I$, $\sigma_{x}$, $\sigma_{z}$,
$\sigma_{y}$, respectively. The total error operator $\sigma_{\bar{\mu}}$ over
all devices in $R$ is the tensor product of all single qubit errors.

The conditional probability distribution
$P(\bar{i}\rightarrow\bar{f},\bar{\mu})$ is then defined as the probability of
recording the outcomes $\bar{f},\bar{\mu}$ assuming an initial state
preparation in subspace
$\mathcal{H}_{\bar{\imath}}\otimes\mathcal{H}_{\bar{\imath}}$. Accordingly,
the extracted GP channel will have the exact same statistics under the
physical process represented above.

The probabilities $P(\bar{i}\rightarrow\bar{f},\bar{\mu})$ can be determined
directly from the Kraus operators $K_{j}$. For a given transition
$\bar{\imath}\rightarrow\bar{f}$, Kraus operator $K_{j}$ decomposed as a sum
over tensor products for the devices in $U,R,D$, and $L$.

$\displaystyle P_{\bar{f}}K_{j}P_{\bar{\imath}}=$
$\displaystyle\sum_{\bar{u},\bar{d}}\biggl{(}K_{j}^{\bar{u},\bar{d},\bar{\imath}\rightarrow\bar{f}}\biggr{)}_{R}\otimes|\bar{f}[U]\rangle\\!\langle\bar{u}|_{U}\otimes|\bar{d}\rangle\\!\langle\bar{\imath}[D]|_{D}\otimes|\bar{f}[L]\rangle\\!\langle\bar{\imath}[L]|_{L}$

where $\left|\bar{u}\right>,\left|\bar{d}\right>$ sum over the tensor product
of standard (normalized) basis vectors ($\left|0\right>,\left|1\right>$)
representing an orthonormal basis for the computational subspaces of devices
$U$ and $D$, respectively. The vectors $\left|\bar{f}[U]\right>$,
$\left|\bar{\imath}[D]\right>$, and
$(\left|\bar{\imath}[L]\right>,\left|\bar{f}[L]\right>)$ correspond to the
leakage states of the devices which leaked, returned to the computational
subspace, and remained leaked, respectively. (Note that the last operator in
the tensor product can be used to represent transitions between leaked
states.) The sub-block Kraus operator
$K_{j}^{\bar{u},\bar{d},\bar{f}[U+L],\bar{\imath}[D+L]}$ can correspondingly
be written as

$\displaystyle K_{j}^{\bar{u},\bar{d},\bar{\imath}\rightarrow\bar{f}}=$
$\displaystyle\hskip
12.91663pt\biggl{(}\left<\bar{f}[U]\right|_{U}\otimes\left<\bar{d}\right|_{D}\otimes\left<\bar{f}[L]\right|_{L}\biggr{)}$
$\displaystyle\hskip 120.55518ptK_{j}$ $\displaystyle\hskip
120.55518pt\biggl{(}\left|\bar{u}\right>_{U}\otimes\left|\bar{\imath}[D]\right>_{D}\otimes\left|\bar{\imath}[L]\right>_{L}\biggr{)}$

Given the above decomposition, we can further break up the operators on the
computational devices $R$ by decomposing them as a linear combination of Pauli
operators,

$K_{j}^{\bar{u},\bar{d},\bar{\imath}\rightarrow\bar{f}}=\sum_{\bar{\mu}}c_{\bar{\mu}}^{j,\bar{u},\bar{d},\bar{\imath}\rightarrow\bar{f}}\sigma_{\bar{\mu}},$

where the sum is taken over the Pauli operators $\sigma_{\bar{\mu}}$ acting on
the devices in $R$; these operators are assumed to vanish on the leakage
states $\left|2\right>,\left|3\right>$. Below we will shorten the notations by
dropping the extra fixed indices $\bar{\imath}\rightarrow\bar{f}$. From this
expansion, one may derive the conditional distribution, cf. Eq. (15):

$P(\bar{\imath}\rightarrow\bar{f},\bar{\mu})\equiv
P(\bar{\imath}\rightarrow\bar{f})P(\sigma_{\bar{\mu}}|\bar{\imath}\rightarrow\bar{f},\bar{\mu})=\frac{1}{2^{|U|}}\sum_{\bar{u},\bar{d},j}\left|c_{\bar{\mu}}^{j,\bar{u},\bar{d}}\right|^{2}.$
(16)

The first term denotes the fact that each state $\left|\bar{u}\right>$ exists
in a computational subspace of dimension $2^{|U|}$ . Finally, the sum itself
is the average probability of applying $\sigma_{\bar{u}}$ on the qubits in
$R$. In the case of no leakage transitions ($\bar{\imath}=\bar{f}$) it
corresponds to the typical Pauli Twirling Approximation.

As a simple example, we apply the approximation to an error channel
representing coherent rotation between the $\left|1\right>$ and
$\left|2\right>$ states. The error channel is composed of a single unitary
Kraus operator

$\displaystyle U=$ $\displaystyle|0\rangle\\!\langle
0|+\cos(\theta)\left(|1\rangle\\!\langle 1|+|2\rangle\\!\langle
2|\right)+|3\rangle\\!\langle 3|$
$\displaystyle+\sin(\theta)\left(|1\rangle\\!\langle 2|-|2\rangle\\!\langle
1|\right).$

Using the definitions of the single device projection operators, the non-
vanishing blocks of the Kraus operator are

$\displaystyle P_{c}UP_{c}$ $\displaystyle=$ $\displaystyle|0\rangle\\!\langle
0|+\cos(\theta)|1\rangle\\!\langle 1|$ $\displaystyle=$
$\displaystyle\left(\cos^{2}(\theta/2)\sigma_{I}+\sin^{2}(\theta/2)\sigma_{z}\right)\cdot
1_{U}\cdot 1_{D}\cdot 1_{L}$ $\displaystyle P_{c}UP_{2}$ $\displaystyle=$
$\displaystyle\sin(\theta)\times\left(1_{R}\cdot 1_{U}\cdot|1\rangle\\!\langle
2|_{D}\cdot 1_{L}\right)$ $\displaystyle+0\times\left(1_{R}\cdot
1_{U}\cdot|0\rangle\\!\langle 2|_{D}\cdot 1_{L}\right)$ $\displaystyle
P_{2}UP_{c}$ $\displaystyle=$
$\displaystyle-\sin(\theta)\left(1_{R}\cdot|2\rangle\\!\langle 1|_{U}\cdot
1_{D}\cdot 1_{L}\right)$
$\displaystyle+0\times\left(1_{R}\cdot|2\rangle\\!\langle 0|_{U}\cdot
1_{D}\cdot 1_{L}\right)$ $\displaystyle P_{2}UP_{2}$ $\displaystyle=$
$\displaystyle\cos(\theta)1_{R}\cdot 1_{U}\cdot 1_{D}\cdot|2\rangle\\!\langle
2|_{L}$ $\displaystyle P_{3}UP_{3}$ $\displaystyle=$ $\displaystyle 1_{R}\cdot
1_{U}\cdot 1_{D}\cdot|3\rangle\\!\langle 3|_{L}$

where we have added trivial terms with zero coefficients to emphasize that the
subspace ${\cal H}_{c}$ it two-dimensional. From this decomposition we may
read off the non-vanishing Pauli coefficients :

$\displaystyle c_{I}^{c\rightarrow c}$ $\displaystyle=\cos^{2}(\theta/2)$
$\displaystyle,\qquad c_{Z}^{c\rightarrow c}=\sin^{2}(\theta/2),$
$\displaystyle c_{0}^{u=1,c\rightarrow 2}$ $\displaystyle=\sin(\theta)$
$\displaystyle=-c_{0}^{d=1,2\rightarrow c},$ $\displaystyle
c_{0}^{2\rightarrow 2}$ $\displaystyle=\cos(\theta)$ , $\displaystyle
c_{0}^{3\rightarrow 3}$ $\displaystyle=1.$

The conditional probabilities can now be read off using Eq. (16). Evidently,
for each input state $\imath$, the sum of output probabilities equals one.

$\imath$ | $f$ | $\mu$ | $P(\imath\rightarrow f,\mu)$
---|---|---|---
$c$ | $c$ | $I$ | $\cos^{4}(\theta/2)$
$c$ | $c$ | $Z$ | $\sin^{4}(\theta/2)$
$c$ | $2$ | - | $\sin^{2}(\theta)/2$
$2$ | $c$ | - | $\sin^{2}(\theta)$
2 | 2 | - | $\cos^{2}(\theta)$
3 | 3 | - | 1

As expected, the probability to observe a transition down from state
$\left|2\right>$ is just the modulus square of the transition amplitude,
$\sin^{2}(\theta)=|\left<1\right|U\left|2\right>|^{2}$. The reverse
transition, though, has half this probability because a device in the
computational subspace is (on average) in state $\left|1\right>$ only half the
time. A higher order effect cause by this twirling is the dephasing observed
in the $c\rightarrow c$ transition. This can be interpreted as a measurement
“back-action”: because the device was not observed to leak and only state
$\left|1\right>$ can leak, the channel acts like a weak measurement in the
standard basis.

###  XIV.3 Comparison of Pauli$+$ and quantum simulations

Figure S19: Comparison of simulated logical error probabilities for the
distance-3 West, X and Z basis experiments. Each data point is the average
over $N=2\times 10^{5}$ samples, so that its standard deviation is bounded
from above by $1/\sqrt{4N}\approx 0.11\%$. Figure S20: Comparison of simulated
detection event fractions for the distance-3 West, X-basis experiment. As in
the experimental data, we see a slow increase in detection event fraction as
the number of rounds progresses. This can be attributed to leakage
accumulation in the data qubits. Figure S21: Comparison of simulated spacelike
and timelike edge probabilities for the distance-3 West, X-basis experiment.
From left to right, the scatter plots correspond to "X" spatial edges (between
stabilizers in the initial state basis), "Z" spatial edges (between
stabilizers with undetermined initial value), and timelike edges (between the
stabilizers separated by one error correction round). The $R^{2}$ quantities
reported above correspond to the coefficient of determination between the
"observed" (kraus_sim) and "predicted" (Pauli$+$) edge probabilities.

We tested the validity of the Generalized Twirling Approximation used by the