Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Natural Gradient implementation #964

Draft
wants to merge 21 commits into
base: master
Choose a base branch
from
Draft

Conversation

WanderingMike
Copy link

Implementation of the Natural Gradient. First, the optimizer class has to be merged and only then will the tests run

Checklist:

  • Reviewers confirm new code works as expected.
  • Tests are passing.
  • Coverage does not decrease.
  • Documentation is updated.

@renatomello
Copy link
Contributor

renatomello commented Aug 3, 2023

I remember during one of the past Qibo meetings I made a suggestion to look into calculating the Fubini-Study metric tensor using a modified version of the Circuit.light_cone method.

I haven't tested anything but it seems to me it would be faster + introduce way less complexity to the underlying code, since it would not require a graph representation of the circuit.

Was that tested by anyone? @WanderingMike @MatteoRobbiati .

I'm asking because calculating this matrix is relevant not only here, but it could also be a function in the quantum_info module that calculates the Fisher information matrix in general, as it was requested in previous issues (e.g. #657)

@renatomello renatomello added documentation Improvements or additions to documentation enhancement New feature or request labels Aug 3, 2023
@WanderingMike
Copy link
Author

@renatomello I am currently trying to benchmark both methods to see if there is a big gap in performance. The big advantage with the graph method is that you don't need to build a new circuit for every gate that you're considering. You can go layer by layer through the circuit and calculate the variance directly on all qubits with the same circuit. This should in theory become advantageous if you have circuit sizes >> 1.

Sidenote: Also, from a high-level point-of-view, it might make sense to start looking at using graphs as a general method in the qibo backend, though this is a larger discussion to be had. It might be a better representation for large circuits

@scarrazza scarrazza added this to the Qibo 0.2.1 milestone Aug 11, 2023
@scarrazza scarrazza removed this from the Qibo 0.2.1 milestone Sep 25, 2023
@scarrazza scarrazza added this to the Qibo 0.2.2 milestone Oct 10, 2023
@scarrazza scarrazza modified the milestones: Qibo 0.2.2, Qibo 0.2.3 Nov 2, 2023
@renatomello
Copy link
Contributor

When this moves forward, I'd like to ask for the subroutine that calculates the Quantum Fisher Information / geometric tensor to be implemented inside the quantum_info module, maybe in quantum_info.metrics. I ask this because it is important on its own and necessary for other things.

@marekgluza
Copy link
Contributor

@renatomello and @scarrazza do you have some notes/docs on the gradient types that you are implementing? Is this linked to a larger feature request?

@derenliu (phd student of Pinaki Sengupta at NTU SG) will be looking at gradients from the geometrical perspective for the dbi model and @wrightjandrew and @MatteoRobbiati and @Sam-XiaoyueLi wanted to also look at gradients to optimize iterations.
Is there something that we can make use of for DBI?

We could use onboarding Deren as an occasion to add some notes to the docs and examples/tutorial notebooks. @jeongrak-son and @Ashwinie-Ghanesh are also interested in the theory so maybe could help add to notes

@renatomello renatomello marked this pull request as draft December 20, 2023 05:34
@renatomello renatomello removed their request for review February 16, 2024 06:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants