Modern Quantum Error Correction Part 1

·28min·Kanyang Ying

Introduction

The traditional approach to QEC centered on the error correction code itself. This suffers from the fact that, unlike classical error which mainly affects data at rest, quantum errors occur during computation. In other words, unlike in classical computing where CPU is assumed to be error-free, "QPU" makes errors all the time.

This means error process and computation process are inherently mingled. And that renders some famous theorems and results like Knill–Laflamme conditions rather inelegant or impractical since they assume a dedicated error channel where no computation happens.

A much cleaner approach has recently been developed by Google1, called Detector Error Model, which can be seen as a generalization of qubit-level error to circuit-level error. This has been further perfected and rewritten using the language of ZX-calculus, under which we shall see the idea is really natural.

This blog posts series introduces the idea of the "detector", this "modern" QEC workflow, and fault-tolerance formulated in ZX-calculus. This assumes you are already familiar with the basics of ZX-calculus. Indeed, you would see many ideas/definitions are most elegant under the ZX-calculus formulation. Additionally, we would be focusing on Clifford diagram only as it's most well understood and we have the more tools to play with.

But right before we start, let's restate the definition of Pauli group.

Basic Stuff

Definition(Pauli String)

A $n$-Pauli string is a tensor product of Pauli operators of length $n$. For example $$ \mathbb{I} \otimes X \otimes Z \otimes Z $$ is a 4-Pauli string.

Definition(Pauli Group)

We denote Pauli group as

The reason we included the prefactor $i^k$ is pauli string themselves don't form a group without prefactor as for example $Y = i XZ$.

We can also "recover" the set of $n$-Pauli strings by consider the quotient of "center" of the group. center are elements who commute with the entire group. Here, center is $i^k \mathbb{I}^{\otimes n}$ with $k$ from $0$ to $3$.

Now we can define equivalence relation that two elements are equivalent when they differ by one of the center. Quotienting out this requivalence gives us equivalence classes where each class is identified with a Pauli string. Therefore, after quotient, it's essentially the set of all Pauli strings. We denote the set after quotient by $\overline{\mathcal{P}^n}$.

Fault on ZX diagrams

There are a lot of models to formalize quantum faults, but all of them can be reduced to thinking of only Pauli faults. We will convince ourselves later by considering how general faults may be decomposed into Pauli faults.

First, we would like to define what is a Pauli fault on a daigram.

Pauli Fault

Definition(Pauli Fault)

Let set of all edges of a ZX diagram be $E$. Pauli faults are elements of $\overline{\mathcal{P}^{|E|}}$ where $\mathcal{P}^{|E|}$ means the Pauli group with support on the edge of the ZX diagram.

example
Example

As a graphical example, consider figure 1 and figure 2.

Diagram $D$ with fault sites. Here the octagons on edge represent "fault sites" which are support of the Pauli faults.
An example pauli fault on $D$ with a X fault and a Y fault (represented by X and Z product and we ignored the overall proportionality constant).

Let $D$ be the diagram and $F \in \overline{\mathcal{P}^{|E|}}$ be a Pauli fault. We denote the final diagram after instantiating $F$ at corresponding fault sites on $D$ by $D^F$.

example
Example

For example, the "X and Y" fault in figure 2 will give rise to an overall $D^F$ below

Noise Model

Definition(Noise Model)

A noise model consists of a set of atomic (Pauli) faults $\mathcal{F}\subseteq \overline{\mathcal{P}^n}$ and a weight function $\mathrm{wt}: \mathcal{F} \to \mathbb{N}^+$.

It's useful to understand weight intuitively as a log scale probability. So roughly faults of weight $w$ means its probability is proportional to $e^{-w}$. Hence higher weight faults are more unlikely to happen.

Then the possible faults under a specific noise model is then the set of Pauli faults $\langle \mathcal{F} \rangle$ generated by $\mathcal{F}$ (here we ignore the proportionality constant when composing those atomic faults so the result is again a Pauli string. Or if you wish you can say $\overline{\mathcal{P}^n}$ forms a group because center satisfies the congruence relation).

