# A Fault-Tolerant Honeycomb Memory

Craig Gidney<EMAIL_ADDRESS>Google Quantum AI, Santa Barbara,
California 93117, USA  Michael Newman<EMAIL_ADDRESS>Google Quantum AI,
Santa Barbara, California 93117, USA  Austin Fowler  Google Quantum AI, Santa
Barbara, California 93117, USA  Michael Broughton  Google Quantum AI, Santa
Barbara, California 93117, USA

###### Abstract

Recently, Hastings & Haah introduced a quantum memory defined on the honeycomb
lattice [24]. Remarkably, this honeycomb code assembles weight-six parity
checks using only two-local measurements. The sparse connectivity and two-
local measurements are desirable features for certain hardware, while the
weight-six parity checks enable robust performance in the circuit model.

In this work, we quantify the robustness of logical qubits preserved by the
honeycomb code using a correlated minimum-weight perfect-matching decoder.
Using Monte Carlo sampling, we estimate the honeycomb code’s threshold in
different error models, and project how efficiently it can reach the “teraquop
regime” where trillions of quantum logical operations can be executed
reliably. We perform the same estimates for the rotated surface code, and find
a threshold of $0.2\%-0.3\%$ for the honeycomb code compared to a threshold of
$0.5\%-0.7\%$ for the surface code in a controlled-not circuit model. In a
circuit model with native two-body measurements, the honeycomb code achieves a
threshold of $1.5\%<p<2.0\%$, where $p$ is the collective error rate of the
two-body measurement gate - including both measurement and correlated data
depolarization error processes. With such gates at a physical error rate of
$10^{-3}$, we project that the honeycomb code can reach the teraquop regime
with only $600$ physical qubits.

##  1 Introduction

Geometrically local codes have been tremendously successful in designing
fault-tolerant quantum memories. They embed in nearest-neighbor layouts and
can be highly robust. Most famous among these is the surface code [30, 16],
which only requires $4$-body measurements on a square qubit lattice and boasts
one of the highest circuit-level thresholds among all quantum codes -
typically estimated to be between $0.5\%-1.0\%$ depending on the specifics of
the noise model [42].

However, we can make things even more local. When encoding information into a
subsystem of the codespace [33, 2], parity constraints can be collected using
only $3$\- [6, 34] and even $2$-body [2, 43, 3, 5] measurements. This is
achieved by decomposing the parity constraints into non-commuting measurements
of the unprotected degrees of freedom. This added locality can simplify
quantum error-correction circuits by either sparsifying the physical layout or
compactifying the syndrome circuit. While both of these qualities may be
desirable at the hardware-level [8, 7, 9], the locality often comes at
significant cost to the quality of error-correction. Intuitively, by releasing
degrees of freedom to increase locality, we also collect less information
about the errors occurring. This manifests as high-weight parity constraints
that can require a large assembly of local measurements to determine. In the
most extreme case, this can eliminate a threshold altogether [2].

From this perspective, Kitaev’s honeycomb model [31] is one of the most
alluring candidates for building a quantum code. This model supports $6$-body
operators that both commute with, and can be built from, the non-commuting
$2$-local terms of its Hamiltonian. These operators are primed to serve as
low-weight parity constraints for a quantum code requiring only $2$-body
measurements. Unfortunately, as several authors have previously noted, a
subsystem code defined directly from these constraints encodes no protected
logical qubits [43, 37].

Fortunately, recent work by Hastings & Haah has alleviated this issue [24].
Rather than defining a static subsystem code from the honeycomb model, their
construction manifests ‘dynamic’ logical qubits. These qubits are encoded into
pairs of macroscopic anticommuting observables that necessarily change in
time. Paired with fault-tolerant initialization and measurement, this
construction - which Hastings & Haah call the _honeycomb code_ \- serves as an
exciting new candidate for a robust error-corrected quantum memory. A locally
equivalent description of this dynamic memory is summarized in Figure 1. In
that layout, a distance-$d$ honeycomb code can be realized as a $1.5d\times d$
periodic lattice of data qubits for $d$ divisible by four.

Figure 1:  The honeycomb code. The layout is a straightened-out hexagonal
tiling of the torus with faces 3-colored red (Pauli X), green (Pauli Y), and
blue (Pauli Z). Edges are assigned the color of the faces they span between.
There is a data qubit at each vertex and, optionally, a measurement ancilla
qubit at the center of each edge. Each edge represents a 2-body measurement
and each face represents a 6-body parity check (stabilizer). Note that the
parity checks commute with all of the edge operators, and so are preserved
when measuring them. As a static subsystem code, this construction protects no
degrees of freedom. The code progresses in repeating rounds, with each round
made up of three sub-rounds. In each sub-round, all the edge parities of one
type are measured: first red (X), then green (Y), then blue (Z). The 6-body
parity checks are assembled as the product of the six edges that form their
perimeter (measured in consecutive sub-rounds). The logical qubit’s two anti-
commuting observables travel along paths highlighted in black and orange. As
the edges along each observable’s path are measured, those measurement results
are multiplied into the observable to prevent it from anti-commuting with the
next sub-round’s edge measurements. Consequently, the specific observables
along each path change from sub-round to sub-round, cycling with a period of
six sub-rounds (two full rounds). Note that there is a second pair of
nonequivalent anti-commuting logical observables, defined along the same paths
but offset by three sub-rounds, making for a total of two encoded logical
qubits. For simplicity, in our analysis, we only consider preserving one of
these two.

###  1.1 Summary of Results

While it is helpful to focus on thresholds - the _quality_ of physical qubit
required to scale a quantum code - we are increasingly interested in the
precise _quantity_ of physical qubits required to hit target error rates. In
this work, we run numerical simulations to estimate both thresholds and qubit
counts required for finite-sized calculations at scale using the honeycomb
memory (and for comparison, the surface code).

When entanglement is generated using two-qubit unitary gates, we find
honeycomb code thresholds of $0.1\%-0.3\%$, depending on the specifics of the
error model. This typically represents approximately half the threshold of the
surface code, which we run in the same model (see Figure 5).

We emphasize that, while two-local sparsely-connected codes can be desirable
in hardware (e.g. to reduce crosstalk [8]), two-locality often greatly
diminishes the quality of error-correction [2, 43]. By comparison, our results
show that the honeycomb memory remains surprisingly robust, and further,
embeds in a lattice of average degree $12/5$. We study its “teraquop regime” -
informally, the ratio of physical qubits to logical qubits required to
implement trillions of logical operations successfully (see Section 2.1).
Without considering its potential hardware advantages, the honeycomb memory
requires between a $5\times$$-$$10\times$ qubit overhead to reach the teraquop
regime compared to the surface code at $10^{-3}$ error rates. However, this
gap widens in a superconducting-inspired model in which the measurement
channel is the dominant error, as each parity check is assembled as the
product of twelve measurements (compared with two in the surface code).

