Learning time-dependent noise to reduce logical errors: real time error rate estimation in quantum error correction

Quantum error correction is important to quantum information processing, which allows us to reliably process information encoded in quantum error correction codes. Efficient quantum error correction benefits from the knowledge of error rates. We propose a protocol for monitoring error rates in real time without interrupting the quantum error correction. Any adaptation of the quantum error correction code or its implementation circuit is not required. The protocol can be directly applied to the most advanced quantum error correction techniques, e.g. surface code. A Gaussian processes algorithm is used to estimate and predict error rates based on error correction data in the past. We find that using these estimated error rates, the probability of error correction failures can be significantly reduced by a factor increasing with the code distance.


I. INTRODUCTION
Quantum error correction [1] is crucial to long-time quantum memory and large-scale quantum computation.Without quantum error correction, usually the performance of a physical quantum system is not good enough for exploiting the full power of quantum information processing.The state-of-the-art life time of quantum states varies from 100 microseconds for superconducting qubits [2] to hours for impurity spins in silicon [3], which are not comparable with most daily used classical memory devices.In the leading experiments a thousand entangling gates can be performed on two ion qubits with only one error on average [4,5], however implementing Shor's algorithm on a meaningful scale may require trillions of gates [6,7].Given the limited coherence time and gate fidelity of the physical system, quantum error correction can reduce errors on the logical information to an arbitrarily low level, so that quantum memory with extendible life time and scalable quantum computation becomes possible.
Efficient quantum error correction benefits from the knowledge of error rates [8][9][10][11][12][13].In quantum error correction, the quantum information is encoded in a subspace, i.e. the logical subspace.Errors are detected by performing a selected set of measurements on the system.These measurements are selected so that they do not damage the logical information, e.g.measuring whether the state is still in the logical subspace.Outcomes of measurements contain the classical information, i.e. error syndromes, that we need for correcting errors.Using these outcomes, we can work out the most likely errors and correct errors accordingly.With a better knowledge of the probability distribution of errors, we have a better chance to guess errors correctly, i.e. error correction fails with a lower probability.
It is a common phenomenon that the strength of noise is determined by some time-dependent factors.For example, the amplitude of mechanical noise is usually time-dependent, e.g.seismic noise depends on human activities, which can affect many experimental systems.For superconducting qubits, fluctuations in the population of unpaired electrons can lead to large temporal variations in the decoherence rate [14].In ion traps, the electric-field noise can excite phonons, which reduce the gate fidelity [15], so the gate fidelity decreases with time between cooling operations.Drifts in the magnetic field and laser frequency can also cause time-dependent decoherence rate and gate fidelity in ion traps.
In this paper, we propose a protocol for estimating time-dependent error rates of each type of errors during quantum error correction.This protocol is based on processing error correction data using a machine learning algorithm, i.e. online Gaussian processes [16].Conventional approaches for measuring the noise in a quantum information device are the quantum process tomography [1] and randomised benchmarking [17], however, both of them cannot be implemented when quantum error correction is in processing.Quantum error correction itself can be used to assess the noise [18][19][20].For example, rates of error syndromes depend on error rates.Error syndrome rates can be used to reduce errors by optimising control parameters [21] and overcoming systematic phase shifts [22].Error syndrome rates can also be used to characterise quantum dynamics of a subsystem of the code [23].Our protocol can access all qubits without interrupting the implementation of the code during scalable fault-tolerant quantum computing.
We propose two methods for estimating error rates based on correction operations and syndrome patterns, respectively.Both methods are approximate.The inaccuracy of the syndrome-pattern method is O( 2 ), where is the error rate.Numerical results show that performances of two methods are similar.Using data obtained in error corrections in the past, the online Gaussian processes algorithm can predict error rates in the future, which are used in future error corrections to reduce error correction failures, i.e. logical errors.Taking the surface (a) Schematic diagram of quantum error correction enhanced by the real time error rate estimation.Taking the seven-qubit CSS code as an example, each circle denotes a qubit, and each face denotes two stabiliser operators σ x σ x σ x σ x and σ z σ z σ z σ z of four qubits on the face.The quantum computer sends stabiliser eigenvalues s to the classical computer, and the classical computer returns correction operations D(s).There are two methods for estimating error rates, which are the correction-operation (CO) method and the syndrome-pattern (SP) method.Arrows indicate the flow of the classical information.(b) Time evolution of the error rate of qubit-7 in the seven-qubit CSS code.The decoder is the ideal decoder that uses error rates provided by the estimator to minimise the post-correction logical error probability.Data are generated numerically by taking E[ ] = 0.02 and σ = 0.01.The unit of time is one round of error correction.Error rates estimated using CO and SP methods coincide with each other.Error rates of other qubits are shown in Fig. 4. code [24] as an example, we find that both methods can significantly reduce logical errors with a factor that increases with the code distance.We remark that both extendible quantum memory and scalable quantum computation usually require a big code distance [6,7,24].To implement our protocol, the required classical computing resource is O(n), where n is the number of qubits.The algorithm for estimating error rates can be parallelised and runs in time O(1) with respect to n.Therefore, our protocol is realistic for scalable quantum information devices.