Another assumption we make about atomic fault is that they happen independently. So if we have two atomic fault forming a composite fault, its probability should be the product of the individual atomic faults' probability. Hence the weight (which is roughly the log of the probability) should add.

Now a natural question is: how do we define weight for those composite faults? Since it's possible that there are multiple way to generate one fault from different atomic faults. The answer is we simply take the minimum of those compositions (hence the most likely way to generate this composite fault).

Formally, we can write this kind of recursive definition for any $F \in \langle \mathcal{F} \rangle$,

We call the $\mathcal{F}_\mathrm{sub}$ which gives rise to the minimal sum of weights the "minimal weight composition".

example
Example

An edge flip noise model defines its atomic faults $\mathcal{F}$ as the set of individual Paulis on $E$. For simplicity, we define them all having weight 1 irrespective of which edge the Pauli is on and what type (i.e. X, Y, Z) of the Pauli it is. The weight of any fault in $\langle \mathcal{F} \rangle$ is then the number of non-identity Paulis of the fault Pauli string in set $\overline{\mathcal{P}^{|E|}}$.

example
Example

A general noise model might include more interesting definition of atomic fault for example by declaring $XZ$ fault after a CNOT as weight 1 instead of 2 (as one would have for a miminal weight composition under the edge flip noise model).

Stabilizers on diagrams

Fundamentally we would like to understand how a fault changes our diagram. And that is best understood through stabilizers of our diagram (because for a Clifford diagram its stabilizer pins down what it is). Therefore, it's useful to have a theory of stabilizer on diagram.

Stabilizers of a spider

Recall that a Clifford spider can only have its phase in the form of $\frac{k\pi}{2}, k \in \mathbb{Z}$. And let's consider the question of how we may place Paulis around it to stabilize (up to an eigenvalue 1 or -1) the spider.

Since we are placing Paulis on the edge around a single spider, we could do that by coloring the edges of the Pauli. And we would use the convention that:

  • Green edge corresponds to $Z$
  • Red edge corresponds to $X$
  • Blue edge corresponds to $Y$
  • Uncolored edge corresponds to identity.

When we say "same color" or "opposite color", blue edge counts as both types since we consider $Y$ as the combination of $Z$ and $X$.

For blue edges, we instantiate it using $Y=iXZ$ and adopt the convention that $X$ is closer to the spider we are considering. Therefore, for example,

More formally, since they are Paulis on the edge of a spider, we may identify such stabilizers with Pauli strings $w \in \overline{\mathcal{P}^n}$ for an $n$-legged spider.

All-or-nothing

We can either color all or none of the edges of a spider in the opposite color.

Remember that $\pi$-copy flips the phase of a spider. This is not an issue for $\pi$ phase as $-\pi = \pi$ modulo $2\pi$. However, it is an issue for $\pm \frac{\pi}{2}$.

And in this case, we would need an additional same color $\pi$ to fix it up (so flip $\pm \frac{\pi}{2}$ back to $\mp \frac{\pi}{2}$).

Parity criteria

One obvious thing one can do is to use spider fusion. So one can color the even number of edges of a spider with the same color.

One nuance being that due to All-or-nothing rule, for $\pm \frac{\pi}{2}$ phases, if they are colored with the opposite colors, then one would need odd number of same color edge.

Spider Stabilizer Rules

In summary,

note
Note

Let $\alpha$ be the phase of the spider. We can either

  • color all the edges with opposite color, OR
  • color none of the edges with opposite color

AND after that

  • If $\alpha = \pm \pi$, color even number of edges in the same color
  • If $\alpha = \pm \pi/2$ and none of the edges is in opposite color, then color even number of edges in the same color
  • If $\alpha = \pm \pi/2$ and all of the edges is in opposite color, then color odd number of edges in the same color

To find the eigenvalues of a spider stabilizer, one simply instantiate the edges according to their color and apply ZX rules while tracking the scalar until we restore the diagram.

example
Example

Here is the generating set of stabilizers for the three-legged green $\pi/2$ spider.

With eigenvalues from left to right being $-1, 1, 1$.