Figure 2:  Teraquop plots showing the physical qubits per logical qubit
required to reach the teraquop regime (one-in-a-trillion per-logical-operation
error rates) using both standard (uncorrelated) and correlated minimum-weight
perfect-matching. SD6 is a standard circuit error model, SI1000 is a
superconducting-inspired circuit error model, and EM3 is a circuit error-model
with primitive two-body measurements (see Section 2). These values are
extrapolated from the line fits in Figure 6. Highlighted regions correspond to
values that the underlying line fit can be forced to imply while increasing
its sum of squares error by at most one (in the natural basis). Some
discretization effects are visible due to the gaps between achievable code
distances.

The picture changes qualitatively if entanglement is instead generated using
native two-body measurements - a context for which this code is optimized
[24]. Direct two-body measurements have been proposed and demonstrated
experimentally in circuit QED [10, 15, 13, 29, 40, 35, 14, 22, 44, 12, 11, 27,
41, 39, 38], and are expected to be the native operation in Majorana-based
architectures [32, 9, 24]. In this setting, we observe a honeycomb code
threshold between $1.5\%$ and $2.0\%$ \- by comparison, previous work reported
a surface code threshold of $0.237\%$ in the same error model [9] (but using a
less accurate union-find decoder). Because of the proximity to the surface
code’s threshold, the comparative physical qubit savings of a teraquop
honeycomb memory at a $10^{-3}$ error rate is several orders of magnitude.

The reason for this reversal of relative performance is that the two-locality
of the honeycomb code allows us to jointly measure the data qubits directly.
This significantly reduces the number of noisy operations in a syndrome cycle
compared with decomposing the four-body measurements of the surface code, and
gracefully eliminates the need for ancilla qubits. As a result, with two-body
measurements at a physical error rate of $10^{-3}$, we project that a teraquop
honeycomb memory requires only $600$ qubits (see Figure 2). In Section 5, we
remark on even further reductions to the teraquop qubit count of the honeycomb
code that we did not consider.

##  2 Error Models

We consider three noisy gate sets, each with an associated circuit-level error
model controlled by a single error parameter $p$. The syndrome extraction sub-
cycles are summarized diagrammatically in Figure 3.

Figure 3:  Pipelining in honeycomb circuits. Left: 3 rounds (9 sub-rounds) of
the EM3 honeycomb circuit, which does not require pipelining. Vertical flat
red/green/blue rectangles are $XX$/$YY$/$ZZ$ parity measurements. Vertical
black poles represent data qubits. Right: 3 rounds (9 sub-rounds) of the SD6
honeycomb circuit, which is pipelined (meaning operations from different
rounds and sub-rounds occur during the same time step) to reduce depth.
Vertical flat red/green/blue rectangles are CNOT gates targeting the
measurement ancilla at the center of an edge, with the color indicating the
current transformed basis of the data qubit. Vertical black poles are data
qubits. White, yellow, and black boxes are reset operations, measurement
operations, and $C_{ZYX}$ operations (the Clifford operation that rotates -120
degrees around $X+Y+Z$) respectively. A sketchup file containing this 3d model
is attached to the paper as an ancillary file named “3d_order.skp”.

Noisy Gate | Definition
---|---
$\text{AnyClifford}_{2}(p)$ | Any 2-qubit Clifford gate, followed by a 2-qubit depolarizing channel of strength $p$.
$\text{AnyClifford}_{1}(p)$ | Any 1-qubit Clifford gate, followed by a 1-qubit depolarizing channel of strength $p$.
$\text{Init}_{Z}(p)$ | Initialize the qubit as $\ket{0}$, followed by a bitflip channel of strength $p$.
$M_{Z}(p)$ | Precede with a bitflip channel of strength $p$, and measure the qubit in the $Z$-basis.
| Measure a Pauli product $PP$ on a pair of qubits and, with probability $p$,
choose an error
$M_{PP}(p)$ | uniformly from the set $\\{I,X,Y,Z\\}^{\otimes 2}\times\\{\text{flip, no flip}\\}$.
| The flip error component causes the wrong result to be reported.
| The Pauli error components are applied to the target qubits after the
measurement.
$\text{Idle}(p)$ | If the qubit is not used in this time step, apply a 1-qubit depolarizing channel of strength $p$.
$\text{ResonatorIdle}(p)$ | If the qubit is not measured or reset in a time step during which other qubits are
| being measured or reset, apply a 1-qubit depolarizing channel of strength
$p$.

Table 1:  Noise channels and the rules used to apply them. Noisy rules stack with each other - for example, Idle($p$) and ResonatorIdle($p$) can both apply depolarizing channels in the same time step. Note that our direct measurement error model is not phenomenological - correlated errors are applied according to the support of each two-qubit measurement, coinciding with the error model in [9].  Abbreviation | SD6 | SI1000 | EM3
---|---|---|---
Name |  | Standard
---
Depolarizing
| Superconducting
---
Inspired
| Entangling
---
Measurements
Noisy Gateset |  | $\text{CX}(p)$
---
$\text{AnyClifford}_{1}(p)$
$\text{Init}_{Z}(p)$
$M_{Z}(p)$
$\text{Idle}(p)$
| $\text{CZ}(p)$
---
$\text{AnyClifford}_{1}(p/10)$
$\text{Init}_{Z}(2p)$
$M_{Z}(5p)$
$\text{Idle}(p/10)$
$\text{ResonatorIdle}(2p)$
| $\text{M}_{PP}(p)$
---
$\text{AnyClifford}_{1}(p)$
$\text{Init}_{Z}(p)$
$M_{Z}(p)$
$\text{Idle}(p)$
| Measurement
---
Ancillae
Yes | Yes | No
| Honeycomb
---
Cycle Length
6 time steps | 7 time steps ($\approx 1000$ns) | 3 time steps
Table 2:  The three noisy gate sets investigated in this paper. See Table 1
for the exact definitions of the noisy gates. The superconducting-inspired
acronym refers to an expected cycle time of about $1000$ nanoseconds [1]. Note
that we still call SD6 “SD6” when applying it to the surface code, even though
for this model the surface code cycle takes 8 time steps instead of 6.

The standard depolarizing model was chosen to compare to the wider quantum
error-correction literature. The entangling measurements model was chosen to
represent hardware in which the primitive entangling operation is a
measurement, as is expected e.g. in Majoranas [32, 24]. The superconducting-
inspired model was chosen to be representative of how we conceive of error
contributions on Google’s superconducting quantum chip, where measurement and
reset take an order of magnitude longer than other gates [1].

