# Decoding the Steane Code

The $$[[5,1,3]]$$ code is a perfect code basically meaning that the weight-0 and weight-1 error spaces completely fill out the $$32$$-dimensional Hilbert space.

On the other hand, the $$[[7,1,3]]$$ Steane code is not perfect. There are $$6$$ stabilizer generators amounting to $$2^6 = 64$$ syndromes and yet the weight 0/1 errors only account for $$22$$ of these, leaving $$42$$ unused syndromes!

In practice it seems prudent to assign some of the weight-2 errors to these $$42$$ unused syndromes. However, there are $$3^2 \binom{7}{2}=189$$ weight-2 errors so we certainly cannot have a syndrome for all of these errors (which makes sense because in that case the code would have distance $$d=5$$ instead). This means we must make a choice for which weight-2 errors we wish to correct. I have never seen this done but I am sure that someone has done it somewhere (does anyone have a reference)?

Is there some choice that results in a better logical error rate than some other choice? Of course it depends on the error model, for example if a $$Z$$ error is more likely than an $$X$$ or $$Y$$ error then you probably want a syndrome for each of the weight-2 $$Z$$-type errors and maybe even some weight-3 $$Z$$-type errors. But in the special case of a depolarizing channel (where $$X$$, $$Y$$, and $$Z$$ occur with the same probability) I would assume that the logical error rate is invariant under this choice. Am I correct?

Edit (2-29-2024): As discussed in the answer by @ChrisD, there seems to be a canonical choice for weight-2 syndromes for the Steane code owing to the fact that it is a CSS code. However, does this choice lead to the best probability of logical error (or more simply, does this choice lead to the best pseudo-threshold) amongst all possible choices of weight-2 syndromes?

• Stim doesn't do decoding, it does simulation. Commented Feb 27 at 21:09
• @CraigGidney My bad, most of my research is non-stabilizer codes so I am not as familiar with Stim! I will edit the tag and post. Commented Feb 27 at 23:45
• The X and Z errors are decoded separately for CSS codes. The Steane code is able to decode up to a single X and single Z, which can occur in 64 different ways. Commented Feb 28 at 4:32
• @ChrisD If you had the time maybe you could explain more as an answer? Commented Feb 28 at 15:19

The error correction protocol for any CSS code (such as the Steane code) is described in e.g. Section 10.4.2 of Nielsen & Chuang, although it's much easier to understand in the stabilizer picture. They key point is that X errors and Z errors are corrected separately, so the Steane code can correct any single qubit $$X$$ error and any single qubit $$Z$$ error. This includes all weight-1 pauli errors $$X_i$$, $$Y_i$$, $$Z_i$$ and all weight-2 errors $$X_i Z_j$$ which, when $$i \neq j$$, give the 42 unused syndromes you are referring to. What it will not correct is weight-2 errors like $$X_i X_j$$, $$Z_i Z_j$$ or $$X_i Y_j$$ and so on.
• This is very interesting. What about for the Shor code (which is also a CSS code). Then correcting X and Z separately accounts for decoding (9+1)(9+1)=100 of the $2^8=256$ error spaces. When decoding the Shor code how do people decode the other $156$ error spaces? Commented Mar 1 at 21:20
• Good question. Take a look at the parity check matrices that define the Shor code (as a CSS code). The Z checks are actually 3 separate repetition codes that are decoded independently, so it is able to identify many two-qubit and three-qubit X errors. Moreover the single-qubit $Z$ errors only produce $4$ unique syndromes. Commented Mar 2 at 1:31
• In response to your edit, the answer depends entirely on the error model. In the case where $Y$ errors are more likely than $X$ ones you might decode the $Z$ syndrome differently depending on what the $X$ syndrome is. Tailoring decoders (and codes) to noise models is certainly worthwhile Commented Mar 2 at 1:38