II. QUANTUM ERROR CORRECTION
We focus on stabiliser codes (see Appendix).To encode k logical qubits in n physical qubits, usually the stabiliser of the code is an Abelian group generated by n − k independent Hermitian Pauli operators (stabiliser generators).We use s = (s 1 , . . ., s n−k ), which is a string of numbers taking values ±1, to denote eigenvalues of these generators, and logical subspace is the subspace in which all eigenvalues are +1 (denoted by 1).Logical qubits are defined by logical Pauli operators {σ}.We consider Pauli errors [σ]ρ = σρσ † , where σ is a Pauli operator.We use Σ

[σ]
s to denote the average of Pauli errors that flips stabiliser eigenvalues from 1 to s and causes the logical Pauli error [σ] at the same time (see Appendix).Errors corresponding to the same set of s and [σ] have the same effect on a logical state therefore do not have to be distinguished.Two errors occurring sequentially is equivalent to the error Σ , where • denotes the entrywise product, and Errors are detected by measuring s.If there is error Σ s on a state initially in the logical subspace, the measurement outcome is s.This outcome does not directly provide any information about the logical error [σ].To find out [σ], we need to implement the decoder in a classical computer.The decoder D is a map from stabiliser eigenvalues s to a logical error [σ].Given the outcome s, we decide that the error is Σ

D(s) s
, and an operation equivalent to Σ D(s) s is performed to correct the error.The overall effect of both the error and the correction operation is Σ , i.e. the state is brought back to the logical subspace 1 with a logical error D(s) [σ].Therefore, error correction succeeds if D(s) = [σ] otherwise results in a logical error.
We consider the error model which is a superoperator describing stochastic Pauli errors.Here, p s is the probability of error Σ [σ] s .Due to this error model, error correction fails with the probability which is the probability of logical errors after error correction.In order to minimise logical errors, we shall choose the correction operation according to the error with the maximum probability, i.e.
Such an ideal decoder relies on the full knowledge of the error model.Without monitoring the noise in real time, we cannot optimise the performance of error correction if error probabilities are time-dependent.The knowledge of the error model is also important for optimising approximate decoders that cannot exactly minimise logical errors, e.g. the surface code decoder using the minimumweight perfect matching algorithm [24].The flow of the real-time error rate estimation in error correction is shown in Fig. 1(a).In each round of error correction, the quantum computer measures stabiliser Two methods for observing error events in the surface code.Each vertex represents a stabiliser operator σ x σ x σ x σ x , and each edge represents a qubit or a phase-flip error on the qubit.In the correction-operation (CO) method, the decoder finds out correction operations on qubits (marked by the black bold line) that connecting stabiliser operators taking eigenvalue −1 (error syndromes, marked by circles with −1).These correction operations indicate errors on corresponding qubits.In the syndrome-pattern (SP) method, errors are observed using the pattern of error syndromes.The error Σ [σ] s is marked by the red bold line.The corresponding syndrome pattern Ss contains these stabiliser operators marked by circles with crosses.Es includes errors that can cause the same syndrome pattern, which are marked by the red bold line and blue dashed lines.Ss includes stabiliser operators marked by circles with crosses and empty circles.Ẽs contains all these errors marked by the red bold line, blue dashed lines and also black dotted lines.In case-i, only one error can cause the syndrome pattern Ss, therefore Es only contains one error, and Ss = Ss.In case-ii, the error Σ s .The pattern Ss occurs faithfully if circles with crosses take the value −1 but empty circles take the value +1.To decide whether there is an error on the qubit marked by the red bold line, we check all stabiliser operators marked by circles.If and only if empty-circle stabiliser operators are +1 and crossedcircle stabiliser operators are -1 (syndromes), we decide that there is an error on the qubit.Using this strategy, we can make sure that, the syndrome pattern is either caused by the single-qubit error on the red bold line or multi-qubit errors.
eigenvalues and sends outcomes to the classical computer.The classical computer runs two programs: the decoder and the error rate estimator.Using stabiliser eigenvalues, the decoder returns correction operations to the quantum computer.In the correction-operation method, the correction operation is decomposed by the decoder (as we will show later) and sent to the error rate estimator.In the syndrome-pattern method, stabiliser eigenvalues are directly sent to the estimator.Based on these data, the estimator provides real time estimations of error rates.Instead of optimising control parameters as in Ref. [21], we use these error rates to assist the decoder to increase the success probability of error correction.

