Accounting for errors in quantum algorithms via individual error reduction

We discuss a surprisingly simple scheme for accounting (and removal) of error in observables determined from quantum algorithms. A correction to the value of the observable is calculated by first measuring the observable with all error sources active and subsequently measuring the observable with each error source reduced separately. We apply this scheme to the variational quantum eigensolver, simulating the calculation of the ground state energy of equilibrium H2 and LiH in the presence of several noise sources, including amplitude damping, dephasing, thermal noise, and correlated noise. We show that this scheme provides a decrease in the needed quality of the qubits by up to two orders of magnitude. In near-term quantum computing, where full fault-tolerant error correction is too expensive, this scheme provides a route to significantly more accurate calculations. The errors in quantum computing can be strongly reduced exploiting partial removal and subsequent estimation of the residual error. Matthew Otten and Stephen Gray from Argonne National Laboratory have devised a simple scheme that should be able to greatly reduce the practical requirements for quantum devices in terms of cleanliness of operation, both for computation and for some quantum sensing protocol. The approach requires being able to actively reduce, of a certain amount, each error source separately, and measure the quantity to be calculated separately each time. Then, the authors show that it is possible to combine these noisy measurements together and get a reliable estimation of the noiseless result. Numerical simulations prove that the scheme would work for many different types of noise.


INTRODUCTION
Quantum computing is beginning to show promising proof-ofprinciple calculations, especially in quantum chemistry. Calculations of the binding energies for molecules such as H 2 1 and BeH 2 2 have been done using small, noisy quantum computers. Applications in machine learning have also been shown on quantum hardware. 3 Quantum computing is entering the noisy intermediate-scale quantum era. 4 Full fault-tolerant error correction is still many years away; near-term quantum computers will have a limited number of qubits, each qubit being noisy. Methods that reduce noise and correct errors without doing full error correction on every qubit will help extend the range of interesting problems that can be solved in the near-term. Each qubit is a very valuable resource for near-term quantum computers; using them efficiently, and reusing them as often as possible, is imperative in enabling useful calculations on near-term devices.
Here we describe and demonstrate a simple scheme for reducing the effects of a variety of noise sources by reducing each source separately and summing the resulting corrections. In practice, the reduction could be accomplished via quantum error correction 5 or by active engineering to reduce a noise rate, e.g., autonomous error correction 6,7 or dynamical decoupling. 8 Simple quantum error correction schemes have already been shown in superconducting circuits 9,10 and such systems are approaching more complicated error correction schemes. 11 In trapped ion quantum computers, a seven qubit color code has been already been demonstrated. 12 Quantum computing architectures are nearing the quality and size where a single qubit could be error corrected, but we are far from every qubit being corrected. The scheme we present could make use of this limited error correction, by sweeping through each qubit, correcting one qubit at a time, but is not dependent on error correction methods per se. We validate it with the variational quantum eigensolver (VQE), 13,14 simulating the calculation of the ground state energies of H 2 and LiH. We assume that a single qubit has its error rate reduced by some means, while the other qubits retain all of their error. Our results show that the scheme reduces the needed quality of each qubit drastically; for 'chemical accuracy', error rates can be up to two orders of magnitude larger. We apply this scheme to multiple noise sources, including amplitude decay, dephasing, thermal noise, and correlated noise. We stress that the scheme can be used to reduce the environmental error from any measured observable, not just those used in VQE. Furthermore, this scheme is not restricted to algorithms on quantum computers; it could potentially be used in quantum sensing. Quantum error correction has been proposed as a method to reduce environmental noise in quantum metrology, 7,15 allowing a probe to reach the Heisenberg limit. 16 Our scheme could reduce the number of error correcting qubits necessary for such a method.

