QHack2021 icon indicating copy to clipboard operation
QHack2021 copied to clipboard

[ENTRY] Step globally, grad locally: circuit optimization with GRAFS

Open zerodynamics opened this issue 4 years ago • 2 comments

Team Name:

zer0dynamics

Project Description:

Gradient ascent in function space (GRAFS) [1] is an algorithm for optimal control synthesis that leverages functional expansions of control fields, and gradient-based optimization on the reduced parameter space formed by the coefficients of the expansion. This QHack project investigates whether the GRAFS method can be used to optimize quantum circuits of the type that instantiate variational algorithms for quantum machine learning. Quantum control generally works at the physical, analog layer of quantum computing to design a single or two-qubit gate with some desired properties, and as such, it's not immediately clear how it can be used with quantum circuits. It turns out to be possible, as this submission shows, by exploiting an expression of the chain-rule (Eq. 18 in [1]) that relates the local gradient (computed at each time slot) to the global gradient (expressed in terms of the coefficients of control expansion). Circuit parameterizations with respect to basis functions are global in the sense that all layers of the network are parameterized by the specification of the basis function coefficients.

Crucially for implementation, the parameter-shift rule for computing analytical gradients on quantum hardware can be used to obtain the local gradients which are then used to construct the global gradients on a classical computer. While each gradient calculation requires the same number of circuit evaluations as vanilla gradient descent, we find in simulations that the GRAFS method converges to the minimum with fewer iterations, and thus provides some resource savings.

Updates to [2]

We compare GRAFS with Quantum Natural Gradient Descent on a specific class of random circuits.

Investigates "digital" Walsh basis function and "smooth" Slepians.

GRAFS performs poorly on deeper circuits with a fixed learning rate, suggesting an adaptive method.

Good performance on deeper circuits was recovered with a learning rate determined by line search (at the cost of a more circuit evaluations) as implemented in Scipy's BFGS (though the natural gradient converges faster).

Barren Plateaus

A quick experiment investigating the cost landscape as we increase the number of qubits is shown in notebook [3] . There was hope that GRAFS would mitigate the problem a bit. As we learned in qhack, correlated circuit parameterizations should, in principle, exhibit gradients with greater variance (hence learnable). GRAFS global parameterizations are correlated by the nature of the basis functions used, however the correlations are across the layers, not the wires/qubits.

[1] D. Lucarelli https://arxiv.org/abs/1611.00188

Presentation:

[2] https://github.com/zerodynamics/pennylane/blob/master/IPYNB/GRAFS_QML.ipynb

[3] https://github.com/zerodynamics/pennylane/blob/master/IPYNB/GRAFS_BP.ipynb

Source code:

https://github.com/zerodynamics/pennylane

zerodynamics avatar Feb 26 '21 22:02 zerodynamics

Thanks for the submission! We hope you have enjoyed participating in QHack :smiley:

We will be assessing the entries and contacting the winners separately. Winners will be publicly announced sometime in the next month.

We will also be freezing the GitHub repo as we sort through the submitted projects, so you will not be able to update this submission.

co9olguy avatar Feb 26 '21 22:02 co9olguy

Thanks to all at Xanadu for the great event.

zerodynamics avatar Feb 26 '21 22:02 zerodynamics