III. INDICATORS OF ERROR EVENTS
Correction operations indicate error events.The stabiliser measurement outcome s occurs with the probability s , therefore the correction operation Σ D(s) s is performed with the probability p s .The probability distribution of correction operations can be described by where q The difference between ÑC and Ñ (the probability distribution of errors) is limited by the post-correction logical error probability p log , i.e. the distance When error correction works properly, p log is small.Therefore, two distributions are similar, and correction operations can approximately indicate error events, i.e. when the correction operation is Σ , it is likely that there is an error Σ D(s) s on the state.However, there are 2 n+k terms in Ñ , so such a method is only practical when the qubit number n is small, e.g.short-distance repetition codes or the smallest surface code considered in Ref. [18,21].In the following of this section, we develop two methods that are applicable to codes with many qubits, therefore these methods can be used in scalable fault-tolerant quantum computing.
The error model can be expressed in the product form where 1 1 is the identity operator, and s } are error rates.Here, E is a subset of errors.When the noise is caused by N independent sources, i.e.Ñ = Ñ1 • • • ÑN , and each independent noise Ñl only affects at most M qubits, the overall noise Ñ is determined by at most 4 M N error rates, i.e. |E| ≤ 4 M N .If these independent noises are all localised, e.g. they are the decoherence of each individual qubit, we have with respect to n. Error rates are real when the fidelity of each independent noise is greater than 1  2 .Although Ñ is a completely positive map, [σ] s may be negative.In the following, we assume that all [σ] s are positive for simplification, and usually the magnitude of a negative error rate is small (∼ O( 2)).See Appendix for detailed discussions about the product form of the error model.
Usually, there are not two errors in E with the same subscript s.If Σ In this case p log is not even lower than the rate of an independent error, i.e. either the code is not proper, or only one of them (we suppose it is Σ s ) is significant and rates of others (Σ [σ2] s ) are much lower.For the second case, we need to know which error is significant, so that errors with the same s are not equally weighted by the decoder, otherwise p log is on the level of the significant error rate (

[σ1]
s ) rather than insignificant error rates ( s ).Because rates of insignificant errors are on the level of the logical error probability, we can neglect them when estimating error rates.In the following, we assume that each s corresponds to at most one unique error Σ The syndrome pattern of s indicates the error Σ s with an inaccuracy O( 2 ) (see Fig. 2).Without any error, all entries of s (stabiliser operators) take the value +1.Error syndromes are entries taking the value −1, which indicate the presence of errors.Syndrome pattern S s is the set of all syndromes in s (see Appendix for details).If S s ⊆ S s , a syndrome in s is also a syndrome in s , and we say that the pattern S s occurs in s .The set of errors s is the rate of the corresponding error, and (see Appendix).Therefore, the syndrome pattern can approximately indicate the corresponding error when P s is small.Now, we propose two methods for observing error events.

