# Minimizing the Profligacy of Searches with Reset
Supplemental Material

John C. Sunil  Richard A. Blythe  Martin R. Evans  SUPA, School of Physics and
Astronomy, University of Edinburgh, Peter Guthrie Tait Road, Edinburgh EH9
3FD, UK  Satya N. Majumdar  Université Paris-Saclay, CNRS, LPTMS, 91405,
Orsay, France

This Supplemental Material details the calculations of the mean cost (Section
I) and the success probability (Section II) in diffusion with resetting.
Section III sets out the Landau-like expansion of the profligacy and the
procedure for determining where phase boundaries lie. Finally, we briefly
expand in Section IV on the interpretation of the profligacy function
introduced in the main text as it applies to the case of predetermined search
strategies.

##  I Derivation of the mean cost

The key quantity that is required to determine the mean total cost incurred in
a diffusive resetting process is $\Omega_{r}(C,t_{f})$, the statistical weight
of trajectories that start at the origin at $t=0$, return to the origin as a
Poisson process at rate $r$, end at a predetermined time $t=t_{f}$ and incur a
total cost $C$. These statistical weights will differ in the ensemble where
the endpoint of the trajectory is free (as in Resetting Brownian Motion, RBM)
or constrained to lie at the origin (as in a Resetting Brownian Bridge, RBB).
Once this quantity is known, we can determine the mean cost over such
trajectories as

$\expectationvalue{C}=\frac{\int{\rm d}C\,C\,\Omega_{r}(C,t_{f})}{\int{\rm
d}C\,\Omega_{r}(C,t_{f})}\;.$ (S1)

An explicit expression for $\Omega_{r}(C,t_{f})$ is obtained from a renewal
equation. The idea is to consider the evolution from the start of the process
until either one of two things happens. The first possibility is that the
particle resets for the first time at some time $0\leq t\leq t_{f}$, after
which the entire process restarts from the origin, with the remainder of the
trajectory lasting a time $t-t_{f}$ and incurring a cost $C-c(x)$, where
$c(x)\geq 0$ is the cost of resetting from the point $x$ to the origin. In
this case, the particle resets with probability ${\rm e}^{-rt}r{\rm d}t$ in
the interval $[t,t+{\rm d}t]$, and is distributed over space as $G(x;t)$ which
is the Green function for diffusion,

$G(x;t)=\frac{1}{\sqrt{4\pi Dt}}e^{-\frac{(x-x_{0})^{2}}{4Dt}}$ (S2)

where $D$ is the diffusion constant. The second possibility is the particle
reaches the point $x$ at time $t_{f}$ without resetting. This event arises
with probability ${\rm e}^{-rt}$, incurs zero cost and we allow only those
endpoints $x$ that fall within the set $E$. For the case of RBM, $E$ is the
entire real line, whereas for RBB, $E$ is the origin.

Expressing these two possibilities as a renewal equation, we find

$\Omega_{r}(C,t_{f})=\int_{0}^{t_{f}}{\rm d}t\,r{\rm
e}^{-rt}\int_{-\infty}^{\infty}{\rm d}x\,G(x;t)\Omega_{r}(C-c(x),t_{f}-t)+{\rm
e}^{-rt}\delta(C)\int_{E}{\rm d}x\,G(x;t_{f})\;.$ (S3)

The first term is a convolution and thus the recursion can be solved by
introducing the double Laplace transform

$\widetilde{\Omega}_{r}(p,s)=\int_{0}^{\infty}{\rm d}C\,{\rm
e}^{-pC}\int_{0}^{\infty}{\rm d}t_{f}\,e^{-st_{f}}\Omega_{r}(C,t_{f})\;.$ (S4)

#### Note on notation

Here we have used $\widetilde{\Omega}_{r}(N,p|x_{0},s)$ to indicate a double
Laplace transform. We will also use a tilde symbol to denote single Laplace
transforms of a single time variable, e.g. $\widetilde{G}(x;s)$, below. The
arguments of the function should make clear the number of Laplace variables.
In certain places, for convenience, we will use ${\mathcal{L}}_{t\to s}$ to
indicate Laplace transform to Laplace variable $s$ and
${\mathcal{L}}^{-1}_{s\to t}$ to indicate Laplace inversion to the time
domain.

Laplace transforming (S3) with respect to both arguments and rearranging, we
find

$\widetilde{\Omega}_{r}(p,s)=\frac{\widetilde{K}(r+s)}{1-r\widetilde{W}(p,r+s)}$
(S5)

where

$\displaystyle\widetilde{K}(s)$ $\displaystyle=\int_{E}{\rm
d}x\,\int_{0}^{\infty}{\rm d}t_{f}\,{\rm e}^{-st_{f}}G(x;t_{f})=\int_{E}{\rm
d}x\,\widetilde{G}(x;s)$ (S6) $\displaystyle\widetilde{W}(p,s)$
$\displaystyle=\int_{-\infty}^{\infty}{\rm d}x\,{\rm
e}^{-pc(x)}\int_{0}^{\infty}{\rm d}t\,{\rm
e}^{-st}G(x;t)=\int_{-\infty}^{\infty}{\rm d}x\,{\rm
e}^{-pc(x)}\widetilde{G}(x;s)$ (S7)

and we have from (S2) that

$\widetilde{G}(x,s)=\frac{1}{2\sqrt{Ds}}e^{-\sqrt{\frac{s}{D}}\absolutevalue{x}}\;.$
(S8)

We see that the function $\widetilde{K}(s)$ is determined by the constraint
placed on the endpoint of the trajectory, and that $\widetilde{W}(p,s)$
depends on the functional form of the cost. Once these functions have been
determined for the cases of interest, we can obtain the mean cost as a
function of $t_{f}$ from (S1) via

$\expectationvalue{C}=\frac{{\mathcal{L}}^{-1}_{s\to
t_{f}}\\{-\partial_{p}\widetilde{\Omega}_{r}(p,s)|_{p\to
0}\\}}{{\mathcal{L}}^{-1}_{s\to t_{f}}\\{\widetilde{\Omega}_{r}(p,s)|_{p\to
0}\\}}\;.$ (S9)

Taking the limit $p\to 0$, we find that the functions to be inverted to obtain
the numerator and denominator, respectively, are

$\displaystyle\left.-\partial_{p}\widetilde{\Omega}_{r}(p,s)\right|_{p\to 0}$
$\displaystyle=\frac{r(r+s)^{2}}{s^{2}}\widetilde{K}(r+s)\int_{-\infty}^{\infty}{\rm
d}x\,c(x)\widetilde{G}(x;r+s)$ (S10)
$\displaystyle\left.\widetilde{\Omega}_{r}(p,s)\right|_{p\to 0}$
$\displaystyle=\frac{r+s}{s}\widetilde{K}(r+s)\;.$ (S11)

###  I.1 Resetting Brownian Motion (RBM)

For the case of RBM, the trajectory endpoint is unconstrained, and the
integral in (S6) is over all $x$. For any properly normalized distribution of
endpoints we then have $\widetilde{K}(s)=\frac{1}{s}$ and the denominator in
(S9) is unity. It thus remains to compute the numerator by inverting (S10) for
the cost function of interest. In the main text we consider power-law cost
functions,

$c(x)=2^{n/2}\absolutevalue{y}^{n}\quad\mbox{where}\quad
y=\frac{x}{\sqrt{2Dt_{f}}}\;,$ (S12)

specifically the linear and quadratic cases, $n=1$ and $n=2$. Substituting
into (S10) yields

$\expectationvalue{C}_{n}^{\rm
RBM}=\frac{\Gamma(n+1)}{t_{f}^{n/2}}{\mathcal{L}}^{-1}_{s\to
t_{f}}\left\\{\frac{r}{s^{2}}\frac{1}{(r+s)^{n/2}}\right\\}=\frac{\Gamma(n+1)}{R^{n/2}}\frac{R\gamma(\frac{n}{2},R)-\gamma(\frac{n}{2}+1,R)}{\Gamma(\frac{n}{2})}$
(S13)

where $R=rt_{f}$ is the dimensionless resetting rate, and $\gamma(s,x)$ is the
lower incomplete Gamma function,

$\gamma(s,x)=\int_{0}^{x}{\rm d}u\,u^{s-1}{\rm e}^{-u}\;.$ (S14)

Note that this result is obtained by recognising the Laplace transform in
(S13) as the convolution of $t$ with $\frac{1}{\Gamma(n/2)}t^{n/2-1}{\rm
e}^{-rt}$, evaluated at $t_{f}$. Note further that $\langle C\rangle_{0}^{\rm
RBM}=R$ and that for the special cases $n=1$ (‘lin’) and $n=2$ (‘quad’)
considered in the main text, we have

$\displaystyle\expectationvalue{C}^{\rm RBM}_{\rm lin}$
$\displaystyle=\frac{{\rm
e}^{-R}}{\sqrt{\pi}}+\frac{(2R-1)\erf\left(\sqrt{R}\right)}{2\sqrt{R}}$ (S15)
$\displaystyle\expectationvalue{C}^{\rm RBM}_{\rm quad}$
$\displaystyle=\frac{2\left(R+{\rm e}^{-R}-1\right)}{R}\;,$ (S16)

where we have used

$\Gamma({\textstyle\frac{1}{2}})=\sqrt{\pi}\;,\quad\gamma({\textstyle\frac{1}{2}},x)=\sqrt{\pi}\erf(\sqrt{x})\quad\mbox{and}\quad\gamma(1,x)=1-{\rm
e}^{-x}$ (S17)

along with the recursion relation

$\gamma(s+1,x)=s\gamma(s,x)-x^{s}{\rm e}^{-x}\;.$ (S18)

###  I.2 Resetting Brownian Bridge (RBB)

For the RBB, the calculation is a little more complex due to the constraint on
the trajectory endpoint. Taking $E$ to comprise just the point at the origin
in (S6) we now have $\widetilde{K}(s)=\frac{1}{2\sqrt{Ds}}$ and the
denominator of (S9) takes the form

${\mathcal{L}}^{-1}_{s\to t_{f}}\\{\widetilde{\Omega}_{r}(p,s)|_{p\to
0}\\}=\frac{1}{2\sqrt{D}}{\mathcal{L}}^{-1}_{s\to
t_{f}}\left\\{\left(1+\frac{r}{s}\right)\frac{1}{\sqrt{r+s}}\right\\}=\frac{{\rm
e}^{-rt_{f}}+\sqrt{\pi rt_{f}}\erf(\sqrt{rt_{f}})}{2\sqrt{\pi Dt_{f}}}\;.$
(S19)

Again, the inversion can be performed by recognising as a convolution.

Turning now to the numerator, we find for $c(x)$ given by (S12) that

${\mathcal{L}}^{-1}_{s\to
t_{f}}\\{-\partial_{p}\widetilde{\Omega}_{r}(p,s)|_{p\to
0}\\}=\frac{1}{2\sqrt{D}}\frac{\Gamma(n+1)}{t_{f}^{n/2}}{\mathcal{L}}^{-1}_{s\to
t_{f}}\left\\{\frac{r}{s^{2}}\frac{1}{(r+s)^{(n-1)/2}}\right\\}\;.$ (S20)

Comparing with (S13) we see that

${\mathcal{L}}^{-1}_{s\to
t_{f}}\\{-\partial_{p}\widetilde{\Omega}_{r}(p,s)|_{p\to
0}\\}=\frac{n}{2\sqrt{Dt_{f}}}\expectationvalue{C}_{n-1}^{\rm RBM}$ (S21)