###  2.1 Figures of merit

For each of these error models, we consider three figures of merit - the
threshold, the lambda factor, and the teraquop qubit count - each of which
depend on the code, decoder, and error model. Of these three, the threshold is
the least indicative of overall performance. It is the physical error
parameter $p_{\text{thr}}$ below which, for any target logical error rate,
there is some (potentially very large) number of qubits we can use to hit that
target.

A better metric is the lambda factor, which additionally depends on a physical
error rate $p$. The lambda factor, $\Lambda(p)$, is the (roughly distance-
independent) error suppression obtained by increasing the code distance by
two, namely $\Lambda(p)=p_{L}^{d}(p)/p_{L}^{d+2}(p)$. The lambda factor is
related to the threshold as $\Lambda(p_{\text{thr}})\approx 1$. The lambda
factor in a superconducting quantum repetition code was carefully studied in
[1].

Finally, the most important metric is the so-called teraquop (trillion-
quantum-operations) qubit count. The teraquop qubit count can be extrapolated
from the lambda factor, and takes into account the total number of qubits
required to realize a particular code. In particular, at a physical error rate
$p$, the teraquop qubit count $T(p)$ is the number of physical qubits required
to successfully realize one trillion logical idle gates in expectation (where
the idle gate is treated as $d$ rounds, the fundamental building block of a
topological spacetime circuit). Put another way, this metric sets a target
physical qubit to logical qubit ratio for realizing a $10^{12}$ gate circuit
volume. For example, with $\sim 10^{3}\cdot T(p)$ physical qubits, we could
reliably implement a $\sim 10^{3}$ logical qubit quantum circuit with $\sim
10^{9}$ layers. We choose this particular size simply because we believe that
it is representative of the computational difficulty of solving important
problems such as chemistry simulation [36] and cryptography [21, 28] using a
quantum computer.

##  3 Methods

In order to simulate the honeycomb code, we combine two pieces of software.
The first is Stim, a high performance stabilizer simulator that supports
additional error-correction features [18]. The second is an in-house minimum-
weight perfect-matching decoder that uses correlations to enhance performance
[17].

For each code and error model, we generate a Stim circuit file [19] describing
the stabilizer circuit realizing a memory experiment. The circuit file
contains annotations asserting that certain measurement sets have
deterministic parities in the absence of noise (we call these measurement sets
_detectors_), as well as annotations stating which measurements are combined
to retrieve the final values of logical observables. Error channels are also
annotated into the circuit, with associated probabilities.

Stim is capable of converting a circuit file into a detector error model file
[20], which is easier for decoders to consume. Stim does this by analyzing
each error mechanism in the circuit, determining which detectors the error
violates and which logical observables the error flips. We refer to the
detectors violated by a single error as the error’s _detection event set_ or
as the error’s _symptoms_ , and to the logical observables flipped by an error
as the error’s _frame changes_. To get a “graph-like” error model, Stim uses
automated heuristics to split each error’s symptoms into a combination of
single symptoms and paired symptoms that appear on their own elsewhere in the
model. Stim declares failure if it cannot perform the decomposition step, or
if any annotated detector or logical observable is not actually deterministic
under noiseless execution.

The decoder takes the graph-like detector error model and converts it into a
weighted matching graph with edges and boundary edges corresponding to the
decomposed two- and one-element detection event sets. See Figure 4 for an
example of a honeycomb code matching graph. The decoder optionally notes how
errors with more than two symptoms have been decomposed into multiple graph-
like (edge-like) errors, and derives reweighting rules between the edges
corresponding to the graph-like pieces. These reweighting rules are used for
correlated decoding.

Stim is also capable of sampling the circuit at a high rate, producing
detection events which are passed to the decoder. Having initialized into the
$+1$-eigenspace of an observable, we declare success when the decoder
correctly guesses the logical observable’s measurement outcome based on the
detection event data provided to it.

Figure 4:  The matching graph, computed automatically by Stim, for the
10-round 4x6-data-qubit SD6 honeycomb code circuit initializing and measuring
the vertical observable. Nodes correspond to detectors (potential detection
events) declared in the circuit. Edges correspond to error mechanisms that set
off two detection events. Edges wrapping around due to the periodic boundary
conditions are shown terminating in empty space. Nodes flipped by an error
mechanism that sets off exactly one detection event are indicated by showing
the associated node as a large black box. Due to the periodic spatial
boundaries, these only occur at the time boundaries of the matching graph
that’s missing initialization and terminal measurement detectors. Note that
for an error to wrap around the lattice yielding a logical failure, at least
four edges must be traversed, consistent with the expected effective distance
of 4. Left: The connected component of the matching graph that corrects errors
that commute with the observable we’re preserving. Center: The connected
component of the matching graph that corrects errors that anti-commute with
the observable we’re preserving. Edges highlighted in green correspond to
errors that flip the specific logical observable annotated in the circuit.
Right: The complete matching graph. The graph has degree at most 12, similar
to the surface code. By contrast, the EM3 honeycomb circuits produce matching
graphs with nodes of degree 18 due to additional correlated errors.

##  4 Results and Discussion

Logical error rates are presented in Figure 5 and Figure 6. Note that we
report the logical error rate per distance-$d$-round block, which can depress
the threshold and lambda estimate relative to reporting the logical error rate
per cycle [42]. In the standard circuit model SD6, we observe a threshold
within $0.2\%-0.3\%$ for the honeycomb code, which compares with a surface
code threshold within $0.5\%-0.7\%$. The relative performance of the honeycomb
code is reduced in the SI1000 model, wherein we observe a threshold of
$0.1\%-0.15\%$ compared to a surface code threshold of $0.3\%-0.5\%$. This
lower relative performance may be attributed to the proportionally noisier
measurement channel. Within the honeycomb code, detectors are assembled as
products of twelve individual measurements. When measurements are the dominant
error channel in the circuit, these twelve-measurement detectors carry
significant noise compared to the two-measurement detectors in the surface
code.

The EM3 error model flips the story. There, we observe a threshold of within
$1.5\%-2\%$ for the honeycomb code. Unlike SD6 and SI1000, we elected not to
simulate the surface code in this model, as there are several avenues for
optimization already explored in previous work [9]. In an identical error
model, they report a threshold of $0.237\%$, significantly below the honeycomb
code. Unfortunately, the two numbers are _not_ directly comparable - in [9], a
union-find decoder was used, which can result in lower thresholds. However, as
the union-find decoder is moderately accurate by comparison [26], we do not
expect this difference to change qualitatively.