Noise sources and removal
We simulate four different types of varying noise sources, represented by Lindblad operators: amplitude damping (L 1 ), dephasing (L 2 ), thermal (L th ), and correlated noise (L c ): where σ is an annihilation operator and D½CðρÞ ¼ CρC y À 1 2 ðC y Cρ þ ρC y CÞ. These Lindblad terms are applied to each qubit or to various combinations of qubits. The parameters in Eq. (1) are , twice the dephasing rate; γ th , the thermalization rate; n th , the thermal occupation (taken to be 0.5); and γ c , the correlated noise rate. We have used this formalism in previous work. [17][18][19] For our calculations we assume that reduction of an error source corresponds to reducing the relevant parameter, γ, by some known amount.
It is important to understand the exact process of the reduction of the relevant error parameters and what effect that has on the relevant error properties of the underlying qubits. For instance, if some active engineering process reduces the error only fractionally, the fractional reduction must be known to make full use of our method; if it is only known approximately, there will still be a correction, but it will not be as drastic. Furthermore, if the error reduction strategy decreases the relevant source of error, but increases a different source of error, the method will not directly be able to account for the additional error. For instance, quantum error correction could be used to reduce the error by correcting each qubit, one at a time. Quantum error correction, however, naturally introduces new overhead in number of qubits (due to the encoding) and in number of gates (due to the increased complexity of logical operations, especially two-qubit operations, on encoded qubits), which could introduce new types of errors into the circuit evaluation. This additional complexity would make the original, noisy evaluation differ by more than just a reduction of the error on each qubit by a partial amount. Furthermore, the quantum error correction algorithms likely to be implemented in the near-term will only partially decrease the error, not eliminate it, even without all these complications. In this work, we assume gates are separated by one time unit and the error rates are given in inverse time units.
Variational quantum eigensolver Here, we briefly overview the variational quantum eigensolver (VQE). VQE solves for an approximate, variational ground state energy of a parameterized wavefunction ansatz, |ψ(θ)〉. The variational principle ensures that E 0 , the true ground state energy of the Hamiltonian H, is always less than E, the energy of a parameterized wavefunction ansatz. E is evaluated on the quantum computer; the parameters θ are optimized using a classical computer. Classical computing methods such as variational quantum Monte Carlo 20 also make use of the variational principle. The hope of a quantum realization is that quantum computers can efficiently prepare non-trivial states which would be more difficult to prepare on a classical computer. While methods like quantum phase estimation 21 can give generally more accurate energies, VQE requires shorter circuits and has a natural robustness to noise. 2,13,22 VQE is not limited to quantum chemistry; it has also been used to study problems in nuclear physics. 23 When using VQE for quantum chemistry, the second quantized quantum chemistry Hamiltonian is transformed into a qubit Hamiltonian using a transformation such as Jordan-Wigner. 24 Correction scheme First consider the Lindbland master equation, A formal solution for a density matrix evolving from time t to t + τ and satisfying this equation is where V τ ðÞ ¼ exp½τLðÞ: We use () above to indicate that L and V τ are superoperators that take in an operator with the brackets to generate a new one. To first order in τ and taking L() to be the sum over Lindblad operators of Eq. (2), Applying gate 1 via application of unitary operator U 1 , evolving under V τ , applying gate 2 (U 2 ), etc., up to gate G (U G ) corresponds exactly to a final density matrix given by where T = (G -1) t, the time after the last gate has been applied. Notice that Eq. (6) is not symmetric, since V τ is a superoperator. Equation (6) is ρ(T) for the case of all m error sources present. The corresponding ρ a (T) with no error terms present is simply: The density matrices resulting from reducing error sources i = 1, 2, …, m separately are V i τ is the corresponding Lindblad evolution operator that contains a suitably scaled L i but has all other terms the same, e.g. to first order in τ, where f i is the fraction of noise removed. Now we consider the new density matrix defined as Insertion of the Eqs. (5) and (9) into Eq. (10) leads, as detailed in the Supplementary Material, tõ being correct to first order in τ, i.e. all first order error terms exactly cancel, with remaining error terms on the order of τ 2 and higher. In contrast, the uncorrected density matrix ρ(T) contains first order error terms. We should note that Eq. (10) could also be obtained via a linear expansion of the density matrix about the noise rates and a finite difference approximation to the first derivatives. However, we prefer our propagator-based derivation since it provides a more physical context as well as a means for rigorous error analysis in terms of the underlying propagation and Lindblad noise terms. The general philosophy of error mitigation via additional measurements and linear response can also be found in somewhat more sophisticated approaches such as quantum subspace expansion. 25 Since the density matrix itself is corrected by this procedure, all observables are also accurate to first order in τ. Equation (10) immediately leads to the observable correction formula, traced with the observable, A: which will also be accurate to order τ whereas the uncorrected observable, 〈A〉, has first order error terms. Suppose, for example, that m = n, where n is the number of qubits, and each qubit is noisy. The strength of Eq. (12) is that, for near-term quantum computing without the possibility of perfect error correction of all n qubits, only OðnÞ computations involving reducing the error on just one qubit (to yield the 〈A i 〉) are required, along with the original calculation with no error reduction to yield 〈A〉. Intuitively, the difference f i (〈A〉 − 〈A i 〉) represents a fraction of the first order noise contributions for noise source i; these are then subtracted away from the noisy expectation value with a relevant scaling 1 fi , leaving a result with less noise. This cancellation relies on the expectation value being built up from many measurements. Each expectation value (〈A〉 and 〈A i 〉) contains contributions from measurements with no error, as well as measurements with errors. Our correction scheme cancels out some of the measurements with error, while leaving the result with no error, leading to a better calculation of the observable. Our simulations of the application of this scheme to VQE indicate that Eq. (12) does indeed yield a substantial improvement for real algorithms. Our method lends itself naturally to use on a quantum computer, where calculations can be repeated and techniques exist for the reduction of error, but it is not restricted to just that. Any quantum system in which an observable can be repeatedly measured and each noise source can be reduced separately can make use of the scheme to obtain a more accurate result; quantum error correction assisted quantum metrology is a prime example. 7,15 In VQE, the measured observable in question is the energy, E, of the wavefunction ansatz. We first optimize the parameters of the wavefunction; this can be done either with no error reduction or potentially reducing the error on a single qubit. Once a set of optimal parameters is found, the expectation value of the energy is evaluated on the quantum computer with no error reduction, and then reducing the error on each qubit separately. For an n qubit problem, this involves only an additional OðnÞ evaluations of the energy on the quantum computer with error reduction on one of the qubits each time. Once all of the energies are measured, Eq. (12) is used to obtainẼ.
H 2 We first consider the hydrogen molecule, H 2 , at equilibrium bond length 0.74 Å and an STO-3G basis, resulting in a four qubit circuit. We use the unitary coupled cluster singles double (UCCSD) ansatz 1 (166 gates) and note that each gate is applied sequentially with one time unit between each gate. We made no effort to apply gates in parallel. The parameters of the wavefunction ansatz were optimized with noise on every qubit. We then sweep through the qubits, reducing the noise from each qubit by 10% (f i = 0.1 for each noise source i). The final energy is then calculated by using our correction scheme, Eq. (12).
Results for typical amplitude damping (γ 1 ) and dephasing (γ 2 ) noises are shown in Fig. 1, representing three different environmental regimes. One regime corresponds to γ 1 = γ 2 and is similar to a superconducting qubit quantum computer, 2 whereas the regime with just γ 2 is consistent with spin 26 and trapped ion 27 quantum computers. Though we do not know of a quantum architecture where γ 1 is the dominant noise source, we include it as a third regime for completeness. The x-axis in this figure (and all subsequent figures) shows the error rate multiplied by the number of gates in the circuit multiplied by the number of qubits, and roughly represents the expected number of errors for a given circuit evaluation. For the γ 1 = γ 2 case, however, the expected number of errors would be doubled, as there are two possible error channels. We see that chemical accuracy (1.6 mHa, the horizontal black line) with respect to the noise-free result can be obtained with error rates more than one order of magnitude higher than without our method; on average, the error rates can be 35× larger. To obtain chemical accuracy, corrections of 50 mHa are applied. On this log-log plot, the slopes of the two lines represent their scaling with error. The correction amount (which is approximately the error of the uncorrected energy) has a slope of 1, whereas the corrected energy has a slope of 2, representing the cancellation of the first order error terms.
The Supplementary Material provides results for this same example removing 100% of the noise. This results in only a slight benefit, compared to removing only a small fraction (10%) of the noise, allowing for error rates to be, on average, 45× larger (30% larger than the fractional case). By removing all of the noise, there is no need for the linear extrapolation done by the factor 1 f ; the value at zero-noise is directly measured for each qubit. Additionally, the determination of the fraction of removed noise, f, can be complicated. This could be done by measuring the relevant error properties before and after the error reduction strategy is applied, but errors in the process could give an unreliable estimation of f. Even a small deviation from the true value of f will eventually result in the slope of the corrected energy becoming 1 (instead of 2) at sufficiently small error rates. This is due to the difference in the corrected energy and the noise-free energy becoming smaller than the precision of the determined f. If an unknown f is assumed to be 1, for instance, the method will still remove a fraction of the error, giving results as if the quantum computer had error rates 1−f; there are still first order errors, but they are smaller due to the correction scheme. Because the difference between the result when a small fraction of the noise is removed and when all of the noise is removed is relatively marginal, we focus on the latter case for the remainder of this paper, where Eq. (12) takes a simpler form with f = 1. The Supplementary Material also provides results for a different wavefunction ansatz, one similar to that of ref. 2 . The results are consistent when using this separate ansatz. Note that these figures make no reference to the true, full configuration interaction energy. The difference plotted is between the corrected energy and the energy evaluated with no noise; the quality of the wavefunction ansatz cannot be determined from these figures alone. The ordering of the results provides a limited sensitivity analysis for different quantum computing architectures. Similar to ref. 22 , we note that VQE is more sensitive to amplitude damping noise than to dephasing noise.
We should note that the very largest gains in accuracy in Fig. 1  (and subsequent figures) occur at relatively low error rates. The initial, uncorrected algorithm that is run should be reasonably reliable, e.g., the error rate should be 1/(no. gates), in inverse time units with gates separated by one time unit. This error rate (e.g., 1/ 166 ≈ 0.006 for the case of Fig. 1) may be quite daunting to achieve in practice; partial error correction on all qubits could be used to achieve this threshold.
Even though the wavefunction parameters were optimized in the presence of noise, the final energy evaluated at the different Fig. 1 Error cancellation for ground state H 2 with the UCCSD ansatz under amplitude damping (γ 1 ), dephasing (γ 2 ), and both amplitude damping and dephasing (γ 1 , γ 2 ) noise sources, removing only 10% of the noise on each qubit separately. The horizontal line represents 'chemical accuracy' , 1.6 mHa. Dashed lines with triangles are the amount of correction applied by our scheme. Solid lines with circles are the difference between the corrected energy and the energy evaluated with no noise parameter sets for the fully error corrected circuit differ very little. The optimal parameters from the largest error rates only give a difference of 1.7 mHa compared to the optimal parameters from the error-free optimal parameters, when both were evaluated with no noise. We therefore optimize the parameters once with no noise and use those parameters for evaluation at all noise rates in the following examples.
Our correction scheme is not limited to environmental noise sources, such as those modeled by γ 1 and γ 2 . Any noise source describable by a Lindblad superoperator can benefit, as long as each noise source can be isolated and reduced independently of all other noise sources. To demonstrate this, we apply a thermal noise source with rate γ th and a correlated noise source with rate γ c to the H 2 UCCSD example, Fig. 2, where we now assume that the noise has been completely removed (f i = 1 for all i). We see trends similar to those for amplitude damping and dephasing; corrections of ≈70 mHa bring the energy to within chemical accuracy at error rates almost 50 times larger than otherwise needed. While perhaps experimentally difficult, thermal noise could be reduced by selectively cooling each qubit. The correction scheme applied to our correlated noise term reveals some subtleties of the method. Our correlated noise Lindblad, L c of Eq. (1), naturally has terms from two qubits. When we sweep through the qubits, we now reduce fully all terms which involve a single qubit; this leads to the removal of each L c term twice, once for each qubit in each L c . This double counting can be corrected by taking half of the calculated correction from each qubit. Our scheme relies on the fact that each term is reduced only once. As long as the noise sources of interest and their controlled reduction are well understood, the scheme can be applied. In our correlated noise term, L c , every term is removed exactly twice and the calculated correction can be halved. Though we focus on fractional noise reduction, the results will still hold if the noise is instead increased by a controlled, known amount (say, doubled), for each qubit separately. The 'correction' would be the difference between the inflated noise run and the normal noise run, scaled by the appropriate factor. This is similar in spirit to refs. [28][29][30] , where the total noise of the system is artificially increased and the results are subsequently extrapolated to the zero noise limit.