The reason why this set has three elements is related to the fact that:

  1. this is essentially a Clifford state consisting of three qubits;
  2. any $n$-qubit Clifford state can be fully described by $n$ independent stabilizers.

Pauli Web

Definition(Pauli Web)

Pauli web is a coloring on edges of a diagram such that for every spider in the diagram, its immediate neighborhood coloring satisfies spider stabilizer rules.

Firing a Pauli Web

One can instantiate Pauli web as a Pauli string of $\overline{\mathcal{P}^{|E|}}$ by "firing" it. By firing it we mean to instantiate a spider stabilizer around each spider according to the Pauli web coloring.

example
Example

Here is an example of firing a Pauli web.

Pauli web firing example.

One see that internal edges can always be cancelled.

warning
Warning

Don't fire a Pauli web by instantiating a single Pauli on each edge according to the coloring. This is tempting to do but isn't really meaningful. Always fire by consider each spider and how edges stabilize them.

Definition(Sign of Pauli Web)

We define the sign of a Pauli web as the total eigenvalue we obtain when we instantiate the Paulis on boundary edges.

To calculate the sign of the web, see the following example,

example
Example

We start by finding the product of individual spider stabilizer's eigenvalue. The upper green spider has eigenvalue $-1$ and the lower red spider has eigenvalue $+1$. Therefore, $$ D = -D_{\text{fired}} $$ And then we can always cancel the internal edges of $D_{\text{fired}}$ to leave exactly only Paulis on the boundary edges of the web. In this step notice that any internal $Y$ edge would incurr a $-1$ phase.

The Pauli web shows that the Clifford state is stabilized by $X Y Z Z$ with eigenvalue $1$.
warning
Warning

Sign of a Pauli web is not equal to product of the individual spider stabilizer's eigenvalues as seen in the example above.

We can separate Pauli webs into two types:

  1. Stabilizing Pauli webs. These are webs such that they have non-trivial support on boundary edges of the diagram.
  2. Detecting regions. These are webs with no boundary edges hence fully closed.

Stabilizing Pauli webs

The best way to understand these webs is through the fact that every Clifford diagram is essentially a Clifford state (by bending input wires to output wires).

And stabilizing Pauli webs are stabilizers of the Clifford state represented by diagram. And the eigenvalue of the stabilizer is given by the sign of its Pauli web. See this example for detail.

Detecting Region

Detecting region has no external edges, hence the stabilizer equation given by the procedure in this example would be either vacuous ($D=D$) or dictating $D=-D$ hence $D=0$.

Flipping sign of the web

How does Pauli web interact with Pauli faults on the edge? Interestingly, when we place a single edge flip Pauli fault on the edge, even though diagram changes (we made one additional edge), the old coloring scheme still works!

example
Example
Up: the original diagram $D$. Down: the diagram $D^F$ where $F$ is a single $Z$-flip on the edge. Note in the new diagram $D^F$ the old Pauli web coloring still works.

What's more interesting is that when we instantiate the fault on the diagram, it's gonna flip the sign of the Pauli web based on how the fault string commutes with the Pauli web coloring.

note
Note

When we say "fault string commutes with the Pauli web coloring" we don't mean firing the Pauli web and check commutation but rather checking commutation via the color of the web.

For example an $X$ fault on a green edge or blue edge counts as anti-commuting, and just like checking ordinary Pauli string commutation, we just count the number of anti-commuting edges and check if it's even or odd.

For example in this figure, the detecting region Pauli web's sign flipped from $1$ to $-1$. The general reason is that, whenever the Pauli on the edge anti-commutes with the Pauli represented by the coloring, its corresponding spider stabilizer eigenvalue would be $-1$. Hence, if we use the procedure to work out the sign of the new web, it would incur an additional sign of $$(-1)^{\text{number of anti-commuting sites}}$$

Therefore, anti-commuting faults flip the sign of Pauli webs.

This is a very useful effect because it tells us how to detect fault when running circuit generally, going beyond simple syndrome extraction measurement. With detecting regions, we can do a "space-time syndrome extraction".

example
Example

Consider a circuit measuring ZZ stabilizers twice.