Figure 5:  Threshold plots showing failure rates per code cell for one of the
observables in the honeycomb code and the surface code under various error
models. For more cases, see Figure 10 in the appendix. By “code cell”, we mean
a spacetime region with a spacelike extent that realizes a code distance of
$d$, and a timelike extent of $d$ rounds. We simulate $3d$ rounds (but report
the error rate per $d$ rounds) to minimize time-boundary effects. Our
honeycomb code description on a torus only realizes distances that are
multiples of four. Highlighted areas correspond to hypotheses whose
likelihoods are within a factor of 1000 of the maximum likelihood estimate.
The large highlighted areas above threshold are due to aggressive termination
of sampling when logical error rates near 50% are detected, resulting in less
samples.

The very high EM3 honeycomb code threshold stems from three factors. First,
two-local codes benefit greatly from a two-body measurement circuit
architecture. Because of their two-locality, we can measure the data qubits
directly without decomposing the effective measurement into a product of noisy
gates. The result is a circuit with significantly less overall noise. Second,
the particular error model we adopted from [9] is somewhat atypical. The
collective failure rate of the two-body measurement includes both the noise it
introduces to data qubits as well as the accuracy of its measurement - a
demanding metric. While this does induce a richer correlated error model, it
introduces less overall noise than two error channels applied independently to
the qubit support and measurement outcome (see Figure 8 in the appendix).
However, we can still infer the excellent performance of the honeycomb code by
comparing it to the surface code - we make such comparisons to avoid
differences in absolute performance that depend on error model details [42].
Third, the honeycomb code is simply an excellent two-local code. While many
other two-local codes involve high-weight parity checks [2, 43], the honeycomb
supports parity checks of weight six. As a result, these checks are less noisy
and the resulting code is more robust.

Figure 6:  Line fit plots projecting logical error rate as a function of code
distance at various error rates. For more cases, see Figure 9 in the appendix.
This plot combines the logical error rates of both observables by assuming an
error occurs if either fails independently, leading to a slight upper bound on
the error. When a noise rate is above threshold (i.e. the logical error rate
increases with code distance), no line fit is shown. The line fits in this
figure are used to generate the lambda plot (Figure 7) and the teraquop plot
(Figure 2).

It is worth noting that both codes appear to achieve the full effective code
distance in both the SD6 and SI1000 models. However, the honeycomb code does
not achieve the full distance in the EM3 model. This is because many of the
two-body measurements fully overlap with the observable, and so the effective
distance of the code is halved due to correlated errors arising from these
direct measurements.

However, the inclusion of ancilla qubits in the EM3 model would create two
deleterious effects. First, it multiplies the total number of qubits at a
particular code distance by $2.5\times$. Consequently, we only require
$1.6\times$ more qubits to achieve a particular effective distance without
ancilla, rather than the $4\times$ overhead required when only counting data
qubits. Second, the inclusion of ancilla qubits generates significant overhead
in syndrome circuit complexity. While increasing the effective distance is
guaranteed to be more efficient in the low-$p$ limit, it appears that entropic
effects contribute more in the $10^{-4}-10^{-2}$ physical error regime. This
can also be inferred from the curve of the logical error rates, as
$p\rightarrow 10^{-4}$ shows the relative contribution of these low-weight
failure mechanisms beginning to dominate the more numerous higher-weight
failure mechanisms. Overall, it appears the trade-off is well worth it.

Figure 7:  Lambda plots showing the average factor by which the per-logical-
operation error rate is suppressed when increasing the code distance by 2
(extrapolated from line fits in Figure 6). Because we increase the honeycomb’s
code distance in jumps of 4, these values are the square roots of the minimum
increase in that case. Highlighted regions correspond to values that the
underlying line fit can be forced to imply while increasing its sum of squares
error by at most one (in the natural basis).

Figure 7 presents the error suppression factor lambda using both correlated
and standard (uncorrelated) decoding. Here, it is clear that the surface code
offers greater error suppression in SD6 and SI1000, and that including
correlations in the decoder boosts this error suppression. This latter point
is important because including correlations does _not_ significantly augment
the threshold - however, it is this below-threshold error suppression that we
are most interested in.

Finally, Figure 2 presents the teraquop regime for each code. This combines
the lambda factor for each code with the total number of qubits required to
realize that error suppression. At distance-$d$ under an independent
depolarizing model, the rotated surface code requires $2d^{2}-1$ data qubits
in total. This compares with either $1.5d^{2}$ qubits without ancillae, or
$3.75d^{2}$ qubit with ancillae in the honeycomb code - although it is worth
noting that, while we protect only one logical qubit, two are encoded.

In line with the threshold and lambda estimates, we observe that the surface
code is significantly more qubit efficient in SD6 and SI1000 at all error
rates. However, we observe that in EM3, at a physical error rate of $10^{-3}$,
we can achieve a teraquop memory using only $600$ qubits.

It is important to note the shape of these curves. In particular, there is a
large savings in teraquop qubit count as the error rate diminishes _near
threshold_. However, far below threshold, these gains taper off. Phrased in
terms of lambda, it is extremely beneficial to operate at an error rate with a
lambda factor of $10$ rather than $2$, but achieving a lambda factor of $50$
rather than $10$ is far less important.

##  5 Conclusions

In this work, we numerically tested the robustness of the honeycomb code and
compared it with the surface code. We found that the honeycomb code is
exceptionally robust among two-local codes in entangling unitary circuit
models, and exceptionally robust among all codes when assuming primitive two-
body measurements. In presenting these results, we introduced the notion of
the teraquop qubit count, which we believe is a good quantification of a
code’s overall finite-size performance. For comparison, we tested the surface
code in two of the three models to provide baseline estimates for its teraquop
regime as well.

Very recently, a planar version of the honeycomb code _with_ boundary was
proposed [23]. Technical differences including modifications to the gate
sequence, new error paths terminating at boundaries, and performance during
logical gates more make this planar variant worthy of additional study. Note
that the honeycomb code’s estimated teraquop qubit count is sensitive to
changes in the boundary conditions. For example, the periodic boundaries
currently allow for two logical qubits to be stored instead of one.111The same
holds true for the rotated toric code [4], although the halved distance of one
of the two logical qubits (due to hook errors) makes this benefit less clear-
cut. However, in this work we did not count the second logical qubit, as we
are unsure how viable using both logical qubits would be in the context of a
complete fault-tolerant computational system.

Also, shortly before completing this work, we realized that rotating/shearing
the periodic layout [4] would use $25\%$ fewer physical qubits to achieve the
same code distance. However, we have not simulated this layout, and this
change may affect the lambda factor of the code. Of course, multiplying the
estimated teraquop qubit count (at a $10^{-3}$ physical error rate) of $600$
by $1/2$ (for the second logical qubit) and $3/4$ (for the rotated/sheared
layout) yields an encouraging number, but because of the preceding caveats, we
do not do so here.