and by dividing by the denominator (S19) we find

$\expectationvalue{C}_{n}^{\rm
RBB}=\frac{n\sqrt{\pi}\expectationvalue{C}_{n-1}^{\rm RBM}}{{\rm
e}^{-R}+\sqrt{\pi R}\erf(\sqrt{R})}\;,$ (S22)

recalling that $R=rt_{f}$. For the special cases $n=1$ and $n=2$ we have

$\displaystyle\expectationvalue{C}^{\rm RBB}_{\rm lin}$
$\displaystyle=\frac{\sqrt{\pi}R}{{\rm e}^{-R}+\sqrt{\pi R}\erf(\sqrt{R})}$
(S23) $\displaystyle\expectationvalue{C}^{\rm RBB}_{\rm quad}$
$\displaystyle=2-\sqrt{\frac{\pi}{R}}\frac{\erf(\sqrt{R})}{{\rm
e}^{-R}+\sqrt{\pi R}\erf(\sqrt{R})}\;.$ (S24)

We compare the functional forms of the mean cost between the two ensembles in
Fig. S1. Fig. 1(a) shows how the mean linear cost behaves with $R$, and is
seen to increase indefinitely as $R\to\infty$ as $\sqrt{R}$. Corresponding
plots for the mean quadratic cost are in Fig. 1(b). Unlike the case for the
linear cost, the mean total quadratic cost saturates as $R\to\infty$.

(a)

(b)

Figure S1: Comparison of mean total cost $\langle C\rangle$ for (a) linear
cost and (b) quadratic cost per reset for RBM and RBB. It can be seen that the
costs increase monotonically for both the cases. This is consistent with the
intuition that more frequent resets will incur a higher cost. Although in the
case of a linear cost the mean cost increases indefinitely with $R$ we find
that in the case of a quadratic cost the mean cost saturates as $R\to\infty$.

##  II Derivation of Success Probabilities

###  II.1 Resetting Brownian Motion (RBM)

For a Resetting Brownian Motion, the probability of reaching a target at
position $m$ by time $t_{f}$ can be obtained from the target’s survival
probability which was given as Eq. (6) in [EM11a]. Noting that the target
surviving corresponds to an unsuccessful search, we find that the success
probability is given by the inverse Laplace transform

$\displaystyle P_{s}^{\text{RBM}}=\int_{\Gamma}\frac{{\rm d}s}{2\pi i}{\rm
e}^{st_{f}}\frac{1}{s}\frac{r+s}{r+s{\rm e}^{\sqrt{\frac{r+s}{D}}m}}\;.$ (S25)

where $\Gamma$ is the Bromwich contour. By introducing rescaled variables
$u=st_{f},R=rt_{f}$ and $M=\frac{m}{\sqrt{2Dt_{f}}}$, we obtain the form
presented in the main text,

$\displaystyle P_{s}^{\text{RBM}}=\int_{\Gamma}\frac{{\rm d}u}{2\pi
i}e^{u}\frac{1}{u}\frac{R+u}{R+u{\rm e}^{M\sqrt{2}\sqrt{u+R}}}\;.$ (S26)

###  II.2 Resetting Brownian Bridge (RBB)

The success probability for a Resetting Brownian Bridge is provided as Eq.
(54) in the Supplemental Material of Ref. [BMS22]. In the notation of the
present work, this reads

$\displaystyle P_{s}^{\text{RBB}}=\phi(R)\int_{\Gamma}\frac{d{\rm u}}{2\pi
i}{\rm e}^{u}\frac{\sqrt{u+R}}{u}\frac{R+u{\rm
e}^{-M\sqrt{2}\sqrt{u+R}}}{R+u{\rm
e}^{M\sqrt{2}\sqrt{u+R}}}\quad\mbox{where}\quad\phi(R)=\frac{\sqrt{\pi}}{e^{-R}+\sqrt{\pi
R}\erf\left(\sqrt{R}\right)}\;.$ (S27)

We can plot the success probabilities (S26) and (S27) by performing the
inverse Laplace transforms numerically [AW06]. In Figure 2(a), we plot the two
functions obtained at fixed $M=1$. For RBM, we find that the success
probability decreases monotonically with $R$, whilst for RBB, the function is
peaked at some nonzero resetting rate $R$. When $M$ is reduced to
$\frac{1}{2}$, Figure 2(b), we find that both functions are peaked.

(a)

(b)

Figure S2: Comparison of probability of finding the target $(P_{\rm s})$ as a
function $R$ for (a) $M=1.0$ and (b) $M=0.5$. For RBM (purple), $P_{\rm s}$
can initially be a decreasing of increasing function function depending on the
value of $M$, whereas for RBB (green) $P_{\rm s}$ always increases initially
with resetting, reaches a maximum then decreases for large $R$.

##  III Landau-like expansion for Profligacy ($\xi$)

To gain deeper insight into the nature of the transitions observed in the main
text, we make a Landau-like expansion of the profligacy (LABEL:profligacy)

$\displaystyle\xi=\expectationvalue{C}-\lambda\ln{P_{\text{s}}}\,$ (S28)

in powers of $R$, valid for small values of $R$, which we define as

$\displaystyle\xi=a_{0}+a_{1}R+a_{2}\frac{R^{2}}{2}+a_{3}\frac{R^{3}}{6}+a_{4}\frac{R^{4}}{24}+\ldots\;,$
(S29)

where $a_{i}=a_{i}(\lambda,M)$. Due to the system not possessing an $R\to-R$
symmetry, we have to include all terms of the expansion. The expansion of
$\langle C\rangle$ can be obtained from performing a Taylor expansions of the
mean total costs given by (S15), (S16), (S23) or (S24), as appropriate for the
case of interest.

We also need to expand $P_{\text{s}}$ in each ensemble, expressions for which
are given by the integrals (S26) and (S27). To perform these expansions, it is
helpful to define $s=u+R$, so that they become

$\displaystyle P_{\text{s}}^{\text{RBM}}$ $\displaystyle={\rm
e}^{-R}\int_{\Gamma}\frac{{\rm d}u}{2\pi i}{\rm
e}^{u}\frac{1}{s-R}\frac{s}{R+(s-R){\rm e}^{M\sqrt{2s}}}\;,$ (S30)
$\displaystyle P_{\text{s}}^{\text{RBB}}$ $\displaystyle=\frac{\sqrt{\pi}{\rm
e}^{-R}}{\sqrt{\pi R}\erf\left(\sqrt{R}\right)+{\rm
e}^{-R}}\int_{\Gamma}\frac{ds}{2\pi i}{\rm
e}^{s}\frac{\sqrt{s}}{s-R}\frac{R+(s-R){\rm
e}^{-M\sqrt{2s}}}{R+(s-R)e^{M\sqrt{2s}}}\;.$ (S31)

The procedure now is to expand these expressions as a power series in $R$, and
invert term-by-term. Up to second order, we find for the RBM case the
expansion

$\displaystyle P^{\text{RBM}}_{\text{s}}=$ $\displaystyle
g_{0}(M)+g_{1}(M)R+g_{2}(M)\frac{R^{2}}{2}+\ldots\;,$ (S32)

where the coefficients $g_{i}(M)$ are given by the integrals

$\displaystyle g_{0}(M)=$ $\displaystyle\int_{\Gamma}\frac{{\rm d}s}{2\pi
i}{\rm e}^{s}\frac{{\rm
e}^{-\sqrt{2}M\sqrt{s}}}{s}=\text{erfc}\left(\frac{M}{\sqrt{2}}\right)$ (S33)
$\displaystyle g_{1}(M)=$ $\displaystyle\int_{\Gamma}\frac{{\rm d}s}{2\pi
i}{\rm e}^{s}\frac{{\rm e}^{-2\sqrt{2}M\sqrt{s}}\left(-1-{\rm
e}^{\sqrt{2}M\sqrt{s}}(-2+s)\right)}{s^{2}}$ (S34) $\displaystyle g_{2}(M)=$
$\displaystyle\int_{\Gamma}\frac{{\rm d}s}{2\pi i}{\rm e}^{s}\frac{{\rm
e}^{-3\sqrt{2}M\sqrt{s}}\left(2+2{\rm e}^{\sqrt{2}M\sqrt{s}}(-3+s)+{\rm
e}^{2\sqrt{2}M\sqrt{s}}\left(6-4s+s^{2}\right)\right)}{s^{3}}\;,$ (S35)

each of which can, like $g_{0}(M)$, be expressed in a closed form in terms of
error functions. Explicit expressions are provided in an accompanying
Mathematica notebook uploaded to DataShare.

Similarly for RBB, we have

$\displaystyle P^{\text{RBB}}_{\text{s}}=$ $\displaystyle
h_{0}(M)+h_{1}(M)R+h_{2}(M)\frac{R^{2}}{2}+\ldots\;,$ (S36)

where

$\displaystyle h_{0}(M)=$ $\displaystyle\int_{\Gamma}\frac{{\rm d}s}{2\pi
i}{\rm e}^{s}\frac{{\rm e}^{-2\sqrt{2}M\sqrt{s}}\sqrt{\pi}}{\sqrt{s}}={\rm
e}^{-2M^{2}}\;,$ (S37) $\displaystyle h_{1}(M)=$
$\displaystyle\int_{\Gamma}\frac{{\rm d}s}{2\pi i}{\rm e}^{s}\frac{{\rm
e}^{-3\sqrt{2}M\sqrt{s}}\sqrt{\pi}\left(-1+{\rm e}^{2\sqrt{2}M\sqrt{s}}+{\rm
e}^{\sqrt{2}M\sqrt{s}}(1-2s)\right)}{s^{3/2}}\;,$ (S38) $\displaystyle
h_{2}(M)=$ $\displaystyle\int_{\Gamma}\frac{{\rm d}s}{2\pi i}e^{s}\frac{2{\rm
e}^{-4\sqrt{2}M\sqrt{s}}\sqrt{\pi}\left(3+6{\rm
e}^{\sqrt{2}M\sqrt{s}}(-1+s)-6{\rm e}^{3\sqrt{2}M\sqrt{s}}(-1+s)+2{\rm
e}^{2\sqrt{2}M\sqrt{s}}s(-3+4s)\right)}{3s^{5/2}}$ (S39)

and which again have closed-form expressions.

A similar process can be used to obtain the terms beyond the quadratic term.
Note that in $R\to 0$ limit, (S32) and (S36) reduce to known results without
resetting:
$P^{\text{RBM}}_{\text{s}}=\text{erfc}\left(\frac{M}{\sqrt{2}}\right)$
[Redner] and $P^{\text{RBB}}_{\text{s}}={\rm e}^{-2M^{2}}$ [BMS22].

The coefficients $a_{i}$ in (S29) can be written in terms of the terms of
expansion of $P_{\text{S}}$ as

$\displaystyle a_{0}=$ $\displaystyle C_{0}-\lambda\log\left(g_{0}\right)\;,$
(S40) $\displaystyle a_{1}=$ $\displaystyle
C_{1}-\lambda\frac{g_{1}}{g_{0}}\;,$ (S41) $\displaystyle a_{2}=$
$\displaystyle\frac{C_{2}}{2}-\lambda\frac{\left(-g_{1}^{2}+g_{0}g_{2}\right)}{2g_{0}^{2}}\;,$
(S42) $\displaystyle a_{3}=$
$\displaystyle\frac{C_{3}}{6}-\lambda\frac{\left(2g_{1}^{3}-3g_{0}g_{1}g_{2}+g_{0}^{2}g_{3}\right)}{6g_{0}^{3}}\;,$
(S43) $\displaystyle a_{4}=$
$\displaystyle\frac{C_{4}}{24}-\lambda\frac{\left(-6g_{1}^{4}+12g_{0}g_{1}^{2}g_{2}-3g_{0}^{2}g_{2}^{2}-4g_{0}^{2}g_{1}g_{3}+g_{0}^{3}g_{4}\right)}{24g_{0}^{4}}\;,$
(S44)

where $C_{n}=\frac{d^{n}\expectationvalue{C}}{dR^{n}}\Big{|}_{R\to 0^{+}}$.
The $g_{i}$ should be substituted with $h_{i}$ in the RBB case.

We now discuss the different cases that occur for transitions in the global
minimum of the profligacy $\xi$ as we vary $\lambda$.

###  III.1 Classical continuous transition

In this case $a_{2}>0$ in the expansion (S29) and may ignore higher order
terms. The curve of continuous transition occurs when $a_{1}=0$. This is the
usual scenario for a continuous transition seen in equilibrium systems
[Goldenfeld]. Continuous transition lines are seen in all four panels of Fig.
LABEL:fig:transitions.

(a)

(b)

Figure S3: The figure presents classical continuous transition observed in
$\xi$ for the case of RBB with linear cost per reset when $\lambda$ is varied
for $M=1.0$. (a) The global minimum which is at $R^{*}=0$ initially
continuously transitions to the new global minimum $R^{*}$ in (b) as $\lambda$
is varied.

For the case of RBM the continuous transition condition, $a_{1}(\lambda,M)=0$,
is satisfied at $\lambda^{*}(M)$ given by

$\displaystyle\lambda^{*}=\frac{d\expectationvalue{C}^{\text{RBM}}}{dR}\bigg{|}_{R\to
0^{+}}\times\frac{\text{erfc}\left(\frac{M}{\sqrt{2}}\right)}{g_{1}(M)}\;,$
(S45)

with $\frac{d\expectationvalue{C}^{\text{RBM}}_{\text{lin}}}{dR}\big{|}_{R\to
0^{+}}=\frac{4}{3\sqrt{\pi}}$ and
$\frac{d\expectationvalue{C}^{\text{RBM}}_{\text{quad}}}{dR}\big{|}_{R\to
0^{+}}=1$. However, since we consider the investment $\lambda$, to act as a
penalty if the searcher does not find the target, we require $\lambda>0$. But
$g_{1}(M)<0$ for $M>0.8198$ which suggests that a continuous transition cannot
exist for RBM if the rescaled distance to the target is greater than
$M=0.8198$. Further, $a_{1}(\lambda^{*},M)>0$ for all values $M<0.8198$, which
implies that the system has a continuous transition for all values of
$M<0.8198$. This exactly matches with the result obtained in the FIG.
LABEL:fig:RBM_linear and LABEL:fig:RBM_quad where no transitions are observed
beyond the critical value of $M$.

For the case of RBB, the continuous transition condition,
$a_{1}(\lambda,M)=0$, is satisfied at $\lambda^{*}(M)$. There we obtain the
curve of continuous transition ($a_{1}(\lambda,M)=0$) to be

$\displaystyle\lambda^{*}=\frac{d\expectationvalue{C}}{dR}\bigg{|}_{R\to
0^{+}}\times\frac{e^{-2M^{2}}}{h_{1}(M)}\;.$ (S46)

where we have the derivatives
$\frac{d\expectationvalue{C}^{\text{RBB}}_{\text{lin}}}{dR}\big{|}_{R\to
0^{+}}=\sqrt{\pi}$ and
$\frac{d\expectationvalue{C}^{\text{RBB}}_{\text{quad}}}{dR}\big{|}_{R\to
0^{+}}=\frac{8}{3}$. Since $h_{1}(M)>0$ for all values of $M$, we obtain a
solution for $a_{1}=0$ for all values of $M$ for RBB. For small values of
$\lambda^{*}$ this corresponds to a continuous transition, however for large
values of $\lambda^{*}$ we find that $a_{2}<0$ and we have to consider
classical discontinuous transition which we now discuss.

###  III.2 Classical discontinuous transition

A discontinuous transition may occur when $a_{1}$ is positive, $a_{2}$ is
negative but $a_{3}$ is positive. Then we have a local minimum in the
profligacy at a non-zero value of $R$ in addition to a boundary minimum at
$R=0$. If on increasing $\lambda$ the global minimum switches between these
two local minima, we have a jump in $R^{*}$ from a zero to a non-zero value.
This is the classical scenario for a discontinuous transition. A classical
tricritical point occurs when a continuous transition line meets a
discontinuous transition line, which occurs when $a_{1}=a_{2}=0$.

(a)

(b)

Figure S4: The figure presents classical discontinuous transition observed in
$\xi$ for the case of RBB with linear cost per reset when $\lambda$ is varied
for $M=0.63$. (a) The global minimum which is at $R^{*}=0$ initially
discontinuously transitions to the new global minimum $R^{*}$ in (b) when the
local minima becomes the new global minima as $\lambda$ is varied.

A classical tricritical point occurs in the case of RBB with linear cost as is
seen in Fig. LABEL:fig:RBB_linear. Then for $a_{2}>0$ we obtain a continuous
transition at $a_{1}=0$ but for $a_{2}<0$ there is a discontinuous transition
and if $a_{1}=a_{2}=0$ (and $a_{3}>0$), we obtain a tricritical point. To
obtain the tricritical point for RBB with linear cost per reset, we set
$a_{2}(\lambda^{*},M)=0$, which gives

$\displaystyle
e^{-2M^{*2}}\frac{d^{2}\expectationvalue{C}}{dR^{2}}\bigg{|}_{R\to
0^{+}}+e^{2M^{*2}}\lambda^{*}h_{1}^{2}(M^{*})-\lambda^{*}h_{2}(M^{*})=0\;,$
(S47)

which upon solving yields the tricritical point
$(M^{*},\lambda^{*})=(0.6333,8.4994)$. For $\lambda$ approaching this point
from above we have a classical discontinuous transition

###  III.3 Non-classical discontinuous transition

Finally we address an interesting scenario, which to our knowledge is a non-
standard way of generating discontinuous transitions. This occurs when
$a_{3}<0$ and $a_{4}>0$ and we retain terms up to $R^{4}$ in the Landau-like
expansion. This is the case for both RBM and RBB with quadratic cost per reset
in an intermediate range of $M$. The quartic expansion in $R$ allows two local
minima in the profligacy if $a_{1}<0$, or one local minimum, plus a boundary
minimum at $R=0$, if $a_{1}>0$. In the latter case either a discontinuous
transition to a non-zero value of $R^{*}$ can occur when the local minimum
becomes the global minimum, or a continuous transition can occur when $a_{1}$
becomes negative; in the former case a discontinuous transition between two
non-zero values of $R^{*}$ can occur when the global minimum switches between
the two local minima. A sequence of a continuous transition (when $a_{1}$
turns negative) followed by a discontinuous transition (when the global
minimum switches between the subsequent two local minima) generates the
overhangs seen in Figs. LABEL:fig:RBM_quad,LABEL:fig:RBB_quad. Thus the red
dots in Figs. LABEL:fig:RBM_quad,LABEL:fig:RBB_quad are not classical
tricritical points as can be verified by evaluating $a_{2}(\lambda^{*},m)=0$
For RBM evaluating this results in two different values $m^{*}_{1,2}$, but
evaluating the coefficient of $R^{3}$ gives
$a_{3}(\lambda^{*},m^{*}_{1,2})<0$.

(a)

(b)

Figure S5: The figure presents the non-classical discontinuous transition
occurs observed in RBB with quadratic cost per reset as $\lambda$ is varied
for $M=0.707$. (a) The global minimum initially emerges continuously from
$R=0$ as $\lambda$ is varied. (b) As lambda is further increased, the second
minimum becomes the global minima and there is a discontinuous transition of
the optimal value $R^{*}$ to the new global minimum.

Finally we comment that, generally speaking, if the coefficients of $R^{2}$ or
higher turn out to be negative, it indicates that a discontinuous transition
might be possible. But the prediction of discontinuous transition must be
considered carefully as the expansion is only quantitatively valid for small
values of $R$.

##  IV Further interpretation of the profligacy function

Consider a search company with $K$ independent Brownian searchers each of
fixed duration $t_{f}$, starting and resetting at the origin with fixed rate
$r$ in one dimension. For the moment, there is no target to search for. For
each walker, there is a cost $C_{\rm traj}$ associated with its trajectory.
The cost per walker $\sum_{\rm traj}C_{\rm traj}/K$ converges, for large $K$,
to the mean cost $\langle C(r)\rangle$ associated with a trajectory of fixed
duration $t_{f}$ (irrespective of the target). The mean cost $\langle
C(r)\rangle$ is an increasing function of $r$. Suppose that the total cost (or
equivalently the mean $\langle C(r)\rangle$) is constrained to have a fixed
value, say, $C_{0}$ (the fixed budget of the search company). Then, from
$\langle C(r)\rangle=C_{0}$, one obtains a unique value of $r$, say, $r_{1}$.
This is the ‘predetermined’ search parameter estimated by the company,
irrespective of where the target may lie.

Now, imagine putting a target at a distance $m$ from the origin and the task
of a searcher is to find the target in the least possible time, i.e., to
maximize the success probability $P_{s}(r)$. However, the value $r_{2}$, that
maximizes $P_{s}(r)$ only, is typically not the same as $r_{1}$ (fixed by the
budget). So, one needs to find a compromise. If we insist on a ‘fixed’ budget
$C_{0}$, then we have no choice but to select the predetermined value $r_{1}$.
One can optimize a bit better by choosing $r$ to be different from the set
value $r_{1}$, i.e., by relaxing the hard cost constraint by a soft one. But
this comes at a price. Allowing a bit more flexibility in the budget by
exceeding $C_{0}$ incurs a penalty, parametrized by a temperature like factor
$\lambda>0$, as an additional weight factor
$\exp\left[-\frac{1}{\lambda}\,\left(\langle C(r)\rangle-C_{0}\right)\right]$,
for $\langle C(r)\rangle>C_{0}$. When $\lambda\to 0$, one recovers the hard
constraint. Then our goal is to find the value of $r=r^{*}$ that maximizes the
product of $P_{s}(r)$ and this weight factor. This is equivalent to minimizing
the profligacy defined by

$\xi=\langle C(r)\rangle-\lambda\,P_{s}(r)$ (S48)

where we have ignored a global constant involving $C_{0}$ without any loss of
generality. Let us remark here that while the success probability $P_{s}(r)$
depends on the target distance $m$, the ‘predetermined’ reset parameter
$r_{1}$ and cost function $\langle C(r)\rangle$ are independent of the target
distance $m$.


# Pieceable fault-tolerant conversion between Steane and Reed-Muller quantum
codes with neural network decoders

Chen Lin  Big Data Research Center, School of Computer Science and
Engineering, University of Electronic Science and Technology of China,
Chengdu, 611731, P.R.China  Guowu Yang<EMAIL_ADDRESS>Big Data Research
Center, School of Computer Science and Engineering, University of Electronic
Science and Technology of China, Chengdu, 611731, P.R.China  Xiaoyu Song
Department of Electrical and Computer Engineering, Portland State University
Marek. A. Perkowski  Department of Electrical and Computer Engineering,
Portland State University