Anti-commuting faults are detected by Pauli web since it flips the sign of the detecting region to $-1$
The left diagram has a detecting region of green color (hence can detect $X, Y$ faults since they anti-commute from what we have). The sign of the detecting region is $k_1 \oplus k_2$.

To have the diagram non-zero (hence probability not zero on that branch of measurement post-selection), we need $k_1 = k_2$.

However, if an $X$ fault appears on one of the edge, the sign of the new web becomes $k_1 \oplus k_2 \oplus 1$ since the fault anti-commutes with the web. Therefore, the non-zero post-selection now becomes $k_1 \not = k_2$. This means we can detect the fault by running measurements!

Inconsequential Faults

Definition(Inconsequential Fault)

Let $D$ be a non-zero diagram. A fault on the diagram $S \in \overline{\mathcal{P}^{|E|}}$ is inconsequential if $D^S = D$.

By stabilizer theory2, we know that every inconsequential fault is generated by some stabilizers of spiders.

note
Note

Why do we want $D$ to be non-zero? Because under zero diagram we could have $S$ which obviously doesn't stabilize the diagram while still $D^S = D = 0$. This is unwanted because we want inconsequential faults be such that they are generated by the spider stabilizers.

For example,

Left: diagram $D$ which is zero, and its two Pauli webs. Right: $S$ such that it isn't generated by spider stabilizers while still stabilizes $D$ in the sense that $D^S = D = 0$.
Definition(Spacetime Equivalence)

We call two faults $F_1, F_2$ spacetime-equivalent if $F_1 = F_2 S$ for some inconsequential fault $S$.

Pauli Web is all you need

Detecting region is all you need

When would a fault send a diagram to zero? Do we need to reduce the diagram via trial-and-error to see if it goes zero or can we "just" check all the detecting regions?

Lemma

Let $|a\rangle, |b\rangle$ be two Clifford states, then $\langle a | b \rangle = 0$ if and only if there exists $S$ in stabilizer subgroup of $|a \rangle$ such that $-S$ is in the stabilizer subgroup of $b\rangle$.

Proof

If there exists such a $S$ then it's trivial to see since

$$\langle a | b \rangle = - \langle a | S^2 | b \rangle = - \langle a | b \rangle $$

hence it's 0.

Let's try prove the converse. The projection $\langle a | b \rangle = 0$ if and only if a sequence of stabilizer projections applied on $|b\rangle$ gives 0. So if the stabilizers of $|a \rangle$ are $Q_i$s then it would be

So how do you project a Clifford state with $\Pi_{Q}^{(0)}$? This is a well-known result for Clifford state simulation via stabilizer tableau. Let's say we have a $n$-qubits Clifford state described by $n$ stabilizers $\{P_i\}$ before the projection. The resulting state after projection is again a Clifford state with stabilizers $\{P_i'\}$ given according to the rules below.

Two cases:

  1. If all the $P_i$ commutes with $Q$ then generate $Q$ using $P_i$ up to a scalar. ($Q$ is guaranteed to be generated up to a scalar by $P_i$ due to Fundamental Theorem of Stabilizer Theory and we have a full-rank of stabilizer set). Since $P_i$ are self-adjoint, we will generate $\pm Q$. If we generate $+Q$ then projection does nothing, otherwise it kills the state.
  2. If some $P_i$ anti-commutes with $Q$ then we pick one anti-commuting $P_i$ as pivot, and then update the rest of anti-commuting $P_j \to P_j P_i =: P_j'$ hence $P_j'$ commutes with $Q$. Then replace $P_i$ with $Q$ and put an arbitrary sign (measurement result gives both results with equal probability).

So every time we project, we either:

  1. Kill the state or
  2. Replace (at most) one stabilizer with $Q_i$ from the stabilizer subgroups of $|a\rangle$ while the rest stabilizers still stay in the original stabilizer subgroup of $P_i$s.

So ultimately to kill the state, we necessarily have to generate $-Q_k$ using a subset of $Q_1, \dots Q_{k-1}$ and a subset of stabilizers in $\langle P_i \rangle$, which proves that there exists an $S$ which is stabilizers of $|b\rangle$ such that $-S$ is in stabilizers of $|a\rangle$.