A. Correction-operation method
In each round of quantum error correction, the quantum computer measures stabiliser eigenvalues to obtain s o [see Fig. 1(a)].Outcomes s o are sent to the decoder in the classical computer in order to find out the correction operation Σ D(so) so .In some decoders, e.g. the minimumweight perfect matching decoder of the surface code [24] (see Fig. 2), the correction operation is automatically decomposed as a product of errors in E in the form Here, y s,x = +1 (−1) indicates that there is an (no) error Σ

[σ]
s at the x-th round error correction.We remark that some decoders are not compatible with the correctionoperation method, e.g. the maximum-likelihood decoder of the surface code [25].In this method, {y Probabilities of the overall correction operation and the actual overall error has a difference smaller than the post-correction logical error probability p log , but the difference between the probability of the observed error event p(y s,x = +1) and the actual rate of the error is not bounded by p log .In our numerical results, we find that the inaccuracy of this method is similar to the syndrome-pattern method.

B. Syndrome-pattern method
In this method, stabiliser measurement outcomes s o are directly sent to the error rate estimator [see Fig. 1(a)], and the estimator observes error events by itself.The estimator notes that there is an error Σ In this method, the probability of the observed error event is p(y s,x = +1) = s , and the difference from the actual error rate s ).We note that P s ∼ | Ẽs | .In the worst case scenario, Ẽs = E.When the noise is caused by localised sources, |E| = O(n), so P s ∼ O(n ) in this case.For extendible codes, e.g. the surface code or color codes [26], n can be a large number.However, usually the stabiliser of an extendible code has a structure that makes Ẽs = O(1) with respect to n.For example, for the surface code, if errors are caused by the dephasing of each individual qubit, | Ẽs | ≤ 13 and it is independent of n (see Fig. 2).

IV. ERROR RATE ESTIMATION
Error rates are estimated using the data of error events, i.e. {y

[σ]
s,x }.If error rates are time-independent, we can directly estimate them using the estimator ˆ s,x ), where N is the total number of error correction rounds in the data.In this way, the uncertainty of the error rate estimation due to the shot noise is ˜ s,x } is not genuine data of error events, because both methods for observing error events are not exact.Therefore the difference between the estimated error rate ˆ

