1
$\begingroup$

I'm quite new to QML and I don't understand how the parameters in a variational circuit are optimized. I read about the parameter shift rule but what happens after the gradient is calculated ? How do I know if I have to decrease or increase the parameters and how is it done ?

$\endgroup$

2 Answers 2

1
$\begingroup$

Variational algorithms are optimized just like classical machine learning algorithms; whether you want to add or subtract the gradient depends on whether you want to minimize or maximize your objective function. For example, VQE is naturally treated as a minimization problem, since the objective function is the energy level for some system for which you want the ground state (minimum). In this case, you want to subtract the gradient (times a learning rate) if you're doing gradient descent.

$\endgroup$
2
  • $\begingroup$ Thank you. Do you have any documents showing how it's applied on models ? $\endgroup$
    – Duen
    Feb 21 at 15:03
  • 1
    $\begingroup$ PennyLane has a really good tutorial on optimizing quantum circuits; the line params = opt.step(cost, params) is a single step of parameter optimization. For example, with gradient descent, it performs a single update $$ \theta_{i + 1} \leftarrow \theta_i - \alpha \nabla J_{\theta_i} $$ $\endgroup$
    – Cody Wang
    Feb 21 at 19:09
0
$\begingroup$

If you're talking about algorithms like VQE, optimization is usually done on a classical computer with classical algorithms. Only the objective function is quantum.

Some good classical algorithms to try are Gradient Descent, Sequential Least Squares Programming (SLSQP) and the Constrained Optimization by Linear Approximation (COBYLA), with trade-offs for each one.

$\endgroup$
1
  • $\begingroup$ I meant, what is the full process once the quantum part gives a result ? Do you have some reference showing step by step how the updates of the parameters is done ? $\endgroup$
    – Duen
    Feb 17 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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