Closed Thommy257 closed 1 year ago
Hi everyone, please use the following notebook to test your optimiser. Please add it to the PR after you've ran it using your own optimiser (replacing SPSA). The notebook will need to be removed before merging, but it's important to visualise the performance first.
https://drive.google.com/file/d/1AT8q_crTWUFJ2hS2bNSrnc5T8WrinSnv/view?usp=share_link
Use jax==0.4.6
and jaxlib==0.4.6
. There is currently a problem with newer versions of jax.
Hi, is this issue still open. I have an implementation of CMA-ES optimizer. Is it of value for the project?
Hi @vivek-kumar9696, of course! Feel free to submit a PR, I'd be happy to have a look at it.
Hi @Thommy257 I would like to work on adding Rotosolve algorithm for unitary hack.
@RamAIbot Hi and thanks for your interest. Since there is already a PR open for Rotosolve (#93) , it might be better to work on some other gradient-free optimiser, see some alternatives in Issue #85. If you open a PR we would be happy to review.
Hi @Thommy257, how about designing an interface namely ScipyOptimizer
with which we can use Scipy's methods for optimization (scipy.optimise.minimise
)?
This is now completed. Thank you all for your work!
Task description
To enhance the performance of our quantum models, we are currently investigating new optimizers for lambeq. One promising candidate is the Rotosolve algorithm (Ostaszewski et al.). Rotosolve is a gradient-free optimizer that leverages the fact that the expectation value of circuit measurements are sinusoidal with respect to the circuit parameters. Hence, Rotosolve can find the optimal parameters without the need for calculating gradients, making it particularly well-suited for optimization in the context of variational quantum algorithms in the NISQ era.
Your task is to implement the Rotosolve algorithm in lambeq, using the
Optimizer
interface. The following steps can be used as a guideline:SPSAOptimizer
RotosolveOptimizer
which inherits fromOptimizer
.Notes
state_dict
andload_state_dict
methods.Optimizer
interface has an attribute calledgradient
. Although Rotosolve is gradient-free, you can use the attribute to store the parameter updates.Resources
Alternative
If you don't manage to implement and test the
RotosolveOptimizer
, you can also implement a different (gradient-free) optimizer of your choice. Some ideas areCOBYLA
,Nelder-Mead
,Conjugate-Gradient
...