Skip to main content
KetQat

Appearance

Topic · advanced

Magic State Distillation

How fault-tolerant computers obtain the non-Clifford resource states that make them universal. Covers magic states and injection, why stabilizer mixtures cannot be distilled, the 15-to-1 protocol and its 35 p^3 output error, overhead exponents, factory costs, cultivation and constant-overhead constructions.

ExpositionMachine-checkedUpdated 2026-12-01 · last verified 2026-12-01

AI-assisted text, machine-checked, not yet reviewed by a person. Citations resolve and an automated pass compared the statements with the cited sources. That is not peer review; check the sources for anything you depend on.

Overview

Most quantum error-correcting codes used in practice, the surface code above all, implement the Clifford group fault-tolerantly and cheaply, and no code implements a universal gate set transversally (see logical gates). Clifford circuits alone are classically simulable, so something else must supply the missing non-Clifford gate. The standard answer is to prepare a special resource state, a magic state such as the T state or the CCZ state, and to consume it by gate teleportation (Gottesman and Chuang).

A magic state prepared directly on an encoded qubit (by state injection) carries an error comparable to the physical error rate, far too large for a long computation. Magic state distillation (Bravyi and Kitaev; Knill) uses only Clifford operations and measurements to turn many noisy copies into fewer, much better ones. The regions of a fault-tolerant computer that do this are called magic state factories, and their cost has long been one of the main inputs to resource estimates.

Intuition

Clifford operations on an error-corrected machine are reliable but "flat": they can never create magic, only move it around. A noisy T state is a little bit of magic mixed with noise. Distillation exploits a code that has a transversal TT gate. Feed fifteen noisy T states into the fifteen qubits of such a code, and the noise becomes a pattern of ZZ errors on the block. The code's checks catch every pattern of one or two errors; the block is thrown away when a check fires. Only a pattern of three or more errors in a specific arrangement slips through, so an input error rate pp becomes roughly 35p335 p^{3}. Repeating the procedure on its own outputs drives the error down doubly exponentially in the number of rounds.

There is a limit. If the noisy input is so bad that it could have been produced by randomly choosing stabilizer states, no Clifford procedure can extract magic from any number of copies. Distillation therefore has a threshold input quality, and the price of each output grows only polylogarithmically with the target accuracy.

Prerequisites

Stabilizer codes, the Clifford group and the Clifford hierarchy, gate teleportation, and the idea of fault-tolerant gadgets. The Hamming code and Reed–Muller codes appear in the analysis.

Mathematical Definitions

DefinitionStabilizer operations and magicEstablished definition

Consider nn qubits (or nn systems of prime dimension pp). A pure stabilizer state is a state U∣0⟩⊗nU \ket{0}^{\otimes n} with UU in the Clifford group, the group of unitaries that map Pauli operators to Pauli operators under conjugation. The stabilizer polytope STABn\mathrm{STAB}_n is the convex hull of the pure stabilizer states; these are the free states. A state outside STABn\mathrm{STAB}_n is a magic state.

Stabilizer operations are the channels generated by

  • preparing ancillas in ∣0⟩\ket{0},
  • Clifford unitaries,
  • measurements of Pauli operators,
  • discarding subsystems,
  • choosing any of the above at random or conditioned on earlier measurement outcomes.

They map STAB\mathrm{STAB} into STAB\mathrm{STAB}. This is the framework of Veitch, Mousavian, Gottesman and Emerson. Its motivation is computational. By the Gottesman–Knill theorem a circuit of stabilizer operations acting on stabilizer states can be simulated efficiently on a classical computer (section 10.5.4 of Nielsen and Chuang), whereas Bravyi and Kitaev showed that stabilizer operations supplemented with a supply of suitable single-qubit magic states are universal for quantum computation and that such states can be distilled from noisy copies. In fault-tolerant architectures stabilizer operations are the comparatively cheap ones, so magic is the costly resource (see Magic State Distillation).

Monotones in use include:

  • for odd prime dimension, the mana, the logarithm of the sum of absolute values of the discrete Wigner function of the state, and the relative entropy of magic (Veitch and co-authors); states with a non-negative Wigner function cannot be distilled to pure magic states by stabilizer operations;
  • for qubits, the robustness of magic
R(ρ)  =  min⁡{∑i∣xi∣  :  ρ=∑ixi σi,  σi pure stabilizer states, xi∈R},\mathcal{R}(\rho) \;=\; \min \Big\{ \sum_i \abs{x_i} \;:\; \rho = \sum_i x_i\, \sigma_i ,\ \ \sigma_i \ \text{pure stabilizer states},\ x_i \in \R \Big\} ,

introduced by Howard and Campbell. It equals 1 exactly on STAB\mathrm{STAB}, is submultiplicative under tensor products, and controls the sampling overhead of a classical simulation that replaces magic states by quasi-probability mixtures of stabilizer states.

DefinitionT state and state injectionEstablished definition

With T=diag⁡(1,eiπ/4)T = \operatorname{diag}(1, e^{i\pi/4}), the T state is

∣T⟩  =  T∣+⟩  =  12(∣0⟩+eiπ/4∣1⟩).\ket{T} \;=\; T\ket{+} \;=\; \frac{1}{\sqrt{2}} \left( \ket{0} + e^{i\pi/4} \ket{1} \right) .

It is the +1+1 eigenstate of the Clifford operator A=e−iπ/4SX=(X+Y)/2A = e^{-i\pi/4} S X = (X + Y)/\sqrt{2}, and it is not a stabilizer state, so it is a magic state in the sense of stabilizer operations. It is related by a Clifford gate to the +1+1 eigenstate of the Hadamard gate; in the terminology of Bravyi and Kitaev both are H-type magic states.

Injection. One copy of ∣T⟩\ket{T} and stabilizer operations implement the TT gate on an arbitrary qubit ∣ψ⟩=a∣0⟩+b∣1⟩\ket{\psi} = a\ket{0} + b\ket{1}. Apply a CNOT controlled on the data qubit with the ∣T⟩\ket{T} qubit as target and measure the target in the ZZ basis. Outcome 0 leaves the data qubit in a∣0⟩+eiπ/4b∣1⟩=T∣ψ⟩a\ket{0} + e^{i\pi/4} b\ket{1} = T\ket{\psi}. Outcome 1 leaves it in T†∣ψ⟩T\dagg \ket{\psi} up to a phase, and applying SS gives T∣ψ⟩T\ket{\psi}. The two outcomes are equally likely. This is an instance of the gate teleportation of Gottesman and Chuang.