###### Abstract

Designing efficient fault-tolerant circuits for converting between two quantum
codes is an effective way to realize universal fault-tolerant quantum
computing. In this work, we adopt the round-robin circuit construction to
design a conversion circuit between CSS 7-qubit error-correcting code and
Reed-Muller 15-qubit code. We take the pieceable fault-tolerant protocol to
guarantee the fault tolerance of our conversion circuit. A neural network
decoding scheme is proposed to suppress the propagation of quantum errors. Our
decoding scheme can effectively reduce the damaging effects of imperfect
syndrome extraction operations and predict possible logical errors that
occurred after the error correction process. We provide a detailed description
of our syndrome data model and analyze the depolarizing noise threshold of our
conversion circuit through numerical simulations of the stabilizer circuit.

††preprint: APS/123-QED

##  I Introduction

The practical quantum computation may be coming soon [1, 2]. Consequently, the
prospect of large-scale quantum computers has generated great interest, as
they can solve certain problems exponentially faster than computers that use
the best-known classic algorithms [3, 4, 5]. Intermediate-scale quantum
computers (NISQ) based on various technologies have been invented [6, 7, 8,
9]. These experimental platforms provide the opportunity to implement some
simple quantum algorithms [10, 11] with the number of qubits ranging from 50
to a few hundred. However, given the limitations of current NISQ, high-
fidelity quantum circuits for the compiling of certain quantum algorithms
require a lot of quantum resources [12, 13, 14].

To protect quantum information from environmental noise and carry out large-
scale computational tasks with high fidelity, it is necessary to carefully
choose an appropriate method to prevent the possible propagation of quantum
errors. Specifically, by combining physical qubits through the use of quantum
error correction codes [15, 16, 17], we can use logical qubit to simulate the
corresponding physical one. Consequently, we can use logical circuit to
compile a quantum algorithm in a fault-tolerant manner [18].

Since the cost of implementing logical circuits is usually considered to be a
major figure of merit of fault-tolerant quantum computation, many studies have
focused on designing efficient fault-tolerant protocols. One of the most
widely used and simplest such schemes is transversal. A logical quantum
operation with transversal construction is automatically fault-tolerant, as
each qubit acted upon by this logical circuit can interact with no more than
one qubit per each code block. Besides, as there always exists a set of finite
quantum gates such that any quantum circuit can be decomposed by a sequence of
these gates with arbitrary precision, it would be very desirable to focus on
the fault-tolerant design for such universal gate library.

However, for most universal fault-tolerant protocols, additional resources are
always required due to the limitation of no-go theorem [19, 20]. This theorem
has shown that any nontrivial quantum code doesn’t exist a universal set of
transversal logical circuits. This fact encourages the development of other
methods to circumvent this limitation. By fault-tolerantly preparing the magic
states, and combining with the existing transversal Clifford gates, a logical
$T$ or Toffoli gate can be constructed fault-tolerantly. However, an
additional distillation procedure needs to be applied to guarantee the quality
of magic states, which consumes a large amount of auxiliary resources [21, 22,
23]. By combining two different codes with complementary transversal gate sets
into a single larger code, a universal gate library can be completed but with
low efficiency [24, 25].

Other approaches involve code conversion techniques to bypass this limitation.
By fault-tolerantly exchanging encoded data between two different codes
$C_{a}$ and $C_{b}$, where each non-transversal logical gate in $C_{a}$ has a
transversal implementation on $C_{b}$ and vice versa, a given universal gate
library can be transversally implemented without magic states. For example,
Steane’s 7-qubit code has transversal Hadamard gate $H$, controlled-NOT gate
(CNOT) and phase gate $P$; Reed-Muller 15-qubit (RM-15) code has transversal
$T$ gate, where $T=diag(1,exp(\frac{i\pi}{4}))$. The gate set
$\\{H,CNOT,P,T\\}$ is a universal gate library. Therefore, we can adopt code
conversion technology to realize a fault-tolerant universal logical gate
library on these two codes. Anderson [26] designed a fault-tolerant conversion
method for the family of quantum Reed-Muller codes, their method can be used
to design a fault-tolerant conversion circuit between Steane’s 7-qubit code
and RM-15 code [27]. By exploiting measurement-based quantum computation,
Muller [28] developed an algorithm for converting between any two different
stabilizer codes and pointed out that the initial code distance will not be
reduced during the application of their conversion circuit. Nevertheless, a
conversion circuit usually requires considerable ancillary resources due to
multiple rounds of error correction. Besides, it only acts on the single
logical qubit, which makes physical qubits in a code block interact with each
other too many times. Therefore, a single error can easily propagate and cause
a logical fault, which reduces the anti-noise ability of the conversion
circuit.

Better decoders result in higher error thresholds and can thus tolerate a
larger noise rate. Some researchers have designed appropriate neural network
decoders for the error correction of a logical qubit to effectively improve
its fault tolerance [29, 30, 31]. But their methods are practical only when
they store encoded information. In addition, these decoders also do not
consider the errors caused by the unperfect error correction procedure.
Different from the transversal structure, it has been proposed that a round-
robin logical circuit can still be executed fault-tolerantly if it can be
partitioned into several pieces with some carefully designed intermediate
error correction processes. This protocol is also called pieceable fault-
tolerant [32]. Meanwhile, as the syndrome data between different circuit
pieces have specific correlations, we think that the event of error
propagation can be effectively predicted with some machine-learning-based
decoders. To summarize, we plan to propose a pieceable fault-tolerant
conversion circuit between Steane’s 7-qubit code and RM-15 code and design a
neural-network decoder to reduce its logical error rate.

In this paper, we first provide the details on how to construct a supervised
multi-classification model on the error syndrome data of a pieceable fault-
tolerant logical circuit; and explain how to use this model in the error
correction process improve its noise immunity further. Then we give the
logical CNOT gate between two logical qubits, where each of them is protected
by a unique code, such as Steane’s 7-qubit code or RM-15 code. Based on the
construction of these CNOT gates, we adopt pieceable fault-tolerant protocol
to realize fault-tolerance and apply our syndrome data prediction model to the
error correction process. Finally, we use these logical gates to design a code
conversion circuit between these two codes. Our conversion circuit guarantees
that all possible error propagation caused by a single-qubit error can be
signaled without a complicated error-syndrome lookup table. To estimate the
fault tolerance of our conversion circuit, we follow the simulation scheme in
[33] and give an estimation of the depolarizing noise pseudo-threshold of our
conversion circuit at the first level of encoding.

The paper is organized as follows. In Sec. II, we review the concept of fault-
tolerant quantum computation and explain the pieceable fault-tolerant
protocol. In Sec. III, we describe the details of constructing a
classification model for the syndrome data of a pieceable fault-tolerant
circuit. In Sec. IV, we express our pieceable fault-tolerant conversion
circuit design and explain how to use deep neural network technology to
improve its fault tolerance. In Sec. V, we design several numerical simulation
experiments to present the pseudo-threshold results and discuss the
performance of our conversion circuit.

##  II Stabilizer code and fault-tolerant computation

This section reviews definitions and preliminary results about quantum error
correction code (QECC) and pieceable fault tolerant protocol. The stabilizer
code is defined by a set of particular Pauli operators, also referred to as
the stabilizer formalism developed by Gottesman [16].

######  Definition 1 (n-qubit Pauli group)

A n-qubit Pauli group $G_{n}$ consists of the tensor products of single-qubit
Pauli operators that can be described by the following set:

$\displaystyle
G_{n}=\\{\lambda\sigma_{1}\otimes\sigma_{2}\otimes\dots\otimes\sigma_{n}:\sigma_{i}\in\\{I,X,Y,Z\\}\\}$
(1)

, where $\lambda\in\\{\pm 1,\pm\sqrt{-1}\\}$.

Given an operator $g\in G_{n}$, its support is defined as a subset of
$[n]:=\\{1,2,\dots,n\\}$, where we denote by the symbol $supp(g)$ the set of
all $i\in[n]$ such that $g$ acting on the $i$-th qubit is not identity. The
weight of a Pauli operator $wt(g)$ equals the size of its support. For
example, $wt(Z\otimes Z\otimes I)=wt(Z_{0}Z_{1})=2$.

Next, we describe the stabilizer formalism. A stabilizer $S$ is an abelian
subgroup belonging to $G_{n}$ which does not contain $-I$. Because the
operators in this group are Hermitian and mutually commuting, they can be
diagonalized simultaneously. Therefore, the stabilizer code can be defined by
the following statement:

######  Definition 2 (n-qubit Stabilizer Code)

Given a stabilizer subgroup $S<G_{n}$, a $n$-qubit stabilizer code $C_{n}$ is
the joint +1 eigenspace of operators in $S$ belonging to the Hilbert space
$(\mathbb{C}^{2})^{\otimes n}$ and can be described by the following set:

$\displaystyle C_{n}=\\{|\psi\rangle:g|\psi\rangle=|\psi\rangle,\forall g\in
S\\}.$ (2)

Without loss of generality, we assume that the dimension of $C_{n}$ is
$2^{n-m}$, where $k=n-m$ is the number of logical qubits and $d$ is the code
distance. According to quantum coding theory, the stabilizer of $C_{n}$ has
$m$ generators, denoted as $S=\ <g_{1},\dots,g_{m}>$, and $C_{n}$ can correct
any Pauli error of weight $t\leqslant\lfloor\frac{d-1}{2}\rfloor$.

With the definition stated above, it is necessary to find corresponding
encoded operations to realize a given computation task. The Pauli subgroup
$C(S)$, called the centralizer of $S$, is defined to be a set of elements in
$G_{n}$ that commute with all elements in $S$. We can first choose operators
$\bar{Z}_{1},\dots,\bar{Z}_{k}$ and $\bar{X}_{1},\dots,\bar{X}_{k}$ in $C(S)$
that are independent of the generators of $S$ and satisfy the communication
conditions $\bar{X}_{i}\bar{Z}_{j}=(-1)^{\delta_{ij}}\bar{Z}_{j}\bar{X}_{i}$.
For convenience, we also refer to these operators as logical Pauli operators.
Therefore, it is not difficult to say that the encoded
$|\bar{0}\rangle^{\otimes k}$ can be uniquely represented by the joint +1
eigenspace of the following set of $n$ operators:
$\\{g_{1},\dots,g_{m},\bar{Z}_{1},\dots,\bar{Z}_{k}\\}$. Similarly, we can
give other basic encoded states by applying the corresponding logical Pauli
$X$ operators to $|\bar{0}\rangle^{\otimes k}$ such that
$\overline{|x_{1}\dots
x_{k}\rangle}=\prod_{i=1}^{k}\bar{X}_{i}^{x_{i}}|\bar{0}\rangle^{\otimes k}$,
where $x_{i}\in\\{0,1\\}.$