[σ]
s and the actual error rate [σ] s also depends on the inaccuracy of the method for observing error events.
Each error rate s is estimated independently.Therefore, in the following we neglect the subscript s and superscript [σ].
When the error rate is time dependent, estimating the error rate using the data of error events {y x } is a typical classification problem that can be solved using the Gaussian processes approach.In this paper, we choose to use the online Gaussian processes algorithm [16].Online Gaussian processes can be applied to large data sets with a reduced cost of computing resources.Some other online Bayesian methods have been used in parameter estimation and quantum tomography [27].The online Gaussuan processes algorithm may provide an alternative tool in these tasks, e.g.estimating non-Markov processes.
Following the Gaussian processes classification approach, we assume that the error rate (f ) is determined by a parameter f .The posterior distribution of the parameter f is approximated by a Gaussian distribution determined by the average f x t and covariance K t (x, x ).Here, f x is the value of f at the x-round error correction, K t (x, x ) is the covariance matrix of variables f x and f x , and the subscript t denotes that the posterior is obtained using data from the first to t-th rounds of error correction.We note that • t denotes the average over the Gaussian distribution given by f x t and K t (x, x ).For any function of f x , we have In the online Gaussuan processes algorithm, f x t and K t (x, x ) are calculated by iterating equations [16] where and To start the iteration, we have to introduce the prior Gaussian distribution f x 0 and K 0 (x, x ), which are respectively the average and covariance before any data is used to estimate the distribution of f .By iterating equations, one set of data (i.e.y t ) is added to the estimation each time.Because y t is contentiously generated in error correction, the posterior distribution is updated contentiously.
We can assume that the evolution of the parameter f , i.e. the error rate , is a Markov process and choose the prior distribution according to the Ornstein-Uhlenbeck process, i.e.K 0 (x, x ) = σ 2 f e − 1 ξ |x−x | .Then the posterior distribution for x, x ≥ t can be written as where δf t and δK t are calculated using 17) and δf 0 = δK 0 = 0. Using data from the first to tth rounds, the estimated error rate at the x-th round is The prior is taken to represent the prior knowledge about which kind of functions f x we expect.There are three parameters determining the Ornstein-Uhlenbeck process, f x 0 , σ f and ξ.We need to measure these parameters before implementing the estimation by other means.Alternatively, we can optimise these parameters, for example, by minimising the logical error probability.The online Gaussian processes algorithm can be applied when the prior is not Markov, but the cost of computing resources may increase.
The data size N increases with the running time of quantum error correction, because new error-event data are introduced at each round of error correction.Using the online Gaussian processes algorithm to predict the evolution of f , usually the number of parameters that need to be computed and stored increases quadratically with the data size [16].Because the correlation in the prior covariance decreases with time, data collected long time ago (|x − x | ξ) can be deleted from the dataset.Therefore, we can freeze the size of effective data once it is large enough.
When the evolution of error rates is Markovian and the prior covariance is set according to the Ornstein-Uhlenbeck process, only two parameters δf t and δK t need to be computed and stored for each error rate Every time new data are introduced, these two parameters are updated according to Eqs. (17,18).Given δf t and δK t , Eqs. (15,16) are used to predict the evolution of the error rate.
To estimate the error rate s , the classical computer needs to detect error events {y s,x }.For the correctionoperation method, detecting the error event is performed by the decoder and does not require any additional computing.For the syndrome-pattern method, identifying the syndrome pattern takes time O(1) and only needs to access O(1) stabiliser measurement outcomes.Therefore, the time cost is O(1) for estimating the error rate and updating the estimation.Each error rate [σ] s is estimated independently, so the computing can be parallelised, and the overall required resource increases with the number of qubits as O(n).Here, we have assumed that noises are localised.
The error rate calculated using the t-th round data is not used in the t-th round error correction, because we do not want to use stabiliser measurement outcomes twice in one round of error correction.
If error corrections are performed periodically without a break, only the (t+1)-th round error correction uses the error rate given by f x t and K t (x, x ), because these two parameters will be updated after new data are introduced at the (t + 1)-th round.We remark that when stabiliser measurement outcomes may be incorrect due to measurement errors and gate errors that can affect measurement outcomes, we may need to repeatedly measure stabiliser operators for several times to perform one round of error correction.In many protocols of stabiliser-code-based fault-tolerant quantum computation, error correction on a subset of qubits needs to stop temporarily in order to inject magic states [28] for completing the universality of logical quantum gates [29], in which case we need to predict the error rate in a further future rather than only the next round.
At the beginning of quantum error correction, the error event data may not be adequate to estimate error rates.Therefore, we can introduce a warming up stage, in which the machine is not actually used in any computing task but error correction is implemented only for the purpose of collecting error-event data.After the warming up stage, we encode information in the error correction code to actually execute the computing task.Because of the ability to predict error rates in the future, error correction cycles can be broken temporarily to implement the encoding.