Noisy T states. Applying AA with probability 1/21/2 maps any single-qubit state ρ\rho to

ρ′  =  (1−p) ∣T⟩⟨T∣  +  p  Z∣T⟩⟨T∣Z,p=1−⟨T∣ρ∣T⟩,\rho' \;=\; (1 - p)\, \ketbra{T}{T} \;+\; p\; Z \ketbra{T}{T} Z , \qquad p = 1 - \bra{T} \rho \ket{T} ,

because AA has eigenvectors ∣T⟩\ket{T} and Z∣T⟩Z\ket{T} and the random application removes the off-diagonal terms in that basis. The fidelity with ∣T⟩\ket{T} is unchanged. A noisy T state can therefore be treated as an ideal one that suffers a ZZ error with probability pp, and injecting it applies TT followed by ZZ with probability pp. The number pp is the error rate of the magic state.

DefinitionCCZ stateEstablished definition

With CCZ=I−2∣111⟩⟨111∣\mathrm{CCZ} = I - 2\ketbra{111}{111}, the CCZ state is

∣CCZ⟩  =  CCZ ∣+⟩⊗3  =  122∑a,b,c∈{0,1}(−1)abc∣abc⟩.\ket{\mathrm{CCZ}} \;=\; \mathrm{CCZ}\, \ket{+}^{\otimes 3} \;=\; \frac{1}{2\sqrt{2}} \sum_{a,b,c \in \{0,1\}} (-1)^{abc} \ket{abc} .

CCZ\mathrm{CCZ} is in the third level of the Clifford hierarchy: it maps each Pauli operator to a Clifford operator under conjugation (for example CCZ X1 CCZ†=X1 CZ23\mathrm{CCZ}\, X_1\, \mathrm{CCZ}\dagg = X_1\, \mathrm{CZ}_{23}). Consequently one copy of ∣CCZ⟩\ket{\mathrm{CCZ}}, consumed by gate teleportation (Gottesman and Chuang), applies a CCZ gate to three data qubits with only Clifford corrections chosen by measurement outcomes. Conjugating a target by Hadamard gates turns CCZ into a Toffoli gate.

A CCZ gate can be built from TT gates and Clifford gates; with an ancilla and a measurement, four TT gates suffice for a Toffoli gate, against seven in the standard ancilla-free circuit (Jones). Factories that output CCZ states directly can be cheaper per Toffoli than factories for four separate T states. Gidney and Fowler also give a catalysed conversion that turns one CCZ state into two T states, using one extra T state that is returned at the end.

Theorems

No distillation from stabilizer mixtures

TheoremStabilizer operations preserve the stabilizer polytopeEstablished result

Let ρ1,…,ρm\rho_1, \dots, \rho_m be states with ρj∈STABnj\rho_j \in \mathrm{STAB}_{n_j}, and let a protocol built from stabilizer operations act on ρ1⊗⋯⊗ρm\rho_1 \otimes \dots \otimes \rho_m and on ancillas prepared in ∣0⟩\ket{0}. For every sequence oo of measurement outcomes that occurs with non-zero probability, the normalised state of the remaining qubits conditioned on oo lies in STAB\mathrm{STAB}. Consequently the unconditioned output, and the output conditioned on any accepting set of outcomes (post-selection), also lies in STAB\mathrm{STAB}.

Corollary (no distillation from free states). If a noisy resource state ρ\rho lies in STAB1\mathrm{STAB}_1, then no stabilizer protocol consuming any number of copies of ρ\rho outputs a state whose fidelity with a target state ∣ψ⟩\ket{\psi} exceeds max⁡σ∈STAB⟨ψ∣σ∣ψ⟩\max_{\sigma \in \mathrm{STAB}} \bra{\psi}\sigma\ket{\psi}. In particular a distillation protocol for magic states can only work on inputs that lie outside the stabilizer polytope. This is the observation behind the threshold analysis of Bravyi and Kitaev and the resource-theory framework of Veitch and co-authors. For the TT state the boundary is computed in equation/stabilizer-fidelity-bound-for-the-t-state.

Holds when
  • Qubits; STABn\mathrm{STAB}_n is the convex hull of the nn-qubit pure stabilizer states U∣0⟩⊗nU\ket{0}^{\otimes n}, UU Clifford.
  • Stabilizer operations are those generated by preparing ∣0⟩\ket{0}, Clifford unitaries, Pauli measurements, discarding qubits, and classical randomness and feed-forward based on earlier outcomes, all noiseless.
Proof · Proof that stabilizer operations preserve the stabilizer polytope

We use the standard fact that an nn-qubit state is a pure stabilizer state exactly when it is the unique joint +1+1 eigenvector of an abelian group SS of 2n2^{n} Pauli operators (with signs) not containing −I-I, generated by nn independent elements, and that then ∣ψ⟩⟨ψ∣=2−n∑g∈Sg\ketbra{\psi}{\psi} = 2^{-n} \sum_{g \in S} g (Gottesman; Aaronson and Gottesman). Such an SS is a maximal abelian subgroup: a Hermitian Pauli operator that commutes with every element of SS lies in ±S\pm S.