##  6 Author Contributions

Craig Gidney wrote code defining, verifying, simulating, and plotting results
from the various honeycomb code circuits. Michael Newman reviewed the
implementation of the code and the simulation results, generated the surface
code circuits to compare against, and handled most of the paper writing.
Austin Fowler wrote the high performance minimum-weight perfect-matching
decoder used by the simulations and helped check simulation results. Michael
Broughton helped scale the simulations over many machines.

##  7 Acknowledgements

We thank Jimmy Chen for consulting on reasonable parameters to use for the
superconducting-inspired error model. We thank Rui Chao for helping us
understand the details of the EM3 error model, and for helpful discussions on
the gap in performance between the surface code and the honeycomb code in this
model. We thank Cody Jones for conversations on multi-qubit measurement and
for feedback on an earlier draft. We thank Dave Bacon and Ken Brown for
feedback on an earlier draft. We thank Twitter user @croller for suggesting
the name “teraquop regime”. Finally, we thank Hartmut Neven for creating an
environment in which this work was possible.

## References

  * AI [2021] Google Quantum AI.  Exponential suppression of bit or phase errors with cyclic error correction.  _Nature_ , 595(7867):383, 2021.  doi: 10.1038/s41586-021-03588-y.
  * Bacon [2006] Dave Bacon.  Operator quantum error-correcting subsystems for self-correcting quantum memories.  _Physical Review A_ , 73(1):012340, 2006.  doi: 10.1103/PhysRevA.73.012340.
  * Bombín [2010] Héctor Bombín.  Topological subsystem codes.  _Physical review A_ , 81(3):032301, 2010.  doi: 10.1103/PhysRevA.81.032301.
  * Bombín and Martin-Delgado [2007] Héctor Bombín and Miguel A Martin-Delgado.  Optimal resources for topological two-dimensional stabilizer codes: Comparative study.  _Physical Review A_ , 76(1):012305, 2007.  doi: 10.1103/PhysRevA.76.012305.
  * Bombin et al. [2012] Hector Bombin, Guillaume Duclos-Cianci, and David Poulin.  Universal topological phase of two-dimensional stabilizer codes.  _New Journal of Physics_ , 14(7):073048, 2012\.  doi: 10.1088/1367-2630/14/7/073048.
  * Bravyi et al. [2012] Sergey Bravyi, Guillaume Duclos-Cianci, David Poulin, and Martin Suchara.  Subsystem surface codes with three-qubit check operators.  _arXiv preprint arXiv:1207.1443_ , 2012.  URL https://arxiv.org/abs/1207.1443.
  * Chamberland et al. [2020a] Christopher Chamberland, Aleksander Kubica, Theodore J Yoder, and Guanyu Zhu.  Triangular color codes on trivalent graphs with flag qubits.  _New Journal of Physics_ , 22(2):023019, 2020a.  doi: https://doi.org/10.1088/1367-2630/ab68fd.
  * Chamberland et al. [2020b] Christopher Chamberland, Guanyu Zhu, Theodore J Yoder, Jared B Hertzberg, and Andrew W Cross.  Topological and subsystem codes on low-degree graphs with flag qubits.  _Physical Review X_ , 10(1):011022, 2020b.  doi: 10.1103/PhysRevX.10.011022.
  * Chao et al. [2020] Rui Chao, Michael E Beverland, Nicolas Delfosse, and Jeongwan Haah.  Optimization of the surface code design for majorana-based qubits.  _Quantum_ , 4:352, 2020.  doi: 10.22331/q-2020-10-28-352.
  * Chow et al. [2010] JM Chow, L DiCarlo, JM Gambetta, A Nunnenkamp, Lev S Bishop, L Frunzio, MH Devoret, SM Girvin, and RJ Schoelkopf.  Detecting highly entangled states with a joint qubit readout.  _Physical Review A_ , 81(6):062325, 2010.  doi: 10.1103/PhysRevA.81.062325.
  * Ciani and DiVincenzo [2017] Alessandro Ciani and DP DiVincenzo.  Three-qubit direct dispersive parity measurement with tunable coupling qubits.  _Physical Review B_ , 96(21):214511, 2017.  doi: 10.1103/PhysRevB.96.214511.
  * Criger et al. [2016] Ben Criger, Alessandro Ciani, and David P DiVincenzo.  Multi-qubit joint measurements in circuit qed: stochastic master equation analysis.  _EPJ Quantum Technology_ , 3(1):1–21, 2016.  doi: 10.1140/epjqt/s40507-016-0044-6.
  * DiCarlo et al. [2009] L. DiCarlo, J. M. Chow, J. M. Gambetta, Lev S. Bishop, B. R. Johnson, D. I. Schuster, J. Majer, A. Blais, L. Frunzio, S. M. Girvin, and et al.  Demonstration of two-qubit algorithms with a superconducting quantum processor.  _Nature_ , 460(7252):240–244, Jun 2009.  ISSN 1476-4687.  doi: 10.1038/nature08121.
  * DiVincenzo and Solgun [2013] David P DiVincenzo and Firat Solgun.  Multi-qubit parity measurement in circuit quantum electrodynamics.  _New Journal of Physics_ , 15(7):075001, Jul 2013\.  ISSN 1367-2630.  doi: 10.1088/1367-2630/15/7/075001.
  * Filipp et al. [2009] S. Filipp, P. Maurer, P. J. Leek, M. Baur, R. Bianchetti, J. M. Fink, M. Göppl, L. Steffen, J. M. Gambetta, A. Blais, and A. Wallraff.  Two-qubit state tomography using a joint dispersive readout.  _Phys. Rev. Lett._ , 102:200402, May 2009.  doi: 10.1103/PhysRevLett.102.200402.
  * Fowler et al. [2012] A. G. Fowler, M. Mariantoni, J. M. Martinis, and A. N. Cleland.  Surface codes: Towards practical large-scale quantum computation.  _Phys. Rev. A_ , 86:032324, 2012.  doi: 10.1103/PhysRevA.86.032324.  arXiv:1208.0928.
  * Fowler [2013] Austin G Fowler.  Optimal complexity correction of correlated errors in the surface code.  _arXiv preprint arXiv:1310.0863_ , 2013.  URL https://arxiv.org/abs/1310.0863.
  * Gidney [2021a] Craig Gidney.  Stim: a fast stabilizer circuit simulator.  _Quantum_ , 5:497, July 2021a.  ISSN 2521-327X.  doi: 10.22331/q-2021-07-06-497.
  * Gidney [2021b] Craig Gidney.  The stim circuit file format (.stim).  https://github.com/quantumlib/Stim/blob/main/doc/file_format_stim_circuit.md, 2021b.  Accessed: 2021-08-16.
  * Gidney [2021c] Craig Gidney.  The detector error model file format (.dem).  https://github.com/quantumlib/Stim/blob/main/doc/file_format_dem_detector_error_model.md, 2021c.  Accessed: 2021-08-16.
  * Gidney and Ekerå [2021] Craig Gidney and Martin Ekerå.  How to factor 2048 bit rsa integers in 8 hours using 20 million noisy qubits.  _Quantum_ , 5:433, 2021.  doi: 10.22331/q-2021-04-15-433.
  * Govia et al. [2015] Luke CG Govia, Emily J Pritchett, BLT Plourde, Maxim G Vavilov, R McDermott, and Frank K Wilhelm.  Scalable two-and four-qubit parity measurement with a threshold photon counter.  _Physical Review A_ , 92(2):022335, 2015.  doi: 10.1103/PhysRevA.92.022335.
  * Haah and Hastings [2021] Jeongwan Haah and Matthew B Hastings.  Boundaries for the honeycomb code.  _arXiv preprint arXiv:2110.09545_ , 2021.  URL https://arxiv.org/abs/2110.09545.
  * Hastings and Haah [2021] Matthew B Hastings and Jeongwan Haah.  Dynamically generated logical qubits.  _Quantum_ , 5:564, 2021.  doi: 10.22331/q-2021-10-19-564.
  * Higgott [2021] Oscar Higgott.  Pymatching: A fast implementation of the minimum-weight perfect matching decoder.  _arXiv preprint arXiv:2105.13082_ , 2021.  URL https://arxiv.org/abs/2105.13082.
  * Huang et al. [2020] Shilin Huang, Michael Newman, and Kenneth R Brown.  Fault-tolerant weighted union-find decoding on the toric code.  _Physical Review A_ , 102(1):012419, 2020.  doi: 10.1103/PhysRevA.102.012419.
  * Huembeli and Nigg [2017] Patrick Huembeli and Simon E Nigg.  Towards a heralded eigenstate-preserving measurement of multi-qubit parity in circuit qed.  _Physical Review A_ , 96(1):012313, 2017.  doi: 10.1103/PhysRevA.96.012313.
  * Häner et al. [2020] Thomas Häner, Samuel Jaques, Michael Naehrig, Martin Roetteler, and Mathias Soeken.  Improved quantum circuits for elliptic curve discrete logarithms.  In _Post-Quantum Cryptography: 11th International Conference, PQCrypto 2020, Paris, France, April 15–17, 2020, Proceedings_ , volume 12100, page 425. Springer Nature, 2020.  doi: 10.1007/978-3-030-44223-1_23.
  * Kerckhoff et al. [2009] Joseph Kerckhoff, Luc Bouten, Andrew Silberfarb, and Hideo Mabuchi.  Physical model of continuous two-qubit parity measurement in a cavity-qed network.  _Physical Review A_ , 79(2):024305, 2009.  doi: 10.1103/PhysRevA.79.024305.
  * Kitaev [2003] A Yu Kitaev.  Fault-tolerant quantum computation by anyons.  _Annals of Physics_ , 303(1):2–30, 2003.  doi: 10.1016/S0003-4916(02)00018-0.
  * Kitaev [2006] Alexei Kitaev.  Anyons in an exactly solved model and beyond.  _Annals of Physics_ , 321(1):2–111, 2006.  doi: 10.1016/j.aop.2005.10.005.
  * Knapp et al. [2018] Christina Knapp, Michael Beverland, Dmitry I Pikulin, and Torsten Karzig.  Modeling noise and error correction for majorana-based quantum computing.  _Quantum_ , 2:88, 2018.  doi: 10.22331/q-2018-09-03-88.
  * Kribs et al. [2005] David Kribs, Raymond Laflamme, and David Poulin.  Unified and generalized approach to quantum error correction.  _Physical review letters_ , 94(18):180501, 2005\.  doi: 10.1103/PhysRevLett.94.180501.
  * Kubica and Vasmer [2021] Aleksander Kubica and Michael Vasmer.  Single-shot quantum error correction with the three-dimensional subsystem toric code.  _arXiv preprint arXiv:2106.02621_ , 2021.  URL https://arxiv.org/abs/2106.02621.
  * Lalumière et al. [2010] Kevin Lalumière, J. M. Gambetta, and Alexandre Blais.  Tunable joint measurements in the dispersive regime of cavity qed.  _Physical Review A_ , 81(4), Apr 2010.  ISSN 1094-1622.  doi: 10.1103/physreva.81.040301.
  * Lee et al. [2021] Joonho Lee, Dominic W. Berry, Craig Gidney, William J. Huggins, Jarrod R. McClean, Nathan Wiebe, and Ryan Babbush.  Even more efficient quantum computations of chemistry through tensor hypercontraction.  _PRX Quantum_ , 2:030305, Jul 2021.  doi: 10.1103/PRXQuantum.2.030305.
  * Lee et al. [2017] Yi-Chan Lee, Courtney G Brell, and Steven T Flammia.  Topological quantum error correction in the kitaev honeycomb model.  _Journal of Statistical Mechanics: Theory and Experiment_ , 2017(8):083106, 2017.  doi: 10.1088/1742-5468/aa7ee2.
  * Livingston et al. [2021] William P Livingston, Machiel S Blok, Emmanuel Flurin, Justin Dressel, Andrew N Jordan, and Irfan Siddiqi.  Experimental demonstration of continuous quantum error correction.  _arXiv preprint arXiv:2107.11398_ , 2021.  URL https://arxiv.org/abs/2107.11398.
  * Mohseninia et al. [2020] Razieh Mohseninia, Jing Yang, Irfan Siddiqi, Andrew N Jordan, and Justin Dressel.  Always-on quantum error tracking with continuous parity measurements.  _Quantum_ , 4:358, 2020.  doi: 10.22331/q-2020-11-04-358.
  * Ristè et al. [2012] D. Ristè, J. G. van Leeuwen, H.-S. Ku, K. W. Lehnert, and L. DiCarlo.  Initialization by measurement of a superconducting quantum bit circuit.  _Physical Review Letters_ , 109(5), Aug 2012.  ISSN 1079-7114.  doi: 10.1103/physrevlett.109.050507.
  * Royer et al. [2018] Baptiste Royer, Shruti Puri, and Alexandre Blais.  Qubit parity measurement by parametric driving in circuit qed.  _Science advances_ , 4(11):eaau1695, 2018.  doi: 10.1126/sciadv.aau1695.
  * Stephens [2014] Ashley M Stephens.  Fault-tolerant thresholds for quantum error correction with the surface code.  _Physical Review A_ , 89(2):022321, 2014.  doi: 10.1103/PhysRevA.89.022321.
  * Suchara et al. [2011] Martin Suchara, Sergey Bravyi, and Barbara Terhal.  Constructions and noise threshold of topological subsystem codes.  _Journal of Physics A: Mathematical and Theoretical_ , 44(15):155301, 2011.  doi: 10.1088/1751-8113/44/15/155301.
  * Tornberg et al. [2014] Lars Tornberg, Sh Barzanjeh, and David P DiVincenzo.  Stochastic-master-equation analysis of optimized three-qubit nondemolition parity measurements.  _Physical Review A_ , 89(3):032314, 2014.  doi: 10.1103/PhysRevA.89.032314.

