\section{Introduction}

A quantum-computing architecture capable of performing large-scale algorithms will require the careful design of many interconnected components~\cite{Fowler12surface}. In addition to well-controlled quantum hardware that can realise error-correcting codes that can detect common types of error~\cite{Shor96, AharonovBen-Or97}, the system will also depend on supporting classical software. A central component of which is a decoding algorithm. Where quantum error-correcting codes are designed to perform error-detecting check measurements to identify the signatures of an error, a decoder then takes the syndrome data from the check measurements to determine the error that may have occurred. All together, the underlying physical hardware, the choice of quantum error-correcting code, and the performance of the chosen decoding algorithm will determine the practicality of realising a scalable machine that processes quantum information.

The surface code~\cite{Kitaev03, Dennis02} underlies many of the leading approaches to produce fault-tolerant quantum computing hardware. Its high fault-tolerance threshold, together with its low-weight error-detection measurements that are local on two-dimensional array of qubits mean that the code is very practical for experimental realisation~\cite{Fowler12surface}. In this perspective we discuss progress towards realising the surface code, with a focus on the different types of decoding algorithms that have been proposed for its realisation. A variety of proposals have been presented to deliver a practical, high-performance decoder to enable the surface code to tolerate a relatively large rate of local noise. These proposals include adaptations of classical decoding algorithms such as belief propagation~\cite{DuclosCianci10, Panteleev2021degeneratequantum}, as well as new solutions to approximate maximum-likelihood decoding using tensor network methods~\cite{Bravyi14} and sampling using a Metropolis-Hastings algorithm~\cite{Wootton2012, Hutter14}.

Reviewing different methods of decoding is beneficial, not only to reflect on new ways to develop better decoders for the surface code, but they also provide us with a prototype decoder for more general low-density parity-check(LDPC) codes, of which the surface code is an archetypal example. See Ref.~\cite{Breuckmann21} for a recent review of progress on LDPC codes. Developing decoders for general LDPC codes may be invaluable in the future, as architectures based on these codes may be more hardware efficient than the surface code architectures we are currently developing to demonstrate scalable quantum computing. Resource efficiency will become an increasingly important issue as we scale our fault-tolerant quantum computing hardware to solve bigger and bigger problems.

We pay particular attention to the minimum-weight perfect-matching decoder~\cite{Edmonds65, Dennis02}. It is among the most well-studied decoders due to its practical implementation, and its demonstrated ability to tolerate a large rate of errors. Given its performance, it is important to understand the properties of the surface code that enables us to use this decoding strategy, as this can reveal how it may be generalised for use with other quantum error-correcting codes. The minimum-weight perfect-matching algorithm exploits fundamental structure of the surface code, namely, a parity conservation law among the defects of its error syndrome~\cite{Kitaev03, Brown20parallelized}. This conservation law means that, at a high level, error configurations can be identified by pairing syndrome defects. This problem is particularly well suited for matching algorithms~\cite{Dennis02}.

The parity conservation law of the surface code is intimately connected with a materialised symmetry~\cite{Kitaev03}, where the symmetry is expressed through a relationship among the stabilizers of the code. One of the main goals of this perspective is to begin to characterise symmetries more broadly for general stabilizer codes. We approach this in two ways. Firstly we look at generalisations of the minimum-weight perfect-matching decoder, including matching decoders for other codes~\cite{Wang10graphical, Delfosse14, Kubica19, Brown20parallelized, Nixon21, Sahay22}, together with bespoke matching decoders that are specialised to correct for noise models that demonstrate a specific structure or bias~\cite{Tuckett20, Bonilla-Ataides:2021}. Secondly, we propose a systematic method to construct a matching decoder for stabilizer codes with certain properties. We discuss the merits and applicability of the construction, and we try to highlight some questions that remain to be addressed to discover a general matching decoder.

The remainder of this perspective is structured as follows. In Sec.~\ref{Sec:Preliminary} we review the surface code together with the different noise models we often consider towards its development. In Sec.~\ref{Sec:Decoders} we review a number of different approaches that have been pursued to design and implement decoding algorithms for the surface code. We pay particular attention to the minimum-weight perfect-matching decoder. In Sec.~\ref{Sec:Symmetries} we discuss the underlying structure of the surface code, namely its symmetries, that permit the use of minimum-weight perfect-matching decoder, and we suggest ways of generalising this decoder to other types of code. We consider generalisations of the minimum-weight perfect-matching decoder, first, by reviewing minimum-weight perfect-matching decoders that have been developed for other codes and, secondly, we propose a systematic way of constructing a matching decoder for codes with certain generic properties. We discuss the relative merits of this proposal, together with questions that need to be addressed to move towards a general construction for a matching decoder. Sec.~\ref{Sec:Discussion} offers some concluding remarks.

\section{Preliminaries}
\label{Sec:Preliminary}

Let us begin by reviewing the surface code, and discuss how it responds to different types of errors.

\subsection{The surface code}
\label{SubSec:SurfaceCode}

It is convenient to describe the surface code using the stabilizer formalism. A quantum error-correcting code protects a logical subspace, or code space, which is spanned by code states $|\psi\rangle$. Code states lie in the common $+1$ eigenvalue eigenspace of the elements of the stabilizer group $\mathcal{S} \subset \mathcal{P}^{ \otimes n} $; an Abelian subgroup of the Pauli group $\mathcal{P}$ acting on $n$ qubits such that $-1 \not \in \mathcal{S}$, where $\mathcal{P} = \langle i, X,Z \rangle $ is the Pauli group generated by the standard Pauli matrices with eigenvalues $\pm 1 $. The stabilizer formalism also specifies canonically anti-commuting pairs of logical Pauli operators $\overline{X}_j,\,\overline{Z}_j \in \mathcal{L}$. Logical operators perform non-trivial rotations on states in the code subspace. These are operators that commute with the stabilizer group, but are not themselves elements of the stabilizer group.

Quantum error-correcting codes are characterised by the set of parameters $ \llbracket n, k, d \rrbracket $ known as the code length, the code dimension and the code distance, respectively. The code length $n$ is the number of physical qubits used to produce the code, the code dimension $k$ is the number of logical qubits encoded by the code, and the code distance $d$ is the weight of the logical Pauli operator with the least weight, where the weight of an operator is the number of qubits on which it has non-trivial support, i.e., non-identity support.

\begin{figure}
\includegraphics{SurfaceCodeLattice.pdf}
\caption{\label{Fig:SurfaceCode} We define the surface code with a qubit on each of the vertices of a square lattice. The stabilizers of the surface code are defined with respect to the faces of the lattice, which are bicoloured. A Pauli-Z type stabilizer is associated to each of the light faces of the lattice and a Pauli-X type stabilizer is associated to each of the dark lattice faces. Specifically, A Z-type(An X-type) stabilizer is the product of Pauli-Z(Pauli-X) operators on the qubits at each of the corners of the light(dark) lattice faces, see (a) and (b). (c)~A weight-two boundary stabilizer on a Pauli-Z type boundary. (d)~and (e)~show the support of logical Pauli-Z and Pauli-X logical operators, respectively. They are such that the Pauli-X(Pauli-Z)-type logical operator terminates at a Pauli-X(Pauli-Z) boundary. A boundary stabilizer~(f), $b = \prod_{f\in \text{grey}}S_f$, is supported on both of the Pauli-Z boundaries shown at the top and bottom of the figure.}
\end{figure}

The surface code is a Calderbank-Shor Steane(CSS)-type error-correcting code. This means that we can find a generating set of the stabilizer group such that all of its elements are the product of either Pauli-X operators, or the product of Pauli-Z operators. We will focus on a common implementation of the surface code, see Fig.~\ref{Fig:SurfaceCode}, defined on a square lattice with a qubit on each of its vertices where the faces of the lattice are bicoloured. The code has Pauli-Z and Pauli-X type stabilizers, $S_f$, associated to the light and dark lattice faces, $f$, respectively, see Figs.~\ref{Fig:SurfaceCode}(a) and~(b). The code has two types of boundaries that we will call X-type and Z-type boundaries. The two different boundary types are distinguished by the different types of stabilizers they support. Specifically, a Pauli-X(Pauli-Z)-type boundary supports weight-two Pauli-X(Pauli-Z) type stabilizers. The weight-two stabilizers are shown in the figure by rounded faces at the boundary, as shown at the top and bottom (left and right) lattice boundaries in Fig.~\ref{Fig:SurfaceCode}. We show a weight-two stabilizer explicitly in Fig.~\ref{Fig:SurfaceCode}(c).

