# How are the parameters in a variational circuit optimized?

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 ?

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.

• Thank you. Do you have any documents showing how it's applied on models ?
– Duen
Feb 21 at 15:03
• 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}$$ Feb 21 at 19:09

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.

• 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 ?
– Duen
Feb 17 at 20:40