##  Appendix A Detection Event Fractions

One measure of the amount of noise in a circuit is the detection event
fraction, namely, the proportion of actual detection events to the total
number of potential detection events. In Figure 8, we plot the detection event
fraction for each combination of error model and code. Notably, the EM3 error
model has a detection fraction significantly lower than the other models in
the honeycomb code. We compared a tweaked EM3 variant that separates the error
due to the projective action of the measurement on the data qubits from the
error on the measurement outcome. The tweaked EM3 model replaces the 32-case
correlated error that occurs with probability $p$ during a parity measurement
with two independent errors: a measurement-result-flipping error which occurs
with probability $p$ and a two qubit depolarizing error with strength $p$
applied to the qubits before the measurement. This tweaked model gives a
detection fraction that appears closer to other error models, and was in fact
used in [6]. This suggests that grouping the measurement and data errors into
a combined error budget may be overoptimistic. In particular, if these errors
occurred independently, they would each have to have probability $\approx p/2$
to match the entropy in the EM3 model (although the EM3 model produces more
correlated errors). With that said, we expect that even in the EM3 model, the
detection event fraction for the surface code remains quite high [9]. Of
course, the various error models are coarse approximations of quantum noise
under different (and sometimes projected) architectures. Consequently, we do
not have the context to set the scale of the parameters used in the EM3 model,
and so we caution against comparing different models directly.

