††thanks: These three authors contributed equally††thanks: These three authors
contributed equally††thanks: These three authors contributed equally

# Logical Magic State Preparation with Fidelity Beyond the Distillation
Threshold on a Superconducting Quantum Processor

Yangsen Ye  Tan He  Hefei National Research Center for Physical Sciences at
the Microscale and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  Shanghai Research Center for Quantum
Science and CAS Center for Excellence in Quantum Information and Quantum
Physics, University of Science and Technology of China, Shanghai 201315, China
He-Liang Huang  Hefei National Research Center for Physical Sciences at the
Microscale and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  Shanghai Research Center for Quantum
Science and CAS Center for Excellence in Quantum Information and Quantum
Physics, University of Science and Technology of China, Shanghai 201315, China
Henan Key Laboratory of Quantum Information and Cryptography, Zhengzhou, Henan
450000, China  Zuolin Wei  Yiming Zhang  Youwei Zhao  Dachao Wu  Hefei
National Research Center for Physical Sciences at the Microscale and School of
Physical Sciences, University of Science and Technology of China, Hefei
230026, China  Shanghai Research Center for Quantum Science and CAS Center for
Excellence in Quantum Information and Quantum Physics, University of Science
and Technology of China, Shanghai 201315, China  Qingling Zhu  Shanghai
Research Center for Quantum Science and CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Shanghai 201315, China  Hefei National Laboratory, University of
Science and Technology of China, Hefei 230088, China  Huijie Guan  Sirui Cao
Hefei National Research Center for Physical Sciences at the Microscale and
School of Physical Sciences, University of Science and Technology of China,
Hefei 230026, China  Shanghai Research Center for Quantum Science and CAS
Center for Excellence in Quantum Information and Quantum Physics, University
of Science and Technology of China, Shanghai 201315, China  Fusheng Chen
Tung-Hsun Chung  Shanghai Research Center for Quantum Science and CAS Center
for Excellence in Quantum Information and Quantum Physics, University of
Science and Technology of China, Shanghai 201315, China  Hefei National
Laboratory, University of Science and Technology of China, Hefei 230088, China
Hui Deng  Hefei National Research Center for Physical Sciences at the
Microscale and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  Shanghai Research Center for Quantum
Science and CAS Center for Excellence in Quantum Information and Quantum
Physics, University of Science and Technology of China, Shanghai 201315, China
Hefei National Laboratory, University of Science and Technology of China,
Hefei 230088, China  Daojin Fan  Hefei National Research Center for Physical
Sciences at the Microscale and School of Physical Sciences, University of
Science and Technology of China, Hefei 230026, China  Shanghai Research Center
for Quantum Science and CAS Center for Excellence in Quantum Information and
Quantum Physics, University of Science and Technology of China, Shanghai
201315, China  Ming Gong  Hefei National Research Center for Physical Sciences
at the Microscale and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  Shanghai Research Center for Quantum
Science and CAS Center for Excellence in Quantum Information and Quantum
Physics, University of Science and Technology of China, Shanghai 201315, China
Hefei National Laboratory, University of Science and Technology of China,
Hefei 230088, China  Cheng Guo  Shaojun Guo  Lianchen Han  Na Li  Hefei
National Research Center for Physical Sciences at the Microscale and School of
Physical Sciences, University of Science and Technology of China, Hefei
230026, China  Shanghai Research Center for Quantum Science and CAS Center for
Excellence in Quantum Information and Quantum Physics, University of Science
and Technology of China, Shanghai 201315, China  Shaowei Li  Shanghai Research
Center for Quantum Science and CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Shanghai 201315, China  Hefei National Laboratory, University of
Science and Technology of China, Hefei 230088, China  Yuan Li  Hefei National
Research Center for Physical Sciences at the Microscale and School of Physical
Sciences, University of Science and Technology of China, Hefei 230026, China
Shanghai Research Center for Quantum Science and CAS Center for Excellence in
Quantum Information and Quantum Physics, University of Science and Technology
of China, Shanghai 201315, China  Futian Liang  Hefei National Research Center
for Physical Sciences at the Microscale and School of Physical Sciences,
University of Science and Technology of China, Hefei 230026, China  Shanghai
Research Center for Quantum Science and CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Shanghai 201315, China  Hefei National Laboratory, University of
Science and Technology of China, Hefei 230088, China  Jin Lin  Shanghai
Research Center for Quantum Science and CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Shanghai 201315, China  Hefei National Laboratory, University of
Science and Technology of China, Hefei 230088, China  Haoran Qian  Hao Rong
Hong Su  Shiyu Wang  Yulin Wu  Hefei National Research Center for Physical
Sciences at the Microscale and School of Physical Sciences, University of
Science and Technology of China, Hefei 230026, China  Shanghai Research Center
for Quantum Science and CAS Center for Excellence in Quantum Information and
Quantum Physics, University of Science and Technology of China, Shanghai
201315, China  Yu Xu  Shanghai Research Center for Quantum Science and CAS
Center for Excellence in Quantum Information and Quantum Physics, University
of Science and Technology of China, Shanghai 201315, China  Hefei National
Laboratory, University of Science and Technology of China, Hefei 230088, China
Chong Ying  Jiale Yu  Hefei National Research Center for Physical Sciences at
the Microscale and School of Physical Sciences, University of Science and
Technology of China, Hefei 230026, China  Shanghai Research Center for Quantum
Science and CAS Center for Excellence in Quantum Information and Quantum
Physics, University of Science and Technology of China, Shanghai 201315, China
Chen Zha  Shanghai Research Center for Quantum Science and CAS Center for
Excellence in Quantum Information and Quantum Physics, University of Science
and Technology of China, Shanghai 201315, China  Hefei National Laboratory,
University of Science and Technology of China, Hefei 230088, China  Kaili
Zhang  Shanghai Research Center for Quantum Science and CAS Center for
Excellence in Quantum Information and Quantum Physics, University of Science
and Technology of China, Shanghai 201315, China  Yong-Heng Huo  Chao-Yang Lu
Cheng-Zhi Peng  Xiaobo Zhu  Jian-Wei Pan  Hefei National Research Center for
Physical Sciences at the Microscale and School of Physical Sciences,
University of Science and Technology of China, Hefei 230026, China  Shanghai
Research Center for Quantum Science and CAS Center for Excellence in Quantum
Information and Quantum Physics, University of Science and Technology of
China, Shanghai 201315, China  Hefei National Laboratory, University of
Science and Technology of China, Hefei 230088, China

