Abstract
Faulttolerant quantum computing promises significant computational speedup over classical computing for a variety of important problems. One of the biggest challenges for realizing faulttolerant quantum computing is preparing magic states with sufficiently low error rates. Magic state distillation is one of the most efficient schemes for preparing highquality magic states. However, since magic state distillation circuits are not faulttolerant, all the operations in the distillation circuits must be encoded in a large distance errorcorrecting code, resulting in a significant resource overhead. Here, we propose a faulttolerant scheme for directly preparing highquality magic states, which makes magic state distillation unnecessary. In particular, we introduce a concept that we call redundant ancilla encoding. The latter combined with flag qubits allows for circuits to both measure stabilizer generators of some code, while also being able to measure global operators to faulttolerantly prepare magic states, all using nearest neighbor interactions. We apply such schemes to a planar architecture of the triangular color code family and demonstrate that our scheme requires at least an order of magnitude fewer qubits and space–time overhead compared to the most competitive magic state distillation schemes. Since our scheme requires only nearestneighbor interactions in a planar architecture, it is suitable for various quantum computing platforms currently under development.
Similar content being viewed by others
Introduction
Ideal quantum computers can efficiently solve several important problems of great interest. Such problems include (but are not limited to) integer factoring^{1} and simulation of large quantum systems^{2} and are believed to be not solvable in polynomial time in the problem size by using classical computers. However, due to inevitable noise in realistic quantum systems, currently available quantum devices are not capable of performing long quantum computations in a reliable way. Quantum error correction and faulttolerant techniques are thus essential to build a universal quantum computer (capable of implementing arbitrary quantum algorithms) out of noisy physical components. Importantly, due to significant hardware constraints, the resource overhead associated with the implementation of faulttolerant methods will need to be low.
The transversal implementation of a logical gate is naturally faulttolerant since errors cannot spread between qubits in a given codeblock. Unfortunately, from the Eastin–Knill theorem^{3}, given any quantum errorcorrecting code, there will always be at least one gate in a universal gate set that cannot be implemented using transversal operations at the errorcorrected logical level. Several faulttolerant methods for implementing gates in a universal gate set have been proposed^{4,5,6,7,8,9,10,11,12,13,14,15,16,17}. Among these various proposals, preparing highquality magic states by using magic state distillation has remained a leading candidate for realizing universal faulttolerant quantum computing^{18,19,20,21,22,23,24,25,26,27}.
It had long been believed that implementing magic state distillation was the dominant cost of building a universal faulttolerant quantum computer. While recent results have shown that this is not necessarily the case^{28}, the cost of performing magic state distillation still remains very high given current hardware constraints. One of the reasons for the high costs of magic state distillation is that the distillation circuits are generally not robust against failures of the Clifford gates used to distill magic states. Consequently, the Clifford gates must be encoded in some largedistance errorcorrecting code (often the surface code) to ensure that these gates have negligible error rates compared to the magic states being injected. Due to the high threshold of the surface code, magic state distillation schemes with the surface code can be implemented with noise rate near p = 10^{−3} using a large enough code distance.
In ref. ^{15}, a faulttolerant method for directly preparing an Htype magic state was proposed using the Steane code and flagqubit circuits^{29,30,31,32,33,34,35,36,37,38}. For physical error rates p ≳ 10^{−5} and with idle qubits failing with error rates 100 times smaller than singlequbit gate error rates, it was shown that fewer qubits were required to prepare Htype magic states than the bestknown distillation schemes. Unfortunately, the scheme requires the ability to perform geometrically nonlocal gates and is scaled up by concatenating the Steane code with itself, making it difficult to implement such a scheme in a scalable way with realistic quantum hardware.
The Steane code belongs to the family of twodimensional color codes^{8,39,40,41}, which are topological codes. In particular, the twodimensional color codes have a nice property that all logical Clifford gates can be implemented using transversal operations. In particular, for a color code with n data qubits, the logical Hadamard gate is simply given by \(\overline{H}={H}^{\otimes n}\). This features makes color codes particularly well suited for preparing Htype magic states. Furthermore, recent work introduced a simple and efficient decoding algorithm for color codes which also uses information from flag qubits to decode up to the full effective code distance^{38,42}.
In this work, we introduce a faulttolerant scheme for directly preparing an Htype magic state encoded in the triangular color code family. In particular, we introduce a concept that we call redundant ancilla encoding. The latter combined with flag qubits allows for circuits to faulttolerantly extract error syndrome information and measure the global logical Hadamard operator to faulttolerantly prepare magic states. Due to the faulttolerance of our proposed scheme, magic states with very low logical error rates can be directly prepared without the need to use very largedistance errorcorrecting codes to encode the required Clifford operations. That is, we find that the Clifford gates in our scheme can have error rates comparable to the magic states being injected, thus significantly reducing the resource requirements. For instance, for a physical error rate p = 10^{−4}, to produce a magic state with a logical error rate of ~5 × 10^{−8}, our scheme requires only 64 qubits (compared to 810 with the best known magic state distillation schemes^{28}) and all Clifford gate operations can be performed at the physical level. Thus, our scheme requires more than an order of magnitude fewer qubits and space–time overhead costs compared to the most competitive existing magic state distillation schemes. Most importantly, our scheme uses only nearestneighbor interactions in a twodimensional planar architecture and thus is well suited for various quantum computing platforms that are currently under development. Moreover, our scheme can be scaled to produce magic states with arbitrarily low error rates by using logical Clifford operations encoded in a twodimensional topological code. We find that using the surface code for our encoded stabilizer operations appears to be the most resourceefficient scheme for producing magic states with error rates lower than 10^{−15}.
Results
Overview of our proposed magic state preparation scheme
Note that logical Clifford gates encoded in a color code can be implemented using transversal operations and hence are faulttolerant. Thus, to complete a universal gate set, we focus on faulttolerantly preparing an Htype magic state encoded in a triangular color code, which can be used to implement the nonClifford T gate (see the Methods section for more details on the Clifford and nonClifford gates, stabilizer operations, Htype magic states, and the triangular color code). Depending on the size and duration of a quantum algorithm, the desired probability that an \(\leftH\right\rangle\) state is afflicted by an error ranges from 10^{−7} to ~10^{−15} (see, e.g., refs. ^{43,44,45}). Since an Htype magic state \(\leftH\right\rangle\) is an eigenstate of the Hadamard operator H with +1 eigenvalue, a highquality Htype magic state can be prepared if the Hadamard operator H can be measured nondestructively and in a faulttolerant way. Here, we propose a faulttolerant scheme for measuring the logical Hadamard operator \(\overline{H}={H}^{\otimes n}\) of the triangular color code, which can be used to directly prepare a highquality magic state.
An overview of our faulttolerant magic state preparation scheme is provided in Fig. 1. Our scheme outputs an Htype magic state \(\left\overline{H}\right\rangle\) encoded in the distanced triangular color code and consists of the following three elements. G^{(1→d)}: a nonfaulttolerant growing operation of a physical \(\leftH\right\rangle\) state to an encoded state \({\left\overline{H}\right\rangle }_{G}\) (see Fig. 7 and the Methods section), \({H}_{m}^{(d)}\): a faulttolerant logical Hadamard measurement circuit (for d ∈ {3, 5, 7}; see Figs. 3 and 4), and EC^{(d)}: a faulttolerant syndrome extraction circuit (see Fig. 2). In particular, we call the latter two circuits \({H}_{m}^{(d)}\) and EC^{(d)} faulttolerant in the sense that they are tflag circuits with t = (d − 1)/2, where the definition of tflag circuit is given below:
Definition 2 (tflag circuit) A circuit C(U) which, when faultfree, implements a projective measurement of a weightw operator \(U\in {{\mathcal{P}}}_{n}^{(2)}\) without flagging is a tflag circuit if the following holds: For any set of v faults at up to t locations in C(U) resulting in an error E with \(\min (wt(E),wt(EU))>v\), the circuit flags (i.e., at least one flag qubit has a nontrivial measurement outcome).
In our scheme, we first grow a noisy physical \(\leftH\right\rangle\) state to an encoded state \({\left\overline{H}\right\rangle }_{G}\) via a growing operation G^{(1→d)}. Due to the nonfaulttolerance of the growing operation, a single fault can result in a logical error afflicting \({\left\overline{H}\right\rangle }_{G}\). However, these errors can be detected by implementing in pairs a faulttolerant logical Hadamard measurement circuit \({H}_{m}^{(d)}\) and a syndrome extraction circuit EC^{(d)} (d − 1)/2 times. Specifically, the Hadamard measurement circuit \({H}_{m}^{(d)}\) checks for logical errors in the encoded magic state \({\left\overline{H}\right\rangle }_{G}\) and the syndrome extraction circuit EC^{(d)} prevents the accumulation of residual errors so that they remain correctable by the code^{15,46}. In particular, we show in Supplementary Note 2 that our magic state preparation scheme in Fig. 1 is faulttolerant in the following sense^{15,47}:
Definition 2 (Faulttolerant state preparation) For t = (d − 1)/2, a statepreparation protocol using a distanced stabilizer code C is said to be faulttolerant if the following two conditions are satisfied: (1) If there are s faults during the statepreparation protocol with s ≤ t, the resulting state differs from a codeword by an error of at most weight s. (2) If there are s faults during the statepreparation protocol with s ≤ t, then ideally decoding the output state results in the same state that would be obtained from the faultfree statepreparation scheme.
Thus, (d − 1)/2 faults in a distance d ∈ {3, 5, 7} triangular color code of our magic state preparation scheme cannot result in a logical failure. In what follows, we describe the syndrome extraction circuit EC^{(d)} and the Hadamard measurement circuit \({H}_{m}^{(d)}\) in more detail.
Syndrome extraction with redundant ancilla encoding
Here, we describe the error syndrome extraction circuit EC^{(d)} used to detect errors at the output of the Hadamard measurement circuit \({H}_{m}^{(d)}\). In particular, to guarantee faulttolerance of our scheme (see Definition 2), we require that the EC^{(d)} circuit is at least a oneflag circuit. For instance, if the circuit is not a oneflag circuit, two single faults in two separate stabilizers can result in a weightfour data qubit error without any flag qubits flagging. Such an error is thus not rejected by the circuit and might not be correctable by the distance5 triangular color code, despite being derived from a twofault event.
In Fig. 2a we illustrate the full EC^{(5)} circuit used to measure the stabilizers of a triangular color code along with the CNOT gate scheduling, which minimizes the circuit depth for the given qubit layout. The weightfour stabilizers are identical to the ones used in ref. ^{38}. However, an important difference can be observed for the weightsix stabilizers, which in addition to using three flag qubits, also uses three ancilla qubits. If an error anticommutes with a weightsix stabilizer, the measurement outcomes of the three ancillas will have odd parity, otherwise it will have even parity. The circuit for measuring a weightsix Xtype stabilizer that respects the CNOT scheduling is given in Fig. 2b. By performing an exhaustive numerical search, we verified that both weightfour and weightsix circuits are twoflag circuits. Since the weights of the stabilizer generators are independent of d, having twoflag circuits is sufficient to ensure that the EC^{(d)} circuits are implemented faulttolerantly^{32}. Lastly, each weightfour and weightsix plaquette in a general EC^{(d)} circuit has the same qubit layout and gate connectivity as those of Fig. 2a.
Now, one might wonder why three ancilla qubits (gray circles in Fig. 2b) instead of a single ancilla are used for measuring the weightsix stabilizers (see for instance the weightsix circuits used in ref. ^{38} that only require one ancilla). Indeed, if one is only interested in performing faulttolerant error correction instead of faulttolerant quantum computation, then a single ancilla qubit suffices since the additional ancillas do not provide more information and they also increase the circuit depth. However, we show below that to use the same qubit layout for measuring the logical Hadamard operator \(\overline{H}={H}^{\otimes n}\) (which is a global operator), the roles of the ancillas and flags in Fig. 2a are reversed. In other words, the ancilla qubits become flag qubits and the flag qubits become ancilla qubits. We thus use more ancilla qubits than necessary to ensure the Hadamard measurement circuit \({H}_{m}^{(d)}\) satisfies the desired faulttolerant properties. We refer to this extra redundancy as redundant ancilla encoding. Below, we demonstrate the utility of using redundant ancilla encoding.
Faulttolerant logical Hadamard measurement
Here, we describe in detail how to construct a tflag circuit (with t = (d − 1)/2) for the nondestructive measurement of the logical Hadamard operator (i.e., \({H}_{m}^{(d)}\)). The circuits we construct apply to distance d triangular color codes with d ∈ {3, 5, 7}. In Fig. 3a, we present a oneflag circuit for measuring of the logical Hadamard operator H^{⊗7} of the d = 3 triangular color code. Note that we used the same qubit layout as the one used for the stabilizer measurement circuit (EC^{(3)} circuit shown in Fig. 3b) but there is a role reversal between the ancilla qubits (gray circles) and the flag qubits (white circles).
We now explain why the circuit in Fig. 3a performs a nondestructive measurement of the logical Hadamard operator H^{⊗7}. Note that the ancilla qubits (gray circles) in Fig. 3a are prepared in the logical plus state of the 6qubit repetition code (or the 6qubit GHZ state \(\frac{1}{\sqrt{2}}({\left0\right\rangle }^{\otimes 6}+{\left1\right\rangle }^{\otimes 6})\)) through the CNOT gates between the ancilla qubits (see Fig. 3c). Then, as shown in Fig. 3d, the 7 controlledHadamard gates implement a logical controlledHadamard gate between the ancilla 6qubit repetition code and the data d = 3 triangular color code. Eventually, the ancilla qubits (in the 6qubit repetition code) are measured in the logical X basis via a X^{⊗6} measurement (see Fig. 3f). Hence, the circuits in Fig. 3c, d, and f implement the simple nondestructive Hadamard measurement circuit in Fig. 5b, except that the ancilla qubits are now encoded in the 6qubit repetition code and the data qubits are encoded in the d = 3 triangular color code.
The most important element of the logical Hadamard measurement circuit in Fig. 3 is the parity check of the ancilla GHZ state by using flag qubits (see Fig. 3e). Note that the flag qubits (white circles) nondestructively measure the parity of the ancilla GHZ state Z_{1}Z_{2}, Z_{3}Z_{6}, and Z_{4}Z_{5}, or the three (out of five) stabilizers of the 6qubit repetition code (we labeled the qubits from the top to the bottom and from the left to the right). These stabilizer measurements will be trivial if all the CNOT gates in Fig. 3c are perfect. However, CNOT gate failures can result in nontrivial flag measurement outcomes. In particular, there are several single CNOT gate failure events that can cause a data qubit error of weighttwo or higher. For the Hadamard circuit to be oneflag, all these failure events should be caught by flag qubits. Indeed, we verify via a comprehensive numerical search that the logical Hadamard circuit in Fig. 3a is a oneflag circuit by confirming that if a single fault at any location results in a data qubit error E with \(\min (wt(E),wt(E{H}^{\otimes 7}))>1\), at least one flag qubit flags.
Further, we construct a twoflag circuit for the logical Hadamard measurement \({H}_{m}^{(5)}\) of the d = 5 triangular color code and a threeflag circuit \({H}_{m}^{(7)}\) for the d = 7 triangular color code (see Fig. 4). Designing such circuits with the desired faulttolerant properties is very involved as it requires careful utilization of the ample flag qubits that become available due to redundant ancilla encoding. However, at a high level, the design principle is similar to the one used for the d = 3 case. That is, in the d = 5 case (i.e., \({H}_{m}^{(5)}\)), we first generate a 21qubit GHZ state in the ancilla qubits (gray circles), or equivalently, a logical plus state of the 21qubit repetition code. The entangled ancilla qubits are then coupled to all of the 19 data qubits (yellow circles) through controlledHadamard gates. Finally, the ancilla qubits (in the 21qubit repetition code) are measured in the logical X basis via a X^{⊗21} measurement. Thus, the circuit in Fig. 4a implements a nondestructive measurement of the logical Hadamard measurement of the d = 5 color code by using ancilla qubits in the 21qubit repetition code.
Because the ancilla qubits are encoded in the 21qubit repetition code, we can check if the ancilla qubits are reliably prepared in the logical plus state by measuring 15 (out of 20) stabilizers of the ancilla 21qubit repetition code using 15 flag qubits (white circles). Performing an exhaustive numerical search, we can confirm that the circuit \({H}_{m}^{(5)}\) is a twoflag circuit. A threeflag circuit for the logical Hadamard measurement \({H}_{m}^{(7)}\) of the d = 7 triangular color code is constructed in the same way by using 45 ancilla qubits prepared in the logical plus state of the 45qubit repetition code, and using 36 flag qubits checking the 36 (out of 44) stabilizers of the 45qubit repetition code (see Fig. 4b). We point out that the order and time steps at which the CNOT gates (used to measure the stabilizers of the repetition code or the GHZ state with flag qubits) are implemented is very important and must be carefully chosen.
Recall that we used a redundant ancilla encoding scheme in the stabilizer measurement circuits (see Fig. 2) and the ancilla qubits in the stabilizer measurement circuits are used as flag qubits in the Hadamard measurement circuits. Thus, redundant ancilla encoding in the stabilizer measurement circuits allows the logical Hadamard measurement circuits to have sufficiently many flag qubits while maintaining the same twodimensional qubit layout. In particular, the logical Hadamard measurement circuits \({H}_{m}^{(5)}\) and \({H}_{m}^{(7)}\) have 15 and 36 flag qubits that check 15 (out of 20) and 36 (out of 45) stabilizers of the ancilla GHZ state, respectively. Without the redundant ancilla encoding, we would have had 9 flag qubits in the d = 5 case and 18 flag qubits in the d = 7 case, as opposed to 15 and 36 flag qubits, respectively. We remark that the logical Hadamard measurement circuits \({H}_{m}^{^{\prime} (5)}\) and \({H}_{m}^{^{\prime} (7)}\) that are constructed with such fewer flag qubits are not twoflag and threeflag circuits. Thus, the redundant ancilla encoding scheme plays a crucial role in guaranteeing the desired faulttolerance property of the logical Hadamard measurement circuits. We also remark that in previous works^{46,48}, it has been shown that GHZ ancilla states can be used to faulttolerantly measure the logical Hadamard operator. However, such GHZ states need to be prepared using ancilla verification methods, which can be very costly and typically requires very low noise rates and nonlocal interactions.
Performance of the scheme with physical operations
Since our magic state preparation scheme in Fig. 1 is faulttolerant, it is robust against any v faults with v ≤ (d − 1)/2 (including failures of all stabilizer operations). Consequently, under the circuitlevel noise model detailed in the Methods section, the logical error probability of the output magic state \(\left\overline{H}\right\rangle\) is given by
where p is the physical error rate and α counts all combinations of (d + 1)/2 faults that lead to acceptance in our statepreparation scheme but results in a logical \(\overline{X}\), \(\overline{Y}\), or \(\overline{Z}\) error. We numerically find that for values of p ≤ 10^{−3}, the higherorder terms in Eq. (1) were found to have a negligible impact on p_{L} (see Table 1).
Note that the logical error rate in Eq. (1) is conditioned on acceptance of the output magic state produced by our statepreparation scheme, i.e., when all the flag qubits do not flag and all the ancilla qubits have even parity. In the “Methods” section, we described in detail how to compute the acceptance probability \({p}_{acc}^{(d)}(p)\). Here, we focus on estimating the qubit overhead and the space–time overhead of our magic state distillation scheme.
Given the acceptance probability \({p}_{acc}^{(d)}(p)\) for preparing a distance d encoded state \(\left\overline{H}\right\rangle\) with physical error rate p, the average number of qubits is given by
where n^{(d)} = (3d^{2} + 1)/4 is the number of data qubits, and \({n}_{anc}^{(d)}\) is the total number of ancilla and flag qubits used in the circuits \({H}_{m}^{(d)}\) and EC^{(d)}. Since each weightsix stabilizer generator requires six qubits, and each weightfour stabilizer three qubits, we have
where \({n}_{{w}_{4}}^{(d)}=(3/2)(d1)\) and \({n}_{{w}_{6}}^{(d)}=(3{d}^{2}12d+9)/8\) are the number of weightfour and weightsix stabilizers. Putting everything together, we obtain
Note that if we repeat the protocol for preparing \(\left\overline{H}\right\rangle\) until the output state is accepted (at the expense of having a higher time cost), the number of qubits required to prepare \(\left\overline{H}\right\rangle\) is simply
We now consider the space–time overhead for implementing the scheme in Fig. 1, where additional qubits (as in Eq. (4)) are used to minimize the time cost. In particular, the space–time overhead \({s}_{O}^{(d)}(p)\) is given as
where \({t}_{{H}_{m}}^{(d)}\) and \({t}_{EC}^{(d)}\) are the total number of time steps required to implement one round of the circuits \({H}_{m}^{(d)}\) and EC^{(d)} respectively. The factor of 14 in Eq. (6) comes from the 14 times steps required to implement the circuit \({\left\overline{H}\right\rangle }_{G}\). Note that we pessimistically assume that all time steps are reached when implementing the circuits in Fig. 1. This is pessimistic since when the magic state preparation scheme does not pass the verification steps, fewer than \(14+\frac{(d1)}{2}({t}_{{H}_{m}}+{t}_{EC})\) time steps are used.
The values of \({p}_{L}^{(d)}\), \(\langle {n}_{tot}^{(d)}(p)\rangle\), \(\min ({n}_{tot}^{(d)})\) and \({S}_{O}^{(d)}(p)\) for p ∈ [10^{−4}, 5 × 10^{−4}] are given in Table 1 and were obtained by performing 10^{9} Monte–Carlo simulations on AWS clusters. For values of p resulting in very low logical failure rates, extrapolation of the best fit curve (using Eq. (1)) was used to compute the logical error rate of \(\left\overline{H}\right\rangle\). Note that using the d = 5 version of the protocol in Fig. 1, an \(\left\overline{H}\right\rangle\) state can be prepared with a logical failure rate of 3.6 × 10^{−8} while using only 68 qubits on average when p = 10^{−4}. Alternatively, one may use \(\min ({n}_{tot}^{(d = 5)})=55\) qubits and repeat the protocol until it is accepted (with an acceptance probability \({p}_{acc}^{(d = 5)}(p=1{0}^{4})=0.81\)). Further, one can use the d = 7 version of the protocol to produce an \(\left\overline{H}\right\rangle\) state with logical failure rate 4.9 × 10^{−10} with only 231 qubits on average. Similarly as above, one may use \(\min ({n}_{tot}^{(d = 7)})=118\) qubits and repeat the protocol until it is accepted (with an acceptance probability \({p}_{acc}^{(d = 7)}(p=1{0}^{4})=0.51\)). In comparison, when p = 10^{−4}, the non faulttolerant magic state distillation scheme in ref. ^{28} requires 810 and 1150 qubits to prepare magic states with failure rates 4.4 × 10^{−8} and 9.3 × 10^{−10}, respectively. We note that recent work suggests that p = 10^{−4} is the appropriate regime to have small enough decoding hardware requirements^{49}.
An important remark is that the space–time overhead values obtained in ref. ^{28} cannot directly be compared with those of Table 1. Roughly speaking, one would need to multiply the numbers obtained in ref. ^{28} by at least six (where the factor of six comes from the fact that six time steps are required to measure all the surface code stabilizers). To be clear, Eq. (6) takes into account the total number of time steps required for each measurement cycle. As such, our scheme provides a space–time overhead improvement, say to obtain a magic state with \({p}_{L}^{(5)}=3.6\times 1{0}^{8}\), by at least an order of magnitude. One of the main reasons for the reduction in overhead is that we did not need to use encoded Clifford operations due to the faulttolerant properties of our circuits. In ref. ^{28}, the magic state being distilled needed to be encoded in the d = 7 surface code (so that the logical error rates of the encoded Clifford gates are ~10^{−9}) to obtain an output state with failure probability 4.4 × 10^{−8}. On the other hand, our scheme does not require encoded Clifford gates with very low error rates, and instead works with physical Clifford gates with an error rate p = 10^{−4}.
Performance of the scheme with encoded Clifford operations
While \(\left\overline{H}\right\rangle\) states with logical error rates near 10^{−8} and 10^{−10} may be sufficient for certain quantum chemistry applications^{50}, \(\left\overline{H}\right\rangle\) states with even lower logical error rates are required for many quantum algorithms. To achieve such low error rates, all stabilizer operations in our magic state preparation schemes in Fig. 1 need to be encoded in an errorcorrecting code so that they have much lower error rates compared to unencoded stabilizer operations. We now discuss the implementation of our \(\left\overline{H}\right\rangle\) preparation scheme presented in Fig. 1 with encoded stabilizer operations. In what follows, we denote \({\left\overline{H}\right\rangle }_{f}\) as the state produced when implementing the scheme of Fig. 1 with encoded stabilizer operations. Further, the circuits G^{(1→d)}, \({H}_{m}^{(d)}\) and EC^{(d)} will be denoted as \({\tilde{G}}^{(1\to d)}\), \({\tilde{H}}_{m}^{(d)}\) and \({\tilde{EC}}^{(d)}\) when implemented with encoded stabilizer operations.
Suppose that in order to prepare an \({\left\overline{H}\right\rangle }_{f}\) state with some target logical error rate, we require all stabilizer operations to be encoded in a triangular color code of distance d_{2}. First, \({\left\overline{H}\right\rangle }_{{d}_{1}}\) states are prepared using the scheme described in Fig. 1 (with d_{1} ∈ {3, 5, 7} and with physical stabilizer operations). The distance d_{1} is chosen such that the \({\left\overline{H}\right\rangle }_{{d}_{1}}\) states have smaller logical failure rates compared with those of the distance d_{2} encoded stabilizer operations. The \({\left\overline{H}\right\rangle }_{{d}_{1}}\) states are used to implement the logical T gates (see Fig. 5a) and for injection in the circuit \({\tilde{G}}^{(1\to {d}_{f})}\). If d_{1} < d_{2}, the \({\left\overline{H}\right\rangle }_{{d}_{1}}\) states must first be grown into \({\left\overline{H}\right\rangle }_{{d}_{2}}\) states using the growing circuit \({G}^{({d}_{1}\to {d}_{2})}\) shown in Fig. 7c. Note that we did not put the tilde on \({G}^{({d}_{1}\to {d}_{2})}\) since all operations are implemented with physical gates (see also the Methods section). Using encoded \({\left\overline{H}\right\rangle }_{{d}_{2}}\) states ensures that stabilizer operations encoded in a distance d_{2} triangular color code can be used with the prepared magic states. See Supplementary Note 5 and Supplementary Figs. 6 and 7 for a more detailed description of the setting and how to estimate the resource overhead.
The numerical values obtained in Table 2 shows that the least costly scheme to prepare the state \({\left\overline{H}\right\rangle }_{f}\) with a logical error rate \({p}_{L}^{({d}_{f})}<4\times 1{0}^{15}\) when p = 10^{−4} is to first prepare the states \({\left\overline{H}\right\rangle }_{{d}_{1}}\) with d_{1} = 7, and to grow these states to encoded d_{2} = 11 states. Using distance d_{2} = 11 encoded stabilizer operations, the final magic state \({\left\overline{H}\right\rangle }_{f}\) is prepared using the distance d_{f} = 3 scheme in Fig. 1. On average, the amount of qubits required to prepare such a state is 10,917 and the space–time overhead is 3.91 × 10^{6}. If the time cost for preparing the \({\left\overline{H}\right\rangle }_{{d}_{1}}\) states is of a lesser concern, the minimum number of qubits required to prepare \({\left\overline{H}\right\rangle }_{f}\) with \({p}_{L}^{({d}_{f})}<4\times 1{0}^{15}\) is 6288. To compare with other schemes, in ref. ^{28}, a magic state with a logical error failure rate of 2.4 × 10^{−15} required a minimum of 16,400 qubits.
To obtain a state \({\left\overline{H}\right\rangle }_{f}\) with \({p}_{L}^{({d}_{f})}\approx 1{0}^{15}\) when p = 10^{−3} using a small amount of resources requires encoded stabilizer operations with much lower logical failure rates than what is achieved with the triangular color code family. One viable option is to use stabilizer operations encoded in the surface code^{51} due to the low error rates that can be achieved when p = 10^{−3}. However, in such a setting, after the states \({\left\overline{H}\right\rangle }_{{d}_{2}}\) have been prepared, they must be teleported to the surface code before they can be injected in the circuit of Fig. 5 and in the circuit implementing \({\tilde{G}}^{(1\to {d}_{f})}\). In particular, one can convert the color code encoded state to the surface code using lattice surgery techniques as was done in ref. ^{52}. In Table 3, we provide estimates of the qubit overhead for preparing \({\left\overline{H}\right\rangle }_{f}\) when the stabilizer operations are encoded in the surface code. We remark that a complete analysis of the resource overhead cost of our scheme using encoded stabilizer operations would require the inclusion of routing costs. In this work, we do not take into account costs associated with the implementation of lattice surgery for performing gates and the transportation of logical qubits. Given that such considerations highly depend on the underlying hardware architecture, we leave such an analysis to future work. In Supplementary Note 5, we discuss alternative schemes with the surface code that do not require lattice surgery techniques.
Discussion
In this work we showed how to prepare an \(\leftH\right\rangle\)type magic state in a faulttolerant way using a twodimensional color code architecture requiring only nearestneighbor interactions. The proposed architecture can be used to both measure local stabilizers of the color code in addition to a global operator, without the need for changing the qubit layout. Such an architecture was made possible with the use of flag qubits, in addition to an important concept that we introduce and call redundant ancilla encoding. Estimating the performance of our scheme, we showed that when p = 10^{−4}, only 68 and 231 qubits are required to prepare an encoded \(\leftH\right\rangle\) state with logical error rates 3.6 × 10^{−8} and 4.9 × 10^{−10}, respectively. In addition, we also showed how our scheme can be used with encoded stabilizer operations to achieve significantly lower logical failure rates, both in the regime where p = 10^{−4} and p = 10^{−3}. We stress that our results were obtained by considering a full circuitlevel depolarizing noise model, where all stabilizer operations could fail.
We also point out key differences between magic state distillation schemes and our faulttolerant methods for preparing magic states. Magic state distillation is a topdown approach, where error detection circuits are designed to prepare magic states without regard to their faulttolerant properties. It is assumed that appropriate code distances for the encoded Clifford operations will be chosen to ensure that consecutive rounds of distillation will produce higher fidelity magic states. Our scheme, which uses flagqubits and redundant ancilla encoding, is a bottomup approach. The faulttolerant properties of the magic state preparation circuits are prioritized and emphasis is given towards constructing vflag circuits for large v. As such, to obtain magic states with very low failure rates, if encoded stabilizer operations are required, such operations can fail with error rates commensurate to the magic states being injected.
Note that when considering the implementation of our scheme with encoded stabilizer operations using the surface code, the d_{f} = 7 version of our scheme was optimal for both p = 10^{−4} and p = 10^{−3}. A clear direction of future work would be to find a vflag circuit (with v ≥ 4) allowing a faulttolerant implementation of a d_{f} ≥ 9 scheme. Such a scheme could potentially further reduce the overhead for preparing \(\leftH\right\rangle\) states with very low error rates. Moreover when using the surface code for the encoded stabilizer operations, instead of performing lattice surgery to convert a color code encoded \({\left\overline{H}\right\rangle }_{{d}_{2}}\) state to one encoded in the surface code (as we did above), another option would be to initially prepare an encoded \({\left\overline{H}\right\rangle }_{{d}_{2}}\) state in a small distance surface code using some other method, such as a magic state distillation protocol. While these techniques can potentially further reduce the required resource overhead, a careful analysis of the overhead would require choosing the appropriate magic state distillation protocol (or some other scheme that uses faulttolerant circuits to prepare encoded magic states). Therefore such an analysis is left for future work.
With a plethora of possible research directions for preparing magic states in a faulttolerant way which build upon our work, and given the realistic hardware constraints that are built directly into our schemes, we believe our work paves the way for achieving very low overhead universal quantum computation with both nearterm and longterm quantum devices.
Methods
Htype magic states
The nqubit Clifford group is defined as
where \({{\mathcal{P}}}_{n}^{(1)}\) is the nqubit Pauli group. The Clifford group is generated by
where
Here H is the Hadamard gate, \(Y(\frac{\pi }{2})={e}^{i\frac{\pi }{4}Y}\) and the CNOT gates acts as
on the computational basis states \(\lefta\right\rangle\) and \(\leftb\right\rangle\). The Clifford group, along with the nonClifford gate
forms a universal gate set. That is, defining \({\mathcal{G}}=\langle H,Y\left(\frac{\pi }{2}\right),T,CNOT\rangle\) and given a target fidelity ϵ, a unitary operator U can be approximated with \({\mathcal{O}}({\mathrm{log}}^{c}1/\epsilon )\) gates in \({\mathcal{G}}\)^{52,53}. Note that the T gate defined in Eq. (11) is Clifford equivalent to the gate \(\tilde{T}=diag(1,{e}^{i\pi /4})\), which is also commonly referred to as the T gate. Whenever we refer to T gates throughout this paper, they will always correspond to the gate given in Eq. (11).
A magic state is a state that can be used as a resource state to simulate nonClifford gates using only stabilizer operations (i.e., Clifford gates, computational basis states and Zbasis measurements). Additionally, magic states can also be distilled using only stabilizer operations^{18}. In this paper we focus entirely on preparing an \(\leftH\right\rangle\)type magic state^{18,20}. In particular, an \(\leftH\right\rangle\) state is given by
which is a +1 eigenstate of H. Note that \(\leftH\right\rangle\) is Clifford equivalent to the following more commonly known magic state
where S = diag(1, i) is the phase gate. The state \({A}_{\frac{\pi }{4}}\rangle\) can be used to simulate the \(\tilde{T}=diag(1,{e}^{i\pi /4})\) gate using stabilizer operations.
In Fig. 5a, we provide the circuit used to simulate the T gate in Eq. (11) using one \(\leftH\right\rangle\) state in addition to stabilizer operations. In many physical implementations however, noisy \(\leftH\right\rangle\) states are injected into such circuits. To determine if an \(\leftH\right\rangle\) state is afflicted by an error, one can measure the Hadamard operator using the circuit show in Fig. 5b. Since \(HY\leftH\right\rangle =Y\leftH\right\rangle\), if \(\leftH\right\rangle\) is afflicted by a Y error, a −1 measurement outcome will be obtained. Further, if \(\leftH\right\rangle\) is afflicted by an X or Z error, then the measurement outcome is ±1 at random. If the outcome is +1, then no error will be present after the measurement. Note that the controlledHadamard gate can be decomposed into products of T, T^{†} and controlledZ gates as shown in Fig. 5c.
Triangular color codes
Color codes are topological codes, and thus the data qubits can placed on a lattice where each stabilizer generator can be measured using nearestneighbor interactions. The triangular color code family has code parameters [[n = (3d^{2} + 1)/4, 1, d]] and is a version of the color code defined on a twodimensional lattice \({\mathcal{L}}\) with boundaries. It is a selfdual CSS code with weightfour and weightsix X and Ztype stabilizers (see Fig. 6). The lattice \({\mathcal{L}}\) is 3colorable, meaning that every face can be colored in red, green, or blue with any other face sharing an incident edge having a different color. All vertices of \({\mathcal{L}}\) (apart from the three corners) are incident to three edges. The distanced triangular color code can correct any errors of weight less than or equal to (d − 1)/2 where d is odd. Further, triangular color codes can implement all logical Clifford gates using transversal operations. In particular, the logical Hadamard operator is simply given by \(\overline{H}={H}^{\otimes n}\) where n is the number of data qubits.
In ref. ^{42}, an efficient decoder (which we refer to as the Lift decoder) for twodimensional color codes was provided. In ref. ^{38} it was shown how the Lift decoder can be extended to color codes with boundaries. Further, it was shown how the Lift decoder can incorporate measurement outcomes from flag qubits to maintain the effective distance of the code under a full circuitlevel noise model (see below). Using such methods, it was found that triangular color codes exhibit a competitive threshold value of 0.2% under a full circuitlevel depolarizing noise model.
Growing the triangular color code
An illustration of the circuit G^{(1→5)} for growing a physical \(\leftH\right\rangle\) state to a logical \(\left\overline{H}\right\rangle\) state encoded in the d = 5 triangular color code is given in Fig. 7a. The preparation of \(\left\overline{H}\right\rangle\) in a general distance d triangular color code can be done as follows. First, one prepares a stabilizer state \(\left{S}_{t}\right\rangle\) (which encodes no logical qubits) that is stabilized by all elements in \({{\mathcal{S}}}_{{\rm{st}}}={{\mathcal{S}}}_{{w}_{2}}\cup ({{\mathcal{S}}}_{{\rm{color}}}\setminus {{\mathcal{S}}}_{{b}_{1}})\) where \({{\mathcal{S}}}_{\rm{color}}\) is the stabilizer group of a distance d triangular color code, \({{\mathcal{S}}}_{{b}_{1}}\) is generated by the X and Ztype weightfour operators (white plaquettes) along the boundary b_{1} of the triangular color code and \({{\mathcal{S}}}_{{w}_{2}}\) is generated by the weighttwo X and Ztype operators along the boundary b_{1} (see Fig. 7 for the case where d = 5). The qubit that is in \(\rm{supp}({{\mathcal{S}}}_{{\rm{color}}})\setminus {\rm{supp}}({{\mathcal{S}}}_{{\rm{st}}})\) is prepared in the physical \(\leftH\right\rangle\) state. Note that in the above construction, any of the three boundaries of \({\mathcal{L}}\) can be chosen. We chose b_{1} for convention.
After preparing \(\left{S}_{t}\right\rangle\), the X and Ztype generators of \({{\mathcal{S}}}_{{b}_{1}}\) are measured along the boundary b_{1}. Since the generators of \({{\mathcal{S}}}_{{b}_{1}}\) do not commute with the weighttwo generators of \({{\mathcal{S}}}_{{w}_{2}}\), the measurement outcomes of each generator in \({{\mathcal{S}}}_{{b}_{1}}\) will be ±1 at random. If a −1 outcome is obtained, a Pauli frame update^{54,55,56,57} needs to be applied to obtain the correct encoded state. In order to perform the correct Pauli frame update based on the random measurement outcomes, we define two onedimensional graphs \({G}_{1x}^{(d)}\) and \({G}_{1z}^{(d)}\). The vertices of the graph \({G}_{1x}^{(d)}\) contain the random measurement outcomes of the Xtype generators in \({{\mathcal{S}}}_{{b}_{1}}\). Each edge corresponds to two qubits that have support on one of the weighttwo operators of \({{\mathcal{S}}}_{{w}_{2}}\). Similarly, the vertices of the graph \({G}_{1z}^{(d)}\) encodes the random measurement outcomes of the Ztype generators in \({{\mathcal{S}}}_{{b}_{1}}\). An example is provided in Fig. 7a for the d = 5 triangular color code. Given the set of highlighted vertices of \({G}_{1x}^{(d)}\) and \({G}_{1z}^{(d)}\), MinimumWeightPerfectMatching (MWPM)^{58} is applied on both graphs. Each highlighted edge involves performing a weighttwo X or Ztype Pauli frame update. For instance, for the graph \({G}_{1x}^{(5)}\) in Fig. 7b, if the edge e_{1} is selected during MWPM, the correction \({Z}_{{q}_{1}}{Z}_{{q}_{6}}\) is applied to the data. Note that the growing scheme is not faulttolerant, and thus there is no need to repeat the measurements described above.
Growing an \(\left\overline{H}\right\rangle\) state encoded in a distanced_{1} triangular color code to one encoded in a distanced_{2} triangular color code (with d_{2} > d_{1}) can be done similarly as above and we denote such a growing circuit by \({G}^{({d}_{1}\to {d}_{2})}\). The circuit \({G}^{({d}_{1}\to {d}_{2})}\) is implemented as follows. As in the case of G^{(1→d)}, a stabilizer state \(\left{S}_{t}\right\rangle\) is prepared, and operators supported on the white plaquettes seperating \({\left\overline{H}\right\rangle }_{{d}_{1}}\) and \(\left{S}_{t}\right\rangle\) are measured (this step can be viewed as gauge fixing of an underlying subsystem code^{59}). Measurements of all operators supported on each plaquette of the distance d_{2} triangular color code are repeated d_{1} times to correct errors and to distinguish measurement errors from the random outcomes obtained when measuring the white plaquettes. An example for implementing G^{(3→7)} is provided in Fig. 7c and d. More details on the implementation of the growing circuits G^{(1→d)} and \({G}^{({d}_{1}\to {d}_{2})}\) are provided in Supplementary Note 1 and Supplementary Fig. 1.
Circuitlevel noise model and simulation details
The full circuitlevel noise model used throughout all simulations performed in this work with physical stabilizer operations is given as follows:

With probability p, each singlequbit gate location is followed by a Pauli error drawn uniformly and independently from {X, Y, Z}.

With probability p, each twoqubit gate is followed by a twoqubit Pauli error drawn uniformly and independently from {I, X, Y, Z}^{⊗2}⧹{I ⊗ I}.

With probability \(\frac{2p}{3}\), the preparation of the \(\left0\right\rangle\) state is replaced by \(\left1\right\rangle =X\left0\right\rangle\). Similarly, with probability \(\frac{2p}{3}\), the preparation of the \(\left+\right\rangle\) state is replaced by \(\left\right\rangle =Z\left+\right\rangle\).

With probability p, the preparation of the \(\leftH\right\rangle\) state is replaced by \(P\leftH\right\rangle\) where P is a Pauli error drawn uniformly and independently from {X, Y, Z}.

With probability \(\frac{2p}{3}\), any single qubit measurement has its outcome flipped.

With probability p, each idle gate location is followed by a Pauli error drawn uniformly and independently from {X, Y, Z}.
It is important to point out that due to the presence of T gates (which are nonClifford) used to implement the controlledHadamard gates (see Fig. 5), an efficient Monte–Carlo simulation of the circuits \({H}_{m}^{(d)}\) using Gottesman–Knill error propagation^{60,61} is not possible. Consequently, we divided the Monte–Carlo simulation to calculate \({p}_{L}^{(d)}\) and \({p}_{{\rm{acc}}}^{(d)}(p)\) into two parts. First, we perform a Monte–Carlo simulation of the circuit used to prepare \({\left\overline{H}\right\rangle }_{G}\). If the output error E_{out} has a nontrivial syndrome or is a logical operator, the protocol of Fig. 1 is aborted, otherwise, we proceed to simulate the \({H}_{m}^{(d)}\) and EC^{(d)} circuits. We define \({p}_{{\rm{acc}},1}^{(d)}\) to be the probability of proceeding to the \({H}_{m}^{(d)}\) and EC^{(d)} circuits. Note that there could be other faults in the \({H}_{m}^{(d)}\) and EC^{(d)} circuits that would cause the protocol to be accepted even though E_{out} had a nontrivial syndrome or was a logical operator. However such an event would require at least (d − 1)/2 faults, and since the large majority of malignant error locations are found in \({H}_{m}^{(d)}\) and EC^{(d)}, such an approximation only affects α in Eq. (1) by a small constant factor. As an example for p = 10^{−4}, \({p}_{{\rm{acc}},1}^{(d)}=0.9897\)(d = 3), \({p}_{{\rm{acc}},1}^{(d)}=0.9711\)(d = 5), and \({p}_{{\rm{acc}},1}^{(d)}=0.9462\)(d = 7). As such, one can see that these probabilities are close to 1 for all relevant code distances. Furthermore, we numerically verify that the probability of a logical failure when preparing \({\left\overline{H}\right\rangle }_{G}\) non faulttolerantly is < 90p for d ≤ 7, hence, < 1% for p = 10^{−4}. Note that these logical errors will be detected in the later stages of Fig. 1 unless there are strictly more than (d − 1)/2 faults in the entire protocol, which is very unlikely.
If all flag qubit and ancilla qubit measurement outcomes in the (d − 1)/2 applications of the \({H}_{m}^{(d)}\) and EC^{(d)} circuits are trivial, the output state is accepted. We define \({p}_{{\rm{acc}},2}^{(d)}\) to be the probability of acceptance for the second part of the simulation (i.e., the simulation of the \({H}_{m}^{(d)}\) and EC^{(d)} circuits). Hence the total acceptance probability is \({p}_{{\rm{acc}}}^{(d)}={p}_{{\rm{acc}},1}^{(d)}{p}_{{\rm{acc}},2}^{(d)}\). To determine if the output error of an accepted state is correctable, we perform one round of perfect error correction using the the Lift decoder.
We also remark that to simulate the circuit \({H}_{m}^{(d)}\), we use the fact that \({T}^{\dagger }XT=\frac{1}{\sqrt{2}}(X+Z)=H\) and \({T}^{\dagger }ZT=\frac{1}{\sqrt{2}}(ZX)=iYH\). Hence if an X or Z error is input to a T or T^{†} gate, we pessimistically apply an X or Z error to the output, each with 50% probability. Such an approximation would be exact if twirling operations were performed both before and after the T^{†} and T gates (see Supplementary Note 3 and Supplementary Fig. 3 for more details; see also^{9}). To be clear, we do not propose applying twirling operations when implementing our scheme as this could reduce the performance. The approximations stated here are performed to allow us to simulate our scheme on a classical computer. More details on the simulation of nonClifford gates are provided in Supplementary Note 4 and Supplementary Figs. 4 and 5. Note that instead of twirling, one could possibly perform an exact simulation using methods introduced in refs. ^{62,63}. We leave such a more sophisticated simulation as a future research direction.
Data availability
All the data used to generate the results of our work can be found in the public repository https://github.com/einsteinchris/MagicStatePrep.git under the file name DataMagicStatePrepSim.nb.
Code availability
The code used to generate the data in this work cannot be shared due to proprietary reasons.
References
Shor, P. W. Algorithms for quantum computation: discrete logarithms and factoring. In Proc. 35th Annual Symposium on Foundations of Computer Science, 124–134 (IEEE, 1994).
Lloyd, S. Universal quantum simulators. Science 273, 1073–1078 (1996).
Eastin, B. & Knill, E. Restrictions on transversal encoded quantum gate sets. Phys. Rev. Lett. 102, 110502 (2009).
Knill, E., Laflamme, R. & Zurek, W. H. Threshold accuracy for quantum computation. Preprint at https://arxiv.org/abs/quantph/9610011 (1996).
Paetznick, A. & Reichardt, B. W. Universal faulttolerant quantum computation with only transversal gates and error correction. Phys. Rev. Lett. 111, 090505 (2013).
JochymO’Connor, T. & Laflamme, R. Using concatenated quantum codes for universal faulttolerant quantum gates. Phys. Rev. Lett. 112, 010505 (2014).
Anderson, J. T., DuclosCianci, G. & Poulin, D. Phys. Rev. Lett. 113, 080501 (2014).
Bombín, H. Gauge color codes: optimal transversal gates and gauge fixing in topological stabilizer codes. N. J. Phys. 17, 083002 (2015).
Bravyi, S. & Cross, A. Doubled color codes. Preprint at https://arxiv.org/abs/1509.03239 (2015).
JochymO’Connor, T. & Bartlett, S. D. Stacked codes: universal faulttolerant quantum computation in a twodimensional layout. Phys. Rev. A 93, 022323 (2016).
Yoder, T. J., Takagi, R. & Chuang, I. L. Universal faulttolerant gates on concatenated stabilizer codes. Phys. Rev. X 6, 031039 (2016).
Chamberland, C., JochymO’Connor, T. & Laflamme, R. Thresholds for universal concatenated quantum codes. Phys. Rev. Lett. 117, 010501 (2016).
Chamberland, C., JochymO’Connor, T. & Laflamme, R. Overhead analysis of universal concatenated quantum codes. Phys. Rev. A 95, 022313 (2017).
Chamberland, C. & JochymO’Connor, T. Error suppression via complementary gauge choices in reedmuller codes. Quantum Sci. Technol. 2, 035008 (2017).
Chamberland, C. & Cross, A. W. Faulttolerant magic state preparation with flag qubits. Quantum 3, 143 (2019).
JochymO’Connor, T. Faulttolerant gates via homological product codes. Quantum 3, 120 (2019).
Lavasani, A., Zhu, G. & Barkeshli, M. Universal logical gates with constant overhead: instantaneous Dehn twists for hyperbolic quantum codes. Quantum 3, 180 (2019).
Bravyi, S. & Kitaev, A. Universal quantum computation with ideal clifford gates and noisy ancillas. Phys. Rev. A 71, 022316 (2005).
Reichardt, B. W. Quantum universality from magic states distillation applied to css codes. Quantum Inf. Process. 4, 251–264 (2005).
Meier, A. M., Eastin, B. & Knill, E. Magicstate distillation with the fourqubit code. Quantum Info Comput. 13, 0195–0209 (2013).
Bravyi, S. & Haah, J. Magicstate distillation with low overhead. Phys. Rev. A 86, 052329 (2012).
Fowler, A. G., Devitt, S. J. & Jones, C. Surface code implementation of block code state distillation. Sci. Rep. 1939, 2045–2322 (2013).
O’Gorman, J. & Campbell, E. T. Quantum computation with realistic magicstate factories. Phys. Rev. A 95, 032338 (2017).
Haah, J., Hastings, M. B., Poulin, D. & Wecker, D. Magic state distillation with low space overhead and optimal asymptotic input count. Quantum 1, 31 (2017).
Haah, J., B. Hastings, M., Poulin, D. & Wecker, D. Magic state distillation at intermediate size. Quantum Info Comput. 18, 97–165 (2018).
Hastings, M. B. & Haah, J. Distillation with sublogarithmic overhead. Phys. Rev. Lett. 120, 050504 (2018).
Haah, J. & Hastings, M. B. Codes and protocols for distilling T, controlledS, and toffoli gates. Quantum 2, 71 (2018).
Litinski, D. Magic state distillation: not as costly as you think. Quantum 3, 205 (2019).
Yoder, T. J. & Kim, I. H. The surface code with a twist. Quantum 1, 2 (2017).
Chao, R. & Reichardt, B. W. Quantum error correction with only two extra qubits. Phys. Rev. Lett. 121, 050502 (2018).
Chao, R. & Reichardt, B. W. Faulttolerant quantum computation with few qubits. npj Quantum Inf. 4, 42 (2018).
Chamberland, C. & Beverland, M. E. Flag faulttolerant error correction with arbitrary distance codes. Quantum 2, 53 (2018).
Tansuwannont, T., Chamberland, C. & Leung, D. Flag faulttolerant error correction, measurement, and quantum computation for cyclic calderbankshorsteane codes. Phys. Rev. A 101, 012342 (2020).
Reichardt, B. W. Faulttolerant quantum error correction for Steane’s sevenqubit color code with few or no extra qubits. Preprint at https://arxiv.org/abs/1804.06995 (2018).
Shi, Y., Chamberland, C. & Cross, A. Faulttolerant preparation of approximate GKP states. N. J. Phys. 21, 093007 (2019).
Chamberland, C., Zhu, G., Yoder, T. J., Hertzberg, J. B. & Cross, A. W. Topological and subsystem codes on lowdegree graphs with flag qubits. Phys. Rev. X 10, 011022 (2020).
Chao, R. & Reichardt, B. W. Flag faulttolerant error correction for any stabilizer code. PRX Quantum 1, 010302 (2020).
Chamberland, C., Kubica, A., Yoder, T. J. & Zhu, G. Triangular color codes on trivalent graphs with flag qubits. N. J. Phys. 22, 023019 (2020).
Bombin, H. & MartinDelgado, M. A. Topological quantum distillation. Phys. Rev. Lett. 97, 180501 (2006).
Kubica, A. & Beverland, M. E. Universal transversal gates with color codes: A simplified approach. Phys. Rev. A 91, 032330 (2015).
Kubica, A. The ABCs of the color code: a study of topological quantum codes as toy models for faulttolerant quantum computation and quantum phases of matter. Ph.D. thesis (2018). https://thesis.library.caltech.edu/10955/.
Kubica, A. & Delfosse, N. Efficient color code decoders in d≥2 dimensions from toric code decoders. Preprint at https://arxiv.org/abs/1905.07393.
Fowler, A. G., Mariantoni, M., Martinis, J. M. & Cleland, A. N. Surface codes: Towards practical largescale quantum computation. Phys. Rev. A 86, 032324 (2012).
Kivlichan, I. D. et al. Improved faulttolerant quantum simulation of condensedphase correlated electrons via trotterization. Quantum 4, 296 (2020).
Gidney, C. & Ekerå, M. How to factor 2048 bit RSA integers in 8 hours using 20 million noisy qubits. Preprint at https://arxiv.org/abs/1905.09749 (2019).
Aliferis, P., Gottesman, D. & Preskill, J. Quantum accuracy threshold for concatenated distance3 codes. Quantum Info Comput. 6, 97–165 (2006).
Gottesman, D. An introduction to quantum error correction and faulttolerant quantum computation. Proc. Symp. Appl. Math. 68, 13–58 (2010).
Campbell, E. T., Terhal, B. M. & Vuillot, C. Roads towards faulttolerant universal quantum computation. Nature 549, 172–179 (2017).
Delfosse, N. Hierarchical decoding to reduce hardware requirements for quantum computing. Preprint at https://arxiv.org/abs/2001.11427 (2019).
McArdle, S., Endo, S., AspuruGuzik, A., Benjamin, S. C. & Yuan, X. Quantum computational chemistry. Rev. Mod. Phys. 92, 015003 (2020).
Fowler, A. G., Whiteside, A. C., McInnes, A. L. & Rabbani, A. Topological code autotune. Phys. Rev. X 2, 041003 (2012).
Kitaev, A. Y. Quantum computations: algorithms and error correction. Russ. Math. Surv. 52, 1191–1249 (1997).
Dawson, C. M. & Nielsen, M. The solovaykitaev algorithm. Quant. Inf. Comput. 6, 81–95 (2006).
Knill, E. Quantum computing with realistically noisy devices. Nature 434, 39–44 (2005).
Terhal, B. M. Quantum error correction for quantum memories. Rev. Mod. Phys. 87, 307–346 (2015).
DiVincenzo, D. P. & Aliferis, P. Effective faulttolerant quantum computation with slow measurements. Phys. Rev. Lett. 98, 020501 (2007).
Chamberland, C., Iyer, P. & Poulin, D. Faulttolerant quantum computing in the pauli or clifford frame with slow error diagnostics. Quantum 2, 43 (2018).
Edmonds, J. Paths, trees, and flowers. Can. J. Math. 17, 449–467 (1965).
Vuillot, C. et al. Code deformation and lattice surgery are gauge fixing. N. J. Phys. 21, 033028 (2019).
Gottesman, D. The Heisenberg representation of quantum computers. In: Proc. XXII International Colloquium on Group Theoretical Methods in Physics 32–43 (Cambrisdge, Mass.: International Press, 1998).
Aaronson, S. & Gottesman, D. Improved simulation of stabilizer circuits. Phys. Rev. A 70, 052328 (2004).
Bravyi, S. & Gosset, D. Improved classical simulation of quantum circuits dominated by clifford gates. Phys. Rev. Lett. 116, 250501 (2016).
Bravyi, S. et al. Simulation of quantum circuits by lowrank stabilizer decompositions. Quantum 3, 181 (2019).
Acknowledgements
C.C. acknowledges Yihe Tang and Milan Cvitkovic for their help in setting up the computing resources with the AWS clusters that were used for performing all the numerical simulations in this work. We would like to thank Earl Campbell, Aleksander Kubica and Fernando Brandao for useful discussions. We thank Simone Severini, Bill Vass and Dominique L’Eplattenier for their guidance and help with submitting the paper. We also thank Kevin Dothager for his help with IP.
Author information
Authors and Affiliations
Contributions
C.C. and K.N. conceived the idea of redundant ancilla encoding, designed the faulttolerant circuits for both syndrome extraction and measuring Hadamard, and proved the faulttolerant properties of the magic state preparation protocol. C.C. performed the numerics and overhead analysis. C.C. and K.N. wrote the manuscript.
Corresponding authors
Ethics declarations
Competing interests
The authors declare no competing interests.
Additional information
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Supplementary information
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons license, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons license, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons license and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Chamberland, C., Noh, K. Very low overhead faulttolerant magic state preparation using redundant ancilla encoding and flag qubits. npj Quantum Inf 6, 91 (2020). https://doi.org/10.1038/s41534020003195
Received:
Accepted:
Published:
DOI: https://doi.org/10.1038/s41534020003195
This article is cited by

Encoding a magic state with beyond breakeven fidelity
Nature (2024)

Lowoverhead code concatenation approaches for universal quantum computation
Quantum Information Processing (2023)

Faulttolerant error correction for quantum Hamming codes with only two ancillary qudits
Quantum Information Processing (2023)

Constraints on magic state protocols from the statistical mechanics of Wigner negativity
npj Quantum Information (2022)

Realtime processing of stabilizer measurements in a bitflip code
npj Quantum Information (2020)