# Surface Code - Convert Control Error to Clifford Error

I am simulating surface code, in order to find the logical error as a function of control error in my circuit. Each of my data qubits is multiplied in control error = a unitary matrix $$U$$ which is close to the identity matrix (but not exactly).

For running time reasons,instead making $$U$$, I am:

1. Decomposing this $$U$$ into super-position of Pauli matrices - $$U=aI+bX+cY+dZ$$ ($$a$$ close to 1)
2. Simulating $$X/Y/Z$$ that it is happening in probability of $$|b|^2 / |c|^2 / |d|^2$$ accordingly
3. Acting in a randomized way with those $$X/Y/Z$$ on my data qubits
4. measuring my logical error

When stabilizing before the error and after the error - Is this process is equivalent to acting with $$U$$ (with probability = 1) on the data qubits? (in terms of same logical error rate)

I wonder if it is equvalent or not, because stabilizng in surface codes making sure that your keep your state. But on the other side, the measurment of the symdrome is on the ancilla which is sharing 4 qubits...

Thank you

• see section III A here: journals.aps.org/prx/abstract/10.1103/PhysRevX.11.041058 for a discussion of this
– Lior
Commented Feb 15, 2022 at 20:35
• It seems that they experimentally tried to find fit when simulating coherent error-they extracted the X/Y/Z error probability - am I right? There is no analytic method to do it? Commented Feb 16, 2022 at 17:07
• Right. But if you follow the calculation in my answer, you’ll see that after the ancilla measurements, coherent errors collapse to incoherent errors. The only place where there’s a difference is if you have multiple coherent errors between ancilla measurements, e.g if every gate adds its own coherent error component
– Lior
Commented Feb 16, 2022 at 18:03
• What is the difference? if I have two coherent errors in a row, so they are two unitary matrices, that I can convert to 1 matrix $U=U_1*U_2$, which in turn can be converted into incoherent error collapse Commented Feb 16, 2022 at 19:33
• yes, but that means that in the simulation you have to somehow keep track of the entire unitary - not sure how you'd do that. If you go with the more simple approach of taking each gate error and converting it to an incoherent error it would be wrong. For example, consider what happens when you do a -Y/2 followed by a Y/2 gate, and your amplitude is off by a fraction of 0.05. Then the coherent error will be 0 because you'll undo it in the 2nd gate, but the incoherent error will be 2*0.05^2.
– Lior
Commented Feb 16, 2022 at 20:39

### Background

The question of the validity of the incoherent approximation is explored in detail in this publication:

Bravyi, S., Englbrecht, M., König, R. et al. Correcting coherent errors with surface codes. npj Quantum Inf 4, 55 (2018). https://doi.org/10.1038/s41534-018-0106-y

They used a mapping of the surface code to Majorana fermions in order to do an efficient simulation that includes coherent noise, with code distance up to 49, which is actually really cool.

The noise model they apply is $$U=(e^{iZ\theta})^{\otimes n}$$, namely, an equal $$Z$$ rotation with angle $$\theta$$ on all qubits. I think this model is a bit artificial since I don't believe a control error will be so uniformly biased. In fact, I'm not even sure why a uniform Z rotation on all the qubits causes any error, and why it doesn't just amount to changing the starting time of the experiment. But let's go with it...

### Results

First of all, they show the threshold angle associated with the logical error threshold is about $$0.1\pi$$ which comes out consistent with the well known 1% logical error rate, using $$p=\sin^2\theta$$.

However, here's the ratio of the Pauli twirled (incoherent) noise with $$p=\sin^2\theta$$, and you can see it's pretty bad below the threshold.

In any case you can see the result is quite pessimistic in this specific case.

## My sketch of the general principles

As you model it - no, it isn't, at least formally speaking. Your control error model is coherent whereas your statistical Pauli error implementation is not. However, at the limit of small errors, they are effectively close enough.

You can see the difference if you look at the Kraus matrices. For example, if your target gate is $$V$$ and your (near identity) control error is $$U=1+\sqrt{\epsilon} X$$, then the Kraus matrix, which operates on your state as $$\rho\to E\rho E^\dagger$$, is $$E = UV$$, and so the transformation for the imperfect gate is:

$$\rho\to\rho_c = (1+\sqrt{\epsilon} X)V\rho V^\dagger(1-\sqrt{\epsilon} X)\\=V\rho V^\dagger+\sqrt\epsilon(XV\rho V^\dagger-V\rho V^\dagger X) - \epsilon(XV\rho V^\dagger X)$$

However, in the statistical bitflip error, the transformation is:

$$\rho\to \rho_{ic} = V\rho V^\dagger+\epsilon XV\rho V^\dagger X$$