Proposition(Diagram goes to zero iff detecting region got flipped)

Let $D$ be a non-zero diagram. $D^S = 0$ if and only if $S$ anti-commutes with at least one of $D$'s detecting region.

Proof

If $S$ anti-commutes with at least one of $D$'s detecting region, then it flips the sign of the detecting region and hence $D=-D=0$ by firing the web.

Hence we only need to prove the inverse: if $D^S = 0$ then $S$ anti-commutes with at least one of $D$'s detecting region.

Let's start by bending wires:

  1. For simplicity, first bend all the input wires of $D$ into output wires. So from now on we assume $D$ is a Clifford state.
  2. Instantiate faults and pull out the edges where $S$ has support on.

So we have the following diagrams for $D$ and $D^S$. Without loss of generality we are only drawing fault $S$ with a single edge flip.

Bending wires around. This helps us converting detecting regions relevant to the fault $S$ into stabilizing Pauli webs for $D'$.

So $D^S$ now can be seen as prepared through three phases:

  1. Prepare $D'$ with input bended over.
  2. Apply some Paulis on the bended-over inputs.
  3. Project onto bunch of (here only one drawn) Bell states.

And we have the following when doing this process:

  1. Without the Paulis applied in the middle, projection is guaranteed to be non-zero (since $D\not = 0$). This also means $D'$ can't be a zero diagram otherwise $D = 0$ clearly.
  2. $D'$ (with inputs bended over) is a Clifford state, so is the Bell state.
  3. What does applying Paulis to $D'$ Clifford state do? It simply flips the sign of its stabilizers. Because in general the new stabilizers of a Clifford state after applying Clifford gate $U$ is given as $$ P_i' = U P_i U^\dagger $$ while here $U$ is a Pauli $Q$ and Paulis either commute or anti-commutes hence $P_i' = \pm P_i$ where $\pm$ depends on the commutation relation between $P_i, Q$.

So now the question turns to what is the necessary and sufficient condition for two Clifford states to be projected to zero.

Therefore by lemma, if $D^S$ is zero, we necessarily need to have the $D'$ state after Pauli fault string to have a stabilizer $R \in \langle X_1 X_2, Z_1 Z_2, X_3 X_4, Z_3 Z_4, \dots \rangle$ with negative sign.

This $R$ will be a Pauli web on the $D'$ state before Pauli fault string applied on it. And the sign of this Pauli web would need to be positive because $D \not = 0$ and $S$ can't be a negative stabilizer otherwise it kills the state by the lemma.

Therefore, the Pauli fault string $S$ must flip the sign of this web which means it anti-commutes with $R$. Finally, this stabilizing Pauli web representing $S$ has the same color for every pair of edges connecting to the Bell states, hence it will actually make a detecting region of the entire diagram $D$ if we color the bell states part with the same color.

Therefore, we proved if $D^S = 0$ then $S$ anti-commutes with at least one Pauli web.

Stabilizing Pauli web is all you need

Proposition(Fault is inconsequential iff it commutes with all webs)

Let $D$ be a non-zero diagram. A fault $S$ is inconsequential if and only if it commutes with all Pauli webs' colorings.

Proof

Under the assumption that $D$ is a non-zero diagram, we can reformulate the proposition as $D^S = D$ if and only if it commutes with all Pauli webs' colorings.

If $D^S = D$, then two diagrams represent the same Clifford state up to a non-zero constant. Since also $D\not = 0$, this means:

  1. $D^S$ is not zero. Hence none of the signs of detecting regions should be flipped (otherwise $D^S = 0$).
  2. They must be stabilized by the same stabilizers with the same sign. Hence none of the signs of the stabilizing Pauli web should be flipped (otherwise $D^S \not = D$).

If it commutes with all Pauli webs' colorings, then again $D^S$ agrees with $D$ on all the signs of the Pauli webs. Since diagram can't go zero without flipping at least one detecting region, we know $D^S \not = 0$. Now since $D^S$ and $D$ are both non-zero and has the same stabilizers and signs of stabilizers, they must be the same state up to a scalar.

