# Do VQE and QAOA use the same Hamiltonian?

In this paper, it talks about the 2-local Hamiltonian in the form:

$$H = \sum_{(u,v)\in E} H_{uv} + \sum_{k \in v} H_k$$

It also says the Ising model, Heisenberg model, XY model and QAOA are in the same form.

In my understanding, 2-local Hamiltonian is a kind of Hamiltonian that interaction is realized only between 2 neighbor qubits (please correct me if I am wrong). I was wondering if VQE has the same form. I remembered that I saw somewhere that says QAOA can be seen as a special case of VQE. My question is, does VQE and QAOA use the same Hamiltonian or there are some differences depending on the specific problems? If they have the same Hamiltonian, the 2-local Hamiltonian case can also be applied to a VQE problem?

• What do you mean by same Hamiltonians? Both methods are used to solve various other Hamiltonians Aug 27 at 7:21

### 2-local forms

As I have seen the term, 2-local Hamiltonians are those Hamiltonians $$\hat H$$ which can be written as a sum of independent qubit operators $$\hat H = \sum_i \sum_j \hat O_{ij}$$, where each $$\hat O_{ij}$$ acts non-trivially only on two qubits $$i$$ and $$j$$. This is as opposed to a global Hamiltonian, whose terms may act on any number of qubits.

This definition is related to the system being studied and does not make reference to implementation details such as qubit architecture. Operators $$\hat O_{ij}$$ may appear for any pair of qubits, not only adjacent pairs.

###### A little more elaboration

We can decompose any Hermitian operator on $$n$$ qubits into a weighted sum of Pauli "words": $$\hat H = \sum_k c_k \hat P_k$$ where each $$\hat P_k$$ is a tensor product of $$n$$ Pauli operators or the identity matrix: $$\hat P_k\in\{I,X,Y,Z\}^{\otimes n}$$. An arbitrary global Hamiltonian will decompose into as many as $$4^n$$ terms. If however we are guaranteed $$k$$-locality, there will only be $${n \choose k}\cdot4^k\in O(n^k)$$ terms.

### QAOA vs VQE

QAOA is indeed a special case of VQE, but the two algorithms use the term "Hamiltonian" a bit differently. In VQE, a quantum circuit is parameterized to prepare an "ansatz", and those parameters are varied classically to optimize a cost-function, which can be written as the expectation value of a so-called "Hamiltonian". That is, in general VQE, the Hamiltonian has nothing to do with the quantum circuit; it simply tells you how to measure the qubits to calculate the cost-function you are trying to optimize.

On the other hand, in QAOA, a completely different "Hamiltonian" is converted into its unitary time-evolution operator: $$\hat U \equiv e^{-i\hat H t} \approx \prod_{i,j} e^{-i \hat O_{ij}t}$$ This unitary operator is applied as the quantum circuit, and the classical variation is essentially varying the Hamiltonian itself. I am not personally familiar with the details of QAOA, and I am hoping that comments may elaborate upon the nature of that variation, and explain QAOA's cost-function.

Each $$\hat U_{ij}=e^{-i\hat O_{ij}t}$$ ostensibly needs to act on an adjacent pair of qubits, such that if $$i$$ and $$j$$ are not already adjacent, one needs a series of SWAPs to permute the qubits until they are. As I understand from the abstract, the paper you reference considers the problem of re-ordering a list of operators $$\hat U_{ij}$$ involving arbitrary (non-adjacent) pairs so as to minimize the number of swaps required on a specific qubit architecture.

### 2-local forms in VQE

I think the previous section answers your question about whether QAOA and VQE use the same Hamiltonian (in short, no!), but there are a couple other related concepts to briefly mention.

In principle, VQE can work with any Hamiltonian at all, local or global. That said, one can more strictly bound certain algorithmic complexity measures more tightly if the Hamiltonian is guaranteed to be $$k$$-local, since the number of independent measurements required to obtain the expectation value of $$\hat H$$ scales more-or-less with the number of terms in the Hamiltonian decomposition (technically with the number of commuting groups those terms can be partitioned into).

A typical application of VQE considers electronic structure of molecules. These Hamiltonians usually include only two-body interactions, although this is merely for the sake of approximation. So when you write out the Hamiltonian as a sum of operators on molecular orbitals, it looks like the 2-local form you wrote in your question. However, properly mapping the orbitals onto qubits (eg. via the Jordan-Wigner or Bravyi-Kitaev transformations) ends up breaking the 2-local form. The actual number of terms in the Hamiltonian is still polynomially bounded, but it becomes harder to efficiently partition the terms into commuting measurement groups.

• Something more on QAOA which can be of interest: quantumcomputing.stackexchange.com/questions/14038/… Aug 27 at 5:56
• BTW, nice explanation of difference between QAOA and VQE. +1 Aug 27 at 5:56
• Thank you very much for the explanation! It's really clear. Could you elaborate more on local/global Hamiltonian? What's the difference? If I understand correctly, based on your answer, the method proposed in the paper cannot be applied to VQE, right? Thanks! Aug 27 at 7:33
• Thank you for the kind feedback. I elaborated a little in the first section on local vs. global Hamiltonians, and a couple sentences in the last section to tie that discussion together. And, right, the method in the paper is concerned with more efficiently implementing a specific type of quantum circuit, whereas in VQE, the quantum circuit is generally unspecified. Of course, if you happen to be implementing VQE with a quantum circuit that looks like simulating a 2-local Hamiltonian, you can certainly use the compilation technique in the paper. Aug 27 at 16:06
• Thanks for your answer! It helps a lot! Aug 30 at 8:52