###### Abstract

Fault-tolerant quantum computing based on surface code has emerged as an
attractive candidate for practical large-scale quantum computers to achieve
robust noise resistance. To achieve universality, magic states preparation is
a commonly approach for introducing non-Clifford gates. Here, we present a
hardware-efficient and scalable protocol for arbitrary logical state
preparation for the rotated surface code, and further experimentally implement
it on the Zuchongzhi 2.1 superconducting quantum processor. An average of
$0.8983\pm 0.0002$ logical fidelity at different logical states with distance-
three is achieved, taking into account both state preparation and measurement
errors. In particular, the magic states $|A^{\pi/4}\rangle_{L}$,
$|H\rangle_{L}$, and $|T\rangle_{L}$ are prepared non-destructively with
logical fidelities of $0.8771\pm 0.0009$, $0.9090\pm 0.0009$, and $0.8890\pm
0.0010$, respectively, which are higher than the state distillation protocol
threshold, 0.859 (for H-type magic state) and 0.827 (for T -type magic state).
Our work provides a viable and efficient avenue for generating high-fidelity
raw logical magic states, which is essential for realizing non-Clifford
logical gates in the surface code.

###### pacs:

03.65.Ud, 03.67.Mn, 42.50.Dv, 42.50.Xa

##  I Introduction

Practical quantum computers are extremely difficult to engineer and build, as
they are easily crippled by the inevitable noise in realistic quantum
hardwares Huang  _et al._ (2020, 2023). Fault-tolerant quantum computing build
on quantum error correction (QEC) offers a promising path to quantum
computation at scale, by encoding the quantum information into logical qubits.
In the past decades, much progress has been made to construct QEC schemes and
realize QEC in the specific context of trapped ions Schindler  _et al._
(2011); Egan  _et al._ (2021); Ryan-Anderson  _et al._ (2021); Hilder  _et
al._ (2022), superconducting circuits Andersen  _et al._ (2020); AI (2021);
Marques  _et al._ (2021); Zhao  _et al._ (2022); Krinner  _et al._ (2022);
Acharya  _et al._ (2022); Reed  _et al._ (2012); Ofek  _et al._ (2016);
Córcoles  _et al._ (2015); Huang  _et al._ (2021), photons Yao  _et al._
(2012); Pittman  _et al._ (2005); Luo  _et al._ (2021); Liu  _et al._ (2019)
and nitrogen-vacancy centers Waldherr  _et al._ (2014); Taminiau  _et al._
(2014); Cramer  _et al._ (2016). The surface code Kitaev (2003); Raussendorf
and Harrington (2007); Fowler  _et al._ (2012), a planar realization of
Kitaev’s toric code, is experimentally attractive as it requires only a two-
dimensional lattice of qubits with nearestneighbour coupling, and has a high
error threshold of about 1%. The quality properties and great potential of
surface code have driven efforts to scale up experiments from distance-two
Andersen  _et al._ (2020); AI (2021); Marques  _et al._ (2021) to distance-
three Zhao  _et al._ (2022); Krinner  _et al._ (2022) and even distance-five
Acharya  _et al._ (2022), until reaching a practical level.

Working with logical qubits to achieve a specific computational task
introduces additional overhead for logical quantum gate operations. The
surface code provides a relatively low-overhead implementation of the logical
Clifford gate. However, a quantum circuit consisting only Clifford gates is
not computationally universal, nor does it confer no quantum computational
advantage, since it can be efficiently simulated by classical computing
Gottesman (1998); Bu and Koh (2019). In order to achieve computational
universality, there must be at least one non-Clifford gate, such as $T$ gate.
These non-Clifford gate can be implemented through magic state injection
Bravyi and Kitaev (2005); Reichardt (2005); Bravyi and Haah (2012); O’Gorman
and Campbell (2017); Hastings and Haah (2018), but unfortunately, it takes a
large overhead and a huge number of magic state Fowler and Gidney (2018);
Bravyi and Haah (2012); Campbell and Howard (2017); O’Gorman and Campbell
(2017). Thus, fast and high-fidelity logical magic state preparation Li
(2015); Łodyga  _et al._ (2015); Gidney (2023a) is crucial in the
implementation of universal logical quantum gates.

Figure 1: Arbitrary logical state preparation protocol and simulation results.
(a) Arbitrary logical state preparation protocol. Top panel: The surface code
is divided into 5 regions, the central data qubit, regions I, II, III, and IV.
The logical operators $\hat{Z}_{L}$ and $\hat{X}_{L}$ intersect at the central
data qubits. Bottom panel: The circuit of the protocol. All qubits are reset
to $|0\rangle$ state at the beginning of the circuit. Then the data qubits in
the regions I and III are prepared to $|+\rangle$ by Hadamard gate, and the
central data qubit is prepared to the target state $|\psi\rangle$ by rotation
gates. One round of surface code cycle is applied afterwards, projecting the
data qubits state into the logical state space. (b-e) Simulation results for
the $|{+i}\rangle_{L}$ state preparation. (b-c) Logical initial error rate as
a function of average physical error rate and surface code distance with no
post-processing (b) and with post-selection of only syndrome measurements (c).
The blue lines in the figure indicate the most demanding threshold, 0.141 (the
15-to-1 state distillation protocol for $H$-type magic state), for state
distillation protocol. (d-e) The ratio of $\varepsilon_{raw}$ to
$\varepsilon_{det}$ and the retained fraction of post-selection as a function
of average physical error rate and surface code distance.

This work aims to explore how to prepare arbitrary logical state, especially
magic states, quickly and with high fidelity. Specifically, an arbitrary
logical state preparation protocol is proposed for the rotated surface code,
inspired by some relevant works Li (2015); Łodyga  _et al._ (2015). The
protocol does not require extra ancilla qubits and is almost identical to the
standard surface code protocol, except that the quantum state needs to be
prepared to a specific product state according to the target logical state
during the initialization stage. Theoretical analysis show good scaling
behavior of the protocol for high-fidelity large-scale logical quantum state
preparation. Furthermore, we experimentally realize the protocol on the
Zuchongzhi 2.1 superconducting quantum system Wu  _et al._ (2021); Zhu  _et
al._ (2022) to demonstrate its practical performance on real quantum devices.
An average logical fidelity of $0.8983\pm 0.0002$ is achieved with post-
selection using syndrome measurements for different prepared logical states,
even in the presence of significant readout errors during measurement. Among
them, two $H$-type logical magic states ${|A^{\pi/4}\rangle}_{L}$,
${|H\rangle}_{L}$ and one $T$-type logical magic state ${|T\rangle}_{L}$ are
obtained with logical fidelities of $0.8771\pm 0.0009$, $0.9090\pm 0.0009$,
and $0.8890\pm 0.0010$, respectively. These are significantly higher than the
15-to-1 magic state distillation protocol threshold 0.859 (for $H$-type magic
state) and the 5-to-1 magic state distillation protocol threshold 0.827 (for
$T$-type magic state) Bravyi and Kitaev (2005). The achieved results suggest
that our work represents a key step towards universal and scalable fault-
tolerant quantum computing, and has the potential to play a crucial role in
some NISQ protocols/algorithms Rolander  _et al._ (2022), such as error
mitigation Hicks  _et al._ (2022).

##  II Arbitrary Logical State Preparation Protocol

The arbitrary logical state preparation protocol is shown in Fig. 1(a). The
basic idea is to initialize the data qubits to a specific quantum state first,
and then apply one round surface code cycle to project the data qubits into
the logical state space. Assume the target logical state is
$|\psi\rangle_{L}=\alpha|0\rangle_{L}+\beta|1\rangle_{L}$, the detailed steps
of our protocol can be described in the following:

1\. Reset all qubits to $|0\rangle$ state, including data qubits and ancilla
qubits.

2\. Divide the rotated surface code into 5 regions, the central data qubit,
regions I, II, III, and IV, as shown in the top panel of Fig. 1(a). Prepare
the data qubits in regions I and III to the $|+\rangle$ state and the data
qubit in the center (intersection of logical operators $\hat{Z}_{L}$ and
$\hat{X}_{L}$) to the target state
$|\psi\rangle=\alpha|0\rangle+\beta|1\rangle$, while the data qubits of the
remaining regions II and IV stay in the $|0\rangle$ state. The data qubits
state after Step 2 is

$\displaystyle|\Psi_{0}\rangle=|\psi\rangle\bigotimes_{D_{i}\in\text{I}\cup\text{III}}|+\rangle\bigotimes_{D_{j}\in\text{II}\cup\text{IV}}|0\rangle$
(1)

where $D_{i}\in\text{I}\cup\text{III}$ ($D_{j}\in\text{II}\cup\text{IV}$) is
denoted as the data qubits of region I and III (II and IV), $D_{c}$ is denoted
as the central data qubit.

3\. Apply one round of surface code cycle. After measuring all the ancilla
qubits, the data qubits are then prepared to the desired logical state
$|\psi\rangle_{L}$.

The protocol is applicable to the surface code with arbitrary distance $d$,
and its quantum circuit is shown in the bottom panel of Fig. 1(a). The
$X$-stabilizers in regions I and III and the $Z$-stabilizers in regions II and
IV would have the deterministic measurement values $0$ if no error occurred.
With post-selection procedures using these stabilizers, the logical initial
error rate can be effectively reduced.

We further investigate the performance of the protocol through numerical
simulation (see Fig. 1(b-e)). The simulation uses the Pauli depolarizing
model, and uses the average physical error rate, i.e. the error rate of all
operations, including single-qubit gate, two-qubit gate, readout, reset and
thermal excitation, are all the same. The target logical state in our
simulations is chosen as $|{+i}\rangle_{L}$, and by doing so, the error
detection capabilities of $X$\- and $Z$-stabilizers can be tested
simultaneously.

We simulate the logical initial error rate with different surface code
distances and average physical error rates. The simulated circuits contain
only one round of surface code cycle (as shown in Fig. 1(a)), followed by a
logical $Y$ measurement (see Supplemental Materials for details). The results
without any post-processing and with syndrome measurement post-selection are
shown in Fig. 1(b) and (c), respectively. The blue line indicates the
threshold for state distillation protocol of the magic state, the threshold
here is chosen to be the most demanding 15-to-1 $H$-type protocol threshold of
0.141. As we can see, the logical initialization error rate increase with the
increasing of the surface code distance and the average physical error rate.
It is clear that there is a significant decrease in the logical error rate by
the post-selection, and the blue line is thus moved towards the right, which
means that more relaxed conditions are able to perform the state distillation
procedure. Figure 1(d) shows the ratio of logical initial error rate before
and after post-selection, which represents the suppression ability of the
post-selection for errors in the logical state preparation process. It can be
seen that the suppression rate ranges from 1 to 4 times for different
conditions, and the suppression ability becomes stronger as the code distance
grows and the average physical error rate decreases.

The retained fraction of post-selection is shown in Fig. 1(e). This is an
important indicator for the the efficiency of state distillation. The retained
fraction increases with decreasing code spacing and average physical error
rate. When the average error rate is 0.0002, the retained fraction is
acceptable in state distillation even for a code distance-21 (about $56\%$).

Figure 2: Layout and circuit implementation. (a) Structure of distance-three
surface code, with 9 data qubits(red dots), 4 $Z$-type ancilla qubits(green
dots) and 4 $X$-type ancilla qubits(blue dots). Connecting lines are colored
according to their involvement in two-qubit gate layers as shown in (c). (b)
Preparing 9 data qubits to a specific state, with 4 qubits stay in $|0\rangle$
state, 4 qubits initialize to $|+\rangle$ state and only one qubit transform
to the target $|\psi\rangle$ state. (c) Circuit for preparing arbitrary
logical state. First initialize 9 data qubits to specific states as (b)
illustrated, then apply one round surface code cycle. Squares with different
tags represent different single-qubit gates. All gates in one color block are
applied simultaneously.

##  III Experimental Implementation on a superconducting quantum processor

To demonstrate the performance of the protocol on a real quantum device, we
create a distance-three surface code using 17 out of the 66 qubits on the
Zuchongzhi 2.1 superconducting quantum system (see Supplemental Materials for
the system performance). This 17-qubit distance-three surface code (see Fig.
2(a)) consists of 9 data qubits, 4 $X$-type ancilla qubits and 4 $Z$-type
ancilla qubits. To prepare the logical state
$|\psi\rangle_{L}=\cos{\left(\frac{\theta}{2}\right)}|0\rangle_{L}+e^{i\varphi}\sin{\left(\frac{\theta}{2}\right)}|1\rangle_{L}$,
the data qubits are initialized in the way shown in Fig. 2(b) to the product
state

$\displaystyle|\Psi\rangle=|+\rangle|+\rangle|0\rangle|0\rangle|\psi\rangle|0\rangle|0\rangle|+\rangle|+\rangle,$
(2)

where
$|\psi\rangle=\cos{\left(\frac{\theta}{2}\right)}|0\rangle+e^{i\varphi}\sin{\left(\frac{\theta}{2}\right)}|1\rangle$
can be experimentally realized using the virtual $Z$-gate and standard $\pi/2$
gate, as

