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 removed separately. We apply this scheme to the variational quantum eigensolver, simulating the calculation of the ground state energy of equilibrium H$_2$ 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 computers, where full fault-tolerant error correction is too expensive, this scheme provides a route to significantly more accurate calculation


INTRODUCTION
Quantum computing, though in its infancy, is beginning to show promising proof-of-principle calculations, especially in quantum chemistry. Calculations of the binding energy curve for molecules such as H 2 [1] and BeH 2 [2] have been done using small, noisy quantum computers. Quantum computing is entering what some are calling the noisy intermediate-scale quantum era [3]. Full fault-tolerant error correction is still many years away; near-term quantum computers will have a limited number of qubits, and each qubit will be 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.
In this work, we describe and demonstrate a simple scheme for reducing the effects of a wide variety of noise sources by removing each source separately and summing the resulting corrections. These noise sources could be removed by any process, but we imagine that they are removed by quantum error correction. Simple quantum error correction schemes have already been shown in systems including superconducting circuits [4,5] and such systems have been shown to be below the threshold for even more complicated error correction schemes [6], such as the surface code [7]. Quantum computing architectures are nearing the quality and size where a single qubit could be error corrected, but we are far from the realm where every qubit can be corrected. The scheme we present can make use of this limited error correction, by correcting each qubit separately. We demonstrate this scheme with the variational quantum eigensolver (VQE) [8,9], by simulating the calculation of the ground state energy of H 2 and LiH. We assume that a single qubit is error corrected, while the other qubits retain all of their error. Our results show that it 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 two wavefunction ansatzes and 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 the VQE algorithm.

Time Evolution and Noise Modeling
Consider a system of n qubits characterized by a timedependent density matrix ρ(t). These qubits are subject to a sequence of k = 1, 2, ..., G gate operations, each described by a unitary transformation U k that corresponds to an instantaeous 'jump' on ρ: We assume a time τ lapses between each gate operation, and during these times ρ evolves under a Lindblad master equation where m represents the number of Lindblad terms (alternatively, the number of error sources); this can be equal to or an integer multiple of the number of qubits, n, but does not need to be. In our calculations, we simulate four different types of Lindblad operators, representing varying noise sources: amplitude damping (L 1 ), dephasing (L 2 ), thermal (L th ), and a correlated noise term (L c ): where D[C](ρ) = CρC † − 1 2 (C † Cρ + ρC † C). These Lindblad terms are applied to each qubit or to various combinations of qubits. The parameters in Eq. (3)  the decay rate associated with the amplitude damping noise; γ 2 = 1 T2 , the decay rate associated with dephasing noise; γ th , the thermalization rate; n th , the thermal occupation (taken to be 0.5 in this work); and γ c , the correlated noise rate. This is the same formalism we have used in previous work [10][11][12]. For many of the results, we assume that the Lindblad terms for a single qubit i have been removed, γ i << γ. In practice, this could be done via quantum error correction [13], or by some active engineering which greatly reduces the noise rate. In this work, gates are separated by one time unit and the error rates are given in inverse time units.

Variational Quantum Eigensolver
Here, we provide a brief overview of the variational quantum eigensolver (VQE). VQE solves for an approximate, variational, ground state by optimizing, using a classical computer, the energy of a parameterized wavefunction ansatz, |ψ(θ) , which is evaluated on a quantum computer. The variational principle ensures that where E 0 is the true ground state energy of the Hamiltonian, H. E, the energy of the parameterized wavefunction ansatz, is evaluated on the quantum computer, and the parameters θ are optimized using a classical computer. Classical computing methods such as variational quantum Monte Carlo [14] also make use of the same variational principle; the hope of a quantum realization is that quantum computers can efficiently prepare nontrivial states that would be much more difficult to prepare on a classical computer. Though methods like quantum phase estimation [15] can give generally more accurate energies, VQE requires shorter circuits and has a natural robustness to noise [2,8,16]. When using VQE to solve for quantum chemistry problems, as this work does, the second quantized quantum chemistry Hamiltonian is transformed into a Hamiltonian acting on qubits using a transformation such as Jordan-Wigner [17]. We use the open source package OpenFermion [18] to generate the qubit Hamiltonian, starting first from the quantum chemistry integrals, generated via Psi4 [19]. We use the unitary coupled cluster singles doubles (UCCSD) ansatz, which is described in detail in Ref. [8]. We use OpenFermion [18] and ProjectQ [20] to generate the circuit for the UCCSD ansatz. We evolve the system using the high-performance density matrix evolution program QuaC: Open Quantum Systems in C [21]. We optimize the parameters of the wavefunctions using both Nelder-Mead [22] and COBYLA [23].