Basically, coherent and incoherent errors do not behave in the same way - coherent errors add up in amplitude, and incoherent errors add in up in squares of amplitudes.

However, as you wrote in your question, the ancilla measurement will project the state onto the even/odd parity subspaces. I.e., if we denote $$\rho_c=UV\rho V^\dagger U^\dagger$$, and $$P_{\pm}$$ to be our even/odd parity eigenstates, Then after the ancilla meaurement we will have, in the coherent error model, the state:

$$pP_+\rho_c P_+ + (1-p)P_- \rho_c P_-.$$

However, if this is the only error in the circuit, then we can assume $$\rho_1 = V\rho V^\dagger$$ is in a definite parity state, and therefore the cross terms such as $$X\rho_1$$ and $$\rho_1 X$$ cancel out, because if e.g $$\rho_1$$ is in an even parity state, then:

$$P_+ X\rho_1 P_+ = X P_- \rho_1 P_+ = X P_- P_+ \rho P_+ ^2 = 0$$

and the same for the other cross terms. Thus, after the ancilla measurement:

$$\rho_{c} \to \rho_{ic}$$.

That being said, this assumes that the only error which occured is the single coherent error. If however state will not have definite parity before this error, e.g if you have two coherent errors that affect the same qubit, this will no longer be correct, and the errors in general will be larger.

• Maybe I did not ask the right question - I know the operation is different, but in terms of analyzing the rate of logical error probability, and remembering that the stabilizer is making sure that after you operate $U$ and measuring the ancilla, the state will collapse to 1 of the 4 options I/X/Y/Z Commented Feb 11, 2022 at 12:19
• I fixed my question Commented Feb 11, 2022 at 12:20
• got it - well, to my knowledge, while the surface code will definitely fix these errors, I don't know what effect exactly it will have on the error rate if you replace a coherent error with angle $\sqrt{\epsilon}$ with an incoherent error $\epsilon$. My guess is that they would be close for small $\epsilon$, with the coherent error being slightly larger as you increase $\epsilon$. In any case, you asked if they are equivalent - they are not.
– Lior
Commented Feb 11, 2022 at 12:41
– Lior
Commented Feb 11, 2022 at 13:43
• @RonCohen see edited andwer yet again...
– Lior
Commented Feb 19, 2022 at 4:29

No it's not literally equivalent, but it's close enough.

I'm not going to go through working out all the math, but here are the key things you need.

1. Decompose your coherent errors into linear combinations of Pauli errors. Note that $$R_Z(\theta)^{\otimes n} = (I \cos(\theta) + i Z \sin(\theta))^{\otimes n}$$.

2. Note that what error correction does is to take terms from that sum with fewer than $$d/2$$ Paulis and replace them with the identity term. So the most significant non-identity terms have a leading factor of $$\sin(\theta)^{d/2}$$.

3. You want to randomize the Pauli frame so that the rotations don't all go the same way. Randomly bit flip and phase flip the qubits as the error correction runs so that instead of getting $$(I \cos(\theta) + i Z \sin(\theta))^{\otimes n}$$ you get $$\prod_{k=0}^{n-1} (I \cos(\theta) + s_k i Z \sin(\theta))^{\otimes n}$$ where each $$s_k$$ is random +1 or -1 value you get to control. This will turn coherent error into incoherent error.

4. After all that work, you compute the trace distance between your carefully decoupled "true" channel and "lol just apply probabilistic Paulis" and find... yeah, you can just use probability Paulis. They're not literally perfect but they're good enough and they're so cheap.

5. Beware that just because you can use Paulis that doesn't mean the translation is always as simple as "I take every term like $$i Z \sin(\theta)$$ and replace it with terms like '$$Z$$ occurs with probability $$\sin(\theta)^2$$'". You likely need to more carefully choose the probabilities than that.

You can actually test some of this out in Quirk's example T state distillation circuit. Put some coherent error on all the data qubits, and see how large the coherent error is on the output. For example, here's what you see if you apply a $$Z^t$$ to every data qubit:

The output likes to pause near multiples of 45 degrees. The pauses are the output angle being pulled towards 45 degrees, because the error correcting code has a transversal T gate. There's a cubic suppression in not-being-45-degrees angle error.