Step 1: elementary operations on pure stabilizer states.

  • Tensor products and ancillas. If ∣ψ⟩=U∣0⟩⊗n\ket{\psi} = U\ket{0}^{\otimes n} and ∣ϕ⟩=V∣0⟩⊗k\ket{\phi} = V \ket{0}^{\otimes k} with U,VU, V Clifford, then ∣ψ⟩⊗∣ϕ⟩=(U⊗V)∣0⟩⊗(n+k)\ket{\psi}\otimes\ket{\phi} = (U \otimes V)\ket{0}^{\otimes(n+k)} and U⊗VU \otimes V is Clifford. Adding an ancilla ∣0⟩\ket{0} is the case V=IV = I.
  • Clifford unitaries. WU∣0⟩⊗nW U \ket{0}^{\otimes n} is a stabilizer state because WUWU is Clifford.
  • Pauli measurement. Measure a Hermitian Pauli operator PP on ∣ψ⟩\ket{\psi} with stabilizer group SS. If P∈±SP \in \pm S the outcome is deterministic and the state is unchanged. Otherwise PP fails to commute with some element of SS (by maximality), so it anticommutes with some g1∈Sg_1 \in S; choose generators g1,…,gng_1, \dots, g_n of SS such that g2,…,gng_2, \dots, g_n commute with PP (multiply any generator that anticommutes with PP by g1g_1). Each outcome s=±1s = \pm 1 occurs with probability 1/21/2, and the post-measurement state (I+sP)∣ψ⟩/∥(I+sP)∣ψ⟩∥(I + sP)\ket{\psi}/\norm{(I + sP)\ket{\psi}} is stabilized by sP,g2,…,gnsP, g_2, \dots, g_n, which are nn independent commuting Pauli operators. So it is again a pure stabilizer state.
  • Discarding qubits. Split the qubits as ABA B with nA+nB=nn_A + n_B = n. Since every non-identity Pauli operator is traceless, Tr⁡B∣ψ⟩⟨ψ∣=2−nA∑g∈SAg\tr_B \ketbra{\psi}{\psi} = 2^{-n_A} \sum_{g \in S_A} g, where SAS_A consists of the restrictions to AA of those g∈Sg \in S that act as the identity on BB. SAS_A is an abelian group of Pauli operators on AA without −I-I; let it have rr independent generators, so ∑g∈SAg=2r Π\sum_{g \in S_A} g = 2^{r}\, \Pi with Π\Pi the projector onto its joint +1+1 eigenspace, of dimension 2nA−r2^{n_A - r}. Extend the generators by nA−rn_A - r further independent Pauli operators h1,…,hnA−rh_1, \dots, h_{n_A - r} that commute with SAS_A and with each other (for example logical ZZ operators of the stabilizer code SAS_A). Then Π=∑t∈{±1}nA−r∣ψt⟩⟨ψt∣\Pi = \sum_{t \in \{\pm 1\}^{n_A - r}} \ketbra{\psi_t}{\psi_t}, where ∣ψt⟩\ket{\psi_t} is the pure stabilizer state stabilized by SAS_A and t1h1,…,tnA−rhnA−rt_1 h_1, \dots, t_{n_A-r} h_{n_A - r}. Therefore Tr⁡B∣ψ⟩⟨ψ∣=2−(nA−r) Π\tr_B \ketbra{\psi}{\psi} = 2^{-(n_A - r)}\, \Pi is the uniform mixture of the 2nA−r2^{n_A - r} states ∣ψt⟩\ket{\psi_t}, an element of STABnA\mathrm{STAB}_{n_A}.

Step 2: mixed inputs. Write each ρj=∑iqi(j)σi(j)\rho_j = \sum_i q^{(j)}_i \sigma^{(j)}_i as a convex combination of pure stabilizer states. Expanding the tensor product, ρ1⊗⋯⊗ρm\rho_1 \otimes \dots \otimes \rho_m is a convex combination of tensor products of pure stabilizer states, which are pure stabilizer states by Step 1. So the input is ρ=∑kqkσk\rho = \sum_k q_k \sigma_k with qk≥0q_k \ge 0, ∑kqk=1\sum_k q_k = 1 and σk\sigma_k pure stabilizer states.

Step 3: induction over the protocol, with post-selection. Each step of the protocol is one of the elementary operations, possibly chosen according to earlier outcomes. Suppose that after some steps, conditioned on the outcome record oo, the state is ρo=∑kqk∣o σk,o\rho_o = \sum_k q_{k|o}\, \sigma_{k,o} with σk,o\sigma_{k,o} pure stabilizer states or elements of STAB\mathrm{STAB}. Apply the next operation, which is determined by oo. A Clifford unitary or an ancilla preparation maps each σk,o\sigma_{k,o} into STAB\mathrm{STAB} by Step 1 and linearity. Discarding qubits is linear and maps each term into STAB\mathrm{STAB}. For a Pauli measurement with outcome ss, let Πs=(I+sP)/2\Pi_s = (I + sP)/2; the conditioned state is

ρo,s  =  ΠsρoΠsTr⁡(Πsρo)  =  ∑kqk∣o Tr⁡(Πsσk,o)Tr⁡(Πsρo)⋅Πsσk,oΠsTr⁡(Πsσk,o),\rho_{o,s} \;=\; \frac{\Pi_s \rho_o \Pi_s}{\tr(\Pi_s \rho_o)} \;=\; \sum_k \frac{q_{k|o}\, \tr(\Pi_s \sigma_{k,o})}{\tr(\Pi_s \rho_o)} \cdot \frac{\Pi_s \sigma_{k,o} \Pi_s}{\tr(\Pi_s \sigma_{k,o})} ,

summing over the terms with Tr⁡(Πsσk,o)>0\tr(\Pi_s \sigma_{k,o}) > 0. The weights are non-negative and sum to one, and each normalised term is in STAB\mathrm{STAB} by Step 1 (applied to the pure components of σk,o\sigma_{k,o} in the same way). So ρo,s\rho_{o,s} is in STAB\mathrm{STAB}. Random choices of operations average conditioned states, which keeps them in the convex set STAB\mathrm{STAB}. By induction the state conditioned on the full outcome record is in STAB\mathrm{STAB}; the unconditioned output, and the output conditioned on any set of accepting records, are convex combinations of these and so lie in STAB\mathrm{STAB} too.

Corollary. σ↦⟨ψ∣σ∣ψ⟩\sigma \mapsto \bra{\psi}\sigma\ket{\psi} is linear, so on the convex set STAB\mathrm{STAB} it is at most its maximum over that set, which bounds the fidelity of every output with ∣ψ⟩\ket{\psi}. □\square

EquationStabilizer fidelity of the T state and the distillability boundaryEstablished result
max⁡σ∈STAB1⟨T∣σ∣T⟩  =  cos⁡2π8  =  2+24≈0.854,p∗  =  sin⁡2π8  =  2−24≈0.146\max_{\sigma \in \mathrm{STAB}_1} \bra{T}\sigma\ket{T} \;=\; \cos^2\frac{\pi}{8} \;=\; \frac{2+\sqrt{2}}{4} \approx 0.854, \qquad p_{*} \;=\; \sin^2\frac{\pi}{8} \;=\; \frac{2-\sqrt{2}}{4} \approx 0.146

