Toward Neural Network Simulation of Variational Quantum Algorithms
Anonymous Author(s)
AfﬁliationAddress
Abstract
Variational quantum algorithms (VQAs) utilize a hybrid quantum–classical architecture to recast problems of high-dimensional linear algebra as ones of stochasticoptimization.
Despite the promise of leveraging near- to intermediate-term quantum resources to accelerate this task, the computational advantage of VQAs overwholly classical algorithms has not been ﬁrmly established.
For instance, while thevariational quantum eigensolver (VQE) has been developed to approximate lowlying eigenmodes of high-dimensional sparse linear operators, analogous classicaloptimization algorithms exist in the variational Monte Carlo (VMC) literature, utilizing neural networks in place of quantum circuits to represent quantum states.
Inthis paper we ask if classical stochastic optimization algorithms can be constructedparalleling other VQAs, focusing on the example of the variational quantum linearsolver (VQLS).
We ﬁnd that such a construction can be applied to the VQLS,yielding a paradigm that could theoretically extend to other VQAs of similar form.
Introduction
Recent impressive progress in quantum computational technology has led to renewed interest inquantum algorithm research.
Much of this excitement stems from the development of quantumalgorithms exhibiting exponential speedups over their classical counterparts, including algorithmsfor large-scale linear algebra [7].
Furthermore, plausible complexity-theoretic assumptions stronglysuggest [12] that quantum computers are capable of preparing quantum states whose output probabilitydistributions are hard to sample classically.
Despite this vast potential, quantum algorithm designsuffers from a few caveats.
Firstly, exponential acceleration requires fault-tolerant quantum computation, which necessitatesaccess to a prohibitively large number of physical qubits.
Even under the assumption of polylogarithmic overhead in the asymptotic limit of problem size [10], the necessary resources for solving linearsystems of practical utility vastly exceed the likely near-term capabilities of noisy intermediate-scalequantum (NISQ) devices.
Secondly, the conjectured hardness results [12] for classical samplingpertain to probability distributions with no known practical utility, without any guidance towardwhich quantum states should be targeted for practical problems.
These two obstacles motivate a new research direction called variational quantum algorithms (VQAs),wherein one encodes a computational problem as a stochastic optimization problem whose solutionis an unknown quantum state; in particular, the probabilistic nature of quantum states dictates thatthis solution be encoded in the output probabilities of the optimal state, which may be estimatedthrough Monte Carlo sampling.
Modeling quantum states classically requires overcoming a curseof dimensionality, since the number of dimensions of a multi-qubit state space grows exponentiallywith the number of qubits.
The potential computational advantage of VQAs stems from theirreliance on a Quantum Processing Unit (QPU) to perform state preparation within a hybrid quantum– classical framework, where the CPU performs gradient-based updates in order to direct the QPUtoward the optimal quantum state.
Variational algorithms have already been designed with thegoal of solving hard combinatorial optimization [5] and for ground state preparation in quantumchemistry [9]; more recently, VQAs have emerged for solving fundamental linear algebra problemsin high dimension, such as matrix–vector products [18], solutions of linear systems [1] and evensingular value decomposition (SVD) [2, 17].
Nonetheless, the existence of a quantum computationaladvantage—as well as its underlying theoretical justiﬁcation—has yet to be demonstrated for VQAs.
To better understand this potential for quantum advantage, we utilize the close relationship between
VQAs and variational quantum Monte Carlo (VQMC), an area that has shown signiﬁcant recentprogress in expanding its capabilities to problems beyond its traditional purview [3].
Similarly to VQAs, the VQMC overcomes the curse of dimensionality by alternating between gradient-basedoptimization and Monte Carlo sampling from a parametrized quantum state.
However, unlike VQAs—whose computational advantage hinges on the conjectured difﬁculty of sampling from a parametrizedquantum circuit—the VQMC gains its power by modeling the quantum state using multi-layerparametrized neural networks [3].
The exploitation of ﬂexible neural networks as many-body trialwavefunctions has made it possible to leverage the enormous success of machine learning (ML) insolving a variety of quantum many-body eigenvalue problems [3].
The close parallels between ideasdeveloped in the very different ﬁelds of VQAs, VQMC, and ML has yielded many opportunitiesfor technology transfer between the three, including the discovery of a VQMC-inspired naturalgradient optimization algorithm for VQAs [14] and an expanding list of VQA-inspired algorithms forcombinatorial optimization [6, 19, 8] and partial differential equations [22].
While VQMC has traditionally focused on ground state preparation and solving the initial valueproblem for the time-dependent Schrödinger equation, there is no fundamental obstruction to tackling practical concern, and we strive to bridge this gap by pursuing VQMCapproaches to linear algebra in exponentially high dimensions.
Choosing to focus on VQMC isolatesthe question of quantum advantage from the inherent advantage of Monte Carlo for overcoming thecurse of dimensionality.
Using a recently discovered Rayleigh quotient reformulation, we introduce a VQMC-based solver for the linear system
Ax = b , where A is a large row-sparse matrix, which wecall the Variational Neural Linear Solver (VNLS).
The VNLS provides a classical benchmark forassessing the quantum computational advantage of the Variational Quantum Linear Solver (VQLS)[1], which is a proposed VQA for solving sparse high-dimensional linear systems.
The VNLShopefully represents the ﬁrst example of a new paradigm for efﬁciently solving a variety of largescale linear algebra problems.
On a longer timeframe, the insights gained by studying VQMCrealizations of NISQ algorithms on classical hardware will provide the basis for further quantumalgorithm technology transfer as quantum hardware matures.
The paper is organized as follows.
We compare and contrast in section 2 the VQA-based and VQMCbased approaches for identifying the ground state of a quantum Hamiltonian.
Section 3 describesthe
Variational Quantum Linear Solver (VQLS) and how it encodes the solution of a linear systeminto the ground state of some Hamiltonian.
Section 4 introduces the Variational Neural Linear Solver(VNLS), a demonstrative example for producing fully-classical machine learning algorithms byapplying VQMC techniques to VQA-inspired objectives.
In section 5, we apply the VNLS to simplelinear systems previously used in demonstration of the VQLS, before providing in section 6 somegeneral suggestions for how this area may be further developed.
Many of the ﬁner details in thispaper are reserved for the appendix.
VQAs and VQMC
We now provide an overview of variational quantum algorithms for Hamiltonian ground stateidentiﬁcation, presented within the context of potential classical simulation of these algorithms.
Wedirectly contrast VQAs with variational Monte Carlo techniques for accomplishing the same task.2.
1 Variational Quantum Algorithms
A variational quantum algorithm (VQA) is a hybrid quantum-classical algorithm simultaneouslyexecuted on a classical CPU and a noisy intermediate-scale quantum processing unit (QPU).
VQAsare iterative: at each step, the CPU proposes a set of parameters to the QPU, which uses these valuesto execute a ﬁxed sequence of parameterized quantum gates operating on a set of n qubits.
This sequence of gates, called an ansatz , is kept shallow, meaning the number of gates in the sequence ispolynomial with respect to n .
The QPU passes information about the prepared state back to the CPU,which then performs some type of gradient-based update to the parameter set.
VQAs can solve a variety of tasks: the one most relevant to this paper is ground state identiﬁcationfor quantum Hamiltonians.
Consider the set {| ψ
θ (cid:105) ∈
C 2 n : θ ∈ R d } of all quantum state vectors ofan n -qubit system that may be represented by different parameterizations of some shallow ansatz.
We immediately observe, since the state vector | ψ θ (cid:105) of our ansatz has dimension 2 n , that the numberof gates used to execute our ansatz is polylogarithmic with respect to the dimension of | ψ θ (cid:105) .
Givena quantum Hamiltonian (Hermitian operator) H on this n -qubit state space, the VQA seeks to ﬁndthe parameterization θ minimizing the expected value of H in state | ψ θ (cid:105) , which is derived from the
Rayleigh-Ritz principle applied to a 2 n × 2 n complex Hermitian matrix H ,
[Equation]
The minimal expected value equals the smallest eigenvalue of H , which is achieved if and onlyif | ψ θ (cid:105) is an associated eigenvector.
Even under this speciﬁc type of VQA paradigm, one canhypothetically solve a variety of problems; all one has to do to make a problem solvable by a groundstate identiﬁcation VQA is to identify a Hamiltonian H such that the solution of the desired problemis, in some way, encoded in its ground state.
The Variational Quantum Linear Solver described insection 3 provides an example of how one may construct such a Hamiltonian, but for the remainderof section 2 we will only consider H as an abstract Hamiltonian.
2.2 Foundations of Classical Simulation of VQAs
The overarching goal of this paper is to explore the utility of “classicalizing” variational quantumalgorithms by replacing the QPU with a classical neural network, simulating all the quantum statepreparation and expected value estimation tasks via Monte Carlo methods.
Van den Nest [16] introduces useful sufﬁcient conditions under which quantum expectation values can be so estimated; inparticular, the states and operators entering into quantum expectation values must satisfy conditionscalled classical tractability and efﬁciently computable sparsity, respectively.
A classically tractable(CT) n -qubit state is one such that for any index x ∈ [2 n ] we may directly calculate the corresponding coordinate (cid:104) x
| ψ θ (cid:105) with respect to the standard basis, and secondly, we may sample from theprobability distribution on indices given by the Born rule,
[Equation]
The normalization constant introduces a slight ambiguity of terminology, as quantum states aregenerally considered normalized, and true classical simulation of a CT state should maintain thisproperty.
However, it is certainly possible to model a CT state using an unnormalized vector, in whichcase one may approximate sampling from the corresponding Born distribution using Monte Carlotechniques.
In this case, the Born rule includes this normalization constant, and it is this formulationof the rule that we follow in this paper.
We also require that the Hamiltonian H , which has dimension 2 n × 2 n , is efﬁciently computable ,meaning it obeys the following sparsity constraint: given any row x ∈ [2 n ] of H , we may calculatethe column indices and values of all nonzero entries of row x of H in polynomial time with respectto n .
Since H is Hermitian, it is true that this property holds for all rows of H
if and only if it holdsfor all columns as well.
It is clear that for H to be efﬁciently computable, the number of nonzeroentries in each row of H must be polynomial in n ; it is not, however, necessary that the number of allnonzero entries in H is polynomial in n .
As we discuss in further detail in section 4.1, the tensorproduct of local Pauli operators is efﬁciently computable, and the sum of a small—polynomial withrespect to n —number of efﬁciently computable operators is efﬁciently computable.
2.3 Variational Quantum Monte Carlo
We now give a description of the VQMC algorithm, which provides the foundation for converting
VQAs into fully classical algorithms.
A brief description of how to implement this algorithm may befound in A.3.
Consider a (possibly unnormalized) parameterized family of vectors | ψ θ (cid:105) residing in a2 n -dimensional complex vector space.
Let ψ θ ( x ) :
= (cid:104) x | ψ θ (cid:105) denote the components of ψ θ relative to the standard orthornormal basis {| x (cid:105) : x ∈ [2 n ] } of C 2 n .
Once normalized, | ψ θ (cid:105) represents onepotential quantum state in the state space of an n -qubit system.
The starting point of the VQMCalgorithm is the observation that the Rayleigh quotient for a Hermitian operator H ∈ C 2 n × 2 n actingon this state space can be expressed in the following probabilistic form,
[Equation]
where the function l θ ( x ) is referred to—for historical reasons—as the local energy , and where thedistribution π θ follows (2).
Equation (3) follows from simple manipulations given in A.1.
Thevariance of the local l θ ( x ) obeys the identity
[Equation]
A remarkable consequence of (4) is that the variance of l θ ( x ) approaches zero if ψ θ approachesany eigenvector of H .
This has the practical implication that convergence of the algorithm can beassessed by gathering statistics for the local energy.
The local energy l θ ( x ) can be efﬁciently computed provided that the non-zero entries of the vector
Hψ θ can be extracted in a time which is polynomial in n , which is true if | ψ θ (cid:105) is a CT state and H isan efﬁciently computable Hamiltonian, as deﬁned in section 2.2.
The VQMC procedure relies on the approximation of the Rayleigh quotient in (3) by averagingbatches sampled according to π θ using Markov Chain Monte Carlo.
More speciﬁcally, VQMCoptimizes (10) by using a variant of stochastic gradient descent called stochastic reconﬁguration [13],which is similar to stochastic natural gradient descent.
In natural gradient descent, the parameterset θ is updated according to the rule θ ← θ − γI + ( θ ) ∇ L ( θ ) , where γ is the learning rate, ∇ L ( θ )is the loss function gradient, and I + ( θ ) represents the Moore–
Penrose pseudoinverse of the Fisherinformation matrix at θ , encoding the geometry of the optimization landscape near θ .
In the case that ψ θ is a real vector—a slight simpliﬁcation of the complex case—the gradient of (3)and the Fisher information matrix at the parameterization θ of ψ θ are given, respectively, by
[Equation]
In practice, the gradient and Fisher information matrix are estimated stochastically—the gradient isestimated using batches of local energies sampled from π θ , and the Fisher information is estimated bycomputing sample covariances between the logarithmic partial derivatives
∂∂θ i (log | ψ θ ( x ) | ) , x ∼ π θof ψ θ with respect to π θ .
VQLS
This section is dedicated to the Variational Quantum Linear Solver (VQLS) [1].
We give a high-leveldescription of the VQLS in section 3.1, followed by some common methods and examples forassessing its performance.
3.1 The Variational Quantum Linear Solver
The VQLS is a VQA designed to target linear systems in exponentially high dimensions of the form
[Equation]
where A denotes an invertible 2 n × 2 n complex matrix and | b (cid:105) ∈ C 2 n is a nonzero vector.
Theoutput of the algorithm is an approximation of the quantum state equal to the normalization of thesolution vector
A − 1 | b (cid:105) .
For simplicity of exposition we assume that A =
A † :=
( A ) t is a Hermitianmatrix representing a quantum observable of the system.
The original formulation of the VQLSmerely presumes that A is invertible, for which a more general formulation of the solver is given in[1].
Furthermore it is demonstrated in [7] that one may always embed a non-Hermitian matrix on ann -qubit space within a Hermitian matrix using one additional ancilla qubit; this formulation is givenin section A.2 of the appendix.
Given a linear system of the form (6), consider the projection P ⊥ bonto the subspace orthogonal to the vector | b (cid:105) ,
[Equation]
with H being the resulting Hamiltonian for which the VQLS seeks to minimize (1).
This minimizationoccurs if and only if | ψ θ (cid:105) is an eigenvector associated with the smallest eigenvalue of H , which inthis case is 0.
In particular, as A is assumed to be invertible, the eigenspace associated with 0 isone-dimensional.
Therefore for each θ , equation (1) gives a nonnegative value, equalling zero if andonly if | ψ θ (cid:105)
∝ A − 1 | b (cid:105) ; section 3.2 further shows exactly how the loss value bounds the accuracy ofthe VQLS.
3.2 Error Bounding for the VQLS
Modulo a few scaling factors, the square root of the VQLS loss L ( θ ) gives an upper bound onthe trace distance between the current model state | ψ θ (cid:105) and the true solution state (cid:12)(cid:12)
A − 1 b (cid:11) ; morespeciﬁcally, we ﬁnd (after correcting a missing factor of (cid:107) A (cid:107) in [1]) that
[Equation]
where κ is the condition number of A and
||
A || is its operator norm.
The trace distance formulationgiven here only holds for pure quantum states, which sufﬁces for our purposes since our proposed
VQLS-inspired solver (the VNLS) uses pure states.
Another useful metric for comparing two quantumstates is their ﬁdelity , which for two pure states equals the square of the cosine of the angle betweentheir corresponding state vectors; in particular, identical quantum states have a ﬁdelity of 1, andorthogonal quantum states have ﬁdelity of 0.
We discuss the trace distance bound, alongside how itimplies an equivalent bound on the ﬁdelities between these two quantum states, in appendix A.4.
3.3 The Ising-Inspired VQLS Problem
As a benchmark for assessing the performance of the VQLS, the authors of [1] introduced an exampleproblem which they term the Ising-inspired VQLS problem.
In particular, given an n qubit systemand a condition number κ they deﬁne
[Equation]
where X j and Z j denote the Pauli- X and Pauli- Z operators applied locally to qubit j , and ζ and ηare scaling factors speciﬁcally chosen such that A has largest eigenvalue 1 and smallest eigenvalue 1 κ .
The vector | b (cid:105) is taken to be the equal superposition state on n qubits given by | b (cid:105) =
| + (cid:105) ⊗ n where| + (cid:105) = (1 / √ 2)( | 0 (cid:105) + | 1 (cid:105) ) .
One noteworthy property of this problem is that the target | b (cid:105) and solution 203 (cid:12)(cid:12)
A − 1 b (cid:11) states become indistinguishable as the problem size increases.
We give a further descriptionand analysis of this phenomenon in appendix A.5 and A.6.
VNLS
In this section we describe an instantiation of VQMC that we term the variational neural linear solver(VNLS).
We focus on a linear system solver for concreteness, but the general strategy theoreticallygeneralizes to a wide range of linear algebra problem, such as the SVD.
The VNLS targets linearsystems A | x (cid:105) ∝ | b (cid:105) of the same form as in section 3.1.
Analogous to the VQLS, we consider thespace {| ψ θ (cid:105) ∈ C 2 n : θ ∈ R d } of parameterized vectors representing some collection of n -qubit CTstates.
Given a 2 n × 2 n Hermitian matrix A and nonzero vector | b (cid:105) , we consider the VQLS objective
[Equation]
Just as is the case for VQLS, we have that L ( θ ) ≥ 0 , with minimum value equal to 0 .
As an alternativeto preparing and storing | ψ θ (cid:105) on an actual quantum device, we will take the approach of recastingthe optimization problem into a form amenable to the variational quantum Monte Carlo, akin to thedescription given in section A.3.
4.1 Applying VQMC to the linear systems problem
Here we give a formulation of the VNLS, alongside a description of how it may be efﬁcientlyimplemented.
The key observation is that VNLS is an instantiation of the VQMC using (7) as the input Hermitian Hamiltonian.
As shown in A.7, we may apply the VQMC objective to this choice of
H and obtain a stochastic objective analogous to (3), with a new local energy l θ ( x ) deﬁned by
[Equation]
The expectation within (11) is taken with respect to the distribution β ( x ) = | b ( x ) | 2 / (cid:104) b | b (cid:105) .
Thus wemay approximate both the objective (10) and its gradient by estimating the expectation values overπ θ and β using batches of data obtained using MCMC or other sampling methods.
Algorithm 2 in
A.7 depicts this exact procedure and how it differs from A.3, traditional VQMC.
For simplicity, weuse the same batch size when sampling from π θ and β , but doing so is not necessary in general.
The variational formulation given above places no additional theoretical restrictions on the structureof A and | b (cid:105) , but some practical considerations have to be made in accordance with the moregeneral Hamiltonian restrictions required for VQMC.
The computational complexities of calculating 229 (cid:0)
A 2 ψ θ (cid:1) ( x ) , ( Ab ) ( x ) , and ( Aψ θ ) ( x ) grow with the number of nonzero entries in row x of A , whichcan be as large as 2 n .
Similarly, the computational complexity of storing and sampling from thedistribution β grows with the number of nonzero entries of | b (cid:105) .
For these reasons, we must requirethat A is efﬁciently computable and that | b (cid:105) is a CT state.
We ensure A is efﬁciently computable in the following way.
We observe that A , as a 2 n × 2 n
Hermitian matrix, may be expressed as a real linear combination of products of local Pauli operators
X , Y , and Z .
Our matrix A will be efﬁciently computable so long as the number of terms in this sumis kept sufﬁcently small.
A description of what this decomposition entails is given in A.9.
There aremany different approaches for ensuring that | b (cid:105) is CT, but for the purposes of this paper we simplystore the nonzero elements of | b (cid:105) directly and require that | b (cid:105) either be sufﬁciently sparse or restrictour testing to problems of sufﬁciently small dimension.
An important detail to keep in mind when training the VNLS using the natural gradient is that scalingeither the matrix A or vector b by any nonzero constant does not alter the problem in any way that the
VNLS can meaningfully recognize, and does not provide any meaningful advantage in performanceor accuracy.
Detailed explanations of these results are given in section A.8 of the appendix.
Experimental Results
As a benchmark test, we apply the VNLS to the Ising-inspired problem discussed in 3.3.
We ﬁxκ
=
and we take | b (cid:105) to have all its entries equal to 1; while VQLS uses the normalized form of | b (cid:105) ,scaling | b (cid:105) does not inﬂuence the performance of VNLS in any signiﬁcant way, as discussed in 4.1.
5.1 Real RBMs
Initializing the weights of a real RBM by sampling from a zero-mean Gaussian distribution withsufﬁciently small variance will, with high probability, place the corresponding state | ψ θ (cid:105) in a smallneighborhood of | b (cid:105) with respect to the trace distance from 3.2.
As discussed in section 3.3, since| b (cid:105) lies in a neighborhood of A − 1 | b (cid:105) , we observe the Ising-inspired problem is trivially easy for areal RBM to learn, as shown in the left-most image in ﬁgure 1; this ﬁgure depicts, for qubit numbers11 through 14, the ﬁdelity between | ψ θ (cid:105) and A − 1 | b (cid:105) over training.
In all observed cases, the RBMinitializes with very high ﬁdelity, and only improves from there.
These results are comparable withthose obtained on larger problem sizes with analogous architecture.
These tests were done for κ = 10 , where the RBM was trained with SR using a learning rate of 0 .
005 ,over 1000 epochs, with a batch size of 1024 VQMC samples.
Local energy samples were drawnfrom 8 Monte Carlo chains.
While directly calculating the ﬁdelity between ψ θ and A − 1 | b (cid:105) to assessperformance is not viable at scale due to memory concerns, plotting this ﬁdelity over the trainingperiod for small problems proves a better way for visually evaluating the model
’s performance thandirectly observing the stochastic loss plots.
As the RBM initializes at a point with a small loss value,the noise in the stochastic loss makes it difﬁcult to visually discern that the loss is decreasing overtime from the loss graph alone.
Though it does not harm the underlying point, we should note thatthe curve for the 14 qubit case is exhibiting roundoff errors, as it is impossible for the ﬁdelity of twoquantum states to be greater than 1.
5.2 Complex RBMs
In addition to the fact that a quirk of the Ising-inspired VQLS problem allows the real RBM toessentially initialize itself at the true solution state, real RBMs are likely not expressive enough to beof much use for the VNLS in practice, as they only learn quantum state vectors with entirely positiveentries; there are certainly many linear systems of practical interest where the entries of the solutionvector do not share the same sign.
Furthermore, since quantum state vectors have complex entries ingeneral, it is natural to explore the complex RBM (cRBM) for use in the VNLS.
Testing of the cRBM VNLS was performed using the κ = 10 Ising-inspired problem with the samehyperparemeter conﬁguration used in 5.1, yielding interesting qualitative results that would likely bemore indicative of the VNLS’s general behavior, in comparison with the somewhat trivial example ofapplying the real RBM (rRBM) to the Ising-inspired problem.
Unlike for rRBMs, the cRBM generally does not initialize in a state close to the solution.
However,we may observe qualitatively that the variance between sampled losses of nearby epochs decreasesover the course of training, as expected.
The second observation is that the cRBM exhibits moreheterogeneous learning behavior at small problem sizes ( n ≤ 10 ), occasionally struggling to learn thesolution to the same standard of accuracy.
We do not consider this a signiﬁcant issue for two reasons:lowering the learning rate and training for more epochs appears to mitigate this issue somewhat, andmoreover, just like the VQLS, the VNLS is not intended to be used for problem sizes suitable forstandard numerical matrix inversion methods; we are primarily interested in its behavior at scale.
At larger problem sizes, the VNLS exhibits more uniform behavior, as demonstrated by the centerand right-most images in ﬁgure 1.
For the right-most image, depicting loss plots, we have smoothedthe loss curves using a Savitzky–Golay ﬁlter, which better reveals the general trend.
The translucent,noisy curves represent the true sampled loss plots; here, we can also observe the efﬁcacy of thealgorithm from the fact that the variances of nearby sample loss values decrease during training,which is a result of equation 4. Such behavior indicates that, relative to problem size, the optimizationlandscape of the Ising-inspired problem becomes easier for the VNLS to navigate.
One likelyexplanation is that the deliberate ﬁxing of the condition number across all problem sizes—which doesnot generally occur for matrices derived from physical applications—contributes to this phenomenon.
Figure 2 demonstrates the effect that altering the batch size or learning rate has on the performance ofthe VNLS.
Batch size was varied between 512, 1024, and 2048 samples per epoch.
In order to makethe loss plots more comparable qualitatively, epoch numbers were scaled so that the total number of
VQMC samples drawn remains ﬁxed.
We observe that while increasing the batch size does improveboth accuracy and rate of convergence, this improvement does not scale linearly with the change inbatch size.
For instance, doubling the batch size from 512 to 1024 allow us to achieve comparableaccuracy in half the time, though the VNLS requires a larger fraction of the training time to achieveit.
in contrast, doubling the batch size from 1024 to 2048 does not halve the required training time inquite the same way.
For larger problem sizes, solely altering the learning rate within reasonable tolerances does not appearto affect performance of the cRBM VNLS in any qualitatively signiﬁcant way beyond the expectedcommensurate change in the rate of convergence, as demonstrated by ﬁgure 2.
Here the number oftraining epochs was adjusted inversely in accordance with the change in learning rate.
Across alllarger ( n > 10 ) problem sizes tested, these learning rates were able to capture the same accuracy andgeneral learning trend.
It should be noted that for the smallest problem sizes, decreasing the learningrate did help to both improve accuracy and smooth out both the loss curve.
These observationscorroborate the idea that larger Ising-inspired problems are easier for the VNLS to solve.
Future Work
Through the application of the VNLS to solving linear systems, we have demonstrated a new paradigmfor adapting VQAs to a wholly classical architecture by simulating the quantum circuit componentwith a neural network.
There are a few natural points of expansion for this general area.
Firstly,the choice of using an RBM for the neural network component is not vital to the algorithm itself,and there are no theoretical or empirical guarantees that RBMs are best suited for this speciﬁc task:one could instead leverage the recent success of autoregressive neural network quantum states [11]or alternatively ﬂow-based modeling for inﬁnite-dimensional linear systems. Recent work in thisdirection indicates that it presents a scalable, practical alternative to RBMs [20].
Another possiblepoint of expansion would be to develop VQMC-based methods for performing other linear-algebraicoperations in high dimensions, such as SVD or QR decomposition, by constructing Monte Carloestimators based on recent developments in the VQA literature [2].
In addition to providing anongoing benchmark for assessing quantum computational advantage of VQAs, continued researchon VQA-inspired classical algorithms might provide valuable insight into the structure of quantumstates for which VQAs might yield quantum advantage
A AppendixA.1 Derivation of the Local Energy
Expanding ψ θ in the standard orthonormal basis, using anti-linearity in the ﬁrst argument gives
[Equation]
[Equation]
where prime in the second summation indicates restriction to the nonzero entries of ψ θ .
Dividing andmultiplying the summand by ψ θ ( x ) , one obtains the desired result:
[Equation]
[Equation]
A.2 Embeddings of Non-Hermitian Matrices
As demonstrated in [7], when presented with a non-Hermitian 2 n × 2 n matrix A , corresponding withan n -qubit state space, one can always embed A into a Hermitian matrix at the cost of one additionalqubit, yielding the following modiﬁed linear system,(cid:20) [Equation] [Equation] (cid:105)
[Equation]
(cid:20)
[Equation]
(cid:21) , whose solution is given by (cid:20)
A
[Equation]
| b (cid:105) (cid:21) .
A.3 Implementing VQMC
Input: Hamiltonian H , quantum state neural network ψ θ , batch size k , learning rate γ
Initialize θ while not done do
Obtain k samples x 1 , . . .
, x k from π θ for i = 1 , . . .
k do
Obtain ( Hψ θ )( x ) by multiplying the nonzero entries of row x of H with the corresponding entries of ψ θ , and summing the results
Compute local energy l θ ( x i )
Compute logarithmic gradients ∇ θ log | ψ θ ( x ) | using automatic differentiation end for
Estimate objective using sample mean
ˆ L ( θ ) = 1 k (cid:80) ki
=1 l θ ( x i )
Estimate gradient and Fisher information using sample mean ∇ ˆ L ( θ ) and covariance matrix
ˆ I ( θ )
Perform parameter update θ ← O PTIMIZER (cid:16) γ, θ, ∇ ˆ L, ˆ I (cid:17) end while
Algorithm 1 gives a succinct description of how VQMC may be implemented in practice.
One maymake a direct comparison between the high-level structures of VQMC and VQAs for Hamiltonianground state identiﬁcation.
The essential difference between the two that in VQMC we assume | ψ θ (cid:105)is a neural-network quantum state in the vein of what is described in section 2.2.
For example, givenan input x ∈ [2 n ] one can model ψ θ ( x ) by the output of a restricted Boltzmann machine (
It should be noted here that VQMC—and, by extension, VNLS—is network-agnostic.
Nothingin what follows will depend upon the use of RBMs, and there is good reason to consider moresophisticated architectures including autoregressive models, which are popular in natural languageprocessing.
A.4 VQLS Error Bound Discussion
Here we describe how the exact value of the objective function (7) informs us of the accuracy of the
VQLS, even when the loss value is nonzero.
The key idea behind this correspondence is given in [1],though there is a slight modiﬁcation that must be made to the result, which we note.
The primary method for assessing and bounding the error of the VQLS is by using the trace distancebetween two quantum states, which is given for two pure states | φ (cid:105) and | ψ (cid:105) by
[Equation]
A more general deﬁnition of trace distance is unnecessary for our purposes since our own VQLSinspired classical solver, the VNLS, does not model mixed quantum states, only pure ones.
Under theassumption that
||
A || ≤ 1 , it is stated in [1] that
[Equation]
(16) where κ is the condition number of A .
As discussed in section 4.1, scaling A by a positive constantc < 1 can make the right-hand side of (16) arbitrary small without actually changing the trace distancebetween the learned and true states, meaning this bound does not hold in its current form.
The discrepancy in the proof of this bound comes from an intermediate result taken from [15], whichstates that the smallest eigenvalue of the matrix A 2 , which equals || A || 2 κ 2 , is bounded below by [Equation]
[Equation]
when ||
A || ≤ 1 .
In this case, 1 κ 2 is actually an upper bound, not a lower one.
Adapting around thissmall error, we may still follow the rest of the argument given in [1] to obtain a new error bound,
[Equation]
which agrees with the scaling argument given above.
This new bound does not require any restrictionon
||
A || , and is equivalent to saying that the trace distance between | ψ θ (cid:105) and A − 1 | b (cid:105) is boundedabove by the product of (cid:112) L ( θ ) with the smallest singular value of A .
Alternately, since the VQLS ansatz | ψ θ (cid:105) and the true solution A − 1 | b (cid:105) correspond with a pair of purequantum states when normalized, an equivalent way of measuring the solver’s error would be throughusing the ﬁdelity between these two states, given here for two general states | ψ (cid:105) and | φ (cid:105) :
[Equation]
The ﬁdelity equals 1 if and only if one vector is a scalar multiple of the other, and 0 if the two vectorsare orthogonal.
The two measures are essentially equivalent for pure states; more speciﬁcally, we have that
[Equation]
(20) from which it follows that any upper bound on the trace distance corresponds uniquely with a lowerbound on the ﬁdelity; thus the bound given in (18) could be used in either case.
A.5 Ising-Inspired VQLS Problem Discussion
Here we give a more detailed description and analysis of the Ising-inspired VQLS problem from [1].
Given a qubit number n and a condition number κ , we consider the matrix
[Equation]
where X j and Z j refer to the Pauli- X and Pauli- Z operators applied locally to qubit j , and ζ and ηare chosen so that A has largest eigenvalue 1 and smallest eigenvalue 1 κ .
The vector | b (cid:105) is taken to bethe equal superposition state on n qubits given by
[Equation]
We observe that while A is surely not the identity matrix, it does behave similarly to the identitywhen applied to | b (cid:105) for nontrivial problem sizes.
We ﬁrst note that for a given problem size n andcondition number κ , we may take coefﬁcients
[Equation]
This choice is based on a heuristic observation that the largest and smallest eigenvalues of
[Equation]
[Equation]
are approximately n and − n , in cases for which the qubit number is small enough that theseeigenvalues can be easily computed numerically.
The vector [ 1 1 ] T is an eigenvector of the matrix X with eigenvalue 1 , meaning that applying Xlocally to any one of the n qubits does not change the system state | b (cid:105) .
Thus | b (cid:105) is an eigenvector of 443 (cid:80) nj =1 X j with eigenvalue n .
It follows that the matrix A perturbs | b (cid:105) in the following way:
[Equation]
It follows that A , when applied to | b (cid:105) , will perturb each entry of | b (cid:105) by at most 2 − n 2 (0 . 05) , anexplanation for which is given in section A.6 of the appendix.
Just as A perturbs the vector | b (cid:105) , it appears that A − 1 acts on | b (cid:105) in a similar manner.
Experimentally,we have found that for problem sizes of at least ﬁve qubits, the ﬁdelity between | b (cid:105) and A − 1 | b (cid:105) issigniﬁcantly close to 1.
Figure 3 demonstrates that this ﬁdelity grows larger with problem size, andthat this trend persists even as the condition number κ increases.
Seeking to explain this phenomenon, we examine the Euclidean distance between | b (cid:105) and A − 1 | b (cid:105) .
We observe that
[Equation]
26) for which a proof is also given in A.6.
While it is possible that this upper bound is not tight, it isnonetheless clear that for a ﬁxed choice of κ , the vectors | b (cid:105) and A − 1 | b (cid:105) become indistinguishableby the VQLS and the VNLS as the qubit number becomes arbitrarily large.
Figure 3 demonstratesthis phenomenon in practice.
A.6 Correspondence between Target and Solution States for Ising-Inspired VQLS Problem
We recall equation 25, which states for the Ising-inspired VQLS problem that
[Equation]
We now show how exactly the local Z term in 25 perturbs the entries of | b (cid:105) .
The Z -matrix maps[1 1] T to [1 − 1] T , so for each i = 0 , . . .
, n − 1 , applying Z locally to qubits i and i + 1 convertsthe state | b (cid:105) into
[Equation]
[Equation] By exploiting the structure of the Kronecker product in exactly the same manner as is done in A.9, wemay calculate speciﬁc coordinates of Z j Z j +1 | b (cid:105) as follows: consider entry x ∈ (cid:8) 0 , 1 , . .
, 2 n − 1 (cid:9) of
Z j Z j +1 | b (cid:105) , represented in binary by ( x 1 , . . .
, x n ) .
The value of entry x equals 2 − n 2 multiplied bythe product, taken over all k = 1 , . . .
, n qubits, of entry x k of either [1 1] T or [1 − 1] T , dependingon whether or not k ∈ { j, j + 1 } .
Thus we may observe that entry x of Z j Z j +1 | b (cid:105) equals 2 − n 2 if x j and x j +1 agree, and − 2 − n 2 ifthey do not.
Since (cid:80) n − 1 j =1 Z j Z j +1 iterates over every pair of consecutive qubits, it follows that entryx of (cid:80) n − 1 j =1 Z
j Z j +1 | b (cid:105) equals the difference, scaled by 2 − n 2 , between the number of consecutivebinary digits in ( x 1 , . . .
, x n ) with the same value, and the number of consecutive binary digits withopposing values.
It follows from (25) that applying A to | b (cid:105) perturbs each entry of | b (cid:105) by at most2 − n 2 (0 . 05) .
We now show the effect of A − 1 on | b (cid:105) .
We observe that the square of the Euclidean distance between
A − 1 | b (cid:105) and | b (cid:105) may be bounded above as follows:
[Equation]
[Table]
[Equation]
Equation 29 follows from the line preceding it by the fact that the local Z -operator is Hermitian.
To complete the bound, we ﬁx any j, k ∈ { 1 , . . .
, n − 1 } and consider the inner product(cid:104) b | Z j +1 Z j Z k Z k +1 b (cid:105) .
Since | b (cid:105) is the tensor product of n copies of the vector 2 − 12 [1 1] T , and theoperator Z j +1 Z j Z k Z k +1 acts locally on | b (cid:105) , it follows that we may decompose the inner product into
[Equation]
[Equation]
where for each (cid:96) the local operator O (cid:96) is given by
[Equation]
I if (cid:96) does not equal any of j, j + 1 , k, k +
Z if (cid:96) equals exactly one of j, j + 1 , k, k +
Z
= I if (cid:96) equals both one of j, j + 1 and one of k, k + 1 .
Since the products
[Equation]
and [
[Equation]
(32) it follows from (30) that (cid:104) b | Z j +1 Z j Z k Z k +1 b (cid:105) equals 1 if j = k and 0 otherwise.
Therefore we havefrom (29) that
[Equation]
A.7 VNLS Objective Derivation
Evaluating the VQMC objective for this speciﬁc choice of H one ﬁnds
[Equation]
[Equation]
[Equation]
[Equation]
By similar manipulations as in section 2.3, we ﬁnd that the VNLS objective function takes theprobabilistic form
[Equation]
where the local energy is
[Equation]
where the distribution β is deﬁned by β ( x ) = | b ( x ) | 2 / (cid:104) b | b (cid:105) .
Algorithm 2 demonstrates the VNLS infull, highlighting its similarities and differences with traditional VQMC.
A.8 Equivalency of VNLS Problems Under Scaling
We demonstrate here how the scaling of a VNLS problem, as described in section 4.1, has nomeaningful effect on the ability of VNLS to solve it using SR.
Algorithm
Input: Matrix A , vector | b (cid:105) , quantum state neural network ψ θ , batch size k , learning rate γ
Initialize θ while not done do
Obtain k samples x 1 , . . .
, x k from π θ and x (cid:48) 1 , . . .
, x (cid:48) k from β for i = 1 , . .
k do
Calculate ( Aψ θ )( x (cid:48) i ) b
( x (cid:48) i ) end for
Estimate expected value w.r.t.
β using 1 k (cid:80) ki
=
( Aψ θ )( x (cid:48) i )
b ( x (cid:48) i ) for i
= 1 , . .
k do
Obtain ( A 2 ψ θ )( x ) by multiplying nonzero entries of row x of A 2 with the corresponding entries of | ψ θ (cid:105) , summing the results
Do the same for ( Ab )( x )
Construct local energy ˆ l θ ( x i ) estimate
Compute logarithmic gradients ∇ θ log | ψ θ ( x ) | using automatic differentiation end for
Estimate objective using sample mean
ˆ L ( θ ) = 1 k (cid:80) ki
=1 ˆ l θ ( x i )
Estimate gradient and Fisher information using sample mean ∇ ˆ L ( θ ) and covariance
ˆ I ( θ )
Perform parameter update θ ← O PTIMIZER (cid:16) γ, θ, ∇ ˆ L, ˆ I (cid:17) end while
Recalling that the goal of VNLS is to ﬁnd, for a given Hermitian matrix A and vector | b (cid:105) , anunnormalized vector | x (cid:105) such that A | x (cid:105) is proportional to | b (cid:105) , we observe that if A | x (cid:105) ∝ | b (cid:105) , then c 1 A | x (cid:105) ∝ c 2 | b (cid:105) (39) for any pair of nonzero scalars c 1 and c 2 . For this reason, the solution set of any VNLS problem isinvariant under scaling of both A and | b (cid:105) .
In practice, one may consider that scaling either A or | b (cid:105) bysome positive value might improve the learning process in some cases, but we ﬁnd that careful scalingof A or | b (cid:105) yields no unique advantage for VNLS performance under stochastic reconﬁguration.
In particular, we ﬁnd that keeping A , θ , and x ﬁxed, scaling | b (cid:105) by any positive constant c does notchange the VNLS objective L ( θ ) or its gradient.
Similarly, keeping | b (cid:105) , θ , and x ﬁxed, scaling A byany positive constant c changes the objective L ( θ ) and its gradient ∇ L ( θ ) to c 2 L ( θ ) and c 2 ∇ L ( θ ) ,which we now explain.
For a given VNLS problem { A, | b (cid:105)} and parameterized, unnormalized quantum state | ψ θ (cid:105) , we recallfrom (11) that the local energy of the VNLS Hamiltonian at basis state x is given by
[Equation]
with the VNLS objective being the expected value of l θ ( x ) with respect to the distribution π θcorresponding with state | ψ θ (cid:105) .
Keeping A , θ , and x ﬁxed, we observe that replacing | b (cid:105) with c | b (cid:105) forany positive scalar c preserves the local energy:
[Equation]
[Equation]
This replacement also has no effect on the distribution β , and consequently scaling the vector b doesnot affect VNLS training in any way.
On the other hand, scaling A while holding | b (cid:105) , θ , and x ﬁxed does alter the local energy:
[Equation]
[Equation]
It follows that our objective L ( θ ) =
[Equation] ∼ π θ [ l θ ( x )] then becomes c 2 L ( θ ) , hence the gradient of ourobjective is replaced with c 2 ∇ L ( θ ) .
Under stochastic reconﬁguration, solving the VNLS problem { cA, | b (cid:105)} using learning rate γ is thentantamount to solving the original problem { A, | b (cid:105)} using learning rate c 2 γ , with the caveat that theobjective function is scaled by c 2 as well.
This latter change notwithstanding, scaling A does notaffect SR in any way that could not similarly be achieved by changing the learning rate.
A.9 Pauli Basis Decomposition of Hermitian Matrices
From this point onward we will treat the rows and columns of every matrix discussed as being indexedstarting from 0.
As discussed in section 4.1, we may decompose any 2 n × 2 n Hermitian matrix Ainto a linear combination A = (cid:88) i
[Equation]
n
[Equation]
{+(45) where each A i j is either the identity operator or one of the Pauli operators X = (cid:20) 01(cid:21) , Y = (cid:20) 
+}
− i i (cid:21) , and Z = (cid:20) 0 −(cid:21) .
Here the notation ⊗ refers to the Kronecker product
[Equation]
47) which may be applied recursively to produce each summand in A .
This exact decomposition of A is made possible by the fact that the four matrices I , X , Y , and Zform a basis for the real vector space of 2 × 2 Hermitian matrices.
The real vector space of 2 n × 2 n
Hermitian matrices comprises the tensor product of n instances of the 2 × 2 matrix space, for whichthe set of matrices of the form A 1 ⊗ · · · ⊗ A n —where A i ∈ { I, X, Y, Z } for every i —forms a basis.
In general, the number of terms comprising A is O (4 n ) ; we shall consider observables for which thenumber of terms is O ( n k ) for some (reasonably small) k .
We can impose the same constraint on thenumber of nonzero entries in b .
Any product of local Pauli operators
[Equation]
is represented by a 2 n × 2 n sparse matrix with exactly one nonzero entry in each row; this fact followsby induction on the number of factors n in c ( A 1 ⊗ · · · ⊗ A n ) , using the deﬁnition of the Kroneckerproduct in (47) alongside the fact that each of the 2 × 2 Pauli matrices—and the identity matrix—hasexactly one nonzero entry in each of its rows.
Given the index x of some row of c ( A 1 ⊗ · · · ⊗ A n ) , it is possible to ﬁnd the column index and valueof the corresponding nonzero entry in O ( n ) time.
The heart of this idea may be found in appendix Bof [4], and in equation 16 of [21].
If A comprises O ( n k ) terms in this local Pauli product form, thenfor each row of A we may ﬁnd the column indexes and values of all its nonzero entries in O ( n k +1 )time by simply looking at each term individually.
Since ( Aψ θ )( x ) equals the inner product of row
xof
A with ψ θ , placing this constraint on A ensures that we can always calculate the local energy of Aat any row in O ( n k +1 ) time.