$\displaystyle|\psi\rangle=Z_{\varphi}\cdot X_{\pi/2}\cdot Z_{\pi-\theta}\cdot
X_{\pi/2}|0\rangle.$ (3)

The corresponding quantum circuit is shown in Fig. 2(c). After implementing
one round of surface code cycle, the logical state $|\psi\rangle_{L}$ is
prepared. Furthermore, as shown in Fig. 2(b), in the logical state preparation
process, 4 stabilizers $X_{1}$, $Z_{2}$, $Z_{3}$, $X_{4}$ are deterministic.

Figure 3: Experimental results of the prepared different logical states. (a)
Logical state fidelity with post-selection in Bloch sphere. The fidelity of
the preparation of different logical states is represented as a circle, which
is divided into multiple annular sectors, each representing a point on the
Bloch sphere, with the radial direction representing the polar angle $\theta$
and the tangential direction representing the azimuthal angle $\varphi$. The
obtained average logical fidelity is 0.8983. (b) Logical measurement results
of $X_{L}$, $Y_{L}$, $Z_{L}$ as a function of polar angle $\theta$ or
azimuthal angle $\varphi$. The colored dashed curves are the result of fitting
with trigonometric function. (c) The logical density matrices of the magic
states. Real and imaginary parts are represented separately, and the
transparent wireframes represent the difference from the ideal density matrix.

We first prepare different logical states of uniformly scattered points on the
Bloch sphere by varying the parameters of ${\theta}$ and ${\varphi}$. Figure
3(a) shows the logical state fidelity $F_{L}$ of these prepared logical states
after using post-selection to drop the results that have detection events
during the preparation (see Supplemental Materials for the results before
post-selection), where

$\displaystyle
F_{L}=\left(\text{Tr}\sqrt{\sqrt{\rho_{\text{exp}}}\cdot\rho_{\text{theory}}\cdot\sqrt{\rho_{\text{exp}}}}\right)^{2},$
(4)

and $\rho_{\text{exp}}$ is the experimental density matrix reconstructed by
maximum-likelihood estimation after logical $X_{L}$, $Y_{L}$, $Z_{L}$
measurements. We note that the measurement results include both state
preparation and measurement (SPAM) error. We do not employ readout error
mitigation strategies Smith  _et al._ (2021) to remove measurement errors
because we believe it provides a more predictive assessment of the actual
fidelity when generating and consuming magic states for a non-Clifford gate,
as consuming the state involves measurement. These fidelities are represented
as pie-shaped (Fig. 3(a)), which is divided into multiple annular sectors,
each representing a point on the Bloch sphere, with the radial direction
representing the polar angle $\theta$ and the tangential direction
representing the azimuthal angle $\varphi$. The obtained average logical
fidelity is $0.8983\pm 0.0002$. Furthermore, we fixed one parameter in
$\theta$ and $\varphi$, measuring the logical operators $\hat{X}_{L}$,
$\hat{Y}_{L}$, $\hat{Z}_{L}$ to obtain expectation results as a function of
the other parameter. As shown in Fig. 3(b), the experimental points of
$\langle X\rangle_{L}$, $\langle Y\rangle_{L}$ and $\langle Z\rangle_{L}$ are
consistent with the sine/cosine variation.

Also, we show logical state tomography results of the prepared three magic
states, including two $H$-type magic states
${|A^{\pi/4}\rangle}_{L}=\frac{1}{\sqrt{2}}\left({|0\rangle}_{L}+e^{i\pi/4}{|1\rangle}_{L}\right)$
and
${|H\rangle}_{L}=\cos{\frac{\pi}{8}}{|0\rangle}_{L}+\sin{\frac{\pi}{8}}{|1\rangle}_{L}$,
and one $T$-type magic state
${|T\rangle}_{L}=\cos{\frac{\beta}{2}}{|0\rangle}_{L}+e^{i\pi/4}\sin{\frac{\beta}{2}}{|1\rangle}_{L}$,
where $\beta=\arccos{\frac{1}{\sqrt{3}}}$. These two type magic states are the
quantum resources for realizing non-Clifford gates $\Lambda({e^{-i\pi/4}})$
and $\Lambda({e^{-i\pi/6}})$, where

$\displaystyle\Lambda({e^{-i\theta}})=\left({\begin{array}[]{*{20}{c}}1&0\\\
0&{{e^{i\theta}}}\end{array}}\right).$ (7)

In Fig. 3(c), the real and imaginary parts of the density matrix are shown
separately. The logical fidelities of these magic states are
$|A^{\pi/4}\rangle_{L}$: $0.8771\pm 0.0009$, ${|H\rangle}_{L}$: $0.9090\pm
0.0009$, and ${|T\rangle}_{L}$: $0.8890\pm 0.0010$, which exceed the threshold
of the respective state distillation.