Derivation. Write a single-qubit state as σ=(I+rxX+ryY+rzZ)/2\sigma = (I + r_x X + r_y Y + r_z Z)/2. The six Pauli eigenstates have Bloch vectors ±ex,±ey,±ez\pm e_x, \pm e_y, \pm e_z, so STAB1\mathrm{STAB}_1 is the octahedron ∣rx∣+∣ry∣+∣rz∣≤1\abs{r_x} + \abs{r_y} + \abs{r_z} \le 1, the stabilizer octahedron used by Bravyi and Kitaev. The T state has Bloch vector t=(1/2,1/2,0)t = (1/\sqrt{2}, 1/\sqrt{2}, 0), and ⟨T∣σ∣T⟩=(1+r⋅t)/2\bra{T}\sigma\ket{T} = (1 + r \cdot t)/2. A linear function on a polytope is maximised at a vertex; over the six vertices the largest value of r⋅tr \cdot t is 1/21/\sqrt{2}, attained at exe_x and eye_y. Hence the maximum fidelity is (1+1/2)/2=cos⁡2(π/8)(1 + 1/\sqrt{2})/2 = \cos^2(\pi/8).

The twirled noisy state has Bloch vector (1−2p) t(1-2p)\, t. It lies in the octahedron exactly when (1−2p)2≤1(1-2p)\sqrt{2} \le 1, that is p≥(1−1/2)/2=sin⁡2(π/8)p \ge (1 - 1/\sqrt{2})/2 = \sin^2(\pi/8); for p>1/2p > 1/2 the vector points the other way and the same bound applies with pp replaced by 1−p1 - p. By the closure theorem, inputs with p∗≤p≤1−p∗p_* \le p \le 1 - p_* cannot be distilled by any stabilizer protocol.

Comparison. The 15-to-1 protocol improves inputs only below its fixed point p≈0.141p \approx 0.141 (output-error record), slightly below p∗≈0.146p_* \approx 0.146. The bound above is necessary for distillability, not sufficient: it does not say that every input with p<p∗p < p_* can be distilled by some protocol.

Holds when
  • Single qubit; STAB1\mathrm{STAB}_1 is the convex hull of the six eigenstates of XX, YY and ZZ.
  • The noisy T state is the twirled form (1−p)∣T⟩⟨T∣+p Z∣T⟩⟨T∣Z(1-p)\ketbra{T}{T} + p\, Z\ketbra{T}{T}Z of definition/t-state.

Error suppression of 15-to-1

EquationOutput error of 15-to-1 distillationEstablished result
pout  =  1+15 (1−2p)8−15 (1−2p)7−(1−2p)152 [ 1+15 (1−2p)8 ]  =  35 p3+O(p4)p_{\mathrm{out}} \;=\; \frac{1 + 15\,(1-2p)^{8} - 15\,(1-2p)^{7} - (1-2p)^{15}}{2\,\big[\,1 + 15\,(1-2p)^{8}\,\big]} \;=\; 35\,p^{3} + O(p^{4})

Here poutp_{\mathrm{out}} is the probability that the output of 15-to-1 distillation carries a ZZ error, conditioned on acceptance. The probability of acceptance is

Pacc  =  1+15 (1−2p)816  =  1−15 p+O(p2).P_{\mathrm{acc}} \;=\; \frac{1 + 15\,(1-2p)^{8}}{16} \;=\; 1 - 15\,p + O(p^{2}) .

The map p↦poutp \mapsto p_{\mathrm{out}} has a non-trivial fixed point at p≈0.141p \approx 0.141: inputs with a smaller error rate are improved, and iterating the protocol drives the error to zero. The expression and the fixed point are those of Bravyi and Kitaev. The coefficient 35 is the number of weight-3 codewords of the [15,11,3][15,11,3] Hamming code.

When the stabilizer operations are themselves noisy, as in a logical-level implementation at finite code distance, their errors add to poutp_{\mathrm{out}} and set a floor that this formula does not contain.

Holds when
  • Noiseless stabilizer operations.
  • Fifteen independent input T states, each with a ZZ error of probability pp and no other error.
  • The output is kept only when all four XX-type checks of the fifteen-qubit code are satisfied.
Proof · Derivation of the 15-to-1 output error

Notation as in 15-to-1 distillation: MM is the 4×154 \times 15 matrix whose columns are the non-zero vectors of F24\F_2^{4}, and H={e∈F215:Me=0}\mathcal{H} = \{ e \in \F_2^{15} : M e = 0 \} is the [15,11,3][15,11,3] Hamming code.

Reduction to a classical question. After step 2 the block is in the state Z(e) TL†∣+L⟩Z(e)\, T_L\dagg \ket{+_L}, where e∈F215e \in \F_2^{15} marks the inputs that carried a ZZ error; ZZ errors commute with the injected TT gates. The bits of ee are independent with Pr⁡[ej=1]=p\Pr[e_j = 1] = p.

  • Detection. Z(e)Z(e) commutes with the stabilizer X(h)X(h) exactly when h⋅e=0h \cdot e = 0. All four checks are satisfied if and only if Me=0M e = 0, that is e∈He \in \mathcal{H}.
  • Effect of an undetected pattern. The ZZ-type stabilizers are the Z(g)Z(g) with g∈Hg \in \mathcal{H} of even weight. If e∈He \in \mathcal{H} has even weight, Z(e)Z(e) is a stabilizer and the state is unchanged. If e∈He \in \mathcal{H} has odd weight, then e+115e + 1^{15} has even weight and lies in H\mathcal{H}, because the all-ones vector 1151^{15} is in H\mathcal{H} (every row of MM has weight 8); hence Z(e)=Z⊗15Z(e+115)Z(e) = Z^{\otimes 15} Z(e + 1^{15}) acts as the logical Zˉ\bar{Z}.

Therefore, with AwA_w the number of codewords of weight ww in H\mathcal{H},

Pacc=∑wAw pw(1−p)15−w,pout=1Pacc∑w oddAw pw(1−p)15−w.P_{\mathrm{acc}} = \sum_{w} A_w\, p^{w} (1-p)^{15-w} , \qquad p_{\mathrm{out}} = \frac{1}{P_{\mathrm{acc}}} \sum_{w \text{ odd}} A_w\, p^{w} (1-p)^{15-w} .

