# How to devise a flag qubit scheme for concatenated codes?

This flag qubit idea was introduced by Rui Chao and Ben Reichardt, last year when I read the paper [arXiv:1705.02329] I thought I understood fully. But today as I revisit I found myself still a bit confused with the construction.

I copied the flag circuit for measurement of $$XZZXI$$ for $$[\![5,1,3]\!]$$ code below.

Q1: I don't get why we need $$\text{CNOT}(b)$$. If we have $$IZ$$ error in $$(a)$$, yes, it would be propagated to the flag qubit through $$(b)$$ but it would also be carried on and passed through by $$(e)$$ and thus cancel out the error. This results in no detection of such a single fault. However, in the paper, it says the following

if a single fault spreads to a data error of weight $$\geq2$$ then the $$X$$ measurement will return $$|-\rangle$$

Q2: To measure stabilizers of e.g. 15 qubit code, the order of $$\text{CNOT}$$s are shuffled around slightly. Is there any pattern for the shuffling? Or do I have to do trial and error to make sure syndromes map to errors 1-to-1?

Q3: How should I devise such a scheme for concatenated codes? I can't find any good reference.
P.S. Surely we can treat everything in the logical level and use two logical ancilla qubits, but this is not what I want. I'm looking for a scheme that uses few ancilla qubits even if we concatenate. (https://arxiv.org/pdf/2006.03068.pdf) provides an example for [49,1,3]. I'm wondering if it's possible to extend to higher level concatenation.

## Q1

The purpose of flag-qubit FT scheme is not to ensure no errors will be left after the syndrome measurement, but to ensure no correlated errors (or large-weight errors) will be produced from the syndrome measurement circuit. Therefore, it's OK to have a single (weight-one) error left, as we believe this single error will be corrected in the next QEC cycle.

Another example of single error that cannot be detected here is any error occured after CNOT(f). apparently, as CNOT(f) is your last gate here, you won't detect it within this cycle.

## Q2

They proved the existence of a permutation such that the correlated errors have different syndrome and how to find such a permutation, just below the Fig. 2 in the paper.

## Q3

Just treat everything of the flag-qubit syndrome measurement circuit in the logical level and you will know how to do in the concatenated case.

• Q1: Yes I totally understand what you say here, CNOT(f) will create weight-1 error in the data block that's fine. But an IZ error on CNOT(a) will create a weight-3 error but gone undetected? Also from your answer I still don't get the point for existence of CNOT(b). Q3: Maybe my question is not so clear. Of course we can always go to the logical level, what I want is a "few qubit" scheme for concatenated code, e.g. I need 2 ancilla qubits for 7 qubit code, can I use, say 4 ancilla qubits or less, for 7x7 code instead of 14. Commented Dec 25, 2023 at 14:33
• For IZ error after CNOT(a), it will be propagated into a IZZZ error, which is identical to the single ZIII error if you can recall ZZZZ is one of the code stabilizers. Commented Dec 26, 2023 at 5:44
• As single-qubit error is safe, you don't need to use the ancilla to flag the existence of such kind of error. The key point here is just to flag all correlated errors, as the following routine need to distinguish the types of them. Commented Dec 26, 2023 at 5:51
• For general code case with distance $d$, the authors have a follow-up work saying that you need at most $d+1$ ancilla qubits. I am not sure if there is further room for improvement for concatenated codes though. Commented Dec 26, 2023 at 5:57