V. NUMERICAL RESULTS
To demonstrate the performance of our protocol, we numerically simulate quantum error corrections using the seven-qubit Calderbank-Shor-Steane (CSS) code [30] and the surface code, respectively.We consider the error model that errors are independent dephasing errors, i.e.
Here, j = (f ) is the probability of a dephasing error on qubit-j occurring between two rounds of stabiliser measurements, (f ) = (1−e −2e f )/2, and f is time-dependent and different for each qubit.We take the dephasing error model as an example, but our methods can be applied to general error models as discussed in Sec.III and used to estimate the rate of correlated errors.Unlike dephasing caused by a slowly varying field that can be cor- We take the expectation of the error rate E[ ] = 0.02, which is about onefifth of the threshold of the surface code [24].The logical error probability decreases with the code distance.Data are calculated numerically using the Monte Carlo method, and lines are obtained by fitting data using Eq. ( 21).Without the error rate estimator, the logical error probability is independent of the variance of error rates σ .Using the syndrome-pattern (SP) method to estimate error rates, the logical error probability can be suppressed and decreases faster than without using the estimator.Insets: Ratios of logical error probabilities p log /p log .Here, p log (p log ) is the logical error probability obtained by using error rates estimated with the following method (SP method): For purple solid lines, we suppose that we can measure actual error rates; For the green dashed lines, error rates are estimated using the correction-operation method; For orange dotted lines, we suppose error-event data used by the estimator are genuine.The decoder is based on the minimum-weight perfect matching algorithm [31], and weights are determined by estimated error rates [24].Error bars correspond to one standard deviation.(b) An example of actual error rates and error rates estimated using two methods for the surface code with the code distance 5.Each square denotes a qubit, and the color represents the error rate.
rected using dynamical decoupling, the dephasing noise in this model can only be corrected using error correction.If the dephasing rate is γ and the time between two rounds of stabiliser measurements is ∆t, γ∆t = e f .When γ∆t 1, e f .Using this approximation, we calculate q (t) and r (t) by taking We assume that the evolution of the parameter f is determined by an Ornstein-Uhlenbeck process, therefore using the Ornstein-Uhlenbeck process as the prior is exact in our examples.We choose f x 0 and σ f by taking the expectation of the error rate E[ ] = 0.02 and its standard deviation σ = 0.01, 0.02 (see Appendix), and we take the time scale of the relaxation in the Ornstein-Uhlenbeck process as ξ = 5000 rounds of error corrections.
In the seven-qubit CSS code, we can find that error rates estimated using two methods coincide with each other but are different from the actual error rate [see Fig. 1(b)].Results of two methods are close because an average error rate much lower than the threshold is considered, in which case error syndromes are sparse, and the correction operation on a qubit is likely to be determined by only neighbouring error syndromes.The difference is due to the inaccuracy of the method for observing error events and also the inaccuracy of the online Gaussian processes algorithm [16].
In the surface code, we demonstrate that the real time error rate estimation can reduce the post-correction logical error probability, and the improvement increases with the code distance [Fig.3(a)].When the code distance is larger, the probability p s of an error is determined by a product of more error rates, so choosing the optimal correction operation is more sensitive to the variance of each error rate.The logical error probability decreases exponentially with the code distance and can be approximately described using the formula where d is the code distance, and parameters α and δ are obtained by fitting data in Fig. 3(a) (see Appendix).When α is larger, the logical error decreases faster with the code distance.We find that α = 0.8401 without using the error rate estimator, which is increased to α = 0.8882 (0.9405) by using the syndrome-pattern method when the σ = 0.01 (0.02).As shown in Fig. 3(b), error rates estimated using the correction-operation method and the syndrome-pattern method are similar.Differences between estimated error rates and actual error rates are plotted in Fig. 5. Two methods have similar effects on the logical probability [see insets in Fig. 3(a)].Data of error events obtained using both methods are not genuine.If we assume that data of error events are genuine (i.e.y

[σ]
s,x = +1 if and only if the corresponding error actually occurs), we find that the logical error probability is not further reduced, i.e. for the purpose of reducing the logical error probability, both methods for observing error events have been optimised in this particular example.If we assume that actual error rates can be measured in some manner and used in error correction, the logical error probability can be further reduced, but the improvement is moderate.

VI. CONCLUSIONS
By learning the time evolution of error rates in a quantum computer, quantum error correction can succeed with a higher probability.We have presented two methods for the real-time estimation of error rates, which work for any stabiliser code.Our methods can estimate error rates by processing the generated in quantum error correction and do not require any additional qubits or operations in the quantum computer.Both methods are approximate but good enough to significantly reduce logical errors.Measuring error rates in error correction can also help us to understand the mechanism of errors and improve the fidelity of the quantum device.We have demonstrated both methods in the seven-qubit CSS code and the surface code.The seven-qubit CSS code is a candidate for demonstrating quantum error correction in the near term further, and the surface code is a promising code for the full-scale fault-tolerant quantum computation.We have only considered memory errors in our numerical simulations, but our methods can be applied to other error models, e.g. each gate in the error correction circuit can cause errors.Our methods only require a small amount of classical computing resources for each qubit by using the online Gussian processes algorithm.In summary, our protocol is realistic and can significantly reduce logical errors in quantum error correction.
is the subspace that all eigenvalues are s i = +1, and k logical qubits are encoded in the logical subspace.We label the logical subspace with 1 = (1, . . ., 1).These logical qubits are defined by logical Pauli operators, which are all elements of G.The Pauli group of k logical qubits is L = σx 1 , σy 1 , σz 1 , . . ., σx k , σy k , σz k , which is a subgroup of G and a subset of the centraliser of S, i.e. elements of L commute with all elements of S.
We We consider the case that the noise includes N independent sources of the noise and each independent noise only affects at most M qubits.In this case , where G l is the group of Pauli errors on these qubits affected by the l-th noise, and |G l | ≤ 4 M .We can reexpress an independent noise as (see the next section) therefore the overall noise where | l G l | ≤ 4 M N .Using average errors, there is an equivalent error model in the product form, where We consider the case that Σ In this case, we can rewrite the error model as s , and N describes the effect of all other errors in E. If the error contributed by N is Σ or both of them can cause a post-correction logical error; similarly when the stabiliser measurement outcome is s or both of them can cause a post-correction logical error.Therefore, the post-correction logical error probability Time evolution of error rates of qubits 1 to 6 in the seven-qubit CSS code.Blue curves represent actual error rates, green curves represent error rates estimated using the correction-operation method, and red curves represent error rates estimated using the syndrome-pattern method.Error rates estimated using two methods coincide with each other.The unit of time is one round of error correction.where the summation covers all u, and α u = where