Figure 8:  Detection fraction plots showing the average probability of a
detector producing a detection event during simulated runs for various
circuits, sizes, and noise parameters. Note that there is a slight initial
uptick in detection event fraction, which quickly stabilizes at higher
distances. This is due to nearby initialization and terminal measurement
phases, which tend to be less noisy.

##  Appendix B Converting Disjoint Error Mechanisms into Independent Error
Mechanisms

The parity measurement error mechanism used for the EM3 error model is defined
in terms of disjoint errors. Error models produced by Stim can only use
independent error mechanisms. This mismatch is handled by converting the
disjoint cases into independent cases, using the formula

$p_{\text{ind}}=\frac{1}{2}-\frac{1}{2}\sqrt[2^{n-1}]{1-p_{\text{mix}}}$

where $n$ is the number of basis errors (e.g. we use $n=5$ because our basis
errors are $X_{1}$, $Z_{1}$, $X_{2}$, $Z_{2}$, flip), $p_{\text{mix}}$ is the
probability of choosing to apply one of the component errors in a maximally
mixing channel, and $p_{\text{ind}}$ is the probability of applying each error
independently so that the concatenation of the independent channels produces
the same error distribution as the maximally-mixing channel [9].

##  Appendix C Additional Data

To avoid overloading the reader, figures in the main text of the paper show
representative cases for the data that we collected. For example, some figures
show data from runs protecting one observable but not from runs protecting the
other, and some figures show error rates when using correlated matching but
not when using standard matching. This appendix section includes more
exhaustive figures, showing data on all of the cases we tried.

We have also made the data we collected available in CSV format, attached to
this paper as an ancillary file named honeycomb_memory_stats.csv. Each row in
the CSV file summarizes how many shots were taken and how many errors were
seen for a particular code distance, error model, decoding strategy, etc.

For each case we considered, we took shots until reaching 100 million shots or
1000 errors, or seeing clear evidence of being above threshold (logical error
rate near 50%); whichever came first. Often we took slightly more shots than
needed because runs were batched and distributed over multiple machines. In
total, we spent roughly 10 CPU core years on the simulations.

All of the data and figures in the paper were generated using python code
available online at https://github.com/strilanc/honeycomb_threshold. The
python code is also attached to the paper as ancillary files with paths
beginning with repo/.

Correlated matching was performed with an internal tool that is not part of
the repository. This makes it more difficult to reproduce the data in this
paper that is based on correlated matching, because correlated matching
involves hand-tuned heuristics (although implementing the decoder in [17]
would be a good start). It is more feasible to reproduce the data based on
standard matching since the minimum-weight perfect-matching problem has well-
defined solutions that other decoders should agree on up to degeneracy (e.g.
our code includes functionality for using PyMatching [25] to decode).

Figure 9:  Exhaustive line fit plots projecting logical error rates as code
distance is increased at different error rates for the honeycomb code and the
surface code using various noisy gate sets and either standard or correlated
decoding.

Figure 10:  Exhaustive threshold plots showing error rates per code cell for
both observables of the honeycomb code and the surface code using various
noisy gate sets and either standard or correlated decoding.

##  Appendix D Example Honeycomb Circuit

The following is a Stim circuit file [19] describing a honeycomb memory
experiment with 2$\times$6 data qubits and 335 rounds. The last round is
terminated early, before its second sub-round. The circuit fault-tolerantly
initializes the horizontal observable, preserves it through noise, and then
fault-tolerantly measures it.

The circuit includes coordinate annotations, noise annotations, and
detector/observable annotations. The noise model is the “tweaked EM3" noise
model mentioned in Figure 8 because that noise model produces the simplest
circuit file.

Because copying code from PDF files is not reliable, this circuit is also
attached to the paper as the ancillary file “example_honeycomb_circuit.stim".

⬇

# Annotate locations of qubits.

QUBIT_COORDS(1, 0) 0

QUBIT_COORDS(1, 1) 1

QUBIT_COORDS(1, 2) 2

QUBIT_COORDS(1, 3) 3

QUBIT_COORDS(1, 4) 4

QUBIT_COORDS(1, 5) 5

QUBIT_COORDS(3, 0) 6

QUBIT_COORDS(3, 1) 7

QUBIT_COORDS(3, 2) 8

QUBIT_COORDS(3, 3) 9

QUBIT_COORDS(3, 4) 10

QUBIT_COORDS(3, 5) 11

# Initialize data qubits into |+> state.

R 0 1 2 3 4 5 6 7 8 9 10 11

X_ERROR(0.001) 0 1 2 3 4 5 6 7 8 9 10 11

TICK