LiH
We also study LiH in the STO-3G basis at bond length 1.74 Å, using 12 qubits, with over 12,000 gates. Results for the UCCSD ansatz are shown in Fig. 3. The correction for LiH is even more dramatic than for H 2 . Corrections of 100-200 mHa bring the answer to within chemical accuracy, and error rates can be over two orders of magnitude higher, ranging from 68 for only γ 1 noise to 128 with only γ 2 noise. This example provides confidence that the correction scheme will work for larger circuits. For LiH the procedure works even better than for the smaller circuits of H 2 . This will likely be true for ever larger circuits: the number of first order errors increases with increasing number of qubits, and these are all approximately corrected. While the number of second order errors also increases, second order errors go as γ 2 and τ 2 , and will be small.
Our method can reduce the error in any measured observable, and so has application to a wide range of quantum algorithms. Further study on other algorithms, e.g., the quantum phase estimation 21 and quantum approximate optimization algorithms, 31 are needed to understand the broader impact of this scheme. Applications to quantum metrology warrant further study: the noise floor of a quantum sensor could be reduced at substantial reduction in cost in number of quantum systems by reducing the overhead for quantum error correction assisted metrology. 7,15 The magnitude of the correction can also be used as a metric for measuring how close to the true answer one is, without knowledge of the true answer. The method relies on the error characteristics with no reduction to be the same as the error characteristics after reduction; in quantum error correction, this may not always be true. Further study into practical methods of reducing the error and ensuring that the error characteristics before and after are similar is ongoing.