The surface code we have defined encodes a single logical qubit. We define a pair of canonically anti-commuting Pauli-X and Pauli-Z logical operators, $\overline{X}$ and $\overline{Z}$, that are respectively the product of physical Pauli-X and Pauli-Z operators. Furthermore, they have a string-like support where the strings can terminate at lattice boundaries of appropriate type. For instance, a string of Pauli-X operators can terminate at the Pauli-X boundary, and a string of Pauli-Z operators can terminate at the Pauli-Z type boundary.  We show the support of a Pauli-Z(Pauli-X) type operator by the thick lines shown at Fig.~\ref{Fig:SurfaceCode}(d)(Fig.\ref{Fig:SurfaceCode}~(e)). It will be important later to note that there are many equivalent instantiations of the same logical operator, since a logical operator multiplied by a stabilizer group element will have the same action on the code space.

A quantum error-correcting code is designed to identify and correct for errors such that logical qubits remain well isolated from the physical environment. To determine the error that has occurred, we first measure stabilizer operators, and then use a decoding algorithm to interpret their outcomes and find an appropriate correction. The list of stabilizer measurement outcomes is known as a syndrome. Furthermore, the stabilizer measurements project noise from more general quantum channels onto Pauli errors, as the eigenstates of the stabilizer measurements are of the form $E |\psi \rangle $ where $E$ is a Pauli operator and $|\psi \rangle$ is a code state. This allows us to concentrate our attention on Pauli errors, $E \in \mathcal{P}^{\otimes n}$, if we assume the noise channel has a very small support on the code space.

The CSS structure allows us to subdivide decoding into two classical problems, where the Pauli-X type stabilizers identify Pauli-Z errors, and Pauli-Z type stabilizers identify Pauli-X errors separately~\cite{Dennis02}. Pauli-Y type errors are regarded as a product of a Pauli-X error and Pauli-Z error under this separation. Using a duality between the two types of stabilizer, we will often discuss error correction with the surface code undergoing only Pauli-X type errors, sometimes known as bit-flip errors, but we note that an equivalent discussion will hold for Pauli-Z (dephasing) errors.

\subsection{The threshold theorem and Pauli noise models}

Scalable quantum computation has been demonstrated to be possible in the presence of errors due to the celebrated threshold theorem~\cite{Shor96, AharonovBen-Or97, Aliferis06}. It shows that the logical error rate can be made vanishingly small by increasing the distance of a quantum error-correcting code, provided the rate of error the physical qubits experience is below some threshold amount.

We require an efficient decoding algorithm to successfully recover encoded logical information. Given some prior information about the noise model, a decoder must interpret the syndrome information to find a correction operator $CE |\psi \rangle = |\psi \rangle$. As the code space is defined as the common $+1 $ eigenvalue eigenspace of the stabilizer operators, a $ -1 $ outcome indicates an error has occurred. We say that face $f$ supports a defect if stabilizer $S_f$ gives the $-1$ measurement outcome.

We find a geometric interpretation for the syndrome data of the surface code that we can exploit to design decoding algorithms~\cite{Dennis02}. With the exception of qubits at the Pauli-X boundaries of lattice, all single qubit bit-flip errors create a pair of defects of the lattice on the two adjacent Pauli-Z type stabilizers. This allows us to regard an error as a string, where the defects lie at the end points of the string. If we assume that errors are uncommon, this means the task of correcting errors far from the lattice boundary involves pairing nearby defects~\cite{Dennis02}. A bit-flip error at a Pauli-X type boundary of the lattice creates a single defect. This means single defects near to the boundary can be paired directly to the boundary.

In Fig.~\ref{Fig:ErrorCorrection}(left) we show an error with dark grey Pauli operators together with their corresponding syndrome shown in dark green. A correction, shown in green, is composed of strings that either connect pairs of defects, or connect single defects to the boundary. Both the error, and the correction operator, are underlaid with thick lines to emphasise the geometric structure of error-correction with the surface code. One can check that the error multiplied by the correction is an element of the stabilizer group. Specifically, we have that $CE = S \in \mathcal{S} $ where $S$ is the product of hatched face operators $S_f$. Decoding fails if the correction recovers the code space such that $CE \in \mathcal{L}$, see Ref.~\cite{Dennis02} or Appendix A of Ref.~\cite{Anwar14} for a detailed discussion on error correction with the surface code from the perspective of homology.

\begin{figure}
\includegraphics[scale=0.5]{ErrorAndCorrection.pdf}
\includegraphics[scale=0.5]{MatchingGraph.pdf}
\caption{Error correction with the surface code. (left)~An error is shown by gray Pauli-X operators, and the detection events of its corresponding syndrome are shown by dark green spots associated to the faces of the Pauli-Z type stabilizers. Note that we have associated a detection event to the boundary stabilizer $b = \prod_{f \in \textrm{grey}} S_f$ where we take the product over grey faces only. This is marked by the grey bar that covers the top and bottom boundary. A correction is shown by green Pauli-X operators. The product of the error and the correction is an element of the stabilizer group, i.e., the product of the hatched faces $S_f$. We therefore recover the encoded state successfully for this choice of correction. (right)~Decoding using the minimum-weight perfect-matching algorithm. The algorithm takes as input a graph with weighted edges, and it returns a perfect matching, i.e., a subgraph of the input graph where every vertex has exactly one incident edge. A minimum-weight perfect matching is such that the sum of the edges of the output subgraph is minimal. \label{Fig:ErrorCorrection}}
\end{figure}

\subsection{Error models and unreliable measurements}

\label{SubSec:MeasurementErrors}

We consider a number of different error models to determine the performance of a quantum error-correcting code. First of all, we will consider an independent and identically distributed error model, where each qubit experiences a Pauli error with probability $p$. The simplest of which, that we have already mentioned, is the bit-flip error model, where a qubit experiences a Pauli-X error with probability $p$. We also consider the depolarising noise model where a qubit experiences a randomly chosen Pauli error with probability $p$. In general, an independent and identically distributed Pauli noise model will add a Pauli error $X_q$, $Y_q$ or $Z_q$ to qubit $q$ with probability $p_X$, $p_Y$ and $p_Z$, respectively, such that $p_X + p_Y + p_Z = p$. We say we have a biased noise model if $p_X$, $p_Y$ and $p_Z$ are not equal. For instance, in many physical architectures the noise model is highly biased towards dephasing errors, where $p_Z \gg p_X ,p_Y$. One could regard the bit-flip noise model as an infinitely biased noise model where $p_X = p$, and $p_Y = p_Z =0$.

In addition to the code itself we also require additional apparatus to perform stabilizer measurements, and this apparatus may also experience errors. We show a stabilizer readout circuit in Fig.~\ref{Fig:FaultTolerant}. Errors that occur when we perform measurements can lead to a stabilizer measurement returning an incorrect outcome. This changes the way we approach error correction compared with the way we have discussed in the previous subsection. We must therefore design a procedure to account for measurement errors. Let us briefly discuss stabilizer measurement circuits and how we deal with unreliable measurements~\cite{Dennis02, Wang03}.

To identify a measurement error, we repeat the stabilizer measurement many times, and we report a defect if two consecutive readings of the same stabilizer disagree. Let us call the comparison between two adjacent stabilizer measurements a detection cell. We show two detection cells in Fig.~\ref{Fig:FaultTolerant}(bottom left). As we show, a measurement error creates a pair of defects at two consecutive times. In fact, we can regard the error as a string-like error where the string is aligned parallel with the time-like direction. In the presence of measurement errors, we recover the geometric picture for decoding discussed in the previous section, where events represented in a $2+1$-dimensional syndrome history are paired~\cite{Wang03}.

We should be mindful of other types of errors when we consider the circuits used for stabilizer readout. For instance, it is possible that an error can propagate through the readout circuit to introduce what is known as a hook error~\cite{Dennis02}. Stabilizer readout circuits and decoding algorithms have been designed to deal with the issue of hook errors~\cite{Fowler12surface}. These circuit-level details go beyond the scope of this perspective. We can often obtain compelling results using a simplified noise model that incorporates measurement errors, that we call the phenomenological noise model~\cite{Wang03}. This is where a measurement returns the incorrect value with probability $q = p$, where $p$ is the probability of a Pauli error occurring on a physical qubit per unit time.

\begin{figure}
\begin{center}
\includegraphics{FaultTolerant.pdf}
\end{center}
\caption{Error correction with circuit-level noise. To measure a stabilizer $S_f$, an additional measurement qubit is added to each face $f$ of the surface code, labelled $M$ in the top-left part of the figure. The measurement qubit is initialised and entangled to the qubits at the corners of face $f$, and is subsequently read out to learn the value of a stabilizer operator. The circuit shown in the top right of the figure measures a Pauli-Z type stabilizer. To detect error events in the situation where measurement errors may occur, we measure each stabilizer repeatedly over time and compare consecutive outcomes. The bottom left figure shows a stabilizer measured three times at times $t-1$, $t$ and $t+1$, where each gray rectangle indicates a stabilizer reading is made. We suppose the stabilizer gives a false outcome at time $t$. Comparing the measurement outcomes at times $t-1$ and $t$, and then again at time $t$ and $t+1$ both reveal defects, marked by green cubes. In a $2+1$-dimensional space-time picture this measurement error can be regarded as a string that runs in parallel to the time direction. In general, to decode in the presence of measurement errors our task is to pair defects in a $2+1$-dimensional spacetime, such as that shown in the bottom-right part of the figure. \label{Fig:FaultTolerant}}
\end{figure}