Figure 4: Fidelity of different logical state with error correction. (a) and
(b) show the fidelity of logical $|0\rangle_{L}$ state with the number of
surface code cycles with (blue line with square) and without (red line with
triangular) error correction, by using our arbitrary logical state preparation
proposal (a) and standard proposal (b), respectively. (c)-(d) Same as (a)-(b)
with logical $|+\rangle_{L}$ state, with arbitrary logical state preparation
proposal (c) and standard proposal (d). (e), (f), and (g) are results for
$|A^{\pi/4}\rangle_{L}$, $|H\rangle_{L}$, and $|T\rangle_{L}$ state using our
arbitrary logical state preparation proposal, respectively.

To observe the error correction performance of the surface code for different
logical initial states, we repeatedly apply the surface code cycles after the
logical state is prepared. Fig. 4 shows how the fidelity the logical states
varies with the number of surface code cycles with and without error
correction. The logical error rates are derived by fitting the curves with
$\mathcal{F}_{L}(k)=\frac{1}{2}\left(1+(1-2\epsilon_{L})^{k-k_{0}}\right)$
O’brien  _et al._ (2017). Fig. 4(a) and (c) show the results for
$|0\rangle_{L}$ and $|+\rangle_{L}$ using the arbitrary state preparation
protocol. The logical error rates per round of $|0\rangle_{L}$ and
$|+\rangle_{L}$ without error correction are $28.53\%$ and $32.24\%$. After
the error correction procedure, the fidelity of the logical states at each
point is improved and the logical error rates per round are reduced to
$24.77\%$ and $25.65\%$, respectively. As a comparison, the results using the
standard protocol Fowler  _et al._ (2012) for $|0\rangle_{L}$ and
$|+\rangle_{L}$ are shown in Fig. 4(b) and (d), and we can observe that the
logical error rates per round of the two protocols are similar. The most
obvious difference is that in the results obtained by standard protocol, the
fidelity of the logical states at the first round is significantly improved
with error correction. This is mainly because that all the four stabilizers
$Z_{1}$, $Z_{2}$, $Z_{3}$, $Z_{4}$ ($X_{1}$, $X_{2}$, $X_{3}$, $X_{4}$) are
work for the $|0\rangle_{L}$ ($|+\rangle_{L}$) in the first round, while only
half of stabilizers, $X_{1}$ and $X_{4}$ ($Z_{2}$ and $Z_{3}$), work for the
$|0\rangle_{L}$ ($|+\rangle_{L}$) in our arbitrary logical state preparation
protocol (as shown in Fig. 2(b)). These stabilizers are in the edge positions
and not near-neighbors, so it is difficult to correct error during logical
state preparation. The most valuable aspect of the arbitrary logical state
preparation protocol is that it can simply prepare arbitrary logical states,
whereas the standard approach requires very complex operations. Fig. 4 (e),
(f), and (g) show the results for magic states ${|A^{\pi/4}\rangle}_{L}$,
${|H\rangle}_{L}$ and ${|T\rangle}_{L}$. The achieved results show that the
logical error rates per round for these prepared complex logical states are
comparable to that of the standard logical states.

##  IV CONCLUSION AND OUTLOOK

The crucial step for surface code based fault-tolerant computing, preparing
distance-three logical magic state with fidelity beyond the distillation
threshold, is achieved in this work. Our work provides a highly simple,
experimentally friendly, and scalable way to prepare high-fidelity raw magic
states, which is critical for decreasing the overhead for distillation, and
thus paving the way for practical fault-tolerant quantum computing. The
protocol developed is partially fault-tolerant and naturally compatible with
the error detection and repeated error correction, to enhance the logical
state fidelity as well as to lift the logical coherence time. It might be
improved to fully fault-tolerant by introducing a flag qubit mechanism
Chamberland and Noh (2020); Chamberland and Cross (2019). In addition, using
some new approaches may further enhance the fidelity of magic state
preparation and measurement Gidney (2023a, b). All of these will be left for
our future work.

###### Acknowledgements.

The authors are grateful for valuable discussions with Craig Gidney and Ying
Li. The authors thank the USTC Center for Micro- and Nanoscale Research and
Fabrication for supporting the sample fabrication. The authors also thank
QuantumCTek Co., Ltd., for supporting the fabrication and the maintenance of
room-temperature electronics. Funding: This research was supported by the
Chinese Academy of Sciences, Anhui Initiative in Quantum Information
Technologies, Shanghai Municipal Science and Technology Major Project (Grant
No. 2019SHZDZX01), Innovation Program for Quantum Science and Technology
(Grant No. 2021ZD0300200), Special funds from Jinan science and Technology
Bureau and Jinan high tech Zone Management Committee, Technology Committee of
Shanghai Municipality, National Science Foundation of China (Grants No.
11905217, No. 11774326), Natural Science Foundation of Shandong Province,
China (grant number ZR202209080019), and Natural Science Foundation of
Shanghai (Grant No. 23ZR1469600), the Shanghai Sailing Program (Grant No.
23YF1452600). X. B. Zhu acknowledges support from the New Cornerstone Science
Foundation through the XPLORER PRIZE. H.-L. H. acknowledges support from the
Youth Talent Lifting Project (Grant No. 2020-JCJQ-QT-030), National Natural
Science Foundation of China (Grants No. 11905294, 12274464), China
Postdoctoral Science Foundation, and the Open Research Fund from State Key
Laboratory of High Performance Computing of China (Grant No. 201901-01).