RESULTS
Consider an initial density matrix ρ(0) and let ρ(T ) be the density matrix obtained after G gate evaluations and no error removal, i.e. between each gate application we allow Lindblad time evolution for a time τ as described above in order to mimic the effects of environmental noise on the qubits. If time t = 0 corresponds to the first gate application and time t = T to the last gate application, then T = (G − 1)τ . Let ρ a (T ) be the corresponding density matrix if there were perfect error correction or, equivalently in our formalism, there was no Lindblad evolution between gate applications. Finally, consider the density matrices ρ i (T ), with i = 1,2,..., m, corresponding to a calculation where Lindblad superoperator i is removed, but all the others are still active. We can define corresponding observables We propose that the observable A can be corrected to yield a more accurate value; i.e., one closer to the value with no noise sources, A a , according to: Suppose, for example, that m = n, the number of qubits, and each qubit is noisy. The strength of Eq. (6) is that, for near-term quantum computing without the possibility of perfect error correction of all n qubits, only O(n) computations involving just one qubit being error corrected (to yield the A i ) are required, along with the original calculation with no error correction to yield A . Intuitively, the difference A − A i isolates a subset of the contributions caused by the noise terms; these are then subtracted away from the noisy expectation value, leaving a result with much 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. The Appendix shows thatÃ approximates A a with no errors in first order τ , the time interval between gate applications, whereas the uncorrected result A approximates A a with errors already appearing in the first order of τ . Our simulations of the application of this scheme to VQE indicate that Eq. (6) does indeed yield a substantial improvement for real algorithms. Eq. (6) lends itself naturally to use on a quantum computer, where calculations can be repeated and quantum error correction offers a natural way to remove errors, but it is not restricted to just that. Any quantum system which in which an observable can be repeatedly measured and each noise source can be removed separately can make use of the scheme to obtain a more accurate result. 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 correction or potentially error correcting 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 correction, and then error correcting 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 correction on one of the qubits each time. Once all of the energies are measured, Eq. (6) is used to obtainẼ.