\section{Decoding algorithms}

\label{Sec:Decoders}

Let us describe the decoding problem, and discuss the efficient algorithms that have been devised to correct errors the surface code experiences. We will pay particular attention to the minimum-weight perfect-matching decoder, as this motivates the discussion in the following section.

A decoder is given the syndrome $\sigma(E)$ for incident error $E$, together with prior information about the error model, and will then look for any correction $C$ with $\sigma(C) = \sigma(E)$ such that $CE$ acts trivially on the encoded state, i.e., $CE \in \mathcal{S}$. For an appropriate error model and assuming the rate of error is sufficiently low, the probability that the decoder should successfully find such a correction should rapidly approach unity as the code distance diverges in order for the a code to demonstrate a threshold~\cite{Shor96, AharonovBen-Or97, Dennis02, Aliferis06}.

The errors that act on a quantum error-correcting code can be grouped into equivalence classes. Unlike classical error correction, there are many errors that can be introduced to a quantum error-correcting code that have an equivalent action. This is because errors are equivalent up to multiplication by a stabilizer operator. For instance, error $E \in \mathcal{P}^{\otimes n}$ has an equivalent action on the code as the error $ES$ for any $S \in \mathcal{S}$. Let us write $A \sim B$ if there exists a stabilizer $S \in \mathcal{S}$ such that $A = BS$, i.e., $A$ is in the same equivalence class of errors as $B$. We look for a correction $C$ such that $C\sim E$ since $CE = SE^2 = S \in \mathcal{S}$ assuming $C\sim E$ holds.