## References

  * Huang  _et al._ (2020) H.-L. Huang, D. Wu, D. Fan, and X. Zhu, Sci. China Inf. Sci. 63, 180501 (2020).
  * Huang  _et al._ (2023) H.-L. Huang, X.-Y. Xu, C. Guo, G. Tian, S.-J. Wei, X. Sun, W.-S. Bao, and G.-L. Long, Sci. China Phys. Mech. Astron. 66, 250302 (2023).
  * Schindler  _et al._ (2011) P. Schindler, J. T. Barreiro, T. Monz, V. Nebendahl, D. Nigg, M. Chwalla, M. Hennrich, and R. Blatt, Science 332, 1059 (2011).
  * Egan  _et al._ (2021) L. Egan, D. M. Debroy, C. Noel, A. Risinger, D. Zhu, D. Biswas, M. Newman, M. Li, K. R. Brown, M. Cetina, _et al._ , Nature 598, 281 (2021).
  * Ryan-Anderson  _et al._ (2021) C. Ryan-Anderson, J. Bohnet, K. Lee, D. Gresh, A. Hankin, J. Gaebler, D. Francois, A. Chernoguzov, D. Lucchetti, N. Brown, _et al._ , Phys. Rev. X 11, 041058 (2021).
  * Hilder  _et al._ (2022) J. Hilder, D. Pijn, O. Onishchenko, A. Stahl, M. Orth, B. Lekitsch, A. Rodriguez-Blanco, M. Müller, F. Schmidt-Kaler, and U. Poschinger, Phys. Rev. X 12, 011032 (2022).
  * Andersen  _et al._ (2020) C. K. Andersen, A. Remm, S. Lazar, S. Krinner, N. Lacroix, G. J. Norris, M. Gabureac, C. Eichler, and A. Wallraff, Nat. Phys. 16, 875 (2020).
  * AI (2021) G. Q. AI, Nature 595, 383 (2021).
  * Marques  _et al._ (2021) J. F. Marques, B. M. Varbanov, M. S. Moreira, H. Ali, N. Muthusubramanian, C. Zachariadis, F. Battistel, M. Beekman, N. Haider, W. Vlothuizen, A. Bruno, B. M. Terhal, and L. DiCarlo, Nat. Phys. 18, 80 (2021).
  * Zhao  _et al._ (2022) Y. Zhao, Y. Ye, H.-L. Huang, Y. Zhang, D. Wu, H. Guan, Q. Zhu, Z. Wei, T. He, S. Cao, F. Chen, _et al._ , Phys. Rev. Lett. 129, 030501 (2022).
  * Krinner  _et al._ (2022) S. Krinner, N. Lacroix, A. Remm, A. Di Paolo, E. Genois, C. Leroux, C. Hellings, S. Lazar, F. Swiadek, J. Herrmann, _et al._ , Nature 605, 669 (2022).
  * Acharya  _et al._ (2022) R. Acharya, I. Aleiner, R. Allen, T. I. Andersen, M. Ansmann, F. Arute, K. Arya, A. Asfaw, J. Atalaya, R. Babbush, _et al._ , arXiv:2207.06431 (2022), 10.48550/arXiv.2207.06431.
  * Reed  _et al._ (2012) M. D. Reed, L. DiCarlo, S. E. Nigg, L. Sun, L. Frunzio, S. M. Girvin, and R. J. Schoelkopf, Nature 482, 382 (2012).
  * Ofek  _et al._ (2016) N. Ofek, A. Petrenko, R. Heeres, P. Reinhold, Z. Leghtas, B. Vlastakis, Y. Liu, L. Frunzio, S. Girvin, L. Jiang, _et al._ , Nature 536, 441 (2016).
  * Córcoles  _et al._ (2015) A. D. Córcoles, E. Magesan, S. J. Srinivasan, A. W. Cross, M. Steffen, J. M. Gambetta, and J. M. Chow, Nat. Commun. 6, 6979 (2015).
  * Huang  _et al._ (2021) H.-L. Huang, M. Narożniak, F. Liang, Y. Zhao, A. D. Castellano, M. Gong, Y. Wu, S. Wang, J. Lin, Y. Xu, _et al._ , Phys. Rev. Lett. 126, 090502 (2021).
  * Yao  _et al._ (2012) X.-C. Yao, T.-X. Wang, H.-Z. Chen, W.-B. Gao, A. G. Fowler, R. Raussendorf, Z.-B. Chen, N.-L. Liu, C.-Y. Lu, Y.-J. Deng, _et al._ , Nature 482, 489 (2012).
  * Pittman  _et al._ (2005) T. Pittman, B. Jacobs, and J. Franson, Phys. Rev. A 71, 052332 (2005).
  * Luo  _et al._ (2021) Y.-H. Luo, M.-C. Chen, M. Erhard, H.-S. Zhong, D. Wu, H.-Y. Tang, Q. Zhao, X.-L. Wang, K. Fujii, L. Li, _et al._ , Proc. Natl. Acad. Sci. 118, e2026250118 (2021).
  * Liu  _et al._ (2019) C. Liu, H.-L. Huang, C. Chen, B.-Y. Wang, X.-L. Wang, T. Yang, L. Li, N.-L. Liu, J. P. Dowling, T. Byrnes, _et al._ , Optica 6, 264 (2019).
  * Waldherr  _et al._ (2014) G. Waldherr, Y. Wang, S. Zaiser, M. Jamali, T. Schulte-Herbrüggen, H. Abe, T. Ohshima, J. Isoya, J. Du, P. Neumann, _et al._ , Nature 506, 204 (2014).
  * Taminiau  _et al._ (2014) T. H. Taminiau, J. Cramer, T. van der Sar, V. V. Dobrovitski, and R. Hanson, Nat. Nanotechnol. 9, 171 (2014).
  * Cramer  _et al._ (2016) J. Cramer, N. Kalb, M. A. Rol, B. Hensen, M. S. Blok, M. Markham, D. J. Twitchen, R. Hanson, and T. H. Taminiau, Nat. Commun. 7, 11526 (2016).
  * Kitaev (2003) A. Y. Kitaev, Ann. Phys. 303, 2 (2003).
  * Raussendorf and Harrington (2007) R. Raussendorf and J. Harrington, Phys. Rev. Lett. 98, 190504 (2007).
  * Fowler  _et al._ (2012) A. G. Fowler, M. Mariantoni, J. M. Martinis, and A. N. Cleland, Phys. Rev. A 86, 032324 (2012).
  * Gottesman (1998) D. Gottesman, arXiv preprint quant-ph/9807006 (1998), arXiv.quant-ph/9807006.
  * Bu and Koh (2019) K. Bu and D. E. Koh, Phys. Rev. Lett. 123, 170502 (2019).
  * Bravyi and Kitaev (2005) S. Bravyi and A. Kitaev, Phys. Rev. A 71, 022316 (2005).
  * Reichardt (2005) B. W. Reichardt, Quantum Inf. Process. 4, 251 (2005).
  * Bravyi and Haah (2012) S. Bravyi and J. Haah, Phys. Rev. A 86, 052329 (2012).
  * O’Gorman and Campbell (2017) J. O’Gorman and E. T. Campbell, Phys. Rev. A 95, 032338 (2017).
  * Hastings and Haah (2018) M. B. Hastings and J. Haah, Phys. Rev. Lett. 120, 050504 (2018).
  * Fowler and Gidney (2018) A. G. Fowler and C. Gidney, arXiv:1808.06709 (2018), 10.48550/arXiv.1808.06709.
  * Campbell and Howard (2017) E. T. Campbell and M. Howard, Phys. Rev. A 95, 022316 (2017).
  * Li (2015) Y. Li, New J. Phys. 17, 023037 (2015).
  * Łodyga  _et al._ (2015) J. Łodyga, P. Mazurek, A. Grudka, and M. Horodecki, Scientific reports 5, 8975 (2015).
  * Gidney (2023a) C. Gidney, arXiv:2302.12292 (2023a), https://doi.org/10.48550/arXiv.2302.12292.
  * Wu  _et al._ (2021) Y. Wu, W.-S. Bao, S. Cao, F. Chen, M.-C. Chen, X. Chen, T.-H. Chung, H. Deng, Y. Du, D. Fan, _et al._ , Phys. Rev. Lett. 127, 180501 (2021).
  * Zhu  _et al._ (2022) Q. Zhu, S. Cao, F. Chen, M.-C. Chen, X. Chen, T.-H. Chung, H. Deng, Y. Du, D. Fan, M. Gong, _et al._ , Science Bulletin 67, 240 (2022).
  * Rolander  _et al._ (2022) A. Rolander, A. Kinos, and A. Walther, Phys. Rev. A 105, 062604 (2022).
  * Hicks  _et al._ (2022) R. Hicks, B. Kobrin, C. W. Bauer, and B. Nachman, Phys. Rev. A 105, 012419 (2022).
  * Smith  _et al._ (2021) A. W. Smith, K. E. Khosla, C. N. Self, and M. Kim, Sci. Adv. 7, eabi8009 (2021).
  * O’brien  _et al._ (2017) T. O’brien, B. Tarasinski, and L. DiCarlo, Npj Quantum Inf. 3, 39 (2017).
  * Chamberland and Noh (2020) C. Chamberland and K. Noh, Npj Quantum Inf. 6, 91 (2020).
  * Chamberland and Cross (2019) C. Chamberland and A. W. Cross, Quantum 3, 143 (2019).
  * Gidney (2023b) C. Gidney, arXiv:2302.07395 (2023b), https://doi.org/10.48550/arXiv.2302.07395.