I am following Litinsky's paper explaining the 15-to-1 distillation protocol.

The usual "trick" done to distill, say the $|T \rangle \equiv T |+ \rangle$ magic state, is to use a code admitting a transversal $T$ gate. Basically we start by encoding $|+\rangle$ (only Clifford operations are needed), then we implement the transversal $T$ and we finally decode the state and reject it if an error has been detected.

If Clifford operations are perfect, the only errors could have been introduced during the transversal $T$. Yet, because it is precisely transversal, one fault can only introduce one error. A code of distance $3$ being able to detect $2$ errors we can guarantee a fidelity of order $p^3$ from $T$ gates having a fault rate of order $p$. For instance, the error rate of the magic state can be reduced from $p$ to $35 p^3$ if one uses the 15-to-1 distillation protocol.

The thing which confuses me is that when we move the Clifford toward the final measurements, the operations we need to do are no longer transversal. Why doesn't it break the previous reasonning?

In practice we have the following equality:

enter image description here

Which can then give the even simpler circuit (the last $10$ qubits can be removed).

enter image description here

In this last circuit, a single failure of the green operations can introduce errors on more than a single-qubit (because we are doing many-body interactions).

My question: Doesn't the commutation rule we use break the transversality aspect? Why is the probability of error of the output magic state reduced from $p$ to $35p^3$ still valid in this case?

[edit]: Regarding the answer and comment below it, I am not sure to understand how single gate failure can always be detected. In the image below, I assume that the blue "gate" introduces a $Z$ error on the last qubit only. This error commutes toward the end of the circuit and introduces an error only on the magic state. Hence it would in principle be undetected (but modify the magic state). Why cannot such thing happen?

enter image description here

  • $\begingroup$ The error model of these circuits is that you can only introduce errors that match the T gates. There is no T gate applied to only the last qubit, so you can't just introduce a Z error acting on only the last qubit. You have to build it out of errors on the observables being phased. The justification for this error model is that everything except the T gates is being protected by the underlying surface code. $\endgroup$ Aug 29, 2023 at 16:37
  • $\begingroup$ Is there any paper where this thing is explained? If I understand you correctly you mean that if $\exp(-i \pi/8 Z_1 Z_2)$ has an error, the only thing that surface code could not natively protect would be $Z_1 Z_2$. If $Z_1$ or $Z_2$ occur "alone", the event would be fixed by the surface code. I am not sure to see why. $\endgroup$ Aug 29, 2023 at 16:53
  • 1
    $\begingroup$ In this circuit, errors come from two places: problems during the t-state injection, and problems executing the factory. The surface code is responsible for protecting against errors that occur while executing the factory, while the distillation is responsible for protecting against errors injecting the t-states. When analyzing these circuits, you are typically focusing on the distillation, and so focus on the errors it is responsible for, requiring the other errors to be sufficiently suppressed by the surface code as to be ignorable. $\endgroup$ Aug 29, 2023 at 17:07
  • $\begingroup$ @CraigGidney ok I think I get it. Could you tell me if I am right in what follows? Under the assumption that the only "wrong" thing that can happen is the magic state preparation, one can show that if the magic state is $a|0\rangle+b|1\rangle$ instead of $|0\rangle+e^{-i \pi/4 }|1\rangle$, then $\exp(-i P \pi/8)$ will be implemented with an error that is proportional to some operator $\alpha I + \beta P$ for some $\alpha, \beta$. This operator is not necessarily unitary [...] $\endgroup$ Sep 10, 2023 at 12:17
  • $\begingroup$ By error discretization principle we can then assume that any of the $\exp(-i P \pi/8)$ gate failing can only introduce an error equal to $P$. Finally, the reason why we assume that the only possible errors are the ones related to magic state preparation is because by increasing the code distance as much as we want, the multi-Pauli measurements can be done as good as we like. Does my explanation makes sense to you? The thing I did not find obvious was that a failure of $\exp(-i P \phi)$ due to bad magic state necessarily gives $\alpha I + \beta P$: it seems to be the case after calculation. $\endgroup$ Sep 10, 2023 at 12:18

1 Answer 1


We don't actually care about the fact that the T gates are "transversal". That's just a way of explaining why the circuit works. The underlying thing we care about is the fact that replacing any two T gates (or any one T gate) with Z*T is detected as an error. And that there are only 35 ways of replacing 3 T gates with Z*T that are undetected.

Rearranging the circuit makes it "not transversal", but it preserves what errors are detected. And it preserves the fact that a correct T state comes out, assuming no Pauli errors are added to the circuit. Those are the properties that actually matter. Daniel discusses this perspective in his talk at QEC'2019:

I used to think about magic state distillation as something that is based on an on an error correcting code with a transversal T gate but nowadays I really prefer to think of distillation purely in terms of circuits [...] The way I think about distillation nowadays is the following. If you express your circuits in terms of sequences of PI over eight rotations there are certain sequences that are equivalent to doing nothing.

Thinking of distillation factories as being based on codes is in many ways a limiting perspective. Distillation factories are based on circuit identities involving non-Clifford gates with detected errors. Codes with transversal gates are just one way of discovering these circuit identities.

In fact, you can go even further than Daniel's rewrite and find a version that only uses 4 qubits!

enter image description here

You can confirm, by following the link to the simulator and adding -1 phases to the sqrt(i) phases, that any pair of errors is still detected. And the display at the end shows that a T state is output. This is another distillation identity, from the same family of 15-to-1 identities.

Here's an example showing this circuit reduces a consistent 10 degree overrotation to a 2.6 degree overrotation (same as the normal circuit). This is only a 4x reduction, but that's because 10 degrees is an enormous starting error. 1 degree of overrotation would be distilled 100x, to below 0.01 degrees of overrotation, but you can't see this easily in the simulator due to the precision used in its displays.

  • $\begingroup$ Thanks, this is very useful to know. The thing that still confuses me is that the reasoning seems to assume that if $P_{\phi}=\exp{-i P \phi}$ fails ($\phi=\pi/4$), then we necessarily introduce a Pauli error $P$ (it is shown on his slides on his video). How are we sure of this? For instance, at mn 21:19 of his video, why couldn't we have an error that only applies some Pauli (say $Z$) on the top qubit, but leaves intact the last 4 qubits (hence, the error would be undetected)? $\endgroup$ Aug 29, 2023 at 15:24
  • $\begingroup$ @MarcoFellous-Asiani That's not the assumption. The assumption is the errors can be written as a linear combination of Pauli errors, where the leading terms in this expansion have at most 2 Paulis. Errors like rotating every T gate by 1 extra degree are suppressed just fine. In the simulator you can test this by creating a custom gate that's just the matrix exp(i pi/180),0,0,exp(i pi/180) and attaching it to some of the rotations in the circuit. $\endgroup$ Aug 29, 2023 at 15:29
  • $\begingroup$ About quirk: I am sorry but I do not understand your distillation circuit (perhaps it is associated to a paper which explains why your drawing does indeed distill a magic state?). About my original question: I edited the end of my question to give a specific example of what I want to say. Is the error I have drawn "forbidden" for some reason? $\endgroup$ Aug 29, 2023 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.