i.e. the error rate
. Here, we have used that [σ]∈G β [σ] = 0, which is due to the fact that the noise is trace-preserving.
Although N is a completely positive map, [σ] may be negative or even complex numbers.Usually, the overall error probability of the noise 1 − p Only errors in Ẽs determine whether S s occurs faithfully.To expand the product form of the noise, we introduce a binary string v, in which v s = 1 (v s = 0) denotes that the error Σ [σ ] s is switched on (switched off).Each s is unique in E, so each element of v is only labelled by s .Then, we can rewrite the expression of s by expanding the product form of the noise, and In the expression of s o (v), the product is the entrywise product.In this expression of s , only one term is nonzero when |v| ≤ 1 (|v| is the number of errors), which corresponds to the error Σ s .We also have p 1 ≥ p 0 P s .Therefore,  I. Fitting parameters α and δ are given in Table II.Differences between actual error rates and error rates estimated using the correction-operation method and the syndromepattern method are plotted in Fig. 5.
FIG. 1.(a) Schematic diagram of quantum error correction enhanced by the real time error rate estimation.Taking the seven-qubit CSS code as an example, each circle denotes a qubit, and each face denotes two stabiliser operators σ x σ x σ x σ x and σ z σ z σ z σ z of four qubits on the face.The quantum computer sends stabiliser eigenvalues s to the classical computer, and the classical computer returns correction operations D(s).There are two methods for estimating error rates, which are the correction-operation (CO) method and the syndrome-pattern (SP) method.Arrows indicate the flow of the classical information.(b) Time evolution of the error rate of qubit-7 in the seven-qubit CSS code.The decoder is the ideal decoder that uses error rates provided by the estimator to minimise the post-correction logical error probability.Data are generated numerically by taking E[ ] = 0.02 and σ = 0.01.The unit of time is one round of error correction.Error rates estimated using CO and SP methods coincide with each other.Error rates of other qubits are shown in Fig.4.
-boundary qubit, and these errors marked by blue dashed lines can case the same syndrome pattern as Σ[σ] } also indicates how to correct errors.Data of error events {y [σ] s,x } are sent to the error rate estimator for further processing [see Fig. 1(a)].
[σ] s at the x-th round error correction (i.e.y [σ] s,x = +1) if the corresponding syndrome pattern S s occurs faithfully in s o , otherwise y [σ]s,x = −1.We remark that, in this case errors are not corrected according to {y [σ] s,x }.