Table 1: The generators of the stabilizer $S$ and logical Pauli operators of Steane’s [[7;1;3]] code Stabilizer generators | Logical Pauli Operator
---|---
$X_{0}X_{2}X_{4}X_{6}$ |
$X_{1}X_{2}X_{5}X_{6}$ |
$X_{3}X_{4}X_{5}X_{6}$ | $\bar{X}_{1}=X^{\otimes 7}$
$Z_{0}Z_{2}Z_{4}Z_{6}$ | $\bar{Z}_{1}=Z^{\otimes 7}$
$Z_{1}Z_{2}Z_{5}Z_{6}$ |
$Z_{3}Z_{4}Z_{5}Z_{6}$ |
Table 2: The generators of the stabilizer $S$ and logical Pauli operators of Reed-Muller [[15;1;3]] code Stabilizer generators | Logical Pauli Operator
---|---
$X_{7}X_{8}X_{9}X_{10}X_{11}X_{12}X_{13}X_{14}$ |
$X_{3}X_{4}X_{5}X_{6}X_{11}X_{12}X_{13}X_{14}$ |
$X_{1}X_{2}X_{5}X_{6}X_{9}X_{10}X_{13}X_{14}$ |
$X_{0}X_{2}X_{4}X_{6}X_{8}X_{10}X_{12}X_{14}$ |
$Z_{7}Z_{8}Z_{9}Z_{10}Z_{11}Z_{12}Z_{13}Z_{14}$ |
$Z_{3}Z_{4}Z_{5}Z_{6}Z_{11}Z_{12}Z_{13}Z_{14}$ |
$Z_{1}Z_{2}Z_{5}Z_{6}Z_{9}Z_{10}Z_{13}Z_{14}$ | $\bar{X}_{1}=X^{\otimes 15}$
$Z_{0}Z_{2}Z_{4}Z_{6}Z_{8}Z_{10}Z_{12}Z_{14}$ | $\bar{Z}_{1}=Z^{\otimes 15}$
$Z_{11}Z_{12}Z_{13}Z_{14}$ |
$Z_{9}Z_{10}Z_{13}Z_{14}$ |
$Z_{8}Z_{10}Z_{12}Z_{14}$ |
$Z_{5}Z_{6}Z_{13}Z_{14}$ |
$Z_{4}Z_{6}Z_{12}Z_{14}$ |
$Z_{2}Z_{6}Z_{10}Z_{14}$ |

We show the stabilizer group of Steane’s $7$-qubit code and RM-15 code in
Table 1 and Table 2. On the other hand, how to perform operations on an
encoded state without losing the code’s protection is a highly important
topic. We next give the definition of t-fault-tolerant; more details can be
found in [17, 16].

######  Definition 3 ($t$-fault-tolerant)

For a [[n;k;d]] code $C_{n}$, let $t=\lfloor\frac{d-1}{2}\rfloor$, a quantum
operation which is protected by $C_{n}$ is $t$-fault-tolerant, if the
following two conditions are satisfied:

(i) For an input codeword with an error of weight $w_{1}$, if $w_{2}$ single-
qubit faults occur during the operation with $w_{1}+w_{2}\leqslant t$, ideally
decoding the output state gives the same codeword as ideally decoding the
input state.

(ii) For $w$ single-qubit faults during the implementation of a fault-tolerant
operation with $w\leqslant t$, no matter how many errors are present in the
input state, the output state differs from a codeword by an error with its
weight no more than $w$.

Here, we say that ideally decoding is equivalent to perform a round of noise-
free error correction. Both conditions are required to ensure that correctable
errors do not propagate through the entire operation and prevent errors from
accumulating during multiple rounds of error correction.

Next we introduce the pieceable fault tolerant protocol. It would be
convenient to intuitively imagine that a specific encoded operation
$\mathcal{C}$ on $C_{n}$ can be decomposed into $r$ pieces:

$\displaystyle\mathcal{C}=\mathcal{C}_{r}\mathcal{C}_{r-1}\dots\mathcal{C}_{1},$
(3)

where parameter $r$ refers to the minimum number of circuit pieces that an
encoding operation can be divided without the loss of fault-tolerance. More
specially, we can obtain a fault-tolerant variant of $\mathcal{C}$ if each
$\mathcal{C}_{i}$ is carefully designed such that certain uncorrectable errors
can be signaled by some adapted error correction process $\mathcal{E}_{i}$. So
a modified t-fault-tolerant variant of $\mathcal{C}$, denoted as
$\widetilde{\mathcal{C}}$, can be described as follows:

$\displaystyle\widetilde{\mathcal{C}}=\mathcal{E}_{r}\mathcal{C}_{r}\mathcal{E}_{r-1}\mathcal{C}_{r-1}\dots\mathcal{E}_{1}\mathcal{C}_{1}.$
(4)

By performing adapted error correction after each $\mathcal{C}_{i}$ on the
encoded state, we obtain several fault-tolerant gadgets
$\mathcal{E}_{i}\cdot\mathcal{C}_{i}\ (i=1,\dots,r)$.

To specifically explain these adjustment error correction processes, we would
like to introduce some useful concepts. The first is contagious error; it is a
type of Pauli error operators that can be described as:

$\displaystyle\mathnormal{E}_{\mathcal{C}}=\\{\mathnormal{E}\in G_{n}:\exists
i\
s.t.[\mathnormal{E},\mathcal{C}_{i}]=\mathnormal{E}\mathcal{C}_{i}-\mathcal{C}_{i}\mathnormal{E}\neq
0\\}.$ (5)

Only contagious error occurred in $\mathcal{C}_{i}$ may propagate. For
example, we assume that one of a circuit piece $\mathcal{C}_{m}$ only contains
a single physical control-Pauli Z ($CZ$) gate with control qubit $a$ and
target qubit $b$, and the input state at the $a$-th qubit has a Pauli $X$
error; then after the application of $\mathcal{C}_{m}$, the input error will
become a $2$-qubit error $X\otimes Z$, i.e., $CZ(X\otimes
I)CZ^{\dagger}=X\otimes Z$. So the single Pauli $X$ is a contagious error
related to $\mathcal{C}_{i}$, and the $Z$-type Pauli errors($I\otimes
Z,Z\otimes I,Z\otimes Z$) are non-contagious.

In each $\mathcal{E}_{i}\ (i=1,\dots,r-1)$ we correct contagious errors
immediately and left the non-contagious error until $\mathcal{E}_{r}$. The
syndrome information of $\mathnormal{E}_{C}$ will be recorded and sent to
$\mathcal{E}_{r}$ for the correction of non-contagious error. Here we also
introduce the tool for correcting contagious error:

$S_{\mathcal{C}}=\\{g\in S:\forall i,[g,\mathcal{C}_{i}]=0\\}.$ (6)

For a r-pieceable fault-tolerant circuit $\mathcal{C}$, the elements of the
stabilizer group satisfying the above conditions are called constant
stabilizers.

##  III Multi-classification model for error syndrome of the pieceable fault-
tolerant logical circuit

Next, we design a decoding scheme for the final error correction of a
pieceable fault-tolerant logical circuit. For convenience, we first introduce
the definition of error syndrome. The syndrome is defined as a classical bit-
string for tracking error events of a fault-tolerant circuit, and it can be
obtained by fault-tolerantly measuring stabilizer generators. Since the effect
of most noise channel on the quantum state can be decomposed as a linear
combination of Pauli operators [17], we only consider this kind of error
throughout the paper. Assuming an error $\mathnormal{E}$ has occurred on a
$[[n;k;d]]$ encoded state, we then fault-tolerantly measure the stabilizer
generators and obtain a syndrome vector as follows:

$\displaystyle
s_{i}(\mathnormal{E})=\left\\{\begin{array}[]{rcl}1&&{[\mathnormal{E},g_{i}]\neq
0}\\\ 0&&{[\mathnormal{E},g_{i}]=0}\quad i=1,\dots,n-k.\end{array}\right.$ (9)

Then the syndrome vector of $\mathnormal{E}$ can be defined as a bit-string
$\bm{s}(E)=(s_{1}(\mathnormal{E}),\dots,s_{n-k}(\mathnormal{E}))\in\mathbb{Z}_{2}^{n-k}$.

A typical decoding process can be described by matching the measured syndrome
$\bm{s}$ with its most likely recovery operator $\mathnormal{R}_{\bm{s}}$ such
that $\mathnormal{R}_{\bm{s}}\mathnormal{E}\in S$. More specifically, the
recovery operator can be written as:

$\displaystyle\mathnormal{R}_{\bm{s}}=\mathcal{L}(\bm{s})\mathcal{T}(\bm{s})\mathcal{G}(\bm{s}),$
(10)

where operator $\mathcal{G}(\bm{s})\in S$ and $\mathcal{T}(\bm{s})$ belongs to
an Abelian group composed of Pauli operators called _pure error_. This group
has $n-k$ generators and satisfies $[g_{i},\mathcal{T}_{j}]=\delta_{ij},\
i,j=1,\dots,n-k$. The part of the recovery operator $\mathcal{L}(\bm{s})\in
N(S)/S$ belongs to the logical Pauli group acting on $k$ logical qubits.

A decoder based on the minimum weight scheme can quickly infer the pure error
$\mathcal{T}(\bm{s})$ from the syndrome $\bm{s}$. However, this kind of
decoders are not scalable for large quantum code and cannot infer potential
logical errors. Actually, an optimal decoder should be able to infer the most
likely logical fault $\mathcal{L}(\mathcal{T})$ from the known syndrome, such
that:

$\mathcal{L}(\mathcal{T})=argmax_{\mathcal{L}}\\{\mathnormal{P}(\mathcal{L}|\mathcal{T})\\}.$
(11)

The pieceable fault-tolerant protocol shown in Eq. (4) makes the syndrome data
of different intermediate error corrections have potential correlation. For
example, the round-robin logical controlled-Z gate on $[[5;1;3]]$ code has
been carefully designed to be fault-tolerant. The constant stabilizer
syndromes of this gate can be further analyzed to infer some weight-$2$
$Z$-type Pauli errors [32]. This observation inspired us to design an extended
decoding scheme to infer the possible error propagation event among several
circuit pieces as much as possible. More specially, for the final error
correction process $\mathcal{E}_{r}$, we explain its decoding process as a
pattern matching model so as to jointly analyze measurement information of $r$
segmented error correction processes. Then this process would infer the most
likely logical error if we effectively training the model functions.
Therefore, we conclude that a optimal decoder of $\mathcal{E}_{r}$ should be
able to infer the logical error information
$\mathcal{L}(\mathcal{T}^{(1)},\cdots,\mathcal{T}^{(r)})$ such that:

$\mathcal{L}(\mathcal{T}^{(1)},\cdots,\mathcal{T}^{(r)})=argmax_{\mathcal{L}}\\{\mathnormal{P}(\mathcal{L}|\mathcal{T}^{(1)},\cdots,\mathcal{T}^{(r)})\\}$
(12)

where $\mathcal{T}^{(i)}$ is the syndrome information of pure errors obtained
from $\mathcal{E}_{i}$.

Since all codes considered in this paper encode a single logical qubit, we
first rewrite the recovery operator of $\mathcal{E}_{r}$ as follows:

$\displaystyle\mathnormal{R}_{\bm{s}_{r}}=\mathcal{L}(\bm{s})\mathcal{T}(\bm{s}_{r})\mathcal{G}(\bm{s}_{r}),$
(13)

where $\bm{s}_{i}$ is the syndrome vector obtained by the error correction
process of $\mathcal{E}_{i}$ and
$\bm{s}=\bm{s}_{1}\times\dots\times\bm{s}_{r}$. Single logical qubit Pauli
group can be expressed as $<i,\bar{X}_{1},\bar{Z}_{1}>$, so the logical
component can be decomposed as
$\mathcal{L}(\bm{s})=\bar{X}_{1}^{a}\bar{Z}_{1}^{b}$ regardless of the global
phase factor, where $a,b\in\mathbb{Z}_{2}$.

Therefore, we introduce two functions $\mathnormal{g}_{X}$ and
$\mathnormal{g}_{Z}$ such that:

$\displaystyle\mathnormal{R}_{\bm{s}_{r}}=\bar{X}_{1}^{\mathnormal{g}_{X}(\bm{s})}\bar{Z}_{1}^{\mathnormal{g}_{Z}(\bm{s})}\mathcal{T}(\bm{s}_{r})\mathcal{G}(\bm{s}_{r}).$
(14)

According to Eq. (14), we model the decoding process as a labeled
classification task of discrete data. Then we define the data set as
$D\subseteq\\{\bm{s}\\}\times L$, and any element of $D$ can be represented
with the form $(\bm{s},\bm{\mathnormal{l}})$, where $\bm{\mathnormal{l}}$ is
the label of class. Here we use the one-hot encoded label for $k$ classes,
i.e., $\bm{\mathnormal{l}}\in
L=\\{\bm{\mathnormal{l}}:\bm{\mathnormal{l}}\in\\{0,1\\}^{k},\bm{1}^{T}\bm{\mathnormal{l}}=1\\}$.
From Eq. (14), the output of model functions need to give the predicted value
$(\mathnormal{g}_{X}(\bm{s}),\mathnormal{g}_{Z}(\bm{s}))$ based on all
intermediate syndromes. So we take different predicted values as
classification labels to corresponding to logical recovery operators, and
denote these labels as
$\\{\bm{\mathnormal{l}}_{I},\bm{\mathnormal{l}}_{\bar{X}},\bm{\mathnormal{l}}_{\bar{Y}},\bm{\mathnormal{l}}_{\bar{Z}}\\}$.

For a $[[n;k;d]]$ code, we note that the logical operator of this code belongs
to the following subgroup
$\mathcal{L}\in<i,\bar{X}_{1},\dots,\bar{X}_{k},\bar{Z}_{1},\dots,\bar{Z}_{k}>$.
Similarly, we can construct a multi-classification model with the number of
$2^{2k}$ categories for a $r$-pieceable fault-tolerant logical circuit, and
the recovery operator of $\mathcal{E}_{r}$ is given as follows:

$\displaystyle\mathnormal{R}_{\bm{s}_{r}}$
$\displaystyle=\bar{X}_{1}^{\mathnormal{g}_{X}^{(1)}(\bm{s})}\dots\bar{X}_{k}^{\mathnormal{g}_{X}^{(k)}(\bm{s})}$
$\displaystyle\cdot\bar{Z}_{1}^{\mathnormal{g}_{Z}^{(1)}(\bm{s})}\dots\bar{Z}_{k}^{\mathnormal{g}_{Z}^{(k)}(\bm{s})}\mathcal{T}(\bm{s}_{r})\mathcal{G}(\bm{s}_{r}).$
(15)

##  IV Pieceable fault-tolerant code conversion circuit

###  IV.1 The construction of conversion circuit

Following the pieceable fault-tolerant protocol, we propose a conversion
circuit between the Steane’s 7-qubit code $C_{7}$ and RM-15 code $C_{15}$.
First, we observe that a SWAP gate [17] between two entangled qubits can be
equivalently implemented by the circuit shown in Fig. 1.

Figure 1: Circuit for swapping two physical qubits, where a swap gate can be
equivalently synthesized by three CNOT gates. Figure 2: The logical SWAP gate,
which can be used to exchange encoded information between two different codes.

For the information encoded in a code block, we can similarly construct a
logical SWAP gate so that the encoded data can be exchanged between different
logical qubits.

More specially, for an encoded qubit
$|\bar{\psi}\rangle=\alpha|\bar{0}\rangle+\beta|\bar{1}\rangle$ protected by
$C_{7}$, when we want to transmit the encoded information to the logical qubit
protected by $C_{15}$, we can first prepare a logical basic state
$|\bar{0}\rangle$ in $C_{15}$ and add it to the original system. Then we
fault-tolerantly apply three logical CNOT gates to the combined system, as
shown in Fig. 2. Finally, we finished this conversion procedure by tracing out
the subsystem of $C_{7}$. Therefore, realizing fault-tolerant logical CNOT
gates between $C_{7}$ and $C_{15}$ is the key for constructing this conversion
circuit.

Figure 3: Pieceable fault-tolerant logical CNOT circuit with $C_{7}$-logical
qubit as the control and $C_{15}$-logical qubit as the target, we use
$\widetilde{\mathcal{C}}_{A}$ to represent this circuit. The intermediate
contagious error correction process $\mathcal{E}_{1}$ is applied after
$\mathcal{C}_{1}$, during which only the constant stabilizers are measured to
correct the Pauli $X$ error for control code block and Pauli $Z$ error for
target code block. Figure 4: Pieceable fault-tolerant logical CNOT circuit
with $C_{15}$-logical qubit as the control and $C_{7}$-logical qubit as the
target, we use $\widetilde{\mathcal{C}}_{B}$ to represent this circuit. The
intermediate contagious error correction process $\mathcal{E}_{1}$ is applied
after $\mathcal{C}_{1}$, during which only the constant stabilizers are
measured to correct the Pauli $X$ error for control code block and Pauli $Z$
error for target code block.

Nikahd _et al._ [34] has proposed a round-robin logical CNOT gate with $C_{7}$
encoded state as control and $C_{15}$ as target, but they didn’t give a
specific solution to make this logical circuit fault-tolerant. Following their
results, we divide this circuit into two pieces and insert a constant
stabilizer error correction process between them to make the entire circuit
fault-tolerant, as shown in Fig. 3. For the control code block, the stabilizer
$Z_{0}Z_{2}Z_{4}Z_{6},Z_{1}Z_{2}Z_{5}Z_{6}$ and $Z_{3}Z_{4}Z_{5}Z_{6}$ are
invariant under the conjugation of circuits $\mathcal{C}_{1}$ and
$\mathcal{C}_{2}$, so these operators are constant stabilizers by definition.
Similarly, for the target code block, those generators that only contain
Pauli-X operator in Table 2 are constant stabilizers.

In contrast, we give a 2-pieceable fault-tolerant logical CNOT circuit with
$C_{15}$ encoded state as control and $C_{7}$ encoded state as target, which
is shown in Fig. 4. We have verified that the stabilizer
$X_{0}X_{2}X_{4}X_{6},X_{1}X_{2}X_{5}X_{6}$ and $X_{3}X_{4}X_{5}X_{6}$ of the
target code block are invariant under the conjugation of circuits
$\mathcal{C}_{1}$ and $\mathcal{C}_{2}$. For the control code block, those
generators that only contain Pauli-Z operator in Table 2 are constant
stabilizers.

We have verified that these two logical CNOT circuits preserve tensor product
of the stabilizer groups of two codes. Moreover, we verified that these
circuits effect the appropriate transformation on the logical Pauli operators
of two code blocks. For instance, the logical CNOT circuit shown in Fig. 3 has
the following property:

$\left\\{\begin{array}[]{lr}\widetilde{\mathcal{C}}_{A}(\bar{X}_{c}\otimes
I)\widetilde{\mathcal{C}}_{A}^{\dagger}\rightarrow\bar{X}_{c}\otimes\bar{Z}_{t}\\\
\widetilde{\mathcal{C}}_{A}(\bar{Z}_{c}\otimes
I)\widetilde{\mathcal{C}}_{A}^{\dagger}\rightarrow\bar{Z}_{c}\otimes
I\end{array}.\right.$ (16)
$\left\\{\begin{array}[]{lr}\widetilde{\mathcal{C}}_{A}(I\otimes\bar{X}_{t})\widetilde{\mathcal{C}}_{A}^{\dagger}\rightarrow\bar{Z}_{c}\otimes\bar{X}_{t}\\\
\widetilde{\mathcal{C}}_{A}(I\otimes\bar{Z}_{t})\widetilde{\mathcal{C}}_{A}^{\dagger}\rightarrow
I\otimes\bar{Z}_{t}\end{array}.\right.$ (17)

###  IV.2 The analysis of fault tolerance

By keeping the constant stabilizer syndrome data in $\mathcal{E}_{1}$ and
passing it to $\mathcal{E}_{2}$, some uncorrectable errors caused by
contagious error will have unique syndromes. Therefore, we can extend the
error-syndrome lookup table to include more correspondences. This extended
decoding strategy can ensure that $\widetilde{\mathcal{C}}_{A}$ and
$\widetilde{\mathcal{C}}_{B}$ are at least 1-fault-tolerant circuits [34, 32].
A fault-tolerant logical circuit can be modeled as a leve-1 encoding extend
rectangle (1-exRec) [18], as shown in Fig. 5. Based on this circuit model, an
existing study [25] has designed a simulation scheme to calculate the pseudo-
threshold value of a 1-exRec. Pseudo-threshold is defined as the intersection
between the error rate line of unprotected gate and its corresponding logical
variant, the higher the pseudo-threshold of the logical circuit, the better
its anti-noise ability. Actually, from our numerical experiments we find that
the above strategy cannot utilize the syndrome results of $\mathcal{E}_{i}$ to
infer possible logical error. Besides, the noisy LEC circuit may also
introduce faults due to the unperfect quantum operations, but the minimal
weight decoding procedure of $\mathcal{E}_{2}$ can’t avoid the disturbance of
these errors.

Our neural-network decoding scheme can be used to analyze the relationship
between syndrome and error, and design an error diffusion early warning
mechanism to correct possible logical errors. We construct a syndrome data
classification model for these 2-pieceable fault-tolerant circuits. We use the
deep neural network algorithm to train these models and apply them to the
final error correction process. We then propose the following decoding
process:

(i) During the implementation of $\mathcal{E}_{2}$, we use the minimum weight
decoding method to apply the pure error recovery operator
$\mathcal{T}(\bm{s}_{2})$;

(ii) Take the syndrome data
$\bm{s}=\bm{s}_{LEC}\times\bm{s}_{1}\times\bm{s}_{2}$ as model input to get
the class value $\mathnormal{g}_{X}(\bm{s})$ and $\mathnormal{g}_{Z}(\bm{s})$,
where we define $\bm{s}_{LEC}$ as the syndrome of LEC circuit. Then we apply
the logical recovery operator
$\mathcal{L}(\bm{s})=\bar{X}_{1}^{\mathnormal{g}_{X}(\bm{s})}\bar{Z}_{1}^{\mathnormal{g}_{Z}(\bm{s})}$.

Figure 5: For a given error correction code, any physical quantum circuit has
its corresponding logical variant on this code, also called rectangle (Rec). A
1-exRec is a level-1 encoding Rec along with its leading error correction
circuit (LEC) and trailing error correction circuit (TEC).

####  IV.2.1 Data set and labels

We take $\widetilde{\mathcal{C}}_{A}$ 1-exRec as an example to explain how we
generate the syndrome data needed to train the logical error prediction model.
Our training set is generated by the following steps:

(i) Prepare the initial encoded state and perform the LEC circuit in a
depolarizing noise environment, and collect the syndrome vector
$\bm{s}_{LEC}$, where its dimension is $20$.

(ii) After a round of ideal projection, we apply the noisy
$\widetilde{\mathcal{C}}_{A}$ to the encoded state, and collect the syndrome
vector $\bm{s}_{1}$ and $\bm{s}_{2}$ obtained during its application, where
the dimension of $\bm{s}_{1}$ is $7$, $\bm{s}_{2}$ is $20$.

(iii) Perform a round of noise-free projection after the implementation of
noisy TEC circuit $\mathcal{E}_{2}$, which aims to make the uncorrectable
error in the conversion circuit become a logical error, then we perform noise-
free logical $Z$-based or $X$-based measurement to detect the logical error on
the output state. Finally, we obtain the class label values of control and
target code blocks.

We apply the depolarizing channel to $\widetilde{\mathcal{C}}_{A}$ 1-exRec
with a sequence of physical error rates. All zero data are excluded from the
training set.

####  IV.2.2 Model optimization strategy and objective function

The parameters of the model function need to be found by using a suitable
machine learning algorithm. Next, we use the deep neural network algorithm to
get the model function. More details can be referred to [35, 36].

In machine learning, the data set $D$ can be seen as a set of points that are
produced by the real function of the data model, and our goal is to use neural
networks to approximate this function. The neural network can be determined by
the parameter $\omega$, then the problem of finding the optimal coefficients
of the function $g_{X}$,$g_{Z}$ is transformed into finding the optimal
parameter $\bm{\omega}$. The objective function $\mathcal{L}(D,\bm{\omega})$
usually is taken as the goal of optimization:

$\displaystyle\mathop{min}\limits_{\bm{\omega}}\mathcal{L}(D,\bm{\omega}).$
(18)

The objective function is the quantification of the difference between the
model output and the observation result, it can be described as follows:

$\displaystyle\mathcal{L}(D,\bm{\omega})=-\sum_{\bm{s}}\sum_{j=1}^{k}\bm{\mathnormal{l}}_{\bm{s}}^{(j)}In\widehat{P}_{j}(\bm{s},\bm{\omega})+\lambda\sum_{m=0}^{M}\|\bm{\omega}^{(m)}\|_{2},$
(19)

where $\bm{\mathnormal{l}}_{\bm{s}}^{(j)}$ is the binary indicator if the
$j$-th class label is the correct classification for measured syndrome
$\bm{s}$, $M$ is the number of layers for the network, and $\widehat{P}_{j}$
is the model predicted probability that $\bm{s}$ belongs to $j$-th class.

Figure 6: A typical feedforward neural network structure diagram.

Our network structure is shown in Fig. 6, the syndrome vector $\bm{s}$ as the
input data of the network is first sent to $M$ hidden layers, and the hidden
layer function is shown as follows:

$\displaystyle H_{m}=f(\omega^{(m-1)}H_{m-1}+b^{(m-1)}),\ m=1,\dots,M.$ (20)

Here we take the rectified linear unit as the active function $f$, i.e.,
$f(x)=\mathnormal{max}\\{0,x\\}$. Then, we pass the output of the last hidden
layer to the SoftMax layer to calculate the probability that $\bm{s}$ belongs
to the $j$-th category. We denote
$\widehat{P}=(\widehat{P}_{1},\dots,\widehat{P}_{k})$, and adapt the following
equation to obtain this

$\displaystyle\widehat{P}_{j}=\frac{e^{V_{j}}}{\sum_{j=1}^{k}e^{V_{j}}},\
j=1,\dots,k,$ (21)

where $V=(V_{1},\dots,V_{k})=\bm{\omega}^{(M)}H_{M}+b^{(M)}$. Finally, we
predict the class label vector
$\widehat{\bm{\mathnormal{l}}}=(\widehat{\mathnormal{l}}^{(1)},\dots,\widehat{\mathnormal{l}}^{(k)})$
of $\bm{s}$ by:

$\displaystyle\widehat{\mathnormal{l}}_{\bm{s}}^{(i)}=\left\\{\begin{array}[]{rcl}1&&{\mathnormal{for}\
i=\mathop{argmax}\limits_{j}\\{\widehat{P}_{j}\\}}\\\
0&&{\mathnormal{otherwise}.}\end{array}\right.$

In contrast, reducing the empirical error usually makes the model over-fit the
training data and gives a more complicated model. Such a case will greatly
damage the generalization of the model and cause additional time consumption.
Therefore, it is usually necessary to add an extra term to the objective
function to reduce the structural error of the model; this term is also called
regularization. Commonly used regularization methods are $L1$ regularization
and $L2$ regularization. Here we use $L2$ regularization, as shown in Eq.
(19), which will limit the coefficient $\bm{\omega}$ in the model function to
reduce the complexity of the model. A hyper-parameter $\lambda$ is also
introduced to balance loss function and regularized weight.

For the training details of $\widetilde{\mathcal{C}}_{A}$, we construct two
binary classification models for the two types of data labeled by
$\mathnormal{g}_{X}(\textbf{s})$ and $\mathnormal{g}_{Z}(\textbf{s})$. The
dimension of input data is 47, and each model has 4 hidden layers and the
number of hidden layer nodes are 256, 512, 1024 and 256. We set the batch size
is 30, the learning rate is $10^{-4}$. We train our models on $pytorch$.

##  V Threshold analysis for the conversion circuit

We next analyze the performance of our conversion circuit through the
stabilizer circuit simulation algorithms [37]. Our simulation experiments are
executed on the platform called LIQUI$|\rangle$ [38]. We show the pseudo-
threshold results of $\widetilde{\mathcal{C}}_{A}$ and
$\widetilde{\mathcal{C}}_{B}$ equipped with our neural-network decoding
procedure. The fault-tolerant performance of the code conversion circuit
composed of these two logical circuits is further analyzed through simulation
experiments.

Figure 7: A typical CNOT 1-exRec simulation procedure. Figure 8: (a) The rate
of logical error $XI$ for $\widetilde{\mathcal{C}}_{A}$. (b) The rate of
logical error $IZ$ for $\widetilde{\mathcal{C}}_{A}$. (c) The rate of the sum
of logical errors for $\widetilde{\mathcal{C}}_{A}$. Figure 9: (a) The rate of
logical error $XI$ for $\widetilde{\mathcal{C}}_{B}$. (b) The rate of logical
error $IZ$ for $\widetilde{\mathcal{C}}_{B}$. (c) The rate of the sum of
logical errors for $\widetilde{\mathcal{C}}_{B}$.

We first introduce the concept of malignant error event [39], which can be
defined as follows: Let $|\psi\rangle$ be the input encoded state. As can be
seen from Fig. 7, the LEC circuit is first applied to the input state, and
then we ideally project the output state of the LEC circuit into the original
code space. Let $|\psi_{LEC}\rangle$ be the state after this projection, and
$|\psi_{TEC}\rangle$ be the final output state after the TEC and a round of
ideal projection. Then we define the malignant error event as
$|\psi_{TEC}\rangle=\mathnormal{E}\cdot\mathnormal{cnot}|\psi_{LEC}\rangle$,
where $\mathnormal{E}$ is a single or two-logical qubit error. For example,
suppose the input state is $|\overline{00}\rangle$, and we get
$|\overline{01}\rangle$ after implementation of CNOT 1-exRec, then a malignant
error event $\mathnormal{E}$ occurs, where $\mathnormal{E}$ can be one of the
following logical errors: $I\bar{X},I\bar{Y},\bar{Z}\bar{X},\bar{Z}\bar{Y}$.

Figure 10: The rate of the sum of logical errors for our fault-tolerant
logical SWAP circuit between Steane’s 7-qubit code and RM 15-qubit code.

The logical error rate of a 1-exRec can be defined as
$\sum_{\mathnormal{E}}\mathcal{P}(\mathnormal{E}|\epsilon)$, where $\epsilon$
represents the physical error rate for all components in a quantum circuit,
$\mathnormal{E}$ represents all the possible malignant error events that a
noisy-CNOT gate will occur, i.e., with a probability of
$\frac{15}{16}\epsilon$, a two-qubit Pauli error drawn uniformly and
independently from $\\{I,X,Y,Z\\}\otimes\\{I,X,Y,Z\\}\backslash\\{I\otimes
I\\}$, and $\mathcal{P}(\mathnormal{E}|\epsilon)$ is the probability of
logical error $\mathnormal{E}$ with a given physical error rate. Therefore,
the pseudo-threshold of a 1-exRec is the physical error probability that
satisfies
$\epsilon=\sum_{\mathnormal{E}}\mathcal{P}(\mathnormal{E}|\epsilon)$.

Following the above definition, we further expand it and define the failure
rate of the logical fault-tolerant SWAP circuit. In fact, due to the error
propagation, any logical fault in one of three CNOT 1-exRec will cause the
entire process to be fail. Thus, we give an estimate about the logical failure
rate of the SWAP circuit as follows:

$\displaystyle\mathcal{P}_{swap}=2\mathcal{P}_{A}(1-\mathcal{P}_{B})(1-\mathcal{P}_{A})+\mathcal{P}_{A}(1-\mathcal{P}_{B})^{2},$
(22)

where $\mathcal{P}_{A}$ is the logical error rate of
$\widetilde{\mathcal{C}}_{A}$ 1-exRec and $\mathcal{P}_{B}$ is the logical
error rate of $\widetilde{\mathcal{C}}_{B}$ 1-exRec. We also give a method to
calculate the pseudo-threshold of a logical SWAP gate. Similarly, we define
its failure event as the failure of any CNOT gate it contains. Since the basic
assumption of our error model is that the error probability of any physical
operation is the same, then the physical failure probability of the SWAP gate
is: $\epsilon_{swap}=3\epsilon(1-\epsilon)^{2}$. So, the pseudo-threshold of a
fault-tolerant logical SWAP circuit is the physical error probability
$\epsilon$ that satisfies $\epsilon_{swap}=\mathcal{P}_{swap}$. The logical
error rate of a 1-exRec can be numerically computed by Monte Carlo method. We
next describe our numerical calculation scheme. Our simulation design has the
following two basic assumptions: First, since the error rate in classical
computers is usually very low (per operation), we assume that classical
information can be ideally protected and do not consider errors in classical
computers in our simulation experiments. Second, to ensure the full use of
resources, we assume that in every single logical qubit, the auxiliary state
that passes the verification can be reused before it is measured to be a
classical bit.

For our simulation scheme, we construct depolarization noise model for
threshold calculation, that is, apply the following noise channel to each
noise physical component in a 1-exREC:

$\displaystyle\varepsilon(\rho)=(1-\frac{3\epsilon}{4})\rho+\frac{\epsilon}{4}(X\rho
X+Z\rho Z+Y\rho Y).$ (23)

The basic noise components in our simulation are listed in Table 3. Here we
make the assumption that the physical error rate of a two-qubit gate and one-
qubit gate being the same. With the basic assumption described above, we now
give the calculate method of logical failure rate for
$\widetilde{\mathcal{C}}_{A}$ or $\widetilde{\mathcal{C}}_{B}$ as follows:

Table 3: Types of physical noisy locations present in the simulation experiment of a 1-exRec. No. | component type
---|---
1 | Basic state $|0\rangle$ preparation
2 | Basic state $|+\rangle$ preparation
3 | Measurement of Pauli operator
4 | Two-qubit quantum gate
5 | Single-qubit non-identity quantum gate

(i) First, we choose a sequence of physical error rates ranged from $10^{-4}$
to $10^{-2}$. For each fixed physical error rate $\epsilon$, we simulate the
$\widetilde{\mathcal{C}}_{A}$ or $\widetilde{\mathcal{C}}_{B}$ under a
depolarizing noise channel. The simulation is valid if all the ancillary
blocks in a 1-exRec pass the verification.

(ii) When a noisy logical CNOT gate fails, it applies an ideal CNOT gate
followed by one of the 15 nontrivial two-qubit logical Pauli operators. Thus,
for each possible logical error $\mathnormal{E}$, we prepare an appropriate
initial encoded state and use the Monte Carlo method to estimate its
conditional probability when the physical error rate is fixed. Here, we set
the number of simulation $N=10^{6}$ and denote the logical error rate as
$\mathcal{P}(\mathnormal{E}|\mathnormal{cnot},\epsilon)=\frac{m}{N}$, where
$m$ is the number of logical errors $\mathnormal{E}$ occurring after $N$
iterations.

Table 4: Pseudo-threshold results for minimal weight decoding strategy and neural-network based decoding strategy. logical circuit | minimal weight | neural-network
---|---|---
$\widetilde{\mathcal{C}}_{A}$ | $9.36\times 10^{-7}$ | $1.06\times 10^{-4}$
$\widetilde{\mathcal{C}}_{B}$ | $1.99\times 10^{-6}$ | $1.98\times 10^{-4}$
fault-tolerant SWAP circuit | $3.26\times 10^{-6}$ | $1.07\times 10^{-4}$

We display our simulation results in Fig. 8, Fig. 9 and Fig. 10. Polynomial
fitting algorithm is used to obtain two types of 1-exRec logical error curves,
and it can be found that the best fitting effect can be achieved by using
quadratic function fitting. Actually, for an effective fault-tolerant quantum
operation, its logical error rate should be smaller than the error rate of
unprotected one, there also has been proved that if error propagation through
the entire fault-tolerant circuit is limited, and a good decoder is used, the
logical error rate should exhibit the power law scaling [40], which means code
concatenation techniques can be adapted to exponentially reduce the logical
error rate.

From our numerical simulation results, we observe that the fitting curve of
the logical error rate of $\widetilde{\mathcal{C}}_{A}$ and
$\widetilde{\mathcal{C}}_{B}$ based on two decoding strategies show the
characteristics of a quadratic curve. We think this is a reasonable numerical
simulation result. Because the code distance of $C_{7}$ and $C_{15}$ is 3,
decoders for these code are effective if they can correct most of the single-
qubit error, such that the logical error can only be caused by two or more
single-qubit errors that occur independently. In contrast, our decoding
strategy can more effectively reduce the logical error rate of the pieceable
fault-tolerant circuit, so it leads to a higher threshold result, as shown in
Table 4.

##  VI CONCLUSIONS

In summary, the main contribution of this work is to combine the pieceable
fault-tolerant protocol to design an efficient code conversion circuit, which
enables the exchange of information between two logical qubits protected by
different error-correcting codes. Because the error that occurs on a pieceable
fault-tolerant logical gate is prone to propagate, the error threshold of such
gate is relatively lower than those who with transversal construction.

Therefore, we first extract the effective features of the syndrome data that
is collected from different circuit pieces and introduce the classical pattern
recognition algorithm in the decoding process. Such treatment actually
transforms the prediction of error propagation into a supervised multi-
classification task. Then, we extend the decoder of a pieceable fault-tolerant
with a trained logical error discrimination model. Finally, we simulate this
pieceable fault-tolerant code conversion circuit under the depolarization
noise to obtain corresponding pseudo-threshold results.

These results have shown that our decoding process can effectively suppress
the logical error rate compared to the minimum weight method. So we think that
our fault-tolerant design of this conversion circuit has a certain
practicability on the current NISQ. Effective pieceable fault-tolerant logical
gate can be further introduced to universal computing scheme based on code
concatenation, such as constructing a non-transversal but fault-tolerant non-
Clifford gate on a 2-level concatenated code. Besides, with the consideration
of the noise in the current experimental platform, we will use the statistical
learning methods to effectively analyze its impact on the output of circuit in
our future work.

###### Acknowledgements.

This work is supported by the National Key R&D Program of China under Grant
No. 2018YFA0306703 and the Natural Science Foundation of Guangxi under Grant
No. 2019GXNSFAA185033.

## References

  * Preskill [2018] J. Preskill, Quantum computing in the nisq era and beyond, Quantum 2, 79 (2018).
  * Neill  _et al._ [2018] C. Neill, P. Roushan, K. Kechedzhi, S. Boixo, S. V. Isakov, V. Smelyanskiy, A. Megrant, B. Chiaro, A. Dunsworth, K. Arya, _et al._ , :a blueprint for demonstrating quantum supremacy with superconducting qubits, Science 360, 195 (2018).
  * Feynman [1982] R. P. Feynman, Simulating physics with computers, International journal of theoretical physics 21, 467 (1982).
  * Farhi  _et al._ [2014] E. Farhi, J. Goldstone, and S. Gutmann, A quantum approximate optimization algorithm, arXiv preprint arXiv:1411.4028 (2014).
  * Shor [1999] P. W. Shor, Polynomial-time algorithms for prime factorization and discrete logarithms on a quantum computer, SIAM review 41, 303 (1999).
  * Häffner  _et al._ [2008] H. Häffner, C. F. Roos, and R. Blatt, Quantum computing with trapped ions, Physics reports 469, 155 (2008).
  * Ballance  _et al._ [2016] C. J. Ballance, T. P. Harty, N. M. Linke, M. A. Sepiol, and D. M. Lucas, High-fidelity quantum logic gates using trapped-ion hyperfine qubits, Phys. Rev. Lett. 117, 060504 (2016).
  * Debnath  _et al._ [2016] S. Debnath, N. M. Linke, C. Figgatt, K. A. Landsman, K. Wright, and C. Monroe, Demonstration of a small programmable quantum computer with atomic qubits, Nature 536, 63 (2016).
  * Devoret and Schoelkopf [2013] M. H. Devoret and R. J. Schoelkopf, Superconducting circuits for quantum information: an outlook, Science 339, 1169 (2013).
  * Childs  _et al._ [2017] A. M. Childs, R. Kothari, and R. D. Somma, Quantum algorithm for systems of linear equations with exponentially improved dependence on precision, SIAM Journal on Computing 46, 1920 (2017).
  * Boixo  _et al._ [2018] S. Boixo, S. V. Isakov, V. N. Smelyanskiy, R. Babbush, N. Ding, Z. Jiang, M. J. Bremner, J. M. Martinis, and H. Neven, Characterizing quantum supremacy in near-term devices, Nature Physics 14, 595 (2018).
  * Campbell  _et al._ [2017] E. T. Campbell, B. M. Terhal, and C. Vuillot, Roads towards fault-tolerant universal quantum computation, Nature 549, 172 (2017).
  * Gottesman [2014] D. Gottesman, Fault-tolerant quantum computation with constant overhead, Quantum Information & Computation 14, 1338 (2014).
  * Raginsky [2003] M. Raginsky, Scaling and renormalization in fault-tolerant quantum computers, Quantum Information Processing 2, 249 (2003).
  * Gottesman [1997] D. E. Gottesman,  _Stabilizer Codes and Quantum Error Correction_ , Ph.D. thesis, California Institute of Technology (1997).
  * Gottesman [2010] D. Gottesman, An introduction to quantum error correction and fault-tolerant quantum computation, in  _Quantum information science and its contributions to mathematics, Proceedings of Symposia in Applied Mathematics_ , Vol. 68 (2010) pp. 13–58.
  * Nielsen and Chuang [2000] M. A. Nielsen and I. L. Chuang, Quantum computation and quantum information (2000).
  * Aliferis  _et al._ [2006] P. Aliferis, D. Gottesman, and J. Preskill, Quantum accuracy threshold for concatenated distance-3 codes, Quantum Information & Computation 6, 97 (2006).
  * Eastin and Knill [2009] B. Eastin and E. Knill, Restrictions on transversal encoded quantum gate sets, Physical review letters 102, 110502 (2009).
  * Zeng  _et al._ [2011] B. Zeng, A. Cross, and I. L. Chuang, Transversality versus universality for additive quantum codes, IEEE Transactions on Information Theory 57, 6272 (2011).
  * Bravyi and Kitaev [2005] S. Bravyi and A. Kitaev, Universal quantum computation with ideal clifford gates and noisy ancillas, Physical Review A 71, 022316 (2005).
  * O’Gorman and Campbell [2017] J. O’Gorman and E. T. Campbell, Quantum computation with realistic magic-state factories, Physical Review A 95, 032338 (2017).
  * Fowler  _et al._ [2013] A. G. Fowler, S. J. Devitt, and C. Jones, Surface code implementation of block code state distillation, Scientific reports 3, 1939 (2013).
  * Jochym-O’Connor and Laflamme [2014] T. Jochym-O’Connor and R. Laflamme, Using concatenated quantum codes for universal fault-tolerant quantum gates, Physical review letters 112, 010505 (2014).
  * Chamberland  _et al._ [2017] C. Chamberland, T. Jochym-O’Connor, and R. Laflamme, Overhead analysis of universal concatenated quantum codes, Physical Review A 95, 022313 (2017).
  * Anderson  _et al._ [2014] J. T. Anderson, G. Duclos-Cianci, and D. Poulin, Fault-tolerant conversion between the steane and reed-muller quantum codes, Physical review letters 113, 080501 (2014).
  * Lin and Yang [2020] C. Lin and G. Yang, Concatenated pieceable fault-tolerant scheme for universal quantum computation, Physical Review A 102, 052415 (2020).
  * Colladay and Mueller [2018] K. R. Colladay and E. J. Mueller, Rewiring stabilizer codes, New Journal of Physics 20, 083030 (2018).
  * Torlai and Melko [2017] G. Torlai and R. G. Melko, Neural decoder for topological codes, Physical review letters 119, 030501 (2017).
  * Darmawan and Poulin [2017] A. S. Darmawan and D. Poulin, Tensor-network simulations of the surface code under realistic noise, Physical review letters 119, 040502 (2017).
  * Baireuther  _et al._ [2018] P. Baireuther, T. E. O’Brien, B. Tarasinski, and C. W. Beenakker, Machine-learning-assisted correction of correlated qubit errors in a topological code, Quantum 2, 48 (2018).
  * Yoder  _et al._ [2016] T. J. Yoder, R. Takagi, and I. L. Chuang, Universal fault-tolerant gates on concatenated stabilizer codes, Physical Review X 6, 031039 (2016).
  * Chamberland  _et al._ [2016a] C. Chamberland, T. Jochym-O’Connor, and R. Laflamme, Architectural analysis of universal concatenated quantum codes, (2016a).
  * Nikahd  _et al._ [2017] E. Nikahd, M. S. Zamani, and M. Sedighi, Low-overhead code concatenation approaches for universal quantum computation, arXiv preprint arXiv:1707.00981 (2017).
  * Bishop [2006] C. M. Bishop,  _Pattern Recognition and Machine Learning (Information Science and Statistics)_ (Springer-Verlag New York, Inc., 2006).
  * Lecun  _et al._ [2015] Y. Lecun, Y. Bengio, and G. Hinton, Deep learning, Nature 521, 436 (2015).
  * Aaronson and Gottesman [2004] S. Aaronson and D. Gottesman, Improved simulation of stabilizer circuits, Physical Review A 70, 052328 (2004).
  * Wecker and Svore [2014] D. Wecker and K. M. Svore, Liqui$|>$: A software design architecture and domain-specific language for quantum computing, arXiv preprint arXiv:1402.4467 (2014).
  * Chamberland  _et al._ [2016b] C. Chamberland, T. Jochym-O’Connor, and R. Laflamme, Thresholds for universal concatenated quantum codes, Physical review letters 117, 010501 (2016b).
  * Fowler  _et al._ [2012] A. G. Fowler, M. Mariantoni, J. M. Martinis, and A. N. Cleland, Surface codes: Towards practical large-scale quantum computation, Physical Review A 86, 032324 (2012).