• BTW, a more interesting version of this question is: When is it acceptable to replace amplitude damping with random Pauli errors? In fact, it's really not clear to me why all real error correction experiments don't just decay to the ground state after enough rounds
– Lior
Commented Feb 11, 2022 at 16:40
• @Lior That actually is a problem in rep code experiments. Even trickier is it looks like the logical error rate falling over time, since |0> is more stable. In quantum codes it can't happen because the X basis measurements project away from |0>. The ground state of the measurements is highly entangled, not separable. In the rep code you fix the problem, make it behave more "like" a quantum code for experiments, by constantly flipping the qubits to twirl away the decay. Commented Feb 11, 2022 at 20:10
• Thanks! When you wrote “X basis measurements”, did you mean “X parity measurements”?
– Lior
Commented Feb 11, 2022 at 20:38
• @Lior Yes. Any measurement involving X or Y basis Paulis will kick you out of |0>. Commented Feb 11, 2022 at 20:42
• Thank's for the detailed answer, but I still did not understand your method. 1. Why do you still using unitary operator of $Icos(θ)+s_{k}iZsin(θ)$, if our goal is to use only clifford with some probability. 2. How $s_k$ is affecting, it is just global phase. 3. What are the probabilities that you are taking? why they are not $sin^2$ ? Commented Feb 16, 2022 at 19:49

I will try to answer myself - please correct me if I am wrong Let's take a simple stabilizer, that collapses to eigenstates of $$ZZ$$ measurement, and deal with X errors, in only 2 data qubits.

After first stabilization, we will have $$|00⟩+ |11⟩$$ on the 2 data qubits (ancilla is measured as zero)

After coherent error of the form $$E=(\sqrt{1-e_1^2} I+e_1 X)⊗(\sqrt{1-e_2^2} I+e_2 X)$$ the state will be

$$=|0⟩E(|00⟩+ |11⟩)$$

$$=|0⟩(E|00⟩+ E|11⟩)$$

$$=|0⟩((\sqrt{1-e_1^2} I+e_1 X)⊗(\sqrt{1-e_2^2} I+e_2 X)|00⟩+ (\sqrt{1-e_1^2} I+e_1 X)⊗(\sqrt{1-e_2^2} I+e_2 X)|11⟩)$$

$$=|0⟩((\sqrt{1-e_1^2} |0⟩+e_1 |1⟩)⊗(\sqrt{1-e_2^2}|0⟩+e_2|1⟩)+ (\sqrt{1-e_1^2}|1⟩+e_1 |0⟩)⊗(\sqrt{1-e_2^2}|1⟩+e_2|0⟩))$$

$$=|0⟩((\sqrt{1-e_1^2} \sqrt{1-e_2^2}+e_1 e_2 )|00⟩+(\sqrt{1-e_1^2}e_2+e_1 \sqrt{1-e_2^2})|01⟩+(e_1 \sqrt{1-e_2^2}+\sqrt{1-e_1^2} e_2 )|10⟩+(e_1 e_2+\sqrt{1-e_1^2} \sqrt{1-e_2 })|11⟩)$$

$$=|0⟩[(e_1 \sqrt{1-e_2 }+\sqrt{1-e_1^2} e_2 )(|01⟩+|10⟩)+(e_1 e_2+\sqrt{1-e_1^2} \sqrt{1-e_2^2})(|00⟩+|11⟩)]$$

After one more stabilization, we will collape:

$$p=(e_1 \sqrt{1-e_2^2 }+\sqrt{1-e_1^2} e_2 )^2 , to- |01⟩+|10⟩$$ $$p=(e_1 e_2+\sqrt{1-e_1^2} \sqrt{1-e_2^2})^2 , to- |00⟩+|11⟩$$

which is NOT like saying that $$X_1$$ will happen in $$p=e_1^2$$ and $$X_2$$ in $$p=e_2^2$$ which looks like:

$$p=(e_1 \sqrt{1-e_2^2})^2+(\sqrt{1-e_1^2} e_2 )^2 , to- |01⟩+|10⟩$$ $$p=(e_1 e_2)^2+(\sqrt{1-e_1^2} \sqrt{1-e_2^2})^2 , to- |00⟩+|11⟩$$

The coherent case has term of:

$$+2e_1e_2\sqrt{1-e_2^2}\sqrt{1-e_1^2}$$ in both flip and non-flip, this term does not exist in the non-coherent case

Where the coherent in the worst case is twice bigger than the twirl in this case:

So, it seems like the right thing to do, if one wants to convert the coherent error, into non coherent error, is:

1. to calculate the matrix $$E$$
2. decompose is into terms like $$a_{ijk}XXZ$$
3. group the terms that give the same eigen states of the stabilizer (e.g. $$XI$$ and $$IX$$, also $$II$$ and $$XX$$)
4. use the terms of each group, to operate with probabilities,in only one operator (e.g. use the group terms of $$XI$$ and $$IX$$ to make only $$XI$$

It is sure complicated with surface code, but I think this is the general way to solve it.