DISCUSSION
We presented a simple scheme to reduce error in quantum algorithms, applying it to simulations of the variational quantum eigensolver. Reducing the error on each qubit (e.g., through error correction or some active or engineering process) one at a time and summing the scaled difference from the result with no error reduction can provide a significant correction to the observable (e.g., energy). This scheme reduces the coherence requirements to obtain chemical accuracy; error rates can be up to two orders of magnitude larger. The overhead is relatively low: an additional O n ð Þ evaluations with single qubit error reduction. The general philosophy used in this work for accounting for errors, replacing all-qubit error correction with additional   3 Error cancellation for the ground state of LiH with the UCCSD ansatz under amplitude damping (γ 1 ), dephasing (γ 2 ), and both amplitude damping and dephasing (γ 1 , γ 2 ) noise sources with total error removal on each qubit separately. See caption of Fig. 1 for explanation of linetypes and symbols M. Otten and S.K. Gray measurements and making use of an error model, has also been exploited in interesting recent work [28][29][30] involving increasing a single global noise parameter, along with extrapolation to zero error assuming a polynomial expansion for the error or via a quasiprobability formalism. Our approach focuses on changing the error associated with each individual qubit or error source separately. Furthermore, our method is developed with focus on mitigating the environmental noise of each qubit, whereas these other interesting works focus on the noise from gate applications. In the near term, with a very limited number of qubits and gates, it is likely that the approach of refs 28-30 is more feasible. However, our method, presented is the paper, could be used for quantum memories and other quantum devices, where the dominant noise source is not the gates, but the environmental interactions. Our approach offers an alternative that is particularly relevant when increasing a global noise parameter (such as the noise on the gates) is infeasible. Other, more recent work, focuses on using a stabilizer formalism, where a specific, relevant quantity (such as a global symmetry of the system) is used to detect errors occurring in a quantum circuit. 32,33 If the symmetry is violated, then an error occurred and the run in question should be excluded. Such approaches cannot eliminate all errors and could be used in tandem with the method we propose in this paper. As quantum devices with larger numbers of qubits come online, utilization of many forms of error mitigation will be necessary to make full use of the power of these small, noisy devices.

Generation of VQE circuits
We use the open source package OpenFermion 34 to generate the qubit Hamiltonian, starting from quantum chemistry integrals generated via Psi4. 35 We use the unitary coupled cluster singles doubles (UCCSD) ansatz, 13 with OpenFermion 34 and ProjectQ 36 to generate the circuits. We optimize the parameters of the wavefunctions using both Nelder-Mead simplex 37 and COBYLA. 38 Time evolution Consider a system of n qubits characterized by a time-dependent density matrix ρ(t) subjected to a sequence of k = 1, 2, …, G gate operations, each being a unitary transformation U k on ρ: ρ ! U k ρU y k . We assume time τ lapses between each gate operation. During these times ρ evolves under a Lindblad master equation, Eq. (2). The dynamics is simulated with the highperformance density matrix evolution program QuaC, 39 using the different noise sources noted in the main text.

DATA AVAILABILITY
The data that support the findings of this study are available from the corresponding author on reasonable request.