Classically optimal variational quantum algorithms

Hybrid quantum-classical algorithms, such as variational quantum algorithms (VQA), are suitable for implementation on NISQ computers. In this Letter we expand an implicit step of VQAs: the classical pre-computation subroutine which can non-trivially use classical algorithms to simplify, transform, or specify problem instance-specific variational quantum circuits. In VQA there is a trade-off between quality of solution and difficulty of circuit construction and optimization. In one extreme, we find VQA for MAXCUT which are exact, but circuit design or variational optimization is NP-HARD. At the other extreme are low depth VQA, such as QAOA, with tractable circuit construction and optimization but poor approximation ratios. Combining these two we define the Spanning Tree QAOA (ST-QAOA) to solve MAXCUT, which uses an ansatz whose structure is derived from an approximate classical solution and achieves the same performance guarantee as the classical algorithm and hence can outperform QAOA at low depth. In general, we propose integrating these classical pre-computation subroutines into VQA to improve heuristic or guaranteed performance.

Today's noisy intermediate scale quantum computers (NISQ) are bounded in power by size, noise and decoherence [1].Do there exist implementable hybrid quantumclassical algorithms which outperform the best classical algorithms?Such an algorithm would exhibit quantum advantage, perhaps the most ambitious goal of the NISQ era.One class of algorithms which shows promise are Variational Quantum Algorithms (VQA) [2][3][4][5][6], which variationally optimize ansätze wavefunctions to extremize expectation values of objective functions.VQA construct a parameterized quantum circuit U ( α) in a classical pre-computation step (Fig. 1B), which is implemented on a NISQ device and optimized in an outer classical loop (Fig. 1C-D).
Classical no-free-lunch (NFL) theorems for optimization imply that algorithmic advantages rely on problem structure [7].Quantum NFL theorems for specific cases exist [8; 9], and for VQAs suggest that the ansatz should reflect problem structure, otherwise VQAs suffer from barren plateaus [10].How can the structure of the problem, form of classical algorithms, or approximate solutions, be used in the classical subroutines of VQA?
A problem might be simplified or reduced as in [11], or by exactly solving weakly connected parts of a MAXCUT graph as in [12].Alternatively, a problem might be mapped or transformed to one with better heuristics [13; 14].Classical insight may motivate the circuit structure as in the case of machine learning models [15; 16], or generate an analogous quantum version of a classical algorithm [17].
The coupled-cluster ansatz used in VQE [2] and the QAOA ansatz [3] reflect structure by including the terms of the objective function in the ansatz.Additionally, VQAs can use approximate classical solutions in their ansatz states using the concept of warm starts, which initialize the variational parameters with values known to mimic a good classical solution [18][19][20][21].If further variational optimization is possible, the VQA will improve upon the performance of the classical algorithm.In the worst case improvement may not be possible due to com- plexity theoretic constraints [22][23][24][25].
In this Letter, the warm start concept is generalized to construct problem instance-specific circuits instead of just choosing initial variational parameters that reproduce approximate solutions in a fixed ansatz circuit structure.We use the VQA pre-computation step (Fig. 1B) to generate problem instance-specific circuits that use problem structure from the form and solutions of classical algorithms as well as from the objective function.
While this pre-computation step is general, we focus on solving the particular problem of MAXCUT inspired by a particular classical algorithm, with the hope of inspiring other VQA algorithms with non-trivial pre-computation subroutines.We construct the Spanning Tree QAOA (ST-QAOA), a particular VQA to solve MAXCUT [26; 27].This algorithm uses approximate solutions from a classical MAXCUT solver as a subroutine to construct a problem instance-specific circuit with r rounds of gates.We show that r = 1 is guaranteed to match the performance of the classical solver, and r → ∞ approaches the exact result.
We introduce the ST-QAOA in a sequence of algorithms that illustrate the trade-offs between quality of solution and classical computational difficulty of the precomputation step.First, we introduce the Spanning Tree Algorithm, which can produce exact solutions at the expense that circuit generation is NP-HARD.Next, we introduce the Variational Spanning Tree Algorithm, which can produce optimal answers at the expense that variational optimization is NP-HARD.Finally, we introduce the ST-QAOA and present numerical evidence of its performance on random instances of 3-regular MAXCUT, demonstrating that ST-QAOA can always reproduces the performance of the classical algorithm it uses to construct its ansatz.
First, let us define the SIGNED MAXCUT problem and the structure of spanning trees, which will be the algorithmic insight for ST-QAOA.A signed graph Γ = (G, σ) [28] is constructed of graph G and signature for each edge σ = ±1.The goal of SIGNED MAXCUT is to find a bipartition of vertices {X, Y } (or binary string z labeling the bipartition) such that the maximal number of edges of Γ are satisfied (or "cut").An edge with a negative signature is satisfied if its vertices are in opposite partitions, and unsatisfied otherwise.MAXCUT is the specific case where the signature of every edge is negative.
SIGNED MAXCUT is closely related to balance in signed graphs [29].A signed graph is balanced ("bipartite") if there exists a bipartition of vertices such that every edge of Γ is satisfied [30].SIGNED MAXCUT is equivalent to the maximum balanced subgraph problem [31]: given some signed graph Γ, what is the minimal number of edges e which need be removed to make Γ\e balanced?Any solution z induces some subset of edges e which remain unsatisfied, so that Γ\e is balanced.An optimal solution z will remove the smallest number of unsatisfied edges e.
The bipartition z of a balanced graph can be found with a directed spanning tree, as follows [32].Given some balanced graph Γ\e, construct any spanning tree T with a unique path between each vertex.Starting with some arbitrary origin vertex, traverse the tree to assign each vertex to a bipartition.If the signature of an edge is (−), assign the next vertex in the path to the opposite partition as its parent, and the same if (+).This satisfies every edge of the spanning tree and, because the graph is balanced, every edge in the reduced balanced graph Γ\e.Any spanning tree over a balanced graph generates the satisfying bipartition z, as z is unique [33].Thus, the maximal bipartition z of graph Γ is equivalent to some choice of spanning tree T z .In this way, the search space of SIGNED MAXCUT solutions can be reduced to searching through the set of all possible spanning trees [34], as the optimal bipartition z is given by some particular spanning tree(s) T z over the signed graph Γ.
Given some signed graph Γ = (G, σ), the optimal bipartition of vertices is encoded in the maximal eigenstate of the objective function where each clause in the sum represents an edge of the graph, with eigenvalue +1 if the edge is satisfied and eigenvalue 0 if the edge is not satisfied, and σ ij the signature of the edge.The goal of any VQA is to optimize the expectation value of the objective function with an ansatz wavefunction.We write an ansatz circuit of r rounds in the general form: Note that r does not correspond to circuit depth.The circuit is constructed from a restricted set of generators H q ; for example, in QAOA, σ i z σ j z operators acting on all edges of a graph ij ∈ G, and σ i x operators acting on all vertices.The classical computers' challenge is specifying the circuit structure in (2) via the pre-computation step (Fig. 1B) and finding particular angles (Fig. 1D) which maximize the objective function.Optimal bitstring solutions may be read out by observing ψ|σ i z |ψ for each qubit and assigning the bitstring according to the measurement ±1.
We will now give exact VQA algorithms for MAXCUT.For the restricted generators of QAOA, eigenstates are cat states due to Z 2 symmetry and the ansatz wavefunction lies in the +1 sector, so an optimal state must have the particular form of a "cat state" [19] where z is the binary representation of the optimal MAXCUT solution, and z = ¬z.The ansatz of Eq. ( 2) can generate such states, and so VQA can be exact [19].
Consider the sequence of unitaries between two vertices This is the desired "cat state", up to a global phase.Changing the sign of σ z σ z generates the state (|11 + |00 )/ √ 2. In general, a unitary U ± ij written as a directed arrow between two vertices i j evolves an initially unentangled X product state into a maximally entangled Bell pair with either the same (+) or opposite (−) correlation.It is simple to generalize that products of these unitaries along a directed tree will generate Z cat states [19].For example, If these unitaries map to a directed spanning tree of G, they may prepare any eigenstate z of Eq. ( 3), by choosing signs U ± of each directed edge depending if the vertices are in the same (+) or opposite (−) partitions.These unitaries are Clifford: Eq. ( 4) is equivalent to a Hadamard on register 1, then a CNOT between registers 0 to 1.This is a unitary version of the spanning tree algorithm of [32], if one chooses the sign of each unitary to be the sign of the signature of its edge.Given some bipartition z and associated spanning tree T z , one can construct the state as an ordered product of these unitaries over directed edges (up to a global phase) Here, T denotes inverse path ordering of unitaries along the directed spanning tree T z , and σ ij is the signature of edge ij in signed graph Γ.Note that not every bipartition z may be constructed in this manner, as the spanning tree requires the reduced balanced subgraph Γ\e to be connected.We call this algorithm "Spanning Tree".
This algorithm is exact in the following case.As part of the pre-computation step, some classical algorithm finds the optimal partition z and an associated spanning tree T z .Then, implement the circuit of Eq. ( 7) to generate a maximal eigenstate of the objective function.However, this exactness comes at the cost that generating the sequence of gates is classically hard.The classical algorithm which creates the optimal circuit must first find the spanning tree(s) whose bipartition provides the solution to the SIGNED MAXCUT problem, which is known to be NP-HARD [35].This demonstrates a case in which their exist exact quantum circuits that provide solutions to hard problems, generating the circuit may itself be a hard problem classically.
The Spanning Tree algorithm can be made variational by allowing the unitaries of the directed edges of any spanning tree to be a function of angles The variational algorithm is as follows.For a signed graph Γ of N vertices, a classical algorithm generates a random spanning tree T and outputs a circuit which is a function of 2N − 2 angles where q indexes the edges of the tree, and T indicates the path ordering of unitaries along the randomly chosen directed spanning tree.We call this algorithm "Variational Spanning Tree" (VST).By Eq. ( 5), extremal values γ q ∈ ±π/4 and β q = π/4 can construct any state (|z + |z )/ √ 2. It is the job of a classical optimizer to optimize the angles and find N − 1 signs of γ p which construct the optimal state.However, this VST algorithm is classical.In the Heisenberg picture, expectation values of operators are where q index all of the edges of the spanning tree on the unique path between vertices i and j.Thus, the expectation value of the objective function for any graph may be computed classically.Bitstrings can also be efficiently sampled using tensor networks [36] by recursively contracting leaves of the spanning tree.Hence VST is purely classical and cannot exhibit any quantum advantage.Instead of generating the circuit being NP-HARD, the optimization itself is NP-HARD [37][38][39].Ultimately, this is because the optimization algorithm is a discrete search, finding N − 1 signs γ = ±π/4 or analogously the optimal bitstring z.VST demonstrates that while circuit generation may be easy, optimizing parameters in and of itself may be a hard problem classically.
It is reasonable to expect that if the number of variational parameters is constant in problem size, the optimization is more efficient.QAOA has this property [3] due to having a more constrained ansatz.Instead of choosing individual terms σ z σ z and σ x acting in serial, QAOA alternates between acting with the objective function C and a sum of Pauli σ x terms B. The number of variational angles is 2p, independent of problem size There has been much work on QAOA.The approximation ratio uniformly increases in p, with the p → ∞ limit converging to the exact state with an adiabatic schedule [3; 40].For large p, it has been observed that the optimal parameters exhibit concentration and become independent of graph instance [41], and optimal parameters for p can induce the parameters for p + 1 [42].These facts suggest that the classical optimization may be efficient.This comes at the cost that performance guarantees are combinatorially difficult to compute [3; 43], and to date QAOA has not outperformed the best classical algorithms [3; 43].QAOA can be contrasted with the FIG. 2. An example round of Spanning Tree QAOA.A classical algorithm computes some approximately optimal SIGNED MAXCUT solution by finding an appropriate spanning tree (left).A QAOA round alternates between σzσz unitaries on edges (red) and σx unitaries on vertices (blue).First, the complement unitary is applied, then the tree unitary, which mimics the directed tree graph via repeated application of σzσz and σx.This is repeated r times.For r = 1 this is guaranteed to match the performance of the classical algorithm, and for r → ∞ the approximation ratio approaches 1.
VQAs we define above, which can generate eigenstates of the objective function, including the maximal state, at expense of generating the gate set, or the optimization procedure, being NP-HARD.
We now propose a combination of the Spanning Tree algorithm and QAOA, which we call Spanning Tree QAOA (ST-QAOA).To avoid the difficulty of parameter optimization, the circuit optimizer will use a nonextensive number of variational parameters, like QAOA.To avoid the difficulty of circuit design, instead of finding the exact maximal spanning tree, the circuit construction will use an approximate solution from a classical MAXCUT solver to generate spanning trees.Finally, to mimic QAOA, the ansatz will repeat p times, and be able to reproduce QAOA as a special case.The ST-QAOA is as follows.
Given some signed graph Γ, a classical MAXCUT solver P outputs some bitstring P (Γ) = z and associated directed spanning tree T z with root vertex v [44].Next, partition the edges of the graph G into those in the spanning tree and its complement to define a ST-QAOA round An example of this circuit is shown in Fig. 2.This applies a unitary generated by the complement edges of the spanning tree, then the spanning tree unitary with some global angle.A ST-QAOA procedure repeats this unitary p times as a function of 3p variational parameters Like QAOA, this algorithm has a number of parameters independent of the problem size.Unlike QAOA, the ansatz depends on the approximate classical solution, and can generate extensive correlations even for r = 1.Such a circuit includes all terms in the objective function and mixing term, except reordered to include the structure of spanning trees, which allows the algorithm to include QAOA as a special case.Let us now inspect the performance of this algorithm.
For r = 1, ST-QAOA can return the bitstring z produced by the classical subroutine P .By choosing the angles γ c = 0, γ T = π/4, β = π/4, the unitary is equivalent to Eq. ( 7) for the particular choice of spanning tree generated by P , and so ST-QAOA can give the same solution as the classical subroutine.Therefore ST-QAOA has the same performance guarantee as its classical subroutine.
For r = 2, it is possible to reproduce a round of QAOA.Given QAOA angles γ * and β * , for the first round, choose angles γ c = γ T = γ * , and β = 0.For the second round, choose angles γ c = γ T = 0 and β = β * .The first round of unitaries is equivalent to the unitary generated by the objective function, as each σ z σ z term commutes.The second round of unitaries is equivalent to the unitary generated by the mixing function for the same reason.Thus, the approximation ratio of level 2r ST-QAOA will always be at least that of level p QAOA.As p increases for QAOA, the approximation ratio increases, approaching 1 in the p → ∞ limit [3].Because the ST-QAOA includes QAOA as a special case, ST-QAOA will also approach the exact result as r → ∞.
ST-QAOA is a useful algorithm with which to interrogate the possibility of various forms of quantum advantage.Can ST-QAOA exceed the performance of the best classical algorithms for worst case graphs?This would be the case if further variational optimization is possible in ST-QAOA for all graphs when the best classical algorithm is used as a subroutine, and would represent quantum advantage.Such a case cannot be established numerically, and may not be possible due to complexity-theoretic constraints [22][23][24][25].A simpler question is whether, above some threshold value of r, there exist subsets of graphs for which ST-QAOA has strictly better performance.This is not quantum advantage, as it only shows improved performance relative to a particular algorithm for a subset of graphs, which imposes additional structure that could be exploited by another specialized classical or quantum algorithm.
To make a quantitative comparison of algorithms we use the performance ratio where C Q (Γ) is the optimized expectation value of the objective function for a VQA applied to the signed graph Γ, and C C (Γ) is the number of satisfied edges given an output from the competing classical algorithm P .A value B(Γ) > 1 indicates that the quantum algorithm can find better solutions than the classical algorithm for particular problem instance Γ.If B > 1 for graphs in some ensemble {Γ}, then the quantum algorithm has average case quantum advantage over its classical competitor, as the quantum algorithm can produce better solutions than the classical algorithm in at least some of the graphs.For the ST-QAOA, the worst case B(Γ) ≥ 1 for all graphs relative to the classical algorithm employed by ST-QAOA to generate the ansatz.As a numerical demonstration, we implement ST-QAOA on an ensemble of 3 regular graphs.We choose two classical algorithms to generate spanning trees.The first is that of Goemans and Williamson (GW) [45], which uses semidefinite programming to achieve an approximation ratio of at least 0.878 in general graphs, and 0.932 in 3-regular graphs [46].The second algorithm samples a random spanning tree and achieves an approximation ratio of 2/3(1 − 1/n) for a 3-regular graph with n-vertices [34].Numerical results for an ensemble of 250 3-regular graphs with 16 vertices are shown in Fig. 3.
Optimization used gradient ascent initialized from 100 random points in parameter space.From Fig. 3A, it is clear that B(Γ) ≥ 1 for ST-QAOA and that there exist graph instances for which the ST-QAOA exhibits advantage over its competing classical algorithm and performs better than QAOA.Figs.3C-D show that the average performance ratio B(Γ) ≥ 1 for all p as expected, indicating an average case advantage for the spanning tree algorithm over its classical subroutine.Fig 3B shows that care must be taken to ensure that the classical algorithm is also performing optimally by illustrating the convergence of average performance ratio to one with increased number of rounds of GW.This illustrates that careless use of classical algorithms can create the illusion of quantum advantage.
In this Letter, we have expanded VQA with problem instance-specific circuits pre-computed by a classical subroutine.We also highlight the computational complexity pitfalls which may arise from such constructions.One may design an algorithm whose circuit yields exact answers to MAXCUT, at the cost that the algorithm is NP-HARD, as exemplified by the spanning tree algorithm.Similarly, an algorithm which constructs the circuit may be simple at the cost that the variational optimization algorithm is NP-HARD, as exemplified by the variational spanning tree algorithm.The intermediate algorithm, the Spanning Tree QAOA, combines QAOA with the concept of spanning trees to improve approximate classical solutions.
However, the ST-QAOA requires the use of its competition as a subroutine to generate the circuit.In practice, any classical algorithm could integrate a similar scheme by running multiple algorithms in parallel and choosing the more optimal result, or use additional classical algorithms to improve the output of one classical algorithm.This is clear in Fig. 3B, when the optimal result among multiple GW queries is used as a classical solution.Because GW is randomized, the performance uniformly increases and removes any additional advantage from the ST-QAOA.Due to this subtlety, we make no claims of quantum advantage, even though the ST-QAOA can only increase the quality of solutions of its classical subroutine.
While we focus on the problem MAXCUT using the concept of spanning trees, the pre-computation step is more general.Using these ideas, constructing VQAs which take advantage of the pre-computation step to non-trivially generate problem instance-specific circuits may improve heuristic and guaranteed performance on the limited quantum resources of today's NISQ devices.

FIG. 1 .
FIG.1.A pictorial representation of a variational quantum algorithm.Given some problem instance (A), a classical subroutine (B) tailors a problem instance-specific circuit, by including problem structure, simplifying or transforming the problem, or using results and structure of classical algorithms.The circuit is run by a near term quantum machine (C) and variational parameters are optimized via repeated query of a classical optimizer (D).
≥ 1 for p ≥ 1. (B) plots the average performance ratio vs. the number of repetitions of the GW algorithm.As GW is a randomized algorithm, repeated sampling uniformly increases its performance, and the performance ratio appears to converge to 1 from above.(C,D) plots the average performance ratio over the ensemble vs. the random spanning tree (C) and Goemans Williamson (D) algorithms.QAOA has advantage over the random algorithm (black dashed) with p ≥ 3 and advantage over ST-QAOA with the random algorithm for p ≥ 5.