qiskit-algorithms
qiskit-algorithms copied to clipboard
Adding a convergence threshold to VQD to filter non-sensible values
Summary
As mentioned here, some optimizers don't work well with shots-based samplers. This leads to VQD returning sometimes absurd values, as shown here.
This Pull Request adds a convergence_threshold
to VQD
to test whether the optimization converged well.
It also paves the road for adapting VQD to V2 primitives.
Details and comments
Changes that were made:
- a
convergence_threshold
parameter now tests whether the average fidelity of the $k$-th eigenstate w.r.t. the previously found eigenstates is larger than this threshold, indicating that not only the eigenvalue returned is likely to be false, but the next iterations won't make sense either. - if the
convergence_threshold
test passes,VQD
now returns $\left\langle\psi_k\middle|H\middle|\psi_k\right\rangle$ instead of $\left\langle\psi_k\middle|H\middle|\psi_k\right\rangle+\sum\limits_{i=1}^{k-1}\beta_i\left|\left\langle\psi_k\middle|\psi_i\right\rangle\right|^2$, which not only makes more sense, but also allows to get decent values even when using gradients-based optimizers such asSLSQP
. - the tutorial has been updated to use
COBYLA
and a value ofbetas
that are closer to real-world use cases. - the tests have been updated. In particular, the values of
betas
have been updated from 50 to 3. A too large value with shot noise made the optimizers focus solely on the fidelity part, forgetting about the energy part.