Leading order. H\mathcal{H} has distance 3, so A1=A2=0A_1 = A_2 = 0. A weight-3 codeword is a set of three distinct columns of MM that sum to zero. Choosing two distinct columns a,ba, b determines the third, a+ba + b, which is non-zero and differs from both; each set is counted 3!=63! = 6 times among the 15⋅1415 \cdot 14 ordered pairs, so A3=15⋅14/6=35A_3 = 15 \cdot 14 / 6 = 35. Since A0=1A_0 = 1,

Pacc=(1−p)15+O(p3)=1−15p+O(p2),pout=35 p3+O(p4).P_{\mathrm{acc}} = (1-p)^{15} + O(p^{3}) = 1 - 15 p + O(p^{2}) , \qquad p_{\mathrm{out}} = 35\, p^{3} + O(p^{4}) .

Exact expression. The dual of H\mathcal{H} is the row space of MM, the [15,4,8][15,4,8] simplex code, with weight enumerator 1+15y81 + 15 y^{8}. The MacWilliams identity gives

W(x)  =  ∑wAwxw  =  116[(1+x)15+15 (1+x)7(1−x)8].W(x) \;=\; \sum_{w} A_w x^{w} \;=\; \frac{1}{16} \Big[ (1+x)^{15} + 15\, (1+x)^{7} (1-x)^{8} \Big] .

Put x=p/(1−p)x = p/(1-p), so that (1−p)(1+x)=1(1-p)(1 + x) = 1 and (1−p)(1−x)=1−2p(1-p)(1 - x) = 1 - 2p. Then

Pacc=(1−p)15 W(x)=1+15 (1−2p)816,(1−p)15 W(−x)=(1−2p)15+15 (1−2p)716.P_{\mathrm{acc}} = (1-p)^{15}\, W(x) = \frac{1 + 15\,(1-2p)^{8}}{16} , \qquad (1-p)^{15}\, W(-x) = \frac{(1-2p)^{15} + 15\,(1-2p)^{7}}{16} .

The odd-weight part of the sum is (1−p)15 [W(x)−W(−x)]/2(1-p)^{15}\,[W(x) - W(-x)]/2, so

pout=W(x)−W(−x)2 W(x)=1+15 (1−2p)8−15 (1−2p)7−(1−2p)152 [1+15 (1−2p)8].p_{\mathrm{out}} = \frac{W(x) - W(-x)}{2\, W(x)} = \frac{1 + 15\,(1-2p)^{8} - 15\,(1-2p)^{7} - (1-2p)^{15}}{2\,\big[ 1 + 15\,(1-2p)^{8} \big]} .

As a check, expanding the numerator in u=1−2pu = 1 - 2p about u=1u = 1: its value and its first two derivatives vanish there and its third derivative is 5040−3150−2730=−8405040 - 3150 - 2730 = -840, so the numerator is −140 (u−1)3+⋯=1120 p3+…-140\,(u-1)^{3} + \dots = 1120\, p^{3} + \dots, and dividing by the denominator 32+O(p)32 + O(p) gives 35 p335\, p^{3}.

Overhead of iterated distillation

EquationMagic state distillation overhead exponentEstablished result
C(ε)  =  O ⁣(log⁡γ(1/ε)),γ  =  log⁡(n/k)log⁡dC(\varepsilon) \;=\; O\!\big( \log^{\gamma}(1/\varepsilon) \big), \qquad \gamma \;=\; \frac{\log (n/k)}{\log d}

C(ε)C(\varepsilon) is the number of noisy input magic states consumed per output state of error rate at most ε\varepsilon, for a fixed input error rate below threshold. The parametrisation by γ\gamma is due to Bravyi and Haah.

