{'fraction_non_alphanumeric': 0.026374779415271617, 'fraction_numerical': 0.00806028521009205, 'mean_word_length': 5.129201987722888, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Computation of molecular spectra on a quantum processor with an error-resilient algorithm

Harnessing the full power of nascent quantum processors requires the eﬃcient management of a limited number of quantum bits with ﬁnite coherent lifetimes. Hybrid algorithms, such as the Variational Quantum Eigensolver (VQE), leverage classical resources to reduce the required number of quantum gates. Experimental demonstrations of VQE have resulted in calculation of Hamiltonian ground states, and a new theoretical approach based on a Quantum Subspace Expansion (QSE) has outlined a procedure for determining excited states that are central to dynamical processes. We use a superconducting-qubit-based processor to apply the QSE approach to the H 2 molecule, extracting both ground and excited states without the need for auxiliary qubits or additional minimization. Further, we show that this extended protocol can mitigate the eﬀects of incoherent errors, potentially enabling larger-scale quantum simulations without the need for complex error-correction techniques.

Harnessing the full power of nascent quantum processors requires the efficient management of a limited number of quantum bits with finite coherent lifetimes. Hybrid algorithms, such as the Variational Quantum Eigensolver (VQE), leverage classical resources to reduce the required number of quantum gates. Experimental demonstrations of VQE have resulted in calculation of Hamiltonian ground states, and a new theoretical approach based on a Quantum Subspace Expansion (QSE) has outlined a procedure for determining excited states that are central to dynamical processes. We use a superconducting-qubit-based processor to apply the QSE approach to the H2 molecule, extracting both ground and excited states without the need for auxiliary qubits or additional minimization. Further, we show that this extended protocol can mitigate the effects of incoherent errors, potentially enabling larger-scale quantum simulations without the need for complex error-correction techniques.

I. INTRODUCTION
Quantum computing, the field of physics dedicated to harnessing quantum phenomena to process information, is rapidly progressing along the path from theoretical curiosity to practical technology. Recent experimental progress has been swift, with successful demonstrations of proof-of-concept algorithms on a range of fledgling quantum processors comprised of natural or engineered quantum spins [1][2][3][4][5]. However, even in leading architectures such as superconducting circuits and trapped ions, state-of-the-art systems comprise only few to tens of qubits-the quantum analog of classical bits-and are difficult to control with high precision. For gate-based quantum processors to be competitive with, or outperform their classical counterparts, both qubit number and gate fidelity must increase significantly [6,7]. Indeed, much of the field is currently focused on the design of a multi-qubit architecture capable of demonstrating an unambiguous quantum speedup over classical computers.
Recent theoretical advances suggest that a hybrid approach-judiciously dividing a computation between quantum and classical resources-will likely find utility in specific applications prior to the emergence of universal quantum computation [8][9][10][11]. One such example is calculating the ground-state energy of complex chemical systems, such as is often required in photovoltaics, biological reactions, and catalyst design. Based on the quantum variational principle-that the ground-state wavefunction of any Hamiltonian minimizes the expected energy [12]-an iterative protocol, known as the Variational Quantum Eigensolver (VQE) was developed [13]. This approach uses a classical optimization routine to minimize the expected energy of candidate wavefunctions, using the quantum hardware to evaluate the expected energy. Essentially the VQE leverages the unique capacity of shallow quantum circuits to prepare entangled states from which efficient classical sampling is not known to be possible.
Essential ingredients of the VQE algorithm have recently been demonstrated on a variety of experimental platforms [13][14][15][16][17][18][19]. These initial experiments indicate a robustness to systematic control errors (so-called coherent errors) which would preclude fully quantum calculations, as well as a manageable scaling of quantum circuit depth with Hamiltonian complexity [18,19]. However, work to date has focused primarily on calculating molecular ground-state energies; while extending the VQE approach to find excited states has been demonstrated in the optical domain, it required additional qubits, complicated multi-qubit control, and additional variational searches [18]. The characterization of excited states is crucial for the description of all phenomena involving significant electronic dynamics, which encompasses a broad class of systems of interest [20]. For example, charge transfer excited states in battery or photovoltaic materials or excitonic excited states in photosynthetic systems are required for the accurate description of dynamics and performance. Moreover, even in the case of more standard chemical reactions, the involvement of electronic excited states may be required for an accurate description of the process, with traditional examples such as photo-dissociation relying critically on this characterization [21,22].
Using a quantum processor comprising two superconducting transmon qubits in a 3D geometry with realtime classical optimization, we diagonalize the electronic structure Hamiltonian of the hydrogen molecule over a wide range of nuclear separations using a variational algorithm. We demonstrate, for the first time within such an architecture, the ability to calculate the full energy spectrum of a given Hamiltonian beyond just the ground state. In addition, we implement a recently developed theoretical extension to the VQE approach based on a Quantum Subspace Expansion (QSE), establishing it's ability to at least partially mitigate stochastic, incoherent errors [23], allowing us to attain near chemical accuracy (1.6 × 10 −3 H) in the calculated energy spectrum. Our work shows how errors can be suppressed via additional measurements, potentially offering an alternative to more advanced error-correction techniques, which are typically difficult to implement and require large resource overhead. These methods can be directly transferred to other systems, such as planar superconducting platforms and ion traps, where significant numbers of qubits can be routinely controlled and read out [1,2,[24][25][26], potentially paving the way for larger more complex quantum simulations in the near future.

II. GENERAL APPROACH
The electronic structure Hamiltonian, an operator on the space of electronic wavefunctions, is first cast into a form suitable for evaluation on a quantum processor. Specifically, the Hamiltonian is first projected onto a discrete set of molecular orbitals-we use the conventional STO-3G basis set [27], which constitutes a so-called minimal set in that it represents the minimum number of orbitals required to represent a given atomic shell. The resulting fermionic Hamiltonian H F is finally mapped onto a two-qubit Hamiltonian H Q (SI Mapping of the H 2 Hamiltonian to Qubits). The correspondence between qubit states and chemical basis states is shown in Fig. 1A. For the hydrogen molecule, H Q takes the form where σ i k is the k th Pauli operator on the i th qubit, and the coefficients {g m }, and thus the total Hamiltonian, are functions of R, the separation between the two hydrogen nuclei. For a given two-qubit state |ψ , prepared on the quantum processor, the expectation H Q is evaluated through repeated measurements of Pauli correlators.
An outline of the VQE algorithm is depicted in Fig. 1B and consists of parameterizing a quantum circuit U ( θ) to prepare an ansatz wavefunction |ψ( θ) , evaluating the expectation ψ( θ)|H Q |ψ( θ) term-wise using a quantum processor, and then using a classical minimization algorithm to update parameters until a minimum, θ min is found. The quantum state |ψ( θ min ) then constitutes an approximation to the ground state of H Q , with an estimated energy of ψ( θ min )|H Q |ψ( θ min ) .
Once the VQE algorithm has converged on an estimate of the ground state wavefunction, the quantum subspace expansion can be applied by measuring additional Pauli correlators that form an approximate matrix representation of H Q within an expanded subspace. This matrix can then be diagonalized classically to yield both lowlying excited-state energies and a refined ground-state energy estimate (Fig. 1C). If the expansion is chosen such that its dimension scales polynomially with system size, this classical matrix calculation is efficient [23]. The effectiveness of the QSE thus requires the existence of such a subspace which captures a significant amount of the excited state support.
We expect that molecular excited energy levels differ from the ground state primarily by excitations which promote a single electron from an occupied to an unoccupied orbital. Therefore to a good approximation, these states are linear combinations of {S 1 : a † i a j |ψ GS }, where a j (a † i ) are fermionic annihilation (creation) operators for the electronic orbitals. While S 1 could serve as a subspace, a more natural choice when working with qubits involves the set of single Pauli flips {P 1 : σ k α |ψ GS | α ∈ {x, y, z}, k ∈ {1, 2}}, which we refer to as a linear response expansion. To calculate the matrix elements H ij in the P 1 basis, we use the quantum processor to evaluate the inner products where |ψ GS is taken to be the initial approximate ground state |ψ( θ min ) , found via the VQE routine. While the non-linear nature of the ansatz selected dictates that there may exist local minimum within the variational search portion of the procedure, in practice we utilize an initial guess that is thought to be within the basin of attraction for standard local minimizers of a high quality minimum and multi-modality is often not observed in practice [28]. In the case of excited states, we benefit from the linear construction of the problem, in that once the minimum and excitation operators have been selected, the solution of the linear subproblem is exact (within the subspace). Thus for our procedure, local minima that can plague variational excited state searches are less likely to be an issue. Beyond providing a means of calculating molecular excited state energies, it was conjectured in ref. [23] that the inclusion of specific measurement operators expanding the number of states under consideration, the QSE could improve the accuracy of the initial VQE ground state estimate. While the VQE can in principle correct for the presence of coherent gate errors, the QSE was thought to additionally correct for incoherent errors, such as dephasing or amplitude damping (SI QSE with Errors). As discussed in the results section, we find experimental support for this conjecture.

A. Quantum
The quantum processor we use to evaluate expectation values consists of two superconducting qubits of the transmon variety [29,30], one of the leading types of superconducting qubits in terms of design simplicity and coherence time. The qubits are initialized in the joint ground state |00 via a heralding measurement [31]. A generating circuit U ( θ) is then used to prepare the desired trial wavefunction (with θ specified by the classical hardware-see next section).
Single-qubit pulses on qubit A and B last 50 and 70 ns respectively, and achieve fidelities of ∼99%. The twoqubit pulse takes up to 310 ns and approaches a fidelity of ∼96%. After state preparation via U ( θ), tomographic reconstruction is used to evaluate H = ij h ij σ i σ j .
Note that in future implementations of VQE on larger quantum systems, full tomography will be impossible (due to an exponential scaling of the number of required measurements). Instead, only the necessary correlators will be directly measured. For this reason, our reconstruction of the two-qubit density matrix from the tomographic measurements did not use any method such as maximum-likelihood estimation which enforces physicality (positivity and trace-normalization) on the result (see (SI Experimental Details).

B. Classical
With the two-qubit processor providing a means to efficiently evaluate H ( θ), the classical computer uses a particle-swarm optimizer (PSO) to find parameter values θ min which minimize this objective function, as shown in Fig. 2A. Input parameters to the PSO are normalized to lie between 0 and 1. Amplitudes for each individual qubit are scaled by that required for a pulse between the |0 & |1 state and for the bSWAP pulse by the equivalent amplitude for a pulse between the |00 & |11 state. Pulse phases are normalized to lie between 0 and 2π radians.
The PSO approach has two properties useful for this work: it is likely to avoid getting trapped in local minima and it is more robust to noisy objective-function calls [35]. The optimization treats a single point in parameter space as a particle, which has a velocity and position. A swarm of n such particles {|ψ( θ s,i ) , i ∈ [1, n]} (with s the swarm iteration number) is first randomly initialized and then at each iteration, the particles' positions are updated based on both their own energy evaluation and those of others in the swarm (SI Experimental Details). Figure 2B shows how iterating through this loop allows the particles to converge on a set of control parameters that prepares the best approximation of our system's ground state ψ( θ g ) and its associated energy.

IV. RESULTS
We apply our algorithm to the H 2 molecule for 45 internuclear distances between 0.05Å and 3.85Å. As shown in Fig. 2A for a internuclear distance of 1.55Å and a random initialization of 20 swarm particles over θ, we observe good convergence of the control parameters within 12 swarm iterations. Each function evaluation consists of 10,000 acquisitions and lasts on the order of a minute, . Monotonic convergence of median energy towards the theoretical value is observed followed shortly thereafter by a rapid decrease in swarm energy variance. Trace distance (dots) of the variationally prepared ground state as a function of swarm iteration shows reasonable convergence to the theoretically expected ground state. The small remaining discrepancy is most likely due to the flat nature of the energy landscape and unavoidable decoherence during state preparation and readout.
resulting in a total algorithm run time of approximately four hours. Experimentally optimized parameters show deviation from those that would be expected in the case of idealized gates (SI VQE and Coherent Errors). In particular, while the experimental single-qubit gate amplitudes and two-qubit bSWAP length agree with numerical simulations, the phase of the bSWAP differs significantly, most likely due to an unaccounted for Stark shift during application of the gate. The successful convergence of the algorithm despite this mis-calibration thus provides additional proof of the protocols intrinsic ability to correct for coherent errors.
Plotting the median energy of the swarm as a function of iteration number, we observe a large initial energy error due to the random nature of the particle initialization, FIG. 3. H2 energy spectrum as a function of internuclear distance. Swarm particle energies for each bond length are histogrammed after application of a linear response expansion and Gaussian filter. Energy estimates obtained by a peak finding routine are indicated by dots with theoretically predicted energy levels shown as solid lines. An unphysical spurious state emerges at internuclear distances greater than ∼ 1.2Å due to uncorrected incoherent errors. Inset shows errors in the estimated ground and excited state energies as compared to chemical accuracy (1.6 × 10 −3 Ha).
followed by an almost monotonic decrease towards the exact theoretical value. When calculating an estimate for a new internuclear distance, we exploit the smoothness of the parameter landscape and re-initialize the swarm particles around the minimum found in the preceding run, allowing them to vary by only 5% from their previous optimum values. This technique allows us to reduce the resources required to achieve convergence from the initial 50 particles and 25 iterations used at 3.85Å to only 20 particles and 6 swarm iterations for subsequent runs. Once each internuclear separation of interest has been processed, we have an initial approximation for the ground state energy function of the H 2 molecule.
To derive excited states from this approximate ground state, we apply the linear-response QSE to each individually-reconstructed density matrix recovered during the minimization process. The results of applying this expansion are plotted in Fig. 3 where data are binned with 1.5 mHa resolution before convolution with a Gaussian filter (standard deviation of 7.5 mHa). Peak-finding routines are then used to estimate the mean energies for both the corrected ground and excited states. This shows improved robustness for small numbers of swarm iterations as it is less affected by outlying particles in the swarm yet to reach the global minimum. Extracting all four states reliably requires the use of the full linearresponse expansion (SI QSE and Choice of Expansion Operators).
Errors between experimentally predicted energies for the ground and excited states and their true values are plotted in the inset of Fig. 3. Chemical accuracy, the level required to make realistic chemical predictions, is achieved for the ground and highest excited state across a wide range of internuclear distances. Estimates of the second and third excited state energies are generally within an order of magnitude of this level. It is interesting to note that although the ground electronic state wavefunction near equilibrium requires little entanglement to accurately represent, the same is not true of the excited states. The QSE is able to approximate these states with only additional local measurements and efficient classical computation, without an increase in required entanglement on the quantum state of the qubits. Figure 4 shows the deviations from the theoretically expected values for the corrected ground-state energies when using different underlying measurement operators for the applied QSE. Those involving just a single Pauli operator offer sporadic improvement over the uncorrected case, with the σ z operator achieving best results at smaller internuclear separations while the σ x operator is most useful at larger ones. The complete linear-response expansion is able to mitigate incoherent errors for which that the bare VQE algorithm is unable to compensate and produces a reduction in the energy estimate error of almost two orders of magnitude over the entire range. By expanding the set of QSE operators (SI QSE beyond Linear Response), it is possible to further improve the ground-state estimate. However, such an expansion incurs increased computational cost. Going forward, it will be important to explore the tradeoff between accuracy and QSE subspace size in extracting the spectra of larger molecules.
Note that ideally, the total number of extracted energy levels should be upper-bounded by the dimension of the Hamiltonian. However, if the extant error channels cause the prepared VQE ground state to be sufficiently mixed (for a given set of QSE operators), it is possible to extract additional "spurious" energy levels. Such a spurious state is observed as indicated in Fig. 3 for internuclear distances between ∼ 1.2Å and ∼ 1.7Å. In some cases, these states may be discarded on the basis of conti-nuity of the energy as a function of internuclear distance. Alternatively, these states can be removed by increasing the span of the QSE operators (at the cost of an increased tomographic measurement overhead). The exact conditions for the presence of a spurious state are currently being investigated.

V. CONCLUSION
We have experimentally implemented an augmented variational quantum eigensolver that uses a polynomial number of additional tomographic measurements to extract molecular excited-state energies and mitigate incoherent errors on the ground-state estimate. With the hydrogen molecule as a test case, we additionally confirm the intrinsic ability of the algorithm to correct for coherent gate errors when pulse properties are optimized directly. Used with classical particle swarm minimization routines well suited to high-dimensional noisy environments, these techniques yield energy estimates with near-chemical accuracy. Our results highlight the potential of QSE to significantly reduce the need for more advanced error correction techniques, thereby facilitating practical applications of near-term quantum hardware.