Introduction

Quantum Monte Carlo methods have evolved to be indispensable in the study of strongly correlated many-body systems where the interplay between competing interactions result in quantum phases that are not observed in their non-interacting counterparts. In the study of strongly correlated systems, computational methods are vital, as standard analytical techniques based on single particle picture or perturbation theory are often rendered ineffective. Among the different numerical techniques, quantum Monte Carlo methods have proven to be very powerful for their ability to simulate a wide range of realistic microscopic Hamiltonians on relatively large system sizes at all temperatures and in all dimensions.

The phenomenal development of quantum information theory over the past two decades and the advent of quantum computers in the past couple of years have significantly broadened the potential for simulating strongly interacting quantum many-body systems. The ability to represent superposition of states directly on a quantum computer promises exponential speedup of quantum algorithms over their classical counterparts. Algorithms that exploit quantum hardware to speed up simulations of the thermal Gibbs state of many-body systems have previously been explored in refs. 1,2,3,4,5,6,7,8, but we are still at a nascent stage of harnessing the power of quantum computation in studying correlated systems.

The Stochastic Series Expansion (SSE)9,10,11,12 method is a widely used Quantum Monte Carlo (QMC) method for simulating models of quantum many-body systems. It is based on sampling the series expansion of \(\exp (-\beta H)\) up to a sufficiently high order. A significant advantage of SSE is that expectation values that are obtained via this method are exact, up to statistical errors. Other approaches include the world line method13,14,15,16, and the Density Matrix Renormalization Group (DMRG) method16,17,18. In this article, we propose an implementation of SSE on a quantum computer and compare its efficiency to conventional SSE on a classical computer. We refer to the former as quantum SSE and the latter as classical SSE and demonstrate several advantages that quantum SSE has over classical SSE. In particular, it will be argued that the no-branching requirement19 from classical SSE can be relaxed in quantum SSE, which leads to important consequences for the simulation of many-body systems. This quantum advantage stems from the ability of quantum processors to prepare nontrivial superpositions of quantum states. In the subsequent discussion, it is assumed the simulated object is a quantum many-body system with N particles and k-local interactions.

First, lifting the no-branching requirement in quantum SSE means that we are no longer limited to basis states that permit a diagonal representation. This has the effect of allowing more general quantum observables to be measured in quantum SSE.

The second consequence is that quantum SSE always leads to nonnegative weights, which are directly sampled from the measurement probabilities of quantum circuits that scale linearly with system size. By comparison, classical SSE by itself cannot guarantee nonnegative weights without imposing strict conditions such as no-branching. This implies that quantum computers may be able to simulate many-body systems currently inaccessible to classical SSE methods due to the famous sign problem20,21. Notably, the Quantum Metropolis Sampling (QMS)3 algorithm also avoids the sign problem by repeated use of the quantum phase estimation algorithm22. However, quantum phase estimation requires deep quantum circuits, and approximates the unitary operation \(U\,=\,\exp (iHt)\) via the Suzuki-Trotter decomposition23. This necessarily introduces a systematic error, unlike exact QMC methods such as SSE, which does not involve Trotterization. The same argument applies to any putative quantum version of Trotter-based algorithms such as the World Line QMC. Although the Continuous Time (CT) World Line method16,24 avoids Trotterization, the simpler structure of the SSE operator string compared to CT QMC makes it better suited for implementation on quantum architectures, especially on near term, noisy quantum processors which require simpler quantum circuits in general.

This article is structured as follows: First, we introduce the broad ideas underlying the SSE QMC method. Second, we will describe a possible SSE implementation on a quantum computer, first for a simpler special case, then for the more general case. Third, we simulate the quantum SSE algorithm for one dimensional spin chains and compare it with exact results. Finally, we discuss how the no-branching condition and the sign problem affects classical SSE, and evaluate the advantages that quantum SSE offers over classical SSE.

Results

Stochastic series expansion

The canonical SSE is a finite temperature quantum Monte Carlo algorithm based on the stochastic sampling of diagonal matrix elements in the Taylor series expansion of the density matrix in a suitably chosen basis19. For efficient implementation, it is necessary to decompose the Hamiltonian as H = −∑bHb. The partition function is written as

$$\begin{array}{lll}Z&:=&{{{\rm{Tr}}}}({{{{\rm{e}}}}}^{-\beta H})\,=\,\mathop{\sum}\limits_{\alpha }\left\langle \alpha \right|{{{{\rm{e}}}}}^{-\beta H}\left|\alpha \right\rangle \\ &=&\mathop{\sum}\limits_{\alpha }\mathop{\sum }\limits_{n\,=\,0}^{\infty }\frac{{\beta }^{n}}{n!}\left.\left\langle \alpha \right|\mathop{\sum}\limits_{{b}_{n}}{H}_{{b}_{n}}\right)\ldots \left(\mathop{\sum}\limits_{{b}_{1}}{H}_{{b}_{1}}\right)\left|\alpha \right\rangle \\ &\approx &\mathop{\sum }\limits_{n\,=\,0}^{M}\mathop{\sum}\limits_{b}\mathop{\sum}\limits_{\alpha }\frac{{\beta }^{n}}{n!}\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle ,\end{array}$$
(1)