Derivation. After rr rounds the error obeys pr≤c pr−1 dp_{r} \le c\, p_{r-1}^{\,d}. With c′=c1/(d−1)c' = c^{1/(d-1)} this reads c′pr≤(c′pr−1)dc' p_r \le (c' p_{r-1})^{d}, so c′pr≤(c′p)drc' p_r \le (c' p)^{d^{r}}. Each round consumes n/kn/k inputs per output, so rr rounds consume (n/k)r(n/k)^{r}. The target pr≤εp_r \le \varepsilon is met once dr≥ln⁡(1/c′ε)/ln⁡(1/c′p)d^{r} \ge \ln(1/c'\varepsilon) / \ln(1/c'p), and since (n/k)r=(dr)log⁡d(n/k)(n/k)^{r} = (d^{r})^{\log_d (n/k)}, the smallest such rr gives

C(ε)  ≤  (d⋅ln⁡(1/c′ε)ln⁡(1/c′p))γ,γ=log⁡dnk.C(\varepsilon) \;\le\; \left( d \cdot \frac{\ln (1/c'\varepsilon)}{\ln (1/c'p)} \right)^{\gamma} , \qquad \gamma = \log_d \frac{n}{k} .

Values.

Protocol Code parameters γ\gamma
15-to-1 (Bravyi and Kitaev) [[15,1,3]][[15,1,3]] log⁡315≈2.46\log_3 15 \approx 2.46
10-to-2 (Meier, Eastin and Knill) 10 inputs, 2 outputs, d=2d = 2 log⁡25≈2.32\log_2 5 \approx 2.32
Triorthogonal family (Bravyi and Haah) [[3k+8,k,2]][[3k+8, k, 2]] →log⁡23≈1.58\to \log_2 3 \approx 1.58
Multilevel (Jones) concatenated, 2r+12^{r}+1 inputs for error O(p2r)O(p^{2^{r}}) →1\to 1
Punctured Reed–Muller (Hastings and Haah) block length about 2582^{58} for γ<1\gamma < 1 <0.678< 0.678
Qudit codes (Krishna and Tillich) qudits of growing dimension →0\to 0
Algebraic-geometry codes (Wills, Hsieh and Yamasaki) qubits, via 2102^{10}-dimensional qudits 00

A value γ=0\gamma = 0 means a constant number of inputs per output, independent of ε\varepsilon. The exponent describes asymptotic input counts only; it says nothing about the size of the blocks needed or the cost of the Clifford operations.

Holds when
  • Noiseless stabilizer operations and independent inputs of error rate pp.
  • One round maps nn inputs of error pp to kk outputs of error at most c pdc\,p^{d}, and the input error is below the protocol's threshold, c1/(d−1)p<1c^{1/(d-1)} p < 1.
  • Outputs of one round are fed to the next in such a way that the inputs of each block remain independent; rejection probabilities are neglected, which is valid at leading order.

Worked Examples

Two rounds of 15-to-1 from p=10−3p = 10^{-3}

Take inputs with error rate p=10−3p = 10^{-3} and assume ideal Clifford operations.

Round 1. The leading-order output error is 35p3=35×10−9=3.5×10−835 p^{3} = 35 \times 10^{-9} = 3.5 \times 10^{-8}. The acceptance probability from the exact expression is (1+15 (0.998)8)/16(1 + 15\,(0.998)^{8})/16. Since 0.9988=0.984110.998^{8} = 0.98411, this is (1+14.762)/16=0.9851(1 + 14.762)/16 = 0.9851, so an accepted output costs on average 15/0.9851=15.2315 / 0.9851 = 15.23 inputs.

Round 2. Fifteen round-1 outputs give 35×(3.5×10−8)3=35×4.29×10−23=1.5×10−2135 \times (3.5 \times 10^{-8})^{3} = 35 \times 4.29 \times 10^{-23} = 1.5 \times 10^{-21}, accepted with probability 1−15×3.5×10−8≈11 - 15 \times 3.5 \times 10^{-8} \approx 1. One output costs about 15×15.23=22815 \times 15.23 = 228 raw inputs.

Reading the result. A computation with 10910^{9} T gates that should fail with probability below 1% needs output error about 10−1110^{-11}. One round (3.5×10−83.5 \times 10^{-8}) is not enough and two rounds overshoot by ten orders of magnitude. This mismatch is why practical factories mix protocols and code distances rather than iterate one protocol, and why the two-level factory of Litinski described below targets 2.6×10−112.6 \times 10^{-11}.

The distillation boundary for the T state

A dephased T state with error rate pp has Bloch vector (1−2p)(1/2,1/2,0)(1-2p)(1/\sqrt{2}, 1/\sqrt{2}, 0). At p=0.15p = 0.15 the coordinates sum to 0.7×2=0.990<10.7 \times \sqrt{2} = 0.990 < 1, so the state is inside the stabilizer octahedron and cannot be distilled by any protocol. At p=0.14p = 0.14 the sum is 0.72×2=1.018>10.72 \times \sqrt{2} = 1.018 > 1: the state is magic, and it is just below the 15-to-1 fixed point p≈0.141p \approx 0.141, so 15-to-1 improves it, slowly. Between 0.1410.141 and 0.1460.146 the state is magic but 15-to-1 makes it worse.

Algorithms and Implementations

The 15-to-1 protocol

Algorithm15-to-1 magic state distillationEstablished result

The code. Let MM be the 4×154 \times 15 binary matrix whose columns are the 15 non-zero vectors of F24\F_2^{4}. The [[15,1,3]][[15,1,3]] punctured Reed–Muller code has XX-type stabilizers X(h)=∏jXjhjX(h) = \prod_j X_j^{h_j} for hh in the row space of MM (four generators of weight 8), ZZ-type stabilizers Z(g)Z(g) for every even-weight gg with Mg=0M g = 0 (ten generators), and logical operators Xˉ=X⊗15\bar{X} = X^{\otimes 15}, Zˉ=Z⊗15\bar{Z} = Z^{\otimes 15}. Every basis string in ∣0L⟩\ket{0_L} has weight 0 or 8 and every basis string in ∣1L⟩\ket{1_L} has weight 7 or 15, so T⊗15T^{\otimes 15} acts as the logical T†T\dagg.

Input. Fifteen noisy T states of error rate pp.

Procedure.

  1. Prepare the encoded state ∣+L⟩\ket{+_L} with stabilizer operations.
  2. Apply TT to each of the 15 qubits by state injection, consuming one input state per qubit. With ideal inputs the block is now in TL†∣+L⟩T_L\dagg \ket{+_L}; an input with a ZZ error leaves a ZZ error on its qubit.
  3. Measure the four XX-type stabilizer generators. If any outcome is −1-1, discard the block and start again.
  4. Decode the block onto a single qubit with a Clifford circuit and apply SS, which maps T†∣+⟩T\dagg\ket{+} to ∣T⟩\ket{T}.

Output. One T state with error rate pout=35p3+O(p4)p_{\mathrm{out}} = 35 p^{3} + O(p^{4}), produced with probability 1−15p+O(p2)1 - 15 p + O(p^{2}); see the output-error record for the exact expressions and their derivation.

Why it works. Only ZZ errors occur. A pattern of ZZ errors passes the checks exactly when it is a codeword of the [15,11,3][15,11,3] Hamming code, and it harms the output exactly when that codeword has odd weight. The lightest such patterns have weight 3, and there are 35 of them.

Equivalent form. Bravyi and Kitaev describe the protocol as measuring the stabilizers of the code directly on the fifteen input states and decoding. The encode-then-inject form above is the one used by Bravyi and Haah for general codes with a transversal TT and gives the same output error.

Cost. Fifteen inputs per attempt and, for small pp, close to fifteen per output. Repeating the protocol on its own outputs for rr rounds cubes the error each time and uses 15r15^{r} inputs per output; the resulting scaling is the distillation overhead exponent with γ=log⁡315≈2.46\gamma = \log_3 15 \approx 2.46.

Holds when
  • Stabilizer operations (Clifford gates, Pauli preparations and measurements) are noiseless.
  • The fifteen input states are independent, each a T state with a ZZ error of probability pp (the twirled form).

Other codes

The 15-to-1 protocol is one member of a broader recipe: any code with a transversal gate from the third level of the Clifford hierarchy, combined with post-selection on its stabilizers, distils the corresponding magic state, and the output error is of order pdp^{d} where dd is the code's distance against the relevant errors. Bravyi and Haah introduced triorthogonal codes, a family of [[3k+8,k,2]][[3k+8, k, 2]] codes with transversal TT that output kk states per block with quadratic error suppression, lowering the overhead exponent towards log⁡23≈1.58\log_2 3 \approx 1.58. Meier, Eastin and Knill give a ten-input, two-output protocol based on a four-qubit code. Jones concatenates such codes so that the exponent approaches 1, and Haah, Hastings, Poulin and Wecker give a family with constant space overhead and an input count that scales linearly in log⁡(1/ε)\log(1/\varepsilon), up to log⁡log⁡\log\log factors, without concatenation. The distillation idea also applies directly to multi-qubit resource states: protocols that output CCZ states can replace four T states per Toffoli gate (Jones; Gidney and Fowler).

Factories at the logical level

In a real machine every qubit of a distillation circuit is itself a logical qubit, for example a surface-code patch, and the Clifford operations are carried out by lattice surgery. The relevant cost is then the space-time volume of the factory per output state. Two observations reduced that cost substantially:

  • Not every qubit needs full distance. The output state only has to be as good as the algorithm requires, and errors that the distillation checks themselves detect only need to be suppressed weakly. Litinski encodes the qubits of a 15-to-1 circuit at different, mostly small, distances. Under circuit-level noise with physical error rate 10−310^{-3}, his (15-to-1)17,7,7(15\text{-to-}1)_{17,7,7} factory outputs states with error 4.5×10−84.5 \times 10^{-8} using 4,620 physical qubits and 42.6 code cycles per state, and a two-level design reaches 2.6×10−112.6 \times 10^{-11} with 46,800 qubits and 157 cycles. He concludes that distillation is not the dominant cost of a surface-code computer.
  • Distil the gate you need. Gidney and Fowler lay out a CCZ factory with a footprint of 12d×6d12d \times 6d that emits one CCZ state every 5.5d5.5d code cycles, where dd is the code distance.

O'Gorman and Campbell give an earlier detailed account of factory footprints under realistic noise. The number of factories a computation needs is set by matching their output rate to the rate at which the algorithm consumes magic states; see resource estimation.

Limitations and Common Pitfalls

  • 35p335 p^{3} assumes perfect Clifford operations. At the logical level, faults in the distillation circuit add terms that are not cubic in pp; the logical error rate of the factory's own qubits sets a floor. The circuit-level factory numbers quoted on this page include these effects; the formula does not.
  • The input error is not the physical error rate. It is the error of the injected logical state, which depends on the injection circuit. With careful post-selection an injected state can be better than the gates that made it (Li).
  • Overhead exponents are asymptotic. A small γ\gamma says nothing about block size or about the cost of the Clifford circuit; protocols with record exponents use very large blocks.
  • Only ZZ-type errors are handled by the twirl. The single-parameter error model relies on twirling the input; without it, the analysis must track other error components.
  • Counting T gates is not counting cost. Throughput, latency and the code distance of the consuming computation all enter; a factory that is cheap in volume but slow can stall the algorithm.

State of the Art

As of 2026-11:

  • Cultivation. Gidney, Shutty and Jones (preprint, 2024) grow a single T state inside a surface-code patch, checking it repeatedly while enlarging the code, at a cost in physical gates comparable to a lattice-surgery CNOT of the same reliability. Their simulations reach logical error rates about 2×10−92 \times 10^{-9} under uniform depolarizing circuit noise of 10−310^{-3}, and about 4×10−114 \times 10^{-11} at 5×10−45 \times 10^{-4}, with an order of magnitude fewer qubit-rounds than earlier approaches; they suggest that further distillation may often be unnecessary. Vaknin and co-authors (preprint, 2025) study cultivation carried out within the surface code itself.
  • Physical-level distillation. Itogawa and co-authors (published 2025) distil before encoding into the surface code, using a Steane-code circuit on a square lattice of physical qubits, and report a logical magic-state error of about 100p2100 p^{2} in numerical simulations.
  • Experiments. Rodriguez and co-authors (published 2025) ran distillation on logical qubits encoded in distance-3 and distance-5 colour codes on a reconfigurable neutral-atom processor and observed output logical magic states with higher fidelity than the inputs.
  • Constant overhead. The best exponent for qubit protocols was γ≈0.678\gamma \approx 0.678 (Hastings and Haah), and Krishna and Tillich reached γ→0\gamma \to 0 for qudits of growing dimension. Wills, Hsieh and Yamasaki (published 2025) obtain γ=0\gamma = 0 for qubits, using asymptotically good algebraic-geometry codes on 2102^{10}-dimensional qudits, each represented by ten qubits. Independent 2024 preprints construct asymptotically good qubit codes with a transversal CCZ gate, which also give distillation with exponent tending to zero (Golowich and Guruswami) or with constant space overhead (Nguyen). These results concern asymptotic input counts; their practical constants have not been established.
Mentions
Mentioned in

Open in the knowledge graph

Contributions about this record

Nobody has published a contribution about it yet.

Publish a result, reproduction or commentPropose a correction to this page

References

  1. Sergei Bravyi, Alexei Kitaev (2005). Universal quantum computation with ideal Clifford gates and noisy ancillas. Physical Review A 71, 022316. doi:10.1103/PhysRevA.71.022316arXiv:quant-ph/0403025
  2. Daniel Gottesman, Isaac L. Chuang (1999). Demonstrating the viability of universal quantum computation using teleportation and single-qubit operations. Nature 402, 390-393. doi:10.1038/46503
  3. E. Knill (2004). Fault-Tolerant Postselected Quantum Computation: Schemes. arXiv:quant-ph/0402171
  4. Sergey Bravyi, Jeongwan Haah (2012). Magic-state distillation with low overhead. Physical Review A 86, 052329. doi:10.1103/PhysRevA.86.052329arXiv:1209.2426
  5. Adam M. Meier, Bryan Eastin, Emanuel Knill (2013). Magic-state distillation with the four-qubit code. Quantum Information and Computation 13(3-4), 195-209. doi:10.26421/QIC13.3-4-2arXiv:1204.4221
  6. Cody Jones (2013). Multilevel distillation of magic states for quantum computing. Physical Review A 87, 042305. doi:10.1103/PhysRevA.87.042305arXiv:1210.3388
  7. Cody Jones (2013). Novel constructions for the fault-tolerant Toffoli gate. Physical Review A 87, 022328. doi:10.1103/PhysRevA.87.022328arXiv:1212.5069
  8. Jeongwan Haah, Matthew B. Hastings, D. Poulin, D. Wecker (2017). Magic state distillation with low space overhead and optimal asymptotic input count. Quantum 1, 31. doi:10.22331/q-2017-10-03-31arXiv:1703.07847
  9. Matthew B. Hastings, Jeongwan Haah (2018). Distillation with Sublogarithmic Overhead. Physical Review Letters 120, 050504. doi:10.1103/PhysRevLett.120.050504arXiv:1709.03543
  10. Anirudh Krishna, Jean-Pierre Tillich (2019). Towards Low Overhead Magic State Distillation. Physical Review Letters 123, 070507. doi:10.1103/PhysRevLett.123.070507arXiv:1811.08461
  11. Adam Wills, Min-Hsiu Hsieh, Hayata Yamasaki (2025). Constant-overhead magic state distillation. Nature Physics 21, 1842-1846. doi:10.1038/s41567-025-03026-0arXiv:2408.07764
  12. Louis Golowich, Venkatesan Guruswami (2025). Asymptotically Good Quantum Codes with Transversal Non-Clifford Gates. Proceedings of the 57th Annual ACM Symposium on Theory of Computing (STOC 2025), 707-717. doi:10.1145/3717823.3718234arXiv:2408.09254
  13. Quynh T. Nguyen (2025). Good binary quantum codes with transversal CCZ gate. Proceedings of the 57th Annual ACM Symposium on Theory of Computing (STOC 2025), 697-706. doi:10.1145/3717823.3718186arXiv:2408.10140
  14. Victor Veitch, S A Hamed Mousavian, Daniel Gottesman, Joseph Emerson (2014). The resource theory of stabilizer quantum computation. New Journal of Physics 16, 013009. doi:10.1088/1367-2630/16/1/013009
  15. Daniel Litinski (2019). Magic State Distillation: Not as Costly as You Think. Quantum 3, 205. doi:10.22331/q-2019-12-02-205arXiv:1905.06903
  16. Craig Gidney, Austin G. Fowler (2019). Efficient magic state factories with a catalyzed |CCZ> to 2|T> transformation. Quantum 3, 135. doi:10.22331/q-2019-04-30-135arXiv:1812.01238
  17. Joe O'Gorman, Earl T. Campbell (2017). Quantum computation with realistic magic-state factories. Physical Review A 95, 032338. doi:10.1103/PhysRevA.95.032338arXiv:1605.07197
  18. Ying Li (2015). A magic state's fidelity can be superior to the operations that created it. New Journal of Physics 17, 023037. doi:10.1088/1367-2630/17/2/023037arXiv:1410.7808
  19. Craig Gidney, Noah Shutty, Cody Jones (2024). Magic state cultivation: growing T states as cheap as CNOT gates. arXiv:2409.17595
  20. Yotam Vaknin, Shoham Jacoby, Arne Grimsmo, Alex Retzker (2025). Efficient Magic State Cultivation on the Surface Code. arXiv:2502.01743
  21. Tomohiro Itogawa, Yugo Takada, Yutaka Hirano, Keisuke Fujii (2025). Efficient Magic State Distillation by Zero-Level Distillation. PRX Quantum 6, 020356. doi:10.1103/thxx-njr6arXiv:2403.03991
  22. Pedro Sales Rodriguez, John M. Robinson, Paul Niklas Jepsen, … Sergio H. Cantú (2025). Experimental demonstration of logical magic state distillation. Nature 645, 620-625. doi:10.1038/s41586-025-09367-3arXiv:2412.15165
  23. Mark Howard, Earl Campbell (2017). Application of a Resource Theory for Magic States to Fault-Tolerant Quantum Computing. Physical Review Letters 118, 090501. doi:10.1103/physrevlett.118.090501
  24. Michael A. Nielsen, Isaac L. Chuang (2010). Quantum Computation and Quantum Information (10th Anniversary Edition). Cambridge University Press. doi:10.1017/CBO9780511976667
  25. Daniel Gottesman (1997). Stabilizer Codes and Quantum Error Correction. PhD thesis, California Institute of Technology. arXiv:quant-ph/9705052
  26. Scott Aaronson, Daniel Gottesman (2004). Improved simulation of stabilizer circuits. Physical Review A 70, 052328. doi:10.1103/PhysRevA.70.052328arXiv:quant-ph/0406196

Contributors

  • KetQat maintainers · @ketqatConceptualization; Supervision (CRediT roles)
  • Claude (AI drafting assistant)Writing, original draft (CRediT roles)

Review history

  1. Automated source check · Pass · 2026-12-01 · Independent automated verification pass (AI, not the drafting session)

    Topic body only (embedded records carry their own states). Worked examples recomputed numerically (0.998^8 = 0.98411, acceptance 0.9851, 15.23 inputs, 1.5e-21, 228 inputs; Bloch sums 0.990 and 1.018). Factory numbers compared with Litinski (arXiv:1905.06903) Table 1 ((15-to-1)_{17,7,7}: 4.5e-8, 4,620 qubits, 42.6 cycles; (15-to-1)_{13,5,5} x (20-to-4)_{27,13,15}: 2.6e-11, 46,800 qubits, 157 cycles); Gidney-Fowler 12d x 6d and 5.5d (1812.01238); abstracts of Haah et al. (1703.07847), Gidney-Shutty-Jones (2409.17595: 2e-9 at 1e-3, 4e-11 at 5e-4, CNOT-comparable cost), Vaknin et al. (2502.01743), Itogawa et al. (2403.03991, about 100 p^2), Rodriguez et al. (2412.15165, d = 3 and 5 colour codes), Golowich-Guruswami (2408.09254), Nguyen (2408.10140, constant space overhead), Hastings-Haah, Krishna-Tillich, Wills-Hsieh-Yamasaki, Bravyi-Haah, Meier-Eastin-Knill, Jones.

Revision history

  1. 2026-12-01Content release 2.1.0: 35 more topics, an independent source check of every record, intake hardening (#17)80537b7e
  2. 2026-11-30KetQat Commons: free learning paths, knowledge records, research problems, literature intake (#14)571c9b10

Current revision 7875a861b1a85baa. Source file knowledge/records/topic/magic-state-distillation.md in the content repository (readable there once it is public).