|q⟩ Bad Qubits

advanced · Physics · Magic States & Distillation

Resource Cost of Distillation

Distillation works, but it is expensive, and for many proposed algorithms the magic-state factory dominates the qubit count and runtime of the whole machine. This lesson estimates that cost.

Counting raw states: the distillation tree

A multi-round factory is a tree. Each 1515-to-11 block consumes 1515 inputs and produces 11 output. To feed an rr-round factory, each of the 1515 inputs to the top block is itself the output of a (r1)(r{-}1)-round sub-factory, and so on. Ignoring post-selection rejection, the number of raw magic states consumed per final distilled output is

Nraw=15r.N_{\text{raw}} = 15^{\,r}.

The number of rounds rr is set by how far the error must fall. Starting from raw error ε0\varepsilon_0 and iterating ε35ε3\varepsilon \mapsto 35\,\varepsilon^3:

ε0=103   ×   ε1=35(103)3=3.5×108   ×   ε2=35(3.5×108)31.5×1021.\varepsilon_0 = 10^{-3} \;\xrightarrow{\ \times\ }\; \varepsilon_1 = 35(10^{-3})^3 = 3.5\times10^{-8} \;\xrightarrow{\ \times\ }\; \varepsilon_2 = 35(3.5\times10^{-8})^3 \approx 1.5\times10^{-21}.

To reach a target of 101210^{-12}, two rounds suffice (ε21012\varepsilon_2 \ll 10^{-12} while ε1=3.5×108\varepsilon_1 = 3.5\times10^{-8} is not yet good enough). So Nraw=152=225N_{\text{raw}} = 15^2 = 225 raw magic states per distilled output — before accounting for batches thrown away on a nontrivial syndrome.

Space and time on a surface code

In a surface-code architecture each of those 1515 (or 225225) magic-state inputs is an encoded logical qubit occupying a patch of physical qubits, and the Clifford circuit of the protocol is realized by lattice surgery over many code cycles. A useful rule of thumb from the Fowler–Devitt–Jones analyses is that a single-level 1515-to-11 factory occupies on the order of  ⁣102\sim\!10^210310^3 logical-qubit-tiles and takes on the order of  ⁣10d\sim\!10\,d code cycles (with dd the code distance), so a two-level factory costs roughly the square of that.[^fowler-surface] Historically, factories were projected to consume the majority of the physical qubits in a fault-tolerant machine running, say, Shor's algorithm.

Why the cost matters — and recent progress

Because TT count drives factory throughput, two research directions attack the cost:

  1. Better protocols / lower overhead. Triorthogonal codes and block codes amortize many outputs per block; catalyzed CCZ2T|CCZ\rangle \to 2|T\rangle conversions cut the per-TT cost substantially.[^gidney-fowler]
  2. Reducing TT count in the algorithm. Fewer non-Clifford gates means fewer magic states; this is the point of TT-count optimization.

Litinski's re-analysis argued that, with careful surface-code layout, distillation is "not as costly as you think" — a single well-designed factory can keep up with a realistic algorithm's TT demand.[^litinski] Still, the basic accounting stands: every logical TT costs one distilled magic state, and each of those costs a tree of  ⁣15r\sim\!15^r raw inputs plus the spacetime to error-correct them all.

Try it

For raw input error ε0=103\varepsilon_0 = 10^{-3} and target output error 101210^{-12}, find the smallest number of rounds rr of 1515-to-11 distillation and return the raw-state cost 15r15^{r} per distilled output. Drive the recurrence ε35ε3\varepsilon \mapsto 35\,\varepsilon^3 yourself.

[^fowler-surface]: Fowler, Mariantoni, Martinis, Cleland, Surface codes, arXiv:1208.0928. [^gidney-fowler]: Gidney, Fowler, Efficient magic state factories…, arXiv:1812.01238. [^litinski]: Litinski, Magic State Distillation: Not as Costly as You Think, arXiv:1905.06903.

Run your code to see the quantum state.

Sign in on the full site to ask questions and join the discussion.