Different equivalence classes of errors differ by their action on the code space. Up to multiplication by stabilizers, the action of a correction $C$ changes compared to $E$ if only if it differs from error $E$ by a logical operator, i.e., if $CL = ES$ for some choice of stabilizer $S \in \mathcal{S}$ such that $CE \in \mathcal{L}$. This distinction allows us to define different equivalence classes of errors $ \mathcal{K}_L $ with respect to some candidate choice of correction $C'$ where each equivalence class is labeled by a logical Pauli operator $L \in \mathcal{L}$. We define
\begin{equation}
\mathcal{K}_L = \left\{ E \in \mathcal{K}_L : E \sim C'L  \right\}.
\end{equation}

For some fixed correction $C'$, an optimal choice of decoder, otherwise known as a maximum-likelihood decoder, will consider the possibility of the occurrence of all errors consistent with each choice of correction $C'L \in \mathcal {K}_L$. Specifically, we look to maximise the value of $P_L$ for each logical operator $L$, such that
\begin{equation}
P_L = \sum_{E \in\mathcal{K}_L} \pi(E), \label{Eqn:ML}
\end{equation}
where we assume that we have prior knowledge to evaluate the probability $\pi(E)$ that the error $E$ was drawn from the distribution specified by the error model. We choose the correction $C = C' L$ for the maximal value of $P_L$

Given the exponential size of the calculation required to find the maximal value of $P_L$ as in Eqn.~(\ref{Eqn:ML}), in general it is inefficient to evaluate the values $P_L$ exactly. Indeed, it is important to find an efficient decoder in order to maintain the algorithmic speedup that is offered by a fault-tolerant quantum computer. In what follows we will discuss the different ways we have found to decode the surface code efficiently.

\subsection{The minimum-weight perfect-matching decoder}
\label{SubSec:MWPM}

We obtain an efficient high-performance decoder using the minimum-weight perfect-matching algorithm. Let us describe this decoder here. Our exposition may be unconventional compared to other descriptions of minimum-weight perfect-matching decoding in the literature, to help elucidate the generalisation for matching decoders we propose in the following section.

For reasonable error models such as local error models, the minimum-weight perfect-matching algorithm can obtain an error that occurred with high probability. In certain cases, for instance for the independent and identically distributed bit-flip noise model, it can obtain the maximal value of $\pi(E)$ over all $E$. It is known that this is sufficient for a decoder to demonstrate a threshold \cite{Dennis02}.

 A perfect matching is a subgraph of an input graph, such that every vertex of the output subgraph has exactly one incident edge, see Fig.~\ref{Fig:ErrorCorrection}(right). The minimum-weight perfect-matching algorithm~\cite{Edmonds65} takes as input a graph with weighted edges, and returns a matching of the input graph such that the sum of the weights of the remaining edges of the output matching is minimal. See Ref.~\cite{Higgott21pyMatching} where an implementation of minimum-weight perfect-matching decoding algorithm is described.

We can adapt the minimum-weight perfect-matching algorithm to decode the surface code~\cite{Dennis02} by using the fact that error events introduce defects in pairs. Let us take the bit-flip error model as an example. It will be helpful re-express an error $E$ in terms of individual string-like error events $\alpha$ such that $ E = \prod_\alpha \alpha $ where each $\alpha$ creates exactly two defects for $\sigma(E)$.

For simplicity we assume that we can factorise the probability that error $E$ occurred as follows
\begin{equation}
\pi(E) = \prod_\alpha \pi(\alpha), \label{Eqn:MWPMassumption}
\end{equation}
such that we can evaluate the probability $\pi(\alpha)$ that the error model introduced error event $\alpha$ to the code. This is assumption is justified for well-studied error models such as the bit-flip noise model, as well as phenomenological noise. This being said, a number of numerical analyses have demonstrated a threshold, even though they may not satisfy Eqn.~(\ref{Eqn:MWPMassumption}), see e.g.~\cite{Nickerson19}.

Given Eqn.~(\ref{Eqn:MWPMassumption}) holds, we can use the minimum-weight perfect-matching algorithm to obtain a maximal value for $\pi(E)$. To do so, we assign each defect a vertex of the graph that is input to the matching algorithm, we then produce a complete graph such that each edge connecting vertices $u$ and $v$ is assigned a weight $- \log \pi(\alpha)$, where $\alpha$ is a string-like error that introduced the events corresponding to vertices $u$ and $v$. The resulting minimum-weight perfect matching $M$ gives a solution with edges corresponding to string-like errors $\alpha \in M $ such that $  - \sum_M \log \pi(\alpha)$ is minimal or, equivalently, $\pi(E) = \prod_M \pi(\alpha)$ is maximal.

To obtain a perfect matching, it is important that we perform matching over an even number of defects, such that we obtain an even number of vertices for the input graph. In the case of the surface code with boundaries, it may be that we have an odd number of defects associated to the lattice faces $S_f$. To deal with this, we introduce a boundary stabilizer
\begin{equation}
b = \prod_{f\in\text{grey}} S_f, \label{Eqn:BdryOp}
\end{equation}
where we take the product over all of the Pauli-Z type stabilizer generators $S_f$. The boundary operator is shown in Fig.~\ref{Fig:SurfaceCode}(f). This operator evaluates the parity of defects that have been measured by faces $S_f$. In practice, if we have an odd number of defects then we allow for one defect to be matched to a vertex associated to a Pauli-X boundary~\cite{Dennis02}.

Let us formalise this statement. We have introduced a boundary operator $b$ to the set of Pauli-Z type face operators $S_f$, such that we have a set of stabilizers $\Sigma$ whose product satisfies
\begin{equation}
b \times \prod_{f\in\text{grey}} S_f = \mathds{1} . \label{Eqn:Symmetry}
\end{equation}
It follows that the set of stabilizers $\Sigma $ that contains $b$ together with the grey face operators $S_f$ must detect an even number of defects, such that the product of their eigenvalues gives the outcome $+1$. Any other outcome will be inconsistent with the relationship given in Eqn.~(\ref{Eqn:Symmetry}). The set $\Sigma$ is an example of a materialised symmetry for the surface code~\cite{Kitaev03}.

The set of stabilizers associated to a materialised symmetry must give rise to an even number defects. We call this a defect parity conservation law. As we have argued, a defect conservation law is a necessary condition to obtain a perfect matching for a decoding graph, as there needs to be an even number of vertices in the input graph to the perfect-matching algorithm to obtain a perfect matching.

It is common to use parity conservation laws to generalise the minimum-weight perfect matching algorithm. For instance, the detection cells defined in SubSec.~\ref{SubSec:MeasurementErrors} give rise to a parity conservation law among detection events. This allows us to generalise the minimum-weight perfect matching decoder to the situation where measurements are unreliable~\cite{Wang03}, and even to deal with circuit level noise, see, e.g., Ref.~\cite{Fowler12surface}.

In addition to these works, the minimum-weight perfect matching decoder has been generalised to decode hyperbolic surface codes~\cite{Breuckmann_2017}, color codes, see~\cite{Wang10graphical, Delfosse14, Kubica19,Chamberland_2020, Beverland2021, Sahay22}, classical fractal codes~\cite{Nixon21} and more generally for fracton topological codes~\cite{Brown20parallelized}. It was proposed in Ref.~\cite{Brown20parallelized} that materialised symmetries may present a path to generalise the minimum-weight perfect-matching decoder for an arbitrary choice of topological stabilizer codes. In the next section we will discuss these results further to propose a construction for a minimum-weight perfect matching decoder for other codes.

\subsection{Fast decoding: clustering and the union-find decoder}

The minimum-weight perfect-matching algorithm gives rise to high-threshold error rates but, in practice, its polynomial time overhead may introduce a time latency that will lead to a bottleneck for high-speed quantum-computing architectures. As such, algorithms that are more efficient and simple have been proposed to overcome this problem.  A seminal result among these efforts is the union-find decoder~\cite{Delfosse2021}. The union-find decoder systematically groups defects into correctable clusters~\cite{Bravyi13a, Anwar14, Hutter15}. In the case of the surface code, correctable clusters include an even number of defects. More generally, a correctable cluster should respect all of the materialised symmetries of an error-correcting code.

The union-find decoder runs in almost linear time in the code length due to the data structures used to identify clusters. Moreover, it demonstrates high thresholds that are comparable with those of the minimum-weight perfect-matching decoder~\cite{Delfosse2021}. It has also been demonstrated that the decoder can correct all Pauli errors of weight up to $d/2$~\cite{Delfosse2021}. The decoder has been generalised to the fault-tolerant case to account for varying probabilities of different types of error using a weighted union-find algorithm~\cite{Shilin2020}.

\subsection{Approximating maximum-likelihood decoding}

Let us also discuss maximum-likelihood decoders. For some situations, efficient maximum-likelihood decoders are known for error correction with the surface code. Furthermore, we have also developed methods for obtaining the threshold obtained by a maximum-likelihood decoder, even for cases where no efficient maximum-likelihood decoder is known.

As discussed in the introduction to this section, a maximum-likelihood decoder must evaluate the probability of an exponentially large number of errors that are consistent with a given syndrome. However, we can obtain a good approximation for the performance of a maximum-likelihood decoder by sampling the most probable errors from a given equivalence class of errors. In Ref.~\cite{Dennis02} it was proposed that we can map maximum-likelihood decoding onto sampling from the partition function of a disordered classical statistical-mechanical model. Under this mapping, frustrated terms of a classical Hamiltonian correspond to a typical error configuration drawn from a given error model, and different spin configurations correspond to errors that are equivalent up to stabilizer operators. The Hamiltonian is sampled at the Nishimori temperature, e.g. $ \beta \sim -  \log p / (1-p) $ where bit-flip errors occur at rate $p$. See ~\cite{Chubb18} for a general formulation of the statistical mechanical mapping. Refs.~\cite{Wootton2012, Hutter14} propose sampling common errors with a Metropolis algorithm to approximate maximum-likelihood decoding in a practical way.

Although the general problem of maximum-likelihood decoding is inefficient in general, some success has been made in obtaining efficient maximum-likelihood decoders. In Ref.~\cite{Bravyi14} two decoders are proposed; the first, an optimal decoder for the surface code undergoing bit-flip errors, and the second, a decoder suitable for more general error models that approximates maximum-likelihood decoding using an efficient tensor network contraction techniques. While these decoders have been very important for benchmarking various codes, the nature of tensor network contraction algorithms means that it is difficult to generalise these decoders for higher-dimensional codes, or even the surface code undergoing measurement errors where we will typically consider decoding a $2+1$-dimensional syndrome. In future work it may be valuable to discover generalisations of these decoders for noise models that reflect all of the error processes that occur in the laboratory.

\subsection{Belief propagation}

Let us finally discuss decoding quantum codes using belief propagation; a standard approach for decoding classical codes~\cite{Gallager1962}. In such decoders, prior information about the error model is updated by passing messages in the form of probability distributions, that correspond to the local error model, between adjacent code variables and nodes of the syndrome. Nevertheless, the generalisation of belief-propagation decoders to quantum codes is non-trivial. This is due to the fact that quantum codes have many degenerate errors, i.e. equivalent errors that give rise to a common syndrome. This can lead message-passing algorithms to produce bad results, as they typically will fail to converge on a fixed error that is consistent with the syndrome of the code~\cite{Poulin08}.

A number of proposals have been presented to overcome the problem of degenerate error configurations using belief-propagation decoders for quantum codes. A recent proposal~\cite{Panteleev2021degeneratequantum} that has received considerable attention combines belief propagation with ordered-statistics decoding. This decoder has produced good thresholds for the surface code, see Ref.~\cite{Roffe2020decoding}. Furthermore, the decoder serves as a versatile decoder that can compare the performance of LDPC codes more generally~\cite{Panteleev2021degeneratequantum}.

The renormalisation-group decoder is another approach to generalise belief-propagation decoding for quantum codes~\cite{DuclosCianci10}. This decoder uses message passing to coarse grain prior information about the error model to determine the error that has been introduced to a topological code. The use of coarse graining, or `renormalisation', means the decoder can be parallelised to run very quickly, with only a logarithmic time overhead in the code length. A renormalisation-group decoder has also been used to decode a phenomenological noise model in Ref.~\cite{DuclosCianci14}.

\section{Conservation laws and quantum error correction}
\label{Sec:Symmetries}

Numerous insights have been obtained about the surface code by regarding it as a phase of matter~\cite{Kitaev03}. It is helpful to keep in mind the Hamiltonian $H = - \Delta  \sum_f S_f$, with the face operators of the surface code $S_f$ defined in SubSec.~\ref{SubSec:SurfaceCode}, such that the ground space of $H$ is the code space of the surface code. In this picture, eigenstates of the surface-code stabilizers $E |\psi \rangle $ are excited states of $H$, where we can regard violated stabilizer generators, with $S_f E |\psi \rangle= (-1) E |\psi \rangle$, as supporting quasiparticle excitations with a well defined position, $f$, and mass $ 2 \Delta $. In the surface code, these excitations are anyonic in nature~\cite{Kitaev03}. Moreover, they respect conservation laws whereby, in the bulk of the lattice, excitations can only be created in pairs. This is the same conservation law that we exploit to use minimum-weight perfect matching to decode the surface code. Here we discuss how a general construction for the minimum-weight perfect-matching decoder can be found by exploring conservation laws for other codes.

A parity conservation law corresponds to a materialised symmetry~\cite{Kitaev03} among its stabilizer group. Let us propose an definition for a materialised symmetry. We say a materialised symmetry $\Sigma$ is a set of stabilizers $S \in \mathcal{S}$ that satisfies
\begin{equation}
\prod_\Sigma S = \mathds{1}. \label{Eqn:MatSymmetry}
\end{equation}

Eqn.~(\ref{Eqn:MatSymmetry}) implies a conservation law. Given a state $|\phi \rangle$ we have that $(\prod_\Sigma S)  |\phi \rangle = (+1)  |\phi \rangle$. It follows that the eigenvalues $s = \pm 1$ for all $ S \in \Sigma$ must multiply together to give $+1$; the eigenvalues of the identity matrix, $\mathds{1}$, as shown on the right-hand side of Eqn.~(\ref{Eqn:MatSymmetry}). We see then that Eqn.~(\ref{Eqn:MatSymmetry}) gives rise to a conservation law, because the stabilizers on the left-hand side must give rise to an even number of defects, i.e., stabilizers in the $-1$ eigenvalue, in order for Eqn.~(\ref{Eqn:MatSymmetry}) to hold. We can therefore exploit symmetries to design a decoder that uses minimum-weight perfect matching.

A natural question to ask is how we might choose a materialised symmetry that is suitable to produce a high-performance decoder for a general choice of stabilizer code. There are a number of subtleties in the definition of a materialised symmetry proposed above, and the definition alone is not enough to produce a decoder in general. Certainly, one can find trivial examples of symmetries $\Sigma$ that will not give rise to practical decoders. In the remainder of this perspective we will discuss some observations that may be helpful to consider if we are to reach a general construction for a matching decoder. We will review different examples of decoders that make use of materialised symmetries, and we will conclude by proposing a construction that systematically reproduces the matching decoder for codes with certain properties. We discuss how these properties enable us to use the construction, and we present some questions we may need to address to find a systematic way of constructing a general minimum-weight perfect-matching decoder.

\subsection{Examples of matching decoders for other stabilizer codes}

Let us discuss some examples where minimum-weight perfect-matching decoders have been proposed and implemented for other examples of stabilizer codes, in addition to the surface-code decoder discussed in detail in SubSec.~\ref{SubSec:MWPM}.

Several variations of minimum-weight perfect-matching decoders have been proposed for the color code~\cite{Bombin06}, see~\cite{Wang10graphical, Delfosse14, Kubica19, Chamberland_2020, Beverland2021, Sahay22} for examples of color-code minimum-weight perfect-matching decoders. The color code is a stabilizer code that is local in two dimensions. It gives rise to point-like defects on the faces of an appropriate lattice, where each defect has an associated colour according to the location of the face operator they occupy. In all of the examples of matching decoders, subsets of defects are matched depending on their colour. Fundamentally, the subsets of detection events that are matched correspond to some conservation law. See Ref.~\cite{Sahay22} where color-code decoding is discussed in the context of conservation laws and materialised symmetries explicitly.

In addition to two-dimensional stabilizer codes that correspond to topologically ordered phases of matter, it is also interesting to explore more general codes. In Ref.~\cite{Brown20parallelized}, a minimum-weight perfect-matching decoder was proposed and implemented for a fracton topological code called the X-cube model~\cite{Vijay16}. This is a three-dimensional model that is of interest at the level of condensed-matter physics as its quasiparticle excitations have constrained dynamics~\cite{Chamon05}. Specifically, quasiparticle excitations of the Hamiltonian of the X-cube model can only move in certain directions without increasing the energy of the system. These constrained dynamics have corresponding materialised symmetries that impose a parity conservation law for quasiparticle excitations among two-dimensional planes of the three-dimensional code.

We can regard the X-cube model as a stabilizer code by taking the commuting terms of its Hamiltonian as the generating elements of a stabilizer group describing a quantum error-correcting code. We can then use the symmetries of the X-cube model to design a matching decoder. In Ref.~\cite{Brown20parallelized}, a matching decoder is proposed that performs matching subroutines that respect the conservation laws of the two-dimensional materialised symmetries of the X-cube model. The decoder then takes the outputs from the different matching subroutines and combines them to obtain a correction. The results show that, by taking advantage of the additional structure that was imposed by the materialised symmetries of the X-cube model, the decoder gives rise to high threshold error rates.

\begin{figure}
\begin{center}
\includegraphics{Fibonacci.pdf}
\end{center}
\caption{\label{Fig:Fibonacci} The Fibonacci code is a classical code with geometrically local and translationally invariant weight-four stabilizers on a two-dimensional array of bits. Stabilizer generators are represented by green triangles. The local stabilizers of its symmetries can also be arranged as a fractal. We can exploit matching together with these symmetries to identify errors in individual bits. In Ref.~\cite{Nixon21} this observation was used to propose an iterative decoder that could can very high-weight errors.}
\end{figure}

It will be interesting to discover matching decoders for more general stabilizer codes, such as other types of fracton topological codes~\cite{Vijay16}. For instance, Ref.~\cite{Haah11} proposes a so-called `type-II' fracton topological code, that has a distance that scales qualitatively better than the X-cube model, where logical operators are supported on a subset of qubits with a fractal structure. Ideally, we will find an efficient decoder that will correct $\sim d / 2$ errors, such that at low error rates, the logical error rate is minimal for local noise models. High-distance codes such as a type-II fracton code, we should expect a very low logical failure rate. However, no such decoder has been implemented for a type-II fracton code.

In work towards a decoder for a type-II fracton topological code, Ref.~\cite{Nixon21} demonstrates a matching decoder for a two-dimensional classical fractal code. The decoder takes advantage of the fractal structure of the materialised symmetries of the classical code, see Fig.~\ref{Fig:Fibonacci}. In Ref.~\cite{Nixon21} a matching decoder was proposed an implemented that iteratively corrects individual bit-flip errors. Numerical results show that the logical failure rate of the iterative decoder decays rapidly in system size, to show that the decoder can take advantage of the high distance of the classical code. Given their similarities, these results demonstrate positive progress towards a high-performance decoder for a type-II fracton topological code.

\subsection{System symmetries}

The notion of a materialised symmetry is generalised to a system symmetry in Ref.~\cite{Tuckett20}. In this generalisation, we look for the symmetries of a code $\mathcal{S}$ that gives rise to an event conservation law with respect to a specific error model $\mathcal{E} \subseteq \mathcal{P}^{\otimes n}$. The term system symmetry reflects that the materialised symmetries are described by the total system, that consists of both the stabilizer code $\mathcal{S}$ and the Pauli error model $\mathcal{E}$. This concept has proven valuable for finding quantum error-correcting codes that are specialised to correct for highly-biased noise models~\cite{Tuckett20, Bonilla-Ataides:2021, Srivastava2022xyzhexagonal, Dua2022, Xu22, SanMiguel22}.

\begin{figure}
\includegraphics{XZZX.pdf}
\caption{The XZZX surface code is defined with a qubit on each vertex of a square lattice. Each face of the lattice has a single stabilizer, the product of Pauli operators $XZZX$. We show a stabilizer to the top left of the figure. The code has one-dimensional symmetries with respect to an error model that is biased to introduce dephasing errors only. Indeed, the product of the hatched stabilizers commutes with all Pauli-Z errors. This gives rise to string-like errors that are constrained to align along horizontal lines under this noise bias. We show one such error to the top right of the figure. This structure is advantageous to the design of high-threshold decoding algorithms for highly-biased noise models. \label{Fig:XZZX}}
\end{figure}

A system symmetry $\Sigma$ is a set of stabilizer generators such that
\begin{equation}
\left( \prod_\Sigma S \right) E |\psi\rangle = (+1)E|\psi \rangle, \quad \forall E \in \mathcal{E}. \label{Eqn:SystemSymmetry}
\end{equation}
A system symmetry implies that we can decode using minimum-weight perfect matching by pairing events on a smaller subset of stabilizer generators. This due to the fact that we may obtain different defect parity conservation laws if we concentrate on specific error models $\mathcal{E} \subset\mathcal{P}^{\otimes n}$. This can qualitatively change the way we design decoders. We note that the definition for a materialised symmetry $\Sigma$ given earlier, see Eqn.~(\ref{Eqn:MatSymmetry}), will trivially satisfy the relationship for a system symmetry, Eqn.~(\ref{Eqn:SystemSymmetry}), for any error model. In this sense, a system symmetry represents a generalisation of the definition for a materialised symmetry proposed earlier.

Let us take the XZZX code as an example~\cite{Bonilla-Ataides:2021}. The code has a single stabilizer operator for each face of a square lattice, see Fig~\ref{Fig:XZZX}. The XZZX code is specalised to correct for dephasing noise where the error model $ \mathcal{E}^Z $ is generated by single-qubit Pauli-Z operators. The XZZX is locally equivalent to the standard surface code via single-qubit rotations. However, unlike the surface code, under an infinitely biased-noise model, $\mathcal{E}^Z$, the XZZX code demonstrates one-dimensional system symmetries. We show the stabilizer generators that multiply to give one such symmetry by the hatched faces in the figure. Given that the product of these terms commutes with Pauli-Z errors, these symmetries satisfy Eqn.~(\ref{Eqn:SystemSymmetry}).

The consequences of the one-dimensional symmetry mean that all string-like errors from the Pauli-Z model are constrained to have a common orientation. We show one such string error with a horizontal orientation to the top right of Fig.~\ref{Fig:XZZX}. This structure means that we can decode the errors on one-dimensional lines separately~\cite{Bonilla-Ataides:2021}, as though each row is a disjoint repetition code. We therefore obtain an exceptionally high threshold in the infinitely biased limit~\cite{Bonilla-Ataides:2021}. Further to this, the XZZX code can be generalised to correct for general, finitely biased Pauli noise. A decoder for this code is obtained readily using the fact that the XZZX code is locally equivalent to the surface code, such that we can adapt the standard decoding algorithms for this purpose~\cite{Bonilla-Ataides:2021}. The XZZX code has also demonstrates very high thresholds under circuit level noise~\cite{Darmawan21}.

\begin{figure}[b]
\includegraphics{BallisticSymmetry.pdf}
\caption{\label{Fig:Ballistic} The ballistic noise model acting on the surface code with Pauli-X(Pauli-Z) stabilizers on the green(grey) faces. The noise model introduces strings of bit-flip errors to the surface code of a fixed length $\xi$ that are oriented either vertically or horizontally. The figure shows errors of fixed length $\xi = 2$. The product of the hatched face operators respect a detection event parity conservation law, where the stabilizer operators are separated by a regular distance. We therefore obtain a system symmetry for the surface code with respect to the ballistic noise model, by taking the set of hatched faces, and translations thereof.}
\end{figure}

In practice, error models that occur in nature may typically introduce correlated errors. One might consider finding system symmetries with other error models where perhaps the Pauli error model $\mathcal{E}$ introduces correlated errors that respect a certain structure. For instance, in Ref.~\cite{Nickerson19} a correlated noise model acting on the surface code called the ballistic noise model is considered, see Fig.~\ref{Fig:Ballistic}. The noise model introduces strings of bit-flip errors where the strings are constrained along a certain orientations and have a fixed length. The rigid structure of the error model is such that decoding for the ballistic noise model can be decomposed into matching on subsets of the stabilizers of the surface code with a regular separation. The stabilizer generators $S_f$ of one such symmetry are marked by hatched faces in Fig.~\ref{Fig:Ballistic}. It may be interesting to find other correlated noise models that respect system symmetries of the code, particularly if those correlated errors frequently occur due to real physical processes. Ideally, we might try to seek an optimal choice of code $\mathcal{S}$ such that a natural error model $\mathcal{E}$ gives rise to many system symmetries that can be exploited for a high-performance decoding. We expect that the general optimisation problem may be difficult to solve.

\subsection{Towards a generalised matching decoder}

Having mentioned a number of examples where minimum-weight perfect-matching decoders have been obtained using symmetries of the stabilizer group, a natural question to ask is how we might choose a suitable symmetry for decoding with more general stabilizer codes. Let us finally discuss what such a generalisation might look like. We propose a construction that gives rise to a matching decoder for codes with certain properties. We present the construction by giving a systematic way of reproducing the surface-code decoder that we discussed in detail in SubSec.~\ref{SubSec:MWPM}. We point to the generic properties of which we make use to reproduce the decoder using our construction, and we discuss some questions that we should address to find a general construction for a decoding algorithm that makes use of minimum-weight perfect matching.

We require a systematic way of finding a non-independent set of stabilizer generators to form a symmetry $\Sigma$ that will be suitable for identifying high-weight errors with a matching decoder. Here we propose using the notion of cleaning~\cite{Bravyi_2009} to obtain one such set of stabilizers. The act of cleaning means to change the support of a logical operator by multiplication by stabilizer operators. We posit that the boundary operator $b$, shown in Fig.~\ref{Fig:SurfaceCode}(f), is an operator that cleans the logical operator a long way over the two-dimensional qubit array, from one boundary to another. More specifically, $b$ cleans one instantiation of the logical operator $\overline{Z}$, that is supported on the top boundary of the lattice, onto another, $\overline{Z'}$, supported at the bottom boundary. The two instantiations of logical operators are such that $\overline{Z}\cdot \overline{Z'} = b \in  \mathcal{S}$.

Let us now look at how we use the boundary operator to find a correction using a perfect-matching algorithm. To produce a correction operator $C$ that corrects the code successfully with high probability, it is sufficient to find the commutator of the error $E$ on a canonical set of logical operators, say $\overline{X}_j$ and $\overline{Z}_j$. Given this information, and an arbitrary choice of correction $C'$ then that recovers any state in the code space, we can always multiply $C'$ by a logical operator $L$ such that $C = C'L$ where $C$ has the same commutator with the logical operator as $E$. It will follow that $CE$ commutes with all logical operators, therefore showing that $CE\in \mathcal{S}$, by definition. In the following discussion we note that we can determine the commutator of $E$ with each logical operator individually using matching. We therefore consider only a single logical operator, say $\overline{Z}$, and assume that we can repeat this process for all logical operators to determine a correction to recover the encoded state.

We use the stabilizer elements of $\Sigma$ to attempt to determine the commutator of $E$ with $\overline{Z}$. By definition we obtain a symmetry by taking $b$ together with the local stabilizer generators used to generate $b$. The value of $b$ determines the commutator of the error $E$ on two instances of the logical operator, $\overline{Z} \cdot \overline{Z'} $. It is our goal to use the the values of the stabilizers of the symmetry $\Sigma$ to distinguish the support of the error on $\overline{Z} $ rather than $\overline{Z'}$.

Let us now point to why we have cleaned $\overline{Z'} $ far from $\overline{Z}$. Local errors supported on $\overline{Z}$ demonstrate a very different syndrome compared with that of local errors supported on $\overline{Z'} $. In addition to changing the parity of $b$, local errors supported on $\overline{Z}$ also create a defects on a faces that is close to the top boundary in order to maintain the defect parity conservation law using local stabilizer generators. In contrast, local errors supported on $\overline{Z'}$, that also change the value of $b$, will also create defects that are close to the bottom boundary.

The minimum-weight perfect-matching algorithm exploits the difference in the syndrome for local errors supported on $\overline{Z} $ and $\overline{Z'}$ to determine the commutator of $E$ with $\overline{Z} $. Specifically, each defect for stabilizers in $\Sigma$, including $b$, is assigned a vertex for the graph that is input to the perfect-matching algorithm, and edges connecting the input vertices are assigned low weights if it is highly probable that the noise model caused some error event that created the given pair of defects, and a higher weight otherwise.

We use the solution of the minimum-weight perfect matching to determine how many errors are supported on $\overline{Z}$ rather than $\overline{Z'}$. Specifically, the parity of the number of defects paired via the top boundary tells us precisely the support of local errors on $\overline{Z}$, whereby an even number of edges paired via the top boundary indicates that $E$ commutes with $\overline{Z}$, and an odd number of edges paired via the top boundary indicates that $E$ anti commutes with $\overline{Z}$. The decoder will fail if defects are mistakenly paired onto $\overline{Z'}$ that should be paired onto $\overline{Z}$, or vice versa. However, given that $b$ cleans $\overline{Z}$ a long distance over the lattice onto $\overline{Z}'$, it should be easy to determine which defects should be paired to $\overline{Z}$ for typical errors that occur at low-error rates, because only high-weight errors that find adversarial configurations will lead to a failure~\cite{Dennis02}.

This example demonstrates a way for how we might generalise a minimum-weight perfect-matching decoder to other codes. Let us first summarise our construction assuming an arbitrary choice of code with certain properties that we state shortly. We have proposed beginning with some instance of a logical operator, $\overline{Z}$, and then used local stabilizer generators to clean $\overline{Z}$ onto another instantiation of the logical operator $\overline{Z'}$ supported onto a distant set of qubits with operator $b \in \mathcal{S}$ . We then use the defects for local stabilizer generators $S \in \Sigma \backslash b $ for symmetry $\Sigma$ such that
\begin{equation}
b = \prod_{\Sigma \backslash b } S,
\end{equation}
to attempt to distinguish the support of error $E$ on logical operator $\overline{Z}$ rather than $\overline{Z'}$. We make this determination using a sensible strategy for matching defects onto either the support of $\overline{Z}$ rather than $\overline{Z'}$ that should be well separated for $b$.

Two key properties of the surface code that we have used to propose this construction are: (I)~that $\overline{Z}$ are well separated over the qubit array $\overline{Z'}$, and (II)~that we knew a suitable initial choice for $\overline{Z}$ to obtain a suitable choice of $b$. We expect that this construction will reproduce minimum-weight perfect-matching decoders with codes where we have a common set of properties. However, we do not expect codes to satisfy these properties in general. There remain several questions, whose answers may allow us to relax the assumptions we have used to obtain our systematic construction.

First of all, the construction proposed above assumes that we begin with a logical operator $\overline{Z}$. However, there are exponentially many different choices for an initial logical operator. We can make any choice $S \overline{Z}$ for all stabilizers $S \in \mathcal{S}$. In the example of the surface code, we deliberately began with a logical operator that reproduced the standard decoder~\cite{Dennis02} where $\overline{Z}$ is supported on the top boundary. However, one could imagine reproducing this strategy with a bad initial choice of logical operator such that the resulting matching algorithm has suboptimal performance. It will be interesting to find a systematic way of finding a good choice of initial logical operator if, indeed, one can always be found. It will certainly be valuable to continue looking for examples of matching decoders for LDPC codes to find ways to relax this assumption.

We have also assumed that a logical operator $\overline{Z}$ can be cleaned onto $\overline{Z'} = b \overline{Z}$ such that $\overline{Z'}$ is supported on qubits that are far away from the support of $\overline{Z}$. However, not all codes have this property. Take for example the color code with triangular boundaries~\cite{Bombin06}. In this example, all instantiations of $\overline{Z} $ and $ \overline{Z'}$ must have at least one common qubit in their support. In spite of this, matching decoders have been demonstrated, see, e.g., Ref.~\cite{Sahay22} and references therein.

Take as another related case, codes that have periodic boundary conditions, the surface code embedded on a torus being the prototypical example~\cite{Kitaev03}. In this case we obtain the symmetry that is typically used to decode this code by cleaning the logical operator $\overline{Z}$ all the way around the torus and back onto itself, such that $\overline{Z} = \overline{Z'}$, using the symmetry whereby $\prod_{f \in \text{grey}} S_f =1$. These two examples suggest that we may be able to design a general minimum-weight perfect-matching decoder by relaxing the assumption that $\overline{Z} $ needs to be cleaned far away from its initial support. Indeed, the reader that has followed this discussion up to this point may have noticed that at no stage has the notion of `far away' been defined precisely.

\begin{figure}
\begin{center}
\includegraphics{Moebius.pdf}
\end{center}
\caption{The color code with three different types of boundary on the sides of a triangular qubit array gives rise to a symmetry supported on a M\"obius strip, where each stabilizer generator of the code appears twice over the manifold. \label{Fig:Moebius}}
\end{figure}

Building on the last point, let us finally mention that matching decoders can be designed where the manifold on which matching is conducted does not reflect the topology of the code. In one example~\cite{Sahay22}, a symmetry is found where the local stabilizer generators of a planar color code are embedded on the surface of a M\"obius strip. We show this symmetry in Fig.~\ref{Fig:Moebius}. Interestingly, each stabilizer generator of the planar color code appears twice on the M\"obius strip. Likewise, the decoder used to correct the surface code with boundaries under a biased noise model uses a symmetry where each stabilizer appears twice~\cite{Tuckett20}. A general approach to discover the matching procedure used in these decoders may require a method more general than cleaning, that allows the duplication of stabilizers in a given symmetry, together with a way of presenting the manifold on which the symmetry is supported. A clearer understanding of how to produce and describe these symmetries may reveal new structure in general LDPC codes with non-local stabilizers~\cite{Breuckmann21}, on the path towards a general construction for a minimum-weight perfect matching decoder.

\section{Conclusion}
\label{Sec:Discussion}
Fault-tolerant quantum computing hardware will require a high-performance decoding algorithm to correct for the errors they suffer. We have reviewed some of the progress that has been made towards the development of the surface code; one of the leading architectures that is now in production to demonstrate scalable quantum computing. In particular we have reviewed many of the decoding algorithms that have been developed to support this practical fault-tolerant quantum-computing system. The minimum-weight perfect-matching decoder has been central to our discussion. This is among the most widely studied decoders that has been considered for surface-code error correction.

In the example of the surface code, the minimum-weight perfect-matching decoder makes use of a parity conservation law, which arises due to a materialised symmetry. This property is fundamental to the structure of the surface code. By presenting this perspective, we hope to find ways of generalising the minimum-weight perfect-matching decoder using similar structures in other codes. To this end, we have reviewed several examples of different matching decoders, and we have presented a systematic construction to produce a matching decoder for other code families, where these families satisfy certain properties. Using these examples we argue that we may be able to go beyond our construction by relaxing some of the assumptions we have used. In future work, it will be exciting to discover new decoders by exploiting the underlying symmetries and conservation laws of general stabilizer codes.

\section*{Acknowledgment}

We would like to thank S. Bartlett, S. Bravyi, K. Brown, A. Cross, S. Flammia and D. Williamson for helpful and encouraging conversations.

\ifCLASSOPTIONcaptionsoff
  \newpage
\fi

\input{Perspective-V5-arXiv.bbl}

\end{document}


\section{Introduction}

In 1969, Coon~\cite{Coon:1969yw} constructed a one-parameter deformation of the Veneziano amplitude that appears to correspond to a unitary S-matrix~\cite{Figueroa:2022onw}.
While the Veneziano amplitude famously describes a spectrum with linearly increasing mass-squares, the Coon amplitude exhibits an accumulation point,
with an infinite number of states below a certain energy,  leading to questions about its physical relevance \cite{Caron-Huot:2016icg}.
Furthermore,  somewhat similar infinite towers of states have been found in recent amplitude studies~\cite{Caron-Huot:2016icg,Bern:2021ppb,Huang:2022mdb,Arkani-Hamed:2020blm}.

In this paper, we point out that the scattering amplitude for open strings on D-branes in ${\rm AdS}$ has several features in common with the Coon amplitude, including the accumulation point in the spectrum and the high-energy behavior. We do find some differences in the behavior of the large angular momentum states. We hope that some of our remarks below will be useful for finding the correct string background leading to the Coon amplitude, if one exists!

This paper is structured as follows. In Sec.~\ref{sec:Coon}, we review the Coon amplitude and the important features that for our analysis.
In Sec.~\ref{sec:string}, describe the D-brane construction in ${\rm AdS}$ that leads to a similar amplitude.
Finally, in Sec.~\ref{sec:comparison}, we compare aspects of the spectra and amplitudes in the Coon and string cases.

\section{The Coon amplitude } \label{sec:Coon}

The Coon amplitude~\cite{Coon:1969yw} is a modification of the standard Veneziano amplitude for the scattering of open strings; see Ref.~\cite{Figueroa:2022onw} and references therein. It reads\footnote{Here we write in the Coon amplitude with the exponential prefactor needed for locality~\cite{Figueroa:2022onw} and using the standard sign convention for scattering amplitudes. Unitarity requires $q \in [0,1]$ ($\gamma \geq 0$).}
\begin{equation}
{\cal A}_{\rm C}(s,t) = g^2 (1-q) \exp\left({\frac{\log \sigma \log \tau}{\log q}} \right) \prod_{n=0}^\infty \frac{\left(1-\frac{q^n}{\sigma\tau}\right)(1-q^{n+1})}{\left(1-\frac{q^n}{\sigma}\right)\left(1-\frac{q^n}{\tau}\right)}\label{eq:AC},~~~~~q = e^{-\gamma},
\end{equation}
where $\sigma = 1 + (\alpha_0 + \alpha' s)(q-1)$ and $\tau = 1 + (\alpha_0 + \alpha' t)(q-1)$, and $g$ is a  coupling constant.
The amplitude contains a dimensionless parameter $q$ that for later convenience we have written as $e^{-\gamma}$.   In the $q\rightarrow 1$ ($\gamma\rightarrow 0$) limit we recover the Veneziano amplitude,
\begin{equation}
{\cal A}_{\rm V}(s,t) = g^2 \frac{\Gamma(-\alpha_0-\alpha' s)\Gamma(-\alpha_0 - \alpha' t)}{\Gamma(-2\alpha_0 + \alpha' u)}.
\end{equation}
We will be mostly interested in the regime where $\gamma$ in Eq.~\nref{eq:AC} is small, so that $q \sim 1$. We will also later assume that $\alpha_0 =1$, as in the usual Veneziano case.
Looking at the poles of Eq.~\eqref{eq:AC} at $s,t=m_n^2$, we find that the spectrum is given by
\begin{equation}
\alpha' m_n^2 = -\alpha_0 + \frac{1-q^n}{1-q}.
\end{equation}
We see that the Coon amplitude has an accumulation point
that is approached exponentially,
\begin{equation} \label{AccCoon}
\alpha'(m_n^2 - m_\infty^2) = -{ q^n \over 1-q} , ~~~~~~~~~~   \alpha' m^2_\infty = { 1 \over 1\,{-}\,q }-\alpha_0 \sim { 1 \over \gamma } .
\end{equation}
For each pole labeled by $n$, there is a tower of states with spin ranging from $0$ to $n$.

When $\gamma \sim 0$, at relatively low energies the Coon amplitude agrees with the low-energy Veneziano amplitude. For larger energies we transition into the high-energy behavior of the Veneziano amplitude, and ultimately when $\alpha' s \gamma \sim O(1)$ we transition further into the true high-energy behavior of the Coon amplitude,
\begin{equation} \label{HighC}
{\log {\cal A}_{\rm C}} \sim  -\frac{\log s \log t}{\gamma} + \cdots ,~~~~~~{\rm for} ~~~~ t, s \gg {  1 \over \alpha' \gamma},
\end{equation}
which results from the exponential prefactor in Eq.~\nref{eq:AC}.
In  appendix~\ref{App:High}, we give the high-energy behavior for all values of $s \gamma$.

\section{Open string amplitudes for branes in AdS}\label{sec:string}

\begin{figure}[t]
    \begin{center}
    \includegraphics[height=8cm]{BraneFig1.pdf}
    \end{center}
    \caption{Scattering of open strings in AdS, attached to a D-brane (blue) at coordinate $\rho = 0$, for the metric given in Eq.~\nref{Met}.}
    \label{AdSScattering}
\end{figure}

We now consider an open string scattering problem that shares features of the Coon amplitude.
To this end, let us consider an ${\rm AdS}_{d+1}$ metric of the form
\begin{equation} \label{Met}
{\rm d}s^2 =  {\rm d}\rho^2 + e^{2 \rho/R} {\rm d}x_d^2,
\end{equation}
where $d\geq 3$, $R$ is the ${\rm AdS}$ radius, and ${\rm d}x_d^2$ is the flat $d$-dimensional metric.
We place a D-brane at $\rho = \rho_0$, extended along all $d$ spacetime directions labeled by $x^\mu$. By scaling symmetry, any choice of $\rho_0$ has the same physics, so we choose $\rho_0=0$ so that the proper time at this position agrees with the coordinate $x^0$.
We will consider the scattering of open strings attached to the D-brane, as depicted in Fig.~\ref{AdSScattering}.\footnote{ For the D-brane to be an actual solution we need more ingredients, such as  Ramond-Ramond fluxes in a type II superstring theory. We will ignore such issues here because our analysis will be insensitive to these details.}

We analyze this problem in the large-radius limit, where
\begin{equation} \label{smallalp}
\tilde \gamma \equiv { \alpha' \over R^2 }  \ll 1.
\end{equation}
In this limit, for relatively low energies satisfying
$\alpha' s \tilde \gamma \ll 1 $, we can approximate the scattering by the flat-space Veneziano amplitude. Note that due to Eq.~\nref{smallalp}, this regime includes the region $\alpha' s \gg 1$.
 As we review in appendix~\ref{DevString}, at high energies the amplitude  has the schematic form
 \begin{equation} \label{HSgen}
 \log {\cal A}_{\rm String} = - { 1 \over \tilde \gamma } F(\alpha' s \tilde \gamma , \alpha' t \tilde \gamma ) ,~~~~~{\rm for } ~~ t, s \to \infty, ~~\tilde \gamma \to 0,~~~~{\rm with} ~~t/s,~s \tilde \gamma  ~~{\rm fixed.}
 \end{equation}
 This behavior arises from a classical string solution in ${\rm AdS}$ \cite{Alday:2007hr}, as in the flat-space analysis of Ref.~\cite{Gross:1987ar}.
  When $\alpha' s \tilde \gamma $ is small, we obtain the high-energy behavior of the Veneziano amplitude, while for large values of $\alpha' s \tilde \gamma $ we find~\cite{Alday:2007hr}
  \begin{equation} \label{HighS}
  \log { \cal A}_{\rm String} \sim -\frac{\log s \log t}{4\pi \tilde \gamma} + \cdots ,~~~~~{\rm for }~~  s , t \gg { 1 \over \alpha' \tilde \gamma } .
 \end{equation}

 \begin{figure}[t]
    \begin{center}
    \includegraphics[height=8cm]{BraneFig2.pdf}
    \end{center}
    \caption{Various string configurations discussed in the text.
In purple, we  depict a string stretching between the brane (blue) and the horizon (yellow).
A pair of such strings has the energy of the continuum threshold. In red,  we show a state of a lower energy consisting of a folded string that stretches up to a finite distance from the brane, with the endpoint momentarily at rest.
This endpoint will start moving towards the brane.
Finally, the spinning string is depicted in brown.}
    \label{VariousStrings}
\end{figure}

 The spectrum contains an accumulation point because we can consider a string that stretches from $\rho=0$ to $\rho = -\infty$; see Fig.~\ref{VariousStrings}. Such a string has  a finite energy that we will write as $E_\infty/2$, where
 \begin{equation} \label{Ega}
 \frac{E_\infty}{2} = { 1 \over 2 \pi \alpha' } \int_{-\infty}^0 {\rm d}\rho\, e^{\rho/R} = { R \over 2 \pi \alpha' } = { 1 \over 2\pi \sqrt{\alpha'} } { 1 \over \sqrt{\tilde \gamma } } .
 \end{equation}
When the center-of-mass energy $s$ is larger than $E_\infty^2$, we can produce a continuum of states consisting of a pair of these stretched strings moving away from each other.

 It is interesting to consider the string spectrum for energies lower than Eq.~\nref{Ega}. A particular set of string states is obtained by considering a folded string stretching from $\rho=0$ to a negative value $\rho_0$. For large $|\rho_0|$ it will have an energy slightly less than twice Eq.~\nref{Ega}. If we have a folded string of this kind at some instant, it would start approaching the brane at later times. We can semiclassically quantize this motion, and one finds a set of states given by Ref.~\cite{Klebanov:2006jj},
 \begin{equation}
\label{AccString}
  E_n = E_\infty\left(1 -  c~e^{ - { \pi^2 \alpha' \over R^2 }  n } \right),~~~~~{\rm for}~~n \gg 1,
    \end{equation}
where $c$ is an $O(1)$ constant that we will not compute.
As in the case of the Coon spectrum, here we are approaching the threshold energy in an exponential manner. This exponential $n$-dependence is largely determined by the conformal symmetry of ${\rm AdS}$ \cite{Klebanov:2006jj}.

 It is also interesting to compute the form of the energy for the lowest-energy rotating string attached to the brane; see Fig~\ref{VariousStrings}. We discuss these solutions in more detail in appendix~\ref{SpinningStrings}, in the classical limit.
  For relatively small angular momenta, this spectrum is given by the flat-space formula,
\begin{equation}
\alpha' E^2 = J.\label{eq:lowJ}
\end{equation}
For large angular momenta, the spectrum can be computed by treating the string as a pair of massive particles interacting via a Coulomb-like potential. The mass of each of these particles is $E_\infty/2$ in Eq.~\nref{Ega}. The potential is obtained from the same computation that gives the quark-antiquark potential in Ref.~\cite{Maldacena:1998im}.  This gives
 \begin{equation}
E - E_\infty  = -\frac{2\pi^3}{\Gamma(1/4)^8 R} \left(\frac{R^2}{\alpha'}\right)^3\frac{1}{J^2}.\label{eq:highJ}
 \end{equation}

\section{Comparison between the two amplitudes}\label{sec:comparison}

The Coon amplitude and the string amplitude for a string in ${\rm AdS}$ have some qualitative features in common. Both contain a small parameter, which we have denoted by $\gamma$ and $\tilde \gamma$ in Eqs.~\nref{eq:AC} and \nref{smallalp}, respectively. For relatively small energies, we recover the low-energy behavior of the Veneziano amplitude. For larger energies we find a deviation from the Veneziano amplitude.
In both cases we see a spectrum with an (exponentially-approached) accumulation point, as shown in Eqs.~\nref{AccCoon} and \nref{AccString}.
In both cases, the very high-energy behavior (at fixed angles) is similar, as we find in Eqs.~\nref{HighC} and \nref{HighS}.

One could wonder whether there is a choice for the relation between $\gamma$ and $\tilde \gamma$ that would make the Coon and AdS string amplitudes match precisely. If we take $\gamma = \pi^2 \tilde \gamma$, then the threshold masses---$m_\infty$ and $E_\infty$ in Eqs.~\nref{AccCoon} and \nref{AccString}, respectively---as well as the approach to the accumulation point---given by the factor multiplying $n$ in the exponential---do indeed match. However, then the high-energy behaviors of $\log {\cal A}$ in Eqs.~\nref{HighC} and \nref{HighS} differ by a multiplicative factor.

On the other hand, the spectrum of rotating strings is different at large $J$. In the Coon amplitude, the minimum energy of a state with a given angular momentum corresponds to setting $n = J$ in Eq.~\nref{AccCoon}, and it approaches the accumulation point exponentially. However, in the situation of the brane in ${\rm AdS}$, the spectrum for large $J$ is given by Eq.~\nref{eq:highJ} which approaches the accumulation point as $1/J^2$.

The discussion in this paper suggests that the Coon amplitude might correspond to ordinary strings in a suitable background. It is not precisely the ${\rm AdS}$ background we discussed here,  because we did not find perfect agreement.\footnote{ We could also consider the  $\tilde \gamma \gg 1$ limit, which  in the case of ${\rm AdS}_5 \times S^5$ is dual to a weakly coupled gauge theory.  We did not find a regime in the Coon amplitude that would give a qualitative agreement in this case.} We hope that this discussion will be useful for finding the appropriate background, if any exists.

\vspace{5mm}

\begin{center}
{\bf Acknowledgments}
\end{center}
\noindent
We thank C. Cheung and A. Zhiboedov for useful discussions and comments.
J.M. is supported in part by U.S. Department of Energy grant DE-SC0009988 and by the Simons Foundation grant 385600.
G.N.R. is supported at the Kavli Institute for Theoretical Physics by the Simons Foundation (Grant No.~216179) and the National Science Foundation (Grant No.~NSF PHY-1748958) and at the University of California, Santa Barbara by the Fundamental Physics Fellowship.