H 0 1 2 3 4 5 6 7 8 9 10 11

DEPOLARIZE1(0.001) 0 1 2 3 4 5 6 7 8 9 10 11

TICK

# X sub-round. Compare X parities to X initializations.

DEPOLARIZE2(0.001) 9 3 2 1 4 5 0 6 7 8 11 10

MPP(0.001) X9*X3 X2*X1 X4*X5 X0*X6 X7*X8 X11*X10

OBSERVABLE_INCLUDE(1) rec[-3]

DETECTOR(0, 3, 0) rec[-6]

DETECTOR(1, 1.5, 0) rec[-5]

DETECTOR(1, 4.5, 0) rec[-4]

DETECTOR(2, 0, 0) rec[-3]

DETECTOR(3, 1.5, 0) rec[-2]

DETECTOR(3, 4.5, 0) rec[-1]

SHIFT_COORDS(0, 0, 1)

TICK

# Y sub-round. Get X*Y=Z stabilizers for first time.

DEPOLARIZE2(0.001) 7 1 2 3 0 5 4 10 9 8 11 6

MPP(0.001) Y7*Y1 Y2*Y3 Y0*Y5 Y4*Y10 Y9*Y8 Y11*Y6

OBSERVABLE_INCLUDE(1) rec[-6]

SHIFT_COORDS(0, 0, 1)

TICK

# Z sub-round. Get Y*Z=X stabilizers to compare against initialization.

DEPOLARIZE2(0.001) 11 5 0 1 4 3 2 8 7 6 9 10

MPP(0.001) Z11*Z5 Z0*Z1 Z4*Z3 Z2*Z8 Z7*Z6 Z9*Z10

OBSERVABLE_INCLUDE(1) rec[-5] rec[-2]

DETECTOR(0, 0, 0) rec[-12] rec[-10] rec[-7] rec[-6] rec[-5] rec[-2]

DETECTOR(2, 3, 0) rec[-11] rec[-9] rec[-8] rec[-4] rec[-3] rec[-1]

SHIFT_COORDS(0, 0, 1)

TICK

# X sub-round. Get Z*X=Y stabilizers for the first time.

DEPOLARIZE2(0.001) 9 3 2 1 4 5 0 6 7 8 11 10

MPP(0.001) X9*X3 X2*X1 X4*X5 X0*X6 X7*X8 X11*X10

OBSERVABLE_INCLUDE(1) rec[-3]

SHIFT_COORDS(0, 0, 1)

TICK

# Stable state reached. Can now consistently compare to stabilizers from
previous round.

REPEAT 333 {

# Y sub-round. Get X*Y = Z stabilizers to compare against last time.

DEPOLARIZE2(0.001) 7 1 2 3 0 5 4 10 9 8 11 6

MPP(0.001) Y7*Y1 Y2*Y3 Y0*Y5 Y4*Y10 Y9*Y8 Y11*Y6

OBSERVABLE_INCLUDE(1) rec[-6]

DETECTOR(0, 2, 0) rec[-30] rec[-29] rec[-26] rec[-24] rec[-23] rec[-20]
rec[-12] rec[-11] rec[-8] rec[-6] rec[-5] rec[-2]

DETECTOR(2, 5, 0) rec[-28] rec[-27] rec[-25] rec[-22] rec[-21] rec[-19]
rec[-10] rec[-9] rec[-7] rec[-4] rec[-3] rec[-1]

SHIFT_COORDS(0, 0, 1)

TICK

# Z sub-round. Get Y*Z = X stabilizers to compare against last time.

DEPOLARIZE2(0.001) 11 5 0 1 4 3 2 8 7 6 9 10

MPP(0.001) Z11*Z5 Z0*Z1 Z4*Z3 Z2*Z8 Z7*Z6 Z9*Z10

OBSERVABLE_INCLUDE(1) rec[-5] rec[-2]

DETECTOR(0, 0, 0) rec[-30] rec[-28] rec[-25] rec[-24] rec[-23] rec[-20]
rec[-12] rec[-10] rec[-7] rec[-6] rec[-5] rec[-2]

DETECTOR(2, 3, 0) rec[-29] rec[-27] rec[-26] rec[-22] rec[-21] rec[-19]
rec[-11] rec[-9] rec[-8] rec[-4] rec[-3] rec[-1]

SHIFT_COORDS(0, 0, 1)

TICK

# X sub-round. Get Z*X = Y stabilizers to compare against last time.

DEPOLARIZE2(0.001) 9 3 2 1 4 5 0 6 7 8 11 10

MPP(0.001) X9*X3 X2*X1 X4*X5 X0*X6 X7*X8 X11*X10

OBSERVABLE_INCLUDE(1) rec[-3]

DETECTOR(0, 4, 0) rec[-30] rec[-28] rec[-25] rec[-24] rec[-22] rec[-19]
rec[-12] rec[-10] rec[-7] rec[-6] rec[-4] rec[-1]

DETECTOR(2, 1, 0) rec[-29] rec[-27] rec[-26] rec[-23] rec[-21] rec[-20]
rec[-11] rec[-9] rec[-8] rec[-5] rec[-3] rec[-2]

SHIFT_COORDS(0, 0, 1)

TICK

}

# Transversal measurement.

H 0 1 2 3 4 5 6 7 8 9 10 11

DEPOLARIZE1(0.001) 0 1 2 3 4 5 6 7 8 9 10 11

TICK

X_ERROR(0.001) 0 1 2 3 4 5 6 7 8 9 10 11

M 0 1 2 3 4 5 6 7 8 9 10 11

OBSERVABLE_INCLUDE(1) rec[-11] rec[-5]

# Compare X data measurements to X parity measurements from last sub-round.

DETECTOR(0, 3, 0) rec[-18] rec[-9] rec[-3]

DETECTOR(1, 1.5, 0) rec[-17] rec[-11] rec[-10]

DETECTOR(1, 4.5, 0) rec[-16] rec[-8] rec[-7]

DETECTOR(2, 0, 0) rec[-15] rec[-12] rec[-6]

DETECTOR(3, 1.5, 0) rec[-14] rec[-5] rec[-4]

DETECTOR(3, 4.5, 0) rec[-13] rec[-2] rec[-1]

# Compare X data measurements to previous X stabilizer reconstruction.

DETECTOR(0, 0, 0) rec[-30] rec[-28] rec[-25] rec[-24] rec[-23] rec[-20]
rec[-12] rec[-11] rec[-7] rec[-6] rec[-5] rec[-1]

DETECTOR(2, 3, 0) rec[-29] rec[-27] rec[-26] rec[-22] rec[-21] rec[-19]
rec[-10] rec[-9] rec[-8] rec[-4] rec[-3] rec[-2]