H2
Our first example is the hydrogen dimer, H 2 , at equilibrium geometry (bond length 0.74Å). We use the sto-3g basis, resulting in a four qubit circuit. We use the UCCSD ansatz (166 gates) and note that each gate is ap-plied 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, removing the noise from one qubit at a time, simulating the effect of error correction on just that qubit. The final energy is then calculated by using our correction scheme, Eq. (6). We plot the results for typical amplitude damping (γ 1 ) and dephasing (γ 2 ) type noises in figure 1, representing three different environmental regimes. γ 1 = γ 2 is similar to a superconducting qubit quantum computer [2], whereas the noise on spin [24] and trapped ion [25] quantum computers is dominated by γ 2 . The dashed lines with triangle markers represent the magnitude of the correction used in our correction scheme, Eq. (6). The solid lines with circle markers represent the difference between the corrected energy and the energy if every qubit were perfectly error corrected. We see that chemical accuracy (1.6 mHa, represented by the horizontal black line) can be obtained with error rates almost two orders of magnitude higher; on average, the error rates can be 45× larger. To get to chemical accuracy, corrections of 60-70 mHa are applied. Furthermore, the corrections at all error rates, even the smallest, get the answer continually closer to the fully error corrected answer. Though it has not been proved in this paper, this gives evidence that this scheme may be variational for VQE. The Appendix provides results for a different wavefunction ansatz, one similar to the entangling ansatz of Ref. [2]. The results are consistent when using this separate ansatz. The ordering of the results provides a limited sensitivity analysis for different quantum computing architectures. Similar to Ref. [16], we note that VQE is more sensitive to amplitude damping noise than to dephasing noise.
Even though the wavefunction parameters were optimized in the presence of noise, the final energy evaluated at the different parameter sets for the fully error corrected circuit differ very little. The optimal parameters from the largest error rates only gave a difference of 1.7mHa compared to the optimal parameters from the error free optimal parameters, when both were evaluated with no noise; this is much less than the remaining error (due to noise), even after correction, for the largest error rates. Because of this, we optimize the parameters once with no noise and use those parameters for evaluation at all noise rates in the following examples.
The correction scheme presented in this work is not limited to environmental noise sources, such as those modeled by γ 1 and γ 2 , and removal via error correction. The scheme is general; systems with any noise source, describable by a Lindblad superoperator, can benefit, as long as each noise source can be isolated and removed independently of all other noise sources. To demonstrate this, we applied a thermal type noise source with rate γ th and a correlated noise source with rate γ c to the H 2 UCCSD example. The results are shown in figure 2. The trends are similar to those for amplitude damping and dephasing; corrections of around 70 mHa bring the energy to within chemical accuracy at error rates almost 50 times larger than otherwise needed. Though it might be experimentally difficult, thermal noise could be reduced by selectively cooling each qubit, one at a time. The correction scheme applied to our correlated noise term reveals some subtleties of the method. Our correlated noise Lindblad, , naturally has terms from two qubits. When we sweep through the qubits, we remove 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 simply corrected by taking half of the calculated correction from each qubit. Our scheme relies on the fact that each term is removed once (and only once); as long as the noise sources of interest and their controlled removal are well understood, the scheme can be applied. If a noise source is removed twice, accounting for that allows for a good correction. In our correlated noise term, L c , every term is removed exactly twice and the calculated correction can be simply halved. Conversely, it is also true that if exactly half the noise is removed, the correction as if all of the noise is removed can be calculated by doubling the correction. Though it might be hard to imagine that something as specific as 'half the noise' can be removed, this idea can be used when the noise is controllable. If the noise is increased by a controlled, known amount (say, doubled, or even just fractionally increased), for each qubit separately, the correction scheme can be applied. 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 Ref. [26], where the total noise of the system is artificially increased and the results are subsequently extrapolated to the zero noise limit.

LiH
We also studied LiH in the sto-3g basis at bond length 1.74Å, using 12 qubits, with over 12,000 gates. We plot the results for the UCCSD ansatz in figure 3. Due to the increased number of qubits and circuit depth, the error rates are, overall, much smaller. 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 with only γ 1 noise to 128 with only γ 2 noise. This example provides confidence that the correction scheme will work for larger circuits; in fact, it works even better, in this case, than for the smaller circuits of H 2 . It is reasonable to believe that this will be true for ever larger circuits; the number of first order errors increases with increasing number of qubits, and these are  all approximately corrected. Though the number of second order errors also increases, the second order errors go as γ 2 and τ 2 , and will generally be small. CONCLUSION We provide a simple scheme to greatly reduce the error in quantum algorithms and apply this scheme to simulations of the variational quantum eigensolver. Error correcting each qubit, one at a time, and summing the difference from the result with no error correction provides a large correction to the energy. This correction greatly reduces the coherence requirements to obtain chemical accuracy; error rates can be up to two orders of magnitude larger, without the need for full error correction. This is at a relatively low overhead; for example, just an additional O(n qubits ) evaluations on the quantum computer with only single qubit error correction. This correction relies on cancellation of error between expectation values; each expectation value calculated needs a sufficient number of measurements to allow for this cancellation. On future quantum devices, either no error correction (or possibly limited error correction) on all qubits and sweeping through full error correction on each qubit can allow much larger systems to be computed, compared to full error correction on each qubit. Though we show results only for VQE, the method can reduce the error in any measured observable, and thus has application to a wide range of quantum algorithms. Further study on other algorithms, such as quantum phase estimation [15] and quantum approximate optimization algorithm [27], should be done to understand the impact of this scheme on other algorithms. The magnitude of the correction can also be used as a metric for measuring how close to the true answer one is, without knowing the true answer; as the correction gets smaller, the effect of the environmental noise is smaller. Furthermore, the magnitude of the correction can be used to compare different architectures, without need for knowledge of the true answer. Whichever architecture gives a smaller correction is likely closer to the true answer, and can be considered a better architecture for that problem.
This work was performed at the Center for Nanoscale Materials, a U.S. Department of Energy Office of Science User Facility, and supported by the U.S. Department of Energy, Office of Science, under Contract No. DE-AC02-06CH11357. We gratefully acknowledge the computing resources provided on Bebop, a high-performance computing cluster operated by the Laboratory Computing Resource Center at Argonne National Laboratory.

Derivation of the Observable Correction Formula
First consider the Lindbland master equation, Eq. (2). A formal solution for a density matrix evolving from time t to t + τ and satisfying this equation is 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), The sequence: apply gate 1, evolve under V τ , apply gate 2, etc., up to gate G corresponds exactly to a final density matrix given by Notice that Eq. (A.10) is not symmetric, with the V τ operators always acting on the right side. Equation (A.10) is ρ(T ) for the case of all m error sources present. The corresponding ρ a (T ) for perfect error correction or no error terms present is simply: (A.11) The density matrices resulting from removing error sources i = 1,2,..., m separately are V i τ is the corresponding Lindblad evolution operator that does not contain L i but has all other terms, e.g. to first order in τ , 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. Equation (A.14) immediately leads to the observable correction formula of the text, Eq. (6), when traced with the observable, A: 16) which will also be accurate to order τ whereas the uncorrected observable, A , has first order error terms.

Entangling Ansatz for H2
We also applied our correction scheme to a different wavefunction ansatz, which we call the entangling ansatz, similar to that described in [2]. For the entangling ansatz, we parameterize the wavefunction by first applying parameterized rotations Rx(θ q 01 )Rz(θ q 02 ), and then alternating between entangling all the qubits in ring by applying a Hadamard gate to qubit q and then a CNOT gate between qubits q and (q + 1)%n qubits for all qubits q, where % is the modulo operator, followed by parameterized rotations Rz(θ q i0 ), Rx(θ q i1 ), and Rz(θ q i2 ) for each qubit q and layer i. This is done for a number of layers d. This circuit is equivalent to that described in Ref. [2], except the entangling circuit is replaced with the ring of Hadamard -CNOTs. Figure 4 gives an example of this circuit with d = 1. The results are shown in figure 5 for a circuit of d = 4, and are almost indistinguishable from the UCCSD results. Corrections of up to 70 mHa are applied to get to chemical accuracy; error rates can be 50× larger to get to chemical accuracy.  FIG. 5: Error cancellation for H 2 at bond length 0.74 A for an 'entangling' ansatz with 4 layers (described in the appendix), under amplitude damping (γ 1 ), dephasing (γ 2 ), and both amplitude damping and dephasing (γ 1 , γ 2 ) noise sources. The horizontal line represents 'chemical accuracy', 1.6 mHa. The dashed lines with triangle markers represent the amount of correction applied by our scheme. The solid lines with circle markers represent the difference between the corrected energy and the energy evaluated with no noise. The results are nearly the same as the unitary coupled cluster singles doubles ansatz, with corrections of up to 70 mHa applied to get to chemical accuracy and error rates which can be up to 50× larger.