where \(\{\left|\alpha \right\rangle \}\) is a complete set of states, b denotes the operator string bnb1 and M is some sufficiently large cutoff in the expansion power. Assuming that each term \(\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \) is nonnegative, the algorithm proceeds by randomly sampling the configuration space \({{{\mathcal{C}}}}\,:=\,\{(n,b,\alpha )\ \forall \ n,b,\alpha \}\). The thermal expectation value of any operator, O, is given by

$$\langle O\rangle \,=\,{{{\rm{Tr}}}}(O{{{{\rm{e}}}}}^{-\beta H})/Z\,\equiv\, \mathop{\sum}\limits_{C}{p}_{C}f(O,C)$$
(2)

where \({p}_{C}\,:=\,\frac{{\beta }^{n}}{n!}\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle /Z\). Finding 〈f(O, C)〉 for any O is not necessarily trivial, but when O is diagonal in the chosen basis, \(f(O,C)\,:=\,\left\langle \alpha \right|O\left|\alpha \right\rangle\) is an unbiased estimator that is readily evaluated.

The SSE method is numerically exact up to statistical errors because the truncation of the Taylor series expansion of the density matrix does not introduce any systematic error. While in principle, operator strings for every expansion power n should be considered, their weight decreases rapidly with \({\frac{{\beta}^{n}}{{n}{!}}}\) for large values of nβ, and is not reachable in practice when a finite number of MC steps are performed. A finite simulation always has some maximum operator string length that can be found empirically via the Monte Carlo updating scheme described as follows: The maximum expansion power depends on the values of the inverse temperature, β, and the Hamiltonian parameters, and is determined empirically by dynamically adjusting the operator string length during the equilibration stage of the simulation. M is then set as some higher number that is never reached by the finite simulation. Importantly, because no operator string length sampled ever reaches M, the truncated terms do not contribute to the final statistics of the simulation so there is no systematic contribution to the error, i.e., the only errors are statistical. In contrast, Trotterization with a finite number of steps always contribute errors regardless of the number of samples obtained, so the error contribution is inherently systematic.

SSE on a quantum computer

We now propose a method of implementing the SSE Monte Carlo algorithm on a quantum computer. The classical implementation of the SSE method requires that Hb satisfy a no-branching condition in order for the algorithm to be efficient (see Discussion). However, this requirement is no longer necessary on quantum computers as they naturally allow for superpositions of a large number of states. We can therefore choose a more convenient decomposition. In general, it is always possible to decompose any Hamiltonian as a sum of products of Pauli matrices:

$$H=\mathop{\sum}\limits_{b}{h}_{b}\mathop{\otimes}\limits_{i=1}^{N}{\sigma }_{{b}^{i}}^{(i)},$$
(3)

where in general bi = 0, 1, 2, 3 and \({\sigma }_{0}\,:=\,{\mathbb{1}}\), σ1 := σx, σ2 := σy and σ3 := σz. Note that in this notation, we used the upper index to label the ith Pauli matrix in the product. This is different from the lower index used to label the operator string b = bnb1 in \({H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\).

In order to illustrate the quantum SSE method, we first consider a special case where the operators \({h}_{{b}_{i}}\) mutually commute, for example, bi = 0, 1 (\({\mathbb{1}}\) and σx). Specifically, we consider the Hamiltonian

$$H\,=\,-\mathop{\sum}\limits_{\langle j,k\rangle }{J}_{jk}{\sigma }_{x}^{(j)}{\sigma }_{x}^{(k)},$$
(4)

Such problems can already be nontrivial. For instance, in ref. 25, the Hamiltonian (4) was considered as an example of a many-body system that is NP hard to simulate for certain lattice configurations.

We first define \({H}_{b}\,:=\,{h}_{b}{\otimes }_{i \,=\, 1}^{N}{\sigma }_{{b}^{i}}^{(i)}\,+\,| {h}_{b}| {\mathbb{1}}\), which ensures that Hb is always positive semidefinite. We can readily verify that {Hb} forms a set of mutually commuting semidefinite operators:

$$\frac{{H}_{b}{H}_{{b}^{\prime}}}{|{h}_{b}{h}_{{b}^{\prime}} | }\,=\,\frac{{H}_{{b}^{\prime}}{H}_{b}}{|{h}_{{b}^{\prime}}{h}_{b}| }$$
(5)

where we used the fact that bi = 0, 1 and \({\sigma }_{{b}^{i}}^{(i)}\) can only be either be \({\mathbb{1}}\) or σx and they mutually commute. The positive semidefiniteness and commutativity of Hb guarantees that a product of such operators \({H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\) is also positive semidefinite (see Supplementary Information under “Positive semidefiniteness: special case”). Making Hb positive semidefinite is equivalent to adding a constant to the Hamiltonian \(H\,\to\, H\,+\,k{\mathbb{1}}\) where k: = ∑bhb, such that the total Hamiltonian is also positive semidefinite. With the positivity of \(\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \) assured, we need a method of sampling the relative weight of a given configuration (n, b, α). In classical SSE, positive weights cannot be assured except for some special choices of \(\left|\alpha \right\rangle \) (see Discussion). Here, we describe a quantum implementation which ensures positivity for arbitrary \(\left|\alpha \right\rangle \).

A quantum algorithm relies on defining appropriate states and unitary operations that can be implemented efficiently on a quantum computer. In the following, we outline how to develop an efficient estimator of the relative weight of a configuration. Let us consider a state with (N + n) qubits of the form:

$$\left|{\psi }_{{{\mbox{in}}}}\right\rangle \,=\,\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{+}_{{{{{\rm{B}}}}}_{1}}\right\rangle \ldots \left|{+}_{{{{{\rm{B}}}}}_{n}}\right\rangle ,$$
(6)

where \(\left|+\right\rangle \,:=\,(\left|0\right\rangle \,+\,\left|1\right\rangle )/\sqrt{2}\), N is the number of particles in the system we are simulating, n is the expansion power in SSE, A = A1…AN denotes the simulated system, and Ai with i {1, 2, …N} denotes the ith particle in the simulated system. Observe that \({H}_{b}\,=\,| {h}_{b}| \left[\,{{\mbox{sgn}}}\,({h}_{b}){\otimes }_{i \,=\, 1}^{N}{\sigma }_{{b}^{i}}^{({{{{\rm{A}}}}}_{i})}\,+\,{{\mathbb{1}}}_{{{{\rm{A}}}}}\right]\) is a superposition of 2 unitary operators \(\,{{\mbox{sgn}}}\,({h}_{b}){\otimes }_{i \,=\, 1}^{N}{\sigma }_{{b}^{i}}^{({{{{\rm{A}}}}}_{i})}\) and \({{\mathbb{1}}}_{{{{\rm{A}}}}}\). We define the following controlled unitary operation:

$${U}_{{{{\rm{A}}}},{B}_{i}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{0}_{{{{{\rm{B}}}}}_{i}}\right\rangle \,=\,{{\mathbb{1}}}_{{{{\rm{A}}}}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{0}_{{{{{\rm{B}}}}}_{i}}\right\rangle$$
(7)
$${U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{i}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{1}_{{{{{\rm{B}}}}}_{i}}\right\rangle \,=\,\left[\,{{\mbox{sgn}}}\,({h}_{b})\mathop{\otimes }\limits_{j \,=\, 1}^{N}{\sigma }_{{b}^{j}}^{({{{{\rm{A}}}}}_{i})}\right]\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{1}_{{{{{\rm{B}}}}}_{i}}\right\rangle .$$
(8)

By calculating the expectation value \(\langle {\psi }_{{{\mbox{in}}}}| {U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{i}}| {\psi }_{{{\mbox{in}}}}\rangle \), one can evaluate an estimator for the relative weight

$$q(n,b,\alpha )\,:=\,| \langle {\psi }_{{{\mbox{in}}}}| {U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{i}}| {\psi }_{{{\mbox{in}}}}\rangle {| }^{2}\,\equiv\, \left| \frac{\left\langle {\alpha }_{{{{\rm{A}}}}}\right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle }{{2}^{n}{h}_{{b}_{n}}\ldots {h}_{{b}_{1}}}\right|^{2}.$$
(9)

The spectrum of \({H}_{{b}_{i}}/| {h}_{{b}_{i}}| \) lies in the range [0, 2] and so the spectrum of \({H}_{{b}_{n}}\ldots {H}_{{b}_{1}}/| {h}_{{b}_{n}}\ldots {h}_{{b}_{1}}| \) is within [0, 2n]. The projected amplitude is therefore not necessarily exponentially small due to the 1/2n factor even for relatively large expansion orders n. In order to find a bounded error estimate for q(n, b, α), quantum circuits are repeatedly prepared and then measured in the computational basis t times. An example of the type of quantum circuit being measured is shown in Fig. 1b. Each of these measurements yield a classical bitstring that is a series of 0s or 1s and out of these t bitstrings, we count the number of bitstrings that are all 0s. The ratio to the total number of samples t estimates q(n, b, α). Since this is a binary distribution, the sample variance scales with ~1/t, so estimating q(n, b, α) to target precision ε requires t ~ 1/ε2 samples in general. In this way, the configuration weights can be estimated to any target degree of numerical precision.

Fig. 1: Quantum SSE simulation of 1D antiferromagnetic spin-1/2 chain.
figure 1

a 1D spin-1/2 chain with antiferromagnetic interaction and periodic boundary condition. For N = 3, the sites are labeled 1, 2, 3 and the corresponding bonds b1, b2, b3. b An example schematic of the quantum circuit calculating the expectation value of string of unitary operators \({U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{1}}^{b1}{U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{2}}^{b2}{U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{3}}^{b3}\). Further details are given in the main text. c, d, e Illustrates the convergence of the mean energy (blue-line with circles) determined by quantum SSE at β = 1. The finite temperature energy of the system represented by the red horizontal line is obtained via exact diagonalization. The x-axis indicates the number of Metropolis iterations Niter for N = 3, 4, 5 respectively.

Alternatively, we can also perform a quantum subroutine called amplitude estimation26 (see Supplementary Information under “Amplitude estimation”). In general, to estimate the probability p to any desired precision ϵ with success probability 1 − δ, the subroutine needs to be invoke certain unitary operations a total of t = t(ϵ, δ) times, where t(ϵ, δ) only depends on the desired precision ϵ and success probability 1 − δ. In this case, the variance scales with ~1/t2, where t is now the number of times the unitary operations are applied rather than the number of independent samples.

Stochastic sampling of operator space

Once the relative weight of a configuration C is sampled, the Monte Carlo simulation proceeds by stochastically sampling the operator space via the Metropolis method. This consists of randomly selecting some new configuration \(C^{\prime} \), and then accepting the newly chosen configuration with probability \({P}_{{{\mathrm{accept}}}}(C\to C^{\prime} )\,:=\,\min \left[W(C^{\prime} )/W(C),1\right]\) where W(C) is the weight of a configuration C = (n, b, α). It is given by the following expression

$$\begin{array}{rcl}W(C)&:=&\frac{{\beta }^{n}}{n!}\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \\ &=&\frac{{\beta }^{n}}{n!}| {2}^{n}{h}_{{b}_{n}}\ldots {h}_{{b}_{1}}| \sqrt{q(n,b,\alpha )},\end{array}$$
(10)

where q(n, b, α) is the probability sampled in Eq. 9. In the Metropolis algorithm, it is implicitly assumed that the probability of selecting \(C^{\prime} \) when the current configuration is C is the same as the probability of selecting C when the current configuration is \(C^{\prime} \), i.e., \({P}_{{{\mathrm{select}}}}(C\,\to\, C^{\prime} )\,=\,{P}_{{{\mathrm{select}}}}(C^{\prime} \,\to\, C)\). Each of the variables n, b, α is updated separately using the ratio \(W(C^{\prime} )/W(C)\) as the probability of accepting an update. In quantum SSE, the update probabilities are determined by \(\sqrt{q(n^{\prime} ,b^{\prime} ,\alpha ^{\prime} )/q(n,b,\alpha )}\), which are obtained by sampling the probabilities q(n, b, α) from the quantum circuit (see Eq. 9). Explicit expressions for the update probabilities are provided in the Supplementary Information under “Metropolis acceptance weights”. The calculation of the update probabilities does not involve the 2n multiplicative factor in Eq. 10, so an exponential blowup in the sampling error does not occur.

Quantum implementation of SSE for general Hamiltonians

In the section “SSE on a quantum computer” we demonstrated a special case implementation of quantum SSE where the quantity \(\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \) is guaranteed to be non-negative. For general Hamiltonians, this may not always be possible because the operator \({H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\) may not be Hermitian. In this section, we discuss an implementation for more general Hamiltonians.

Recall the expression for the expectation value of an operator:

$$\langle O\rangle \,=\,\mathop{\sum}\limits_{n,b,\alpha }\frac{{\beta }^{n}}{n!}\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \left\langle \alpha \right|O\left|\alpha \right\rangle /Z.$$

Note that the summation over all possible strings b contain \(\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \), as well as its complex conjugate \(\left\langle \alpha \right|{H}_{{b}_{1}}\ldots {H}_{{b}_{n}}\left|\alpha \right\rangle \). Since \(\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle +\left\langle \alpha \right|{H}_{{b}_{1}}\ldots {H}_{{b}_{n}}\left|\alpha \right\rangle =2{\rm{Re}} \left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle\), only the real part of each term contributes to the expectation value. Hence we can equivalently write

$$\langle O\rangle \,=\,\mathop{\sum}\limits_{n,b,\alpha }\frac{{\beta }^{n}}{n!}\mathrm{Re} \left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \left\langle \alpha \right|O\left|\alpha \right\rangle /Z.$$
(11)

Therefore, in order to implement quantum SSE, we only need to sample the real portion of \(\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \) and ensure that it is nonnegative. We show that this can be done by adding a sufficiently large constant to the Hamiltonian (see Supplementary Information under “Positive semidefiniteness: general case”).

Suppose Mn is the cutoff in the expansion power (see Eq. 1). For a fixed M, let \({H}_{b}\,:=\,| {h}_{b}| \left[\,{{\mbox{sgn}}}\,({h}_{b}){\otimes }_{i \,=\, 1}^{N}{\sigma }_{{b}^{i}}^{({{{{\rm{A}}}}}_{i})}\,+\,2M{{\mathbb{1}}}_{{{{\rm{A}}}}}\right]\). We note that this is an unequal superposition of 2 unitary operations that depends on the cutoff value M.

We introduce the state

$$\left|{\psi }_{{{\mbox{in}}}}\right\rangle \,:=\,\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{\phi }_{{{{{\rm{B}}}}}_{1}}\right\rangle \ldots \left|{\phi }_{{{{{\rm{B}}}}}_{n}}\right\rangle \left|{+}_{{{{\rm{C}}}}}\right\rangle ,$$
(12)

where

$$\left|{\phi }_{{{{{\rm{B}}}}}_{i}}\right\rangle \,:=\,\sqrt{(2M)/(2M\,+\,1)}\left|{0}_{{{{{\rm{B}}}}}_{i}}\right\rangle \,+\,\sqrt{1/(2M\,+\,1)}\left|{1}_{{{{{\rm{B}}}}}_{i}}\right\rangle$$

and \(\left|{+}_{{{{\rm{C}}}}}\right\rangle \,:=\,\frac{1}{\sqrt{2}}(\left|{0}_{{{{\rm{C}}}}}\right\rangle \,+\,\left|{1}_{{{{\rm{C}}}}}\right\rangle )\). As before, by introducing appropriate unitary operators, the relative weight of the configurations can be evaluated. In addition to \({U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{i}}\), we further define the unitary VAB,C, which is controlled by qubit C:

$$\begin{array}{rcl}&&{V}_{{{{\rm{AB}}}},{{{\rm{C}}}}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{\phi }_{{{{{\rm{B}}}}}_{1}}\right\rangle \ldots \left|{\phi }_{{{{{\rm{B}}}}}_{n}}\right\rangle \left|{0}_{{{{\rm{C}}}}}\right\rangle \\ &&\,\,:=\,{U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{1}}\ldots {U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{n}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{\phi }_{{{{{\rm{B}}}}}_{1}}\right\rangle \ldots \left|{\phi }_{{{{{\rm{B}}}}}_{n}}\right\rangle \left|{0}_{{{{\rm{C}}}}}\right\rangle \\ &&{V}_{{{{\rm{AB}}}},{{{\rm{C}}}}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{\phi }_{{{{{\rm{B}}}}}_{1}}\right\rangle \ldots \left|{\phi }_{{{{{\rm{B}}}}}_{n}}\right\rangle \left|{1}_{{{{\rm{C}}}}}\right\rangle \\ &&\,\,:=\,{U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{n}}\ldots {U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{1}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{\phi }_{{{{{\rm{B}}}}}_{1}}\right\rangle \ldots \left|{\phi }_{{{{{\rm{B}}}}}_{n}}\right\rangle \left|{1}_{{{{\rm{C}}}}}\right\rangle \end{array}$$
(13)

For any given expansion power n, we can verify the expression:

$$\begin{array}{lll}\left\langle {\psi }_{{{\mathrm{in}}}}\right|{V}_{{{{\rm{AB}}}},{{{\rm{C}}}}}\left|{\psi }_{{{\mbox{in}}}}\right\rangle &=&\frac{\left\langle {\alpha }_{{{{\rm{A}}}}}\right|{H}_{{b}_{1}}\ldots {H}_{{b}_{n}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \,+\,\left\langle {\alpha }_{{{{\rm{A}}}}}\right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle }{2{(2M\,+\,1)}^{n}| {h}_{{b}_{n}}\ldots {h}_{{b}_{1}}| }\\ &=&\frac{{\mathrm{Re}} \left\langle {\alpha }_{{{{\rm{A}}}}}\right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|{\alpha }_{{{{{\rm{A}}}}}}\right\rangle }{{(2M\,+\,1)}^{n}| {h}_{{b}_{n}}\ldots {h}_{{b}_{1}}| },\end{array}$$
(14)

which allows us to define an estimator for the relative weight:

$$\begin{array}{lll}q(n,b,\alpha )&:=&| {\left\langle {\psi }_{{{\mathrm{in}}}}\right|{V}_{{{{\rm{AB}}}},{{{\rm{C}}}}}\left|{\psi }_{{{\mbox{in}}}}\right\rangle | }^{2}\\ &\equiv &{\left|\frac{{\mathrm{Re}} \left\langle{\alpha }_{{{{{\rm{A}}}}}}\right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|{\alpha }_{{{{{\rm{A}}}}}}\right\rangle}{{(2M\,+\,1)}^{n}| {h}_{{b}_{n}}\ldots {h}_{{b}_{1}}| }\right|}^{2}\end{array}$$
(15)

Note that the spectrum of \({H}_{{b}_{i}}/| {h}_{{b}_{i}}| \) is in the range [0, 2M + 1] so the absolute value of \({\mathrm{Re}} \left\langle {\alpha}_{{{{{\rm{A}}}}}}\right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|{\alpha}_{{{{{\rm{A}}}}}}\right\rangle/| {h}_{{b}_{n}}\ldots {h}_{{b}_{1}}|\) is within the range [0, (2M + 1)n]. The configuration weights, and hence \({\mathrm{Re}} \left\langle{\alpha}_{{{{{\rm{A}}}}}}\right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|{\alpha}_{{{{{\rm{A}}}}}}\right\rangle\), are always nonnegative.

From the above arguments, we see that the configurations can be sampled by measuring the probability q(n, b, α). The Metropolis portion of the simulation then proceeds as before, where the acceptance probability depends on the ratio \(\sqrt{q(n^{\prime} ,b^{\prime} ,\alpha ^{\prime} )/q(n,b,\alpha )}\). Note that the above argument finds a sufficiently large constant to add to the Hamiltonian to avoid negative weights. This constant may be too large for many specific problems. We expect that the minimum constant that is required can be optimized on a case by case basis. We also highlight that adding a constant to the Hamiltonian is only necessary when the initial Hamiltonian contains negatively weighted configurations. The above arguments show that quantum SSE is able to avoid negative weights for general Hamiltonians and arbitrary basis states \(\left|\alpha \right\rangle \), which is not possible in general for classical SSE except for special cases.

Example: 1D antiferromagnetic spin-1/2 chain

To demonstrate the proposed algorithm, we simulated the Hamiltonian of one dimensional periodic spin chains with N = 3, 4, 5 sites. The algorithm was implemented using the quantum simulation toolkit Qiskit27 and the measured observables were compared with results from exact diagonalization. The Hamiltonian with antiferromagnetic exchange is given by

$$H^{\prime} \,=\,J\mathop{\sum}\limits_{b}{\sigma }_{x}^{b(1)}{\sigma }_{x}^{b(2)},$$
(16)

where J > 0 and b(i) is the i-th site of the b-th bond (see Fig. 1a). The classical SSE implementation violates the no-branching condition and suffers from the sign problem if we do not use the eigenstates of σx to construct the basis states, \(\left|\alpha \right\rangle \). In quantum SSE this constraint no longer exists as the no-branching requirement is lifted and the string of bond operators have positive-semidefinite weights. To illustrate this, we choose the basis states \(\left|\alpha \right\rangle \) to be product states of σz eigenvectors (i.e., products of \(\left|\uparrow \right\rangle ,\left|\downarrow \right\rangle \)) rotated by Hadamard gates and non-Clifford phase gates \(T\,=\,\left(\begin{array}{rc}1&0\\ 0&{{{{\rm{e}}}}}^{i\pi /4}\end{array}\right)\). In general, quantum circuits with non-Clifford gates are known to be difficult to simulate classically28,29.

The energy calculations from quantum SSE as a function of the number of Metropolis iterations are shown Fig. 1c–e for site numbers N = 3, 4, 5 respectively at β = 1. For all the cases considered, it was observed that the mean energy computed via quantum SSE converges towards the exact finite temperature energy of the system obtained from exact diagonalization, thus demonstrating the validity of the algorithm.

Discussion

Recall that implementing SSE Monte Carlo requires each term \(\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \) in the expansion to be nonnegative. In general, this cannot be always guaranteed except for special cases. This results in the infamous sign problem20,21 which severely restricts the applicability of QMC methods.

In the classical implementation of SSE, the sign problem arises from the so-called no-branching condition. This is the requirement that \({H}_{b}\left|\alpha \right\rangle \,\propto\, \left|\alpha ^{\prime} \right\rangle\), where \(\left|\alpha ^{\prime} \right\rangle \) is also a basis vector. In other words, we always have to use a decomposition of H = ∑bHb such that Hb does not create superpositions of basis states. For any given basis, this means that every Hb satisfying the no-branching requirement can be classified as a diagonal operator satisfying \({H}_{b}\left|\alpha \right\rangle \,\propto\, \left|\alpha \right\rangle\) for every α, or an off-diagonal update satisfying \({H}_{b}\left|\alpha \right\rangle \,\propto\, \left|\alpha ^{\prime} \right\rangle\) where \(\alpha \,\ne\, \alpha ^{\prime}\) for some α.

A diagonal update can always be made positive by adding a sufficiently large constant. This is because if Hb is a diagonal update, then \({H}_{b}^{\prime}\left|\alpha \right\rangle \,:=\,({H}_{b}\,+\,k{\mathbb{1}})\left|\alpha \right\rangle \,\propto\, \left|\alpha \right\rangle\) is also a diagonal update.

On the other hand, we see that if Hb is an off-diagonal update, adding a constant will necessarily create a superposition of basis states, since \(({H}_{b}\,+\,k{\mathbb{1}})\left|\alpha \right\rangle \,\propto\, {h}_{b,\alpha }\left|\alpha ^{\prime} \right\rangle \,+\,k\left|\alpha \right\rangle\) where \(\alpha \,\ne\, \alpha ^{\prime}\). This means that we cannot guarantee that Hb is always positive semidefinite for off-diagonal updates, without violating the no-branching condition. This in turn implies that \(\left\langle \alpha \right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \) is not necessarily positive, which is the sign problem.

From the above, we see that the sign problem exists because of the no-branching requirement. If we avoid the sign problem by lifting no-branching requirement, one will have to keep track of all the off-diagonal elements of \({H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|\alpha \right\rangle \). In the worst case, the computational resources required to keep track of an arbitrary superposition of basis states is of the order \({{{\mathcal{O}}}}(\exp (N))\), where N is the number of particles.

The primary benefit of the quantum SSE method is that it does not require the no-branching condition, as quantum computers naturally allows for the creation of superpositions of quantum states. This allows us to sample the relative weights of a given configuration directly, without needing to keep track of all the off-diagonal elements. By lifting the no-branching requirement, we can always ensure that the relative weights are nonnegative, thus also avoiding the sign problem. We have shown this for the special case where the Hamiltonian can be decomposed into products of \({\mathbb{1}}\) or σx, as well as for more general Hamiltonians.

We now discuss several advantages that quantum SSE offers over classical SSE. The first advantage is that a much wider range of observables can be measured using quantum SSE. Both quantum and classical SSE compute statistical averages most easily when the observable O is diagonal in the basis \(\left|\alpha \right\rangle \). Unlike classical SSE, however, quantum SSE does not require the no-branching condition so there is no longer any limitations on the choice of basis states \(\left|\alpha \right\rangle \). For any given operator O, we can now choose any basis \(\{\left|\alpha \right\rangle \}\) that diagonalizes the observable O, as long as the the basis state \(\left|\alpha \right\rangle \) can be efficiently prepared on the quantum computer. The corresponding estimator for the observable O is then \(f(O,C)\,:=\,\left\langle \alpha \right|O\left|\alpha \right\rangle\). Consequently, quantum SSE allows more general quantum observables to be measured compared to classical SSE. An example of this is when \(O\,=\,\left|\phi \right\rangle \left\langle \phi \right|\) for a known quantum state \(\left|\phi \right\rangle \). In this case, O is the projector onto the state \(\left|\phi \right\rangle \) and \(\langle O\rangle \,=\,\left\langle \phi \right|{{{{\rm{e}}}}}^{-\beta H^{\prime} }/Z\left|\phi \right\rangle\) is the overlap between \(\left|\phi \right\rangle \) and the thermal state \({{{{\rm{e}}}}}^{-\beta H^{\prime} }/Z\). In general, finding the state overlap is not easily implementable using classical SSE. In the Shastry-Sutherland model30,31,32 for instance, this can be used to directly verify that the ground state is a product of singlet pairs. This is achieved by by letting \(\left|\phi \right\rangle \) be a product of singlets and then sampling the expectation values using quantum SSE.

A second advantage of quantum SSE is the low circuit complexity required to estimate the configuration weight. Consider the computational cost of implementing quantum SSE for the special case discussed in the section “SSE on a quantum computer”. Here, sampling \(\left\langle {\alpha }_{{{{\rm{A}}}}}\right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \) given some operator string b requires a total of n unitary operations to be performed, multiplied by the number of samples t for any target numerical precision. Combine this with the fact that 〈n〉, the average expansion power in SSE, is proportional to the system energy and scales with βN, and the end result is that the total number of quantum gates required to sample the configuration weight requires \({{{\mathcal{O}}}}(n) \,\sim\, {{{\mathcal{O}}}}(N)\) number of operations, i.e., it scales linearly with system size. A similar argument can also be made if we employ the amplitude estimation algorithm (see Supplementary Information under “Amplitude estimation”). An analysis for general Hamiltonians will lead to the same conclusion, since essentially the same set of unitary operations are performed, except with an additional control operation. We therefore expect the size of the quantum circuits in quantum SSE to scale with \({{{\mathcal{O}}}}(N)\) in general.

Compare this to the classical SSE algorithm. In classical SSE, the cost of sampling the configuration weight is \({{{\mathcal{O}}}}(N)\) only when the no-branching condition is satisfied and there is no sign problem. As previously discussed, a consequence of this is that the no-branching condition fixes the basis \(\left|\alpha \right\rangle \), which limits the kinds of observables that classical SSE can measure. More generally, without the no-branching condition, classical SSE encounters the sign problem and the computational cost of avoiding negative weights is generally \( \sim {{{\mathcal{O}}}}(\exp (N))\). By comparison, the complexity of the quantum circuit is \({{{\mathcal{O}}}}(N)\) if the basis state \(\left|\alpha \right\rangle \) is generated by a circuit of size \({{{\mathcal{O}}}}(N)\), or poly(N) if \(\left|\alpha \right\rangle \) is generated by a circuit of size poly(N). Taking into account all such possible basis states, we expect the improvement in terms of computational complexity to be exponential.

The third advantage of quantum SSE is that it can be efficiently parallelized to a short depth quantum circuit. Short depth circuits belong to the quantum complexity class QNC, which is the class of quantum circuits with polylogarithmic depth. In order to see this, observe that the unitary operations \({U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{i}}\) and VAB,C are composed of layers of controlled-Pauli operations. In general, such operations are known to belong to the quantum complexity class QNC133, which has depth complexity \({{{\mathcal{O}}}}(\log N)\). This means that the depth complexity of quantum SSE belongs to QNC1 for any \(\left|\alpha \right\rangle \) generated in logarithmic depth, or more generally QNC if \(\left|\alpha \right\rangle \) is generated in polylogarithmic depth. In particular, the example in Fig. 1 belongs to QNC1. Note that this circuit contains non-Clifford T gates and that non-Clifford gates are not efficiently simulable on classical computers28,29. Such short depth quantum circuits are also especially well suited for implementation on NISQ processors34 with limited coherence times. To the best of our knowledge, we are not aware of a similar result for classical SSE.

In summary, we proposed a quantum implementation of the SSE Monte Carlo algorithm and compared it to its classical counterpart. It was shown that the cost of implementing a single Monte Carlo update in quantum SSE scales linearly with the number of particles N. We compare this to the classical implementation of SSE, where certain many-body systems exhibit the sign problem and incurs an additional cost that scales exponentially with N. The quantum algorithm was able to avoid this by ensuring that the weight of the configuration is always positive, regardless of the chosen basis. This suggests that quantum computers can significantly speed up the simulation of complex quantum many-body systems. Even when the sign problem is not present in classical SSE, quantum SSE can still be advantageous, since it allows for more general observables to be measured. This was demonstrated via a numerical simulation of a 1D spin-1/2 chain using the quantum SSE algorithm in combination with a basis that is typically hard to implement in classical SSE. In all cases considered, it was shown that quantum SSE converged to the correct results obtained from exact diagonalization.

It is known that estimating the ground state energy of a k-local Hamiltonian is QMA complete25,35,36. Here, we have shown that quantum SSE can perform bounded error estimates of the configuration weights in polynomial time, which is not always possible in classical SSE. While this quantum speedup removes a major bottleneck in classical SSE, it does not necessarily imply an exponentially fast rate of convergence to the ground state energy, nor that QMA complete problems can be solved in polynomial time in general. Nonetheless, the quantum SSE algorithm shows that quantum computers are promising tools for accelerating the SSE Monte Carlo simulation in many scenarios. This may provide a pathway for probing the quantum properties of many-body systems that are currently inaccessible to existing classical techniques.

Methods

We describe in detail how the simulation in Section “Example: 1D antiferromagnetic spin chain” was performed. After adding identity operators to the bond operators to make them positive-semidefinite, the effective Hamiltonian for J = 1 in the quantum SSE simulation is

$$H\,=\,\mathop{\sum}\limits_{b}{H}_{b},$$
(17)

where \({H}_{b}\,=\,{\mathbb{1}}\,-\,{\sigma }_{x}^{b(1)}{\sigma }_{x}^{b(2)}\).

The controlled unitary operator \({U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{i}}^{b}\) performs the map,

$${U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{i}}^{b}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{+}_{{{{{\rm{B}}}}}_{i}}\right\rangle \,=\,\frac{1}{\sqrt{2}}\left(\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{0}_{{{{{\rm{B}}}}}_{i}}\right\rangle \,-\,{\sigma }_{x}^{b(1)}{\sigma }_{x}^{b(2)}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{1}_{{{{{\rm{B}}}}}_{i}}\right\rangle \right).$$
(18)

that were introduced in the section “SSE on a quantum computer”. The expectation value of operator strings \({H}_{{b}_{1}}{H}_{{b}_{2}}\ldots {H}_{{b}_{n}}\)—needed to evaluate the partition function—is related to \({U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{i}}^{b}\) according to (hb = 1 b since J = 1):

$$\left\langle {\alpha }_{{{{\rm{A}}}}}\right|\left\langle {+}_{{{{{\rm{B}}}}}_{1}}\right|\ldots \left\langle {+}_{{{{{\rm{B}}}}}_{n}}\right|{U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{n}}^{{b}_{n}}\ldots {U}_{{{{\rm{A}}}},{{{{\rm{B}}}}}_{1}}^{{b}_{1}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle \left|{+}_{{{{{\rm{B}}}}}_{1}}\right\rangle \ldots \left|{+}_{{{{{\rm{B}}}}}_{n}}\right\rangle \,=\,\frac{1}{{2}^{n}}\left\langle {\alpha }_{{{{\rm{A}}}}}\right|{H}_{{b}_{n}}\ldots {H}_{{b}_{1}}\left|{\alpha }_{{{{\rm{A}}}}}\right\rangle .$$
(19)

An example quantum circuit performing this measurement is shown in Fig. 1b. In this example circuit, there are six physical qubits where qubits q0, q1, q2 are ancillae, and qubits q3, q4, q5 represent the system. The quantum circuit determines the expectation value of string of \({U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{2}}^{{b}_{3}}{U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{1}}^{{b}_{2}}{U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{0}}^{{b}_{1}}\) for a three site periodic system when n = 3. We will describe in detail the steps involved in the circuit in Fig. 1b.

In Step I, the ancilla qubits q0, q1 and q3 are prepared in the states \(\left|{-}_{{{{{\rm{q}}}}}_{0}}\right\rangle ,\,\left|{-}_{{{{{\rm{q}}}}}_{1}}\right\rangle ,\,\left|{-}_{{{{{\rm{q}}}}}_{2}}\right\rangle \) respectively, using Hadamard and Pauli X gates.

In Step II the system qubits q3, q4 and q5 representing the spin-1/2 sites of the physical spin chain are prepared in some initial state \({\left|\alpha \right\rangle }_{A}\) by applying either the identity or the Pauli X-gate followed by a Hadamard and the non-Clifford T-gate. This generates basis states via a constant depth, non-Clifford quantum circuit.

In Step III the unitary operations \({U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{2}}^{{b}_{3}},\,{U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{1}}^{{b}_{2}}\) and \({U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{0}}^{{b}_{1}}\) are completed by sequentially applying CNOT operations onto \({\left|\alpha \right\rangle }_{A}\left|{-}_{{{{{\rm{q}}}}}_{0}}\right\rangle \left|{-}_{{{{{\rm{q}}}}}_{1}}\right\rangle \left|{-}_{{{{{\rm{q}}}}}_{2}}\right\rangle \).

Finally in Step IV, the qubits are rotated using Hadamard, X gates, inverse T gates and then measured in the computational basis. The probability of measuring all qubits with the outcome 0 gives the square of the expectation value of \({U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{2}}^{{b}_{3}}{U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{1}}^{{b}_{2}}{U}_{{{{\rm{A}}}},{{{{\rm{q}}}}}_{0}}^{{b}_{1}}\). All of the quantum gates used to construct the quantum circuit are standard quantum gates included as part of the Qiskit library.

After evaluating the expectation value for a given operator string and spin state, the relative weight is computed from \(\sqrt{q(n^{\prime} ,b^{\prime} ,\alpha ^{\prime} )/q(n,b,\alpha )}\). The Metropolis algorithm, as described in the section “Stochastic sampling of operator space”, is then implemented accordingly to update the quantum state and the operator string. In SSE, the finite temperature energy of the system is evaluated using the expression19,

$$E\,=\,-\frac{\left\langle n\right\rangle }{\beta }\,+\,N,$$
(20)

where \(\left\langle n\right\rangle \) is the average length of operator string per Metropolis loop. Note that the contributing term N in Eq. 20 is due to adding a constant to the Hamiltonian to ensure positive semidefiniteness.

The Metropolis sampling is initialized with some arbitrary string of operators. The average operator string length \(\left\langle n\right\rangle \) is then calculated after an initial 104 Metropolis steps, and the mean energy is evaluated using Eq. 20. The simulation was performed for site numbers N = 3, 4, 5 at a fixed inverse temperature β = 1.