FIG. 3 .
FIG. 3. (a)Post-correction logical error probability p log as a function of the code distance for the surface code.We take the expectation of the error rate E[ ] = 0.02, which is about onefifth of the threshold of the surface code[24].The logical error probability decreases with the code distance.Data are calculated numerically using the Monte Carlo method, and lines are obtained by fitting data using Eq.(21).Without the error rate estimator, the logical error probability is independent of the variance of error rates σ .Using the syndrome-pattern (SP) method to estimate error rates, the logical error probability can be suppressed and decreases faster than without using the estimator.Insets: Ratios of logical error probabilities p log /p log .Here, p log (p log ) is the logical error probability obtained by using error rates estimated with the following method (SP method): For purple solid lines, we suppose that we can measure actual error rates; For the green dashed lines, error rates are estimated using the correction-operation method; For orange dotted lines, we suppose error-event data used by the estimator are genuine.The decoder is based on the minimum-weight perfect matching algorithm[31], and weights are determined by estimated error rates[24].Error bars correspond to one standard deviation.(b) An example of actual error rates and error rates estimated using two methods for the surface code with the code distance 5.Each square denotes a qubit, and the color represents the error rate.

]
FIG. 4.Time evolution of error rates of qubits 1 to 6 in the seven-qubit CSS code.Blue curves represent actual error rates, green curves represent error rates estimated using the correction-operation method, and red curves represent error rates estimated using the syndrome-pattern method.Error rates estimated using two methods coincide with each other.The unit of time is one round of error correction.

FIG. 5 .
FIG. 5.Differences between actual error rates and estimated error rates ˆ .The color of each square denotes the difference |d | for a qubit of the surface code, where d = −ˆ .

( 1 2 • 1 −so 2 ,| 1−s 2 |
[I]   1 (which implies p [I] ≥ 1/2), in which case α u ≥ 0 and [σ] is always real.When an error rate [σ] is negative, usually the magnitude of[σ]  is much smaller than other error rates.Because p[σ] ∼ [σ] + O( 2 ) is always non-negative, we have | [σ] | ∼ O( 2 ) when [σ]is negative.When expanding the product form, the product of two errors may result in the error [σ] in the summation form, which leads to the term O( 2 ).For example, we consider the noise of a single qubit in the formN = (1−2p)[I]+p[σ x ]+p[σ z ],in which the probability of the [σ y ] error is zero.For such a singlequbit noise, the product form readsN = N x N y N z , where N ω = (1 − 2 ω )[I] + ω [σ ω ], x = z = (1 − √ 1 − 4p)/2 and y = [1 − (1 − 2p)/ √ 1 − 4p]/2.One can find that the rate of the [σ y ] error is negative, and y = − 2x /(1 − 2 x ).Regardless of the sign of α u , in general log α u = log |α u | + iπθ(−α u ), where θ(•) is the Heaviside step function.Therefore, the product expression always exists, but [σ] may be complex numbers.In this paper, we focus on the case that [σ] is always positive.Appendix D: Inaccuracy of the syndrome-pattern methodEach error Σ [σ] s maps to a set of stabiliser generators S s = {S k | s k = −1} flipped by the error.S s is the syndrome pattern of the error Σ syndrome pattern S s occurs faithfully with the probability s = so g f (s, s o )p so .Here, g f (s, s o ) = g(s, s o ) − g(s , s o )), (D1) g(s, s o ) = δ 1−s , and | • | denotes the number of ones in a binary string.g(s, s o ) takes the value 1 (otherwise 0) if S s occurs in s o ; g f (s, s o ) takes the value 1 (otherwise 0) if S s occurs faithfully in s o .

s
≤ P s − (1 − P s )P s = P 2 s .Data of qubits 1 to 6 in the seven-qubit CSS code are given in Fig.4.To obtain these numerical results, we have taken f x 0 and σ f as shown in Table includes errors in E that can cause the syndrome pattern S s .We say that the pattern S s occurs faithfully in the stabiliser measurement outcome s o if only S s occurs in s o but syndrome patterns of other errors in E s do not (i.e. S s ⊆ S so but S s If S s occurs faithfully and it is caused by one error, the error must be Σ includes all syndromes that can be caused by errors in E s .We only need to check these syndromes in Ss to find out whether S s occurs faithfully.The set of errors Ẽs = {Σ s }).s ∈Es S s s Ss = ∅} includes errors in E that can cause syndromes in Ss .All other errors in E but out of Ẽs are irrelevant to the syndrome pattern S s .S s occurs faithfully (in the stabiliser measurement outcome) with the probability s =

TABLE II .
Parameters α and δ and their standard deviations.σ = 0 corresponds to the case that the error rate estimator is not used.