Proposition(Spacetime-equivalent iff flip the same set of webs)

Let $D$ be a non-zero diagram and $F_1, F_2$ be two faults on $D$. $F_1, F_2$ are spacetime-equivalent if and only if they flip the signs of the same Pauli webs.

Proof

If $F_1 = F_2 S$ for some inconsequential $S$, then $F_1 F_2$ is inconsequential and then it commutes with all Pauli webs (detecting or stabilizing) by the above proposition. Therefore, it must be the case that Pauli string $F_1, F_2$ individually agrees on commutativity with any Pauli strings.

If $F_1, F_2$ agrees in terms of commutativity with all Pauli webs, then $F_1 F_2$ commutes with all Pauli webs, hence $F_1 F_2$ is inconsequantial and $F_1, F_2$ are spacetime equivalent.

Proposition(Undetectable faults are spacetime-equivalent iff diagrams are equivalent)

Let $D$ be a non-zero diagram and $F_1, F_2$ are two undetectable faults on $D$. $F_1, F_2$ are spacetime-equivalent if and only if $D^{F_1} = D^{F_2}$.

Proof

we only need to prove that under this assumption, $F_1, F_2$ flips the same Pauli webs if and only if $D^{F_1} = D^{F_2}$.

If $D^{F_1} = D^{F_2}$ and since $F_1, F_2$ are not detectable, by proposition we know both $D^{F_1}, D^{F_2}$ are non-zero. Hence they must be the same non-zero Clifford state and hence flips the same stabliizing Pauli webs.

If undetectable $F_1, F_2$ flips the same Pauli webs, then by proposition both diagrams are not zero and has the same stabilizers and signs, hence must be of the same state and $D^{F_1} = D^{F_2}$.

note
Note

Can there be detectable fault that doesn't flip the non-detecting Pauli web's sign? Here is a simple example you might want to entertain yourself with.

The vanilla diagram $D$

And there are two Pauli webs of the diagram:

Two Pauli webs of $D$, right being a detector region

Now consider a X fault on the bottom edge, it anti-commutes with the detecting region and commutes with the left web. Hence $D^F=0$ but still gets stabilized by the left web by eigenvalue 1.

Though this discussion is a bit pointless (since a zero diagram should be stabilized by any stabilizer with both eigenvalue 1 and -1). It does show that it could be possible that a detectable fault anti-commutes with some detecting region while commutes with all the webs with boundaries.

Next Steps

In this blog post, we have gathered basic tools including noise models, Pauli webs and theorems related to them. One immediate observation being that Pauli webs are immensely powerful to pin down faults happening during the diagram (or circuits) which is a major part of quantum error correction (figure out what error has happened without looking at the state).

In the next post, we will define fault-equivalence, formulate fault-tolerance, circuit distance (and see how it relates to usual code distance we like to talk about), define what quantum error correction really means (what do we want to achieve during QEC?) and more.

Acknowledgement

Almost none of the content, except examples and the proof on detecting region and zero diagram, in this blog post is original by me. Thanks Aleks, Ben, and Andrey for explaining details of the theory to me, and I hope I successfully reproduced the essentials of those in the blog post so others can benefit :)

Some general useful references I used and learned from include 3 and 4. You could find many of the propositions and definitions here probably in more details and/or formalities in those papers.

References

1

M. McEwen, D. Bacon, and C. Gidney, “Relaxing Hardware Requirements for Surface Code Circuits using Time-dynamics,” Quantum, vol. 7, p. 1172, Nov. 2023, doi: 10.22331/q-2023-11-07-1172.

2

C. Borghans, “ZX-Calculus and Quantum Stabilizer Theory”.

3

B. Rodatz, B. Poór, and A. Kissinger, “Fault Tolerance by Construction,” Oct. 09, 2025, arXiv: arXiv:2506.17181. doi: 10.48550/arXiv.2506.17181.

4

M. Rüsch, B. Rodatz, and A. Kissinger, “Completeness for Fault Equivalence of Clifford ZX Diagrams,” Nov. 30, 2025, arXiv: arXiv:2510.08477. doi: 10.48550/arXiv.2510.08477.