Qarameterized circuits: Quantum parameters for QML

Evan Peters, University of Waterloo, Institute for Quantum Computing, Fermilab Quantum Institute
Prasanth Shyamsundar, Fermi National Accelerator Laboratory, Fermilab Quantum Institute

This project is a submission to the QHack Open Hackathon 2021.
Team Name: PhaseliciousDeinonyqus ($\varphi$🦕)

GitHub repository: https://github.com/peterse/groveropt


So you want to train your quantum circuit but you're tired of optimizing everything classically...?

Variational quantum circuits are the foundation of many near term quantum algorithms, from quantum chemistry to quantum machine learning. The applications span from drug discovery 💊 to particle physics ☢ to quantitative finance 🤑 and beyond!. In most of these applications, parameters are optimized by using the quantum quantum circuit to compute a cost function for some initial choice of parameters, and then updating these parameters using a classical optimizer running in lockstep with the quantum circuits.

In this project we introduce Quantum-parameterized (Qarameterized) circuits for the optimization of variational circuits, which turns the power of a quantum circuit back towards itself to boost optimization!


Background

Training a parameterized quantum circuit requires that we find some set of classical angles $\theta$ that correspond to the extremum of an observable. For some parameterized circuit $U(\theta)$ with parameters $\theta$, our goal is usually to find parameters that minimize the value of some observable quantity $H$, that is

$$ \underset{\theta}{\operatorname{argmin}} \, \langle 0 | U(\theta) H U^\dagger (\theta)|0\rangle $$

However, if we construct a modified observable $H_Q$ that's accessible in quantum space and we upload our parameter values into quantum states $|\theta\rangle$, then we can rephrase this as a quantum parameterization problem:

$$ \underset{|\theta\rangle}{\operatorname{argmin}} \, \langle \theta | H_Q |\theta\rangle $$

Our technique to achieving quantum parameterization is summarized in the following animation:

...Now lets find out how this works!


1. What is a Qarameterized circuit?

A Qarameterized circuit is a variational circuit that is parameterized by control quantum registers (possibly in addition to classical free parameters). Quantum parameterization has been proposed previously, for example (Verdon, 2018) and (Shyamsundar, 2021), but our algorithm improves the probability of finding circuit optima using a gradient-free technique.

In order to apply this optimization technique we prepare the circuit by "lifting" each parameter into quantum state space:




2. Why use a Qarameterized Circuit?

...Superposition!

The main advantage of using quantum parameters is that they can exist in a superposition of the computational basis states. This opens up the possibility of finding good/optimal states for the quantum parameters in a manifestly quantum manner.

Oracles to evaluate the states of the quantum parameters

In order to optimize the values of parameters, classical or quantum, we need a way to evaluate the parameter values (or states). In order to leverage the superposition aspect of Qarameterized circuits discussed above, we need to coherently evaluate the states of the quantum parameters. Similar to Grover's algorithm, we need to construct an oracle to apply a state-dependent phase to the quantum parameters.

In this project, we set the goal of the optimization is to find train the variational circuit to produce the all-zeros bitstring (similar to the Pennylane Barren Plateus Tutorial](https://pennylane.ai/qml/demos/tutorial_barren_plateaus.html ). We created an oracle which evaluates the quantum parameters based on the following score function: $$\mathrm{score} = \Big|\big\langle\psi(\theta_\mathrm{quant})\big|0\big\rangle\Big|^2$$

For more information about this implementation, check out the notebook more_detailed.ipynb in our GitHub repository.


3. Training Qarameterized circuits using amplitude amplification

(Shyamsundar, 2021) introduces the non-boolean amplitude amplification algorithm, which can preferentially amplify the states of the quantum parameters based on an objective function. Here we simply apply the algorithm to amplify the "good states" in the quantum control registers. Our algorithm queries the cost landscape for an observable $H$ for a superposition of choices of $|\theta\rangle$. Specifically, this happens in two steps:

  1. Construct a quantum oracle to coherently evaluate the state of the control registers, using $\exp (\pm i \pi H)$.

  2. Train the circuit using a modified version of Grover's algorithm, which preferentially amplifies the good states of $|\theta\rangle$ held in the control registers.


4. Measuring the quantum parameter

Finally, measuring the state of the control register after the amplification process will yield good states for the quantum parameters. This completes the manifestly-quantum, gradient-free training of our Qarameterized circuits!

🎉 🎉 🎉

Experiments

As a warm-up, we begin by creating a low-depth random variational circuit with two trainable parameters. The classical quantum circuit we used for this experiment is shown below, alongside its qarameterized counterpart that has been lifted to use quantum parameters.





We then used qarameterization to search the parameter space for the optimal choices of $(\theta_0, \theta_1)$. Since this circuit has only two trainable parameters we can easily visualize the score landscape for different values of the parameters compared to the probability that qarameterization samples a given choice of $(\theta_0, \theta_1)$.

Our simulated experiments produced two plots:





🔥🔥...The parameter probability landscape almost perfectly reproduces the cost landscape! 🔥🔥

Scaling it up

To put our algorithm to the test, we constructed and lifted a deeper 4-qubit circuit with four trainable parameters:





These kinds of circuits are quite powerful regardless of the single parameter per layer, for example being able to serve as universal function approximators (Schuld, 2020)! We used the Qarameterized circuit as an initializer for training an arbitrary cost function, and found that this technique greatly improved the initial cost of the circuit, allowing gradient-based optimizers to finish the job quickly and smoothly:




Outlook and Discussion

In this project we

  1. Constructed variational quantum circuits that are Qarameterized by quantum registers/parameters.
  2. Constructed an oracle to coherently evaluate the quantum curcuits (and hence the states of the quantum parameters) using a score/cost function.
  3. Trained the quantum parameters in a manifestly quantum manner, using the non-boolean amplitude amplification algorithm.

Our project offers several exciting possibilities for future work in quantum machine learning:

Alternative Qarameterized circuit architectures

In this project we started with a classically parameterized variational circuit and elevated the classical rotation angles to be quantum parameters. However, several other circuit architectures are possible for qarameterized circuits.

Since the circuit training doen't rely on computing gradients, the parameters need not correspond to rotation angles; they can simply be control registers for the various controlled operations in the circuits!

Quantum oracles for other score/cost functions

In this project we constructed an oracle for a simple score function, based on the inner-product of the circuit's output to a known target state, similar to the Pennylane Tutorial](https://pennylane.ai/qml/demos/tutorial_barren_plateaus.html )

Using the presciption in (Shyamsundar, 2021), we can create oracles for a number of tasks, including minimizing energies (VQE), training supervised classifiers, and learning on quantum simulations.

Gradient-free training

Since our circuit training paradigm doesn't rely on gradients, it could potentially alleviate the barren plateaus problem (McClean, 2018).

One approach: use the amplification-based training to find good initial paramater values for the classical gradient-based training algorithms.