3
$\begingroup$

I was recently reading through the tutorial on the Cirq documentation about creating variational quantum algorithms, and I came to the section on ansatz preparation. The way that the ansatz is constructed in the tutorial is:

  1. Apply an XPowGate for the same parameter for all qubits. This is the method we have written above.
  2. Apply a ZPowGate for the same parameter for all qubits where the transverse field term h is +1.
  3. Apply a CZPowGate for the same parameter between all qubits where the coupling field term J is +1. If the field is -1 apply CZPowGate conjugated by X gates on all qubits.

Now, I know that there is no single, consistent way to construct an ansatz, but I was wondering, how exactly was this ansatz arrived at, and how do we know that it is correct? The reason I ask this is because I was curious, and I changed the ZPow gate to an XPow gate, and got radically different results for the minimized energy.

$\endgroup$
5
$\begingroup$

Take a look again at the Hamiltonian, which is $$ H = \sum_{\langle i, j \rangle} J_{i j} Z_i Z_j + \sum_{i} h_i Z_i $$ Then notice that ZPowGate is generated by the the Pauli Z operator, and CZPowGate is equivalent to an operator generated by $Z \otimes Z$ up to single-qubit rotations. The idea is that Step 2 of the ansatz corresponds to applying a pulse generated by the term on the right-hand side, and Step 3 corresponds to applying a pulse generated by the term on the left-hand side. Applying pulse sequences generated by terms of the Hamiltonian of interest is a common motivation for ansatz choice (see here, here, or here for papers that use this principle).

Step 1 of the ansatz is included as a gate generated by a term which does not commute with the other terms. Without such a gate, multiple steps of the ansatz could just be collapsed together and the ansatz would not be very interesting.

An alternative view of why it makes sense to include Step 1, and this kind of ansatz more generally, is explained in Section VI of the QAOA paper. The idea is motivated by quantum computation by adiabatic evolution. In such a computation, one prepares the ground state of an easy Hamiltonian, which in this case would be $$ B = \sum_{i} X_i $$ and evolve under the time-dependent Hamiltonian $$ G(t) = (1 - \frac{t}{T} B) + \frac{t}{T} H $$ for some total evolution time $T$. It turns out that a large enough evolution time $T$ will guarantee that the system ends up in the ground state of $H$. If you discretize this time evolution, you will get a bunch of time-steps which are like the ansatz: each time step has a gate generated by X on each qubit, and then gates generated by terms of the Hamiltonian. The idea then is to fix the number of time steps and then take the angles of the individual gates to be variational parameters. For a large enough number of ansatz steps, there will certainly be some choice of angles that gives the ground state, but the hope is that a small number of ansatz steps will suffice.

$\endgroup$
  • $\begingroup$ Thank you for your answer! I was just wondering, about the initial Hamiltonian, why we are able to chose a Z-rotation for both terms? In the tutorial, we start off with the Ising model, which has spin configurations of +1/-1, but why are we able to accurately map this to a problem that can be run on a quantum computer by replacing the +1/-1 spin values with Z-rotations? $\endgroup$ – Jack Ceroni Feb 28 at 3:29
  • $\begingroup$ Classically, each spin can be +1 or -1. There are $2^n$ possible spin configurations, where $n$ is the number of spins. Each configuration is assigned a scalar energy value according to the energy function. When mapping this problem to a quantum problem, the energy function is replaced with a Hamiltonian, and the values of the energy function correspond to eigenvalues of the Hamiltonian. It turns out that replacing each spin variable with a Pauli Z operator accomplishes exactly this mapping, with computational basis vectors being the eigenvectors. $\endgroup$ – Kevin Sung Feb 28 at 17:33
  • $\begingroup$ How can we extract the hyperplane corresponding to the network of this system that one is taking the gradient at every step to find the hyperparameters that satisfy the loss function condition? $\endgroup$ – Enrique Segura Apr 14 at 19:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.