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

Add qjit-ted "Symmetry-invariant quantum machine learning force fields" demo #1392

Closed
wants to merge 2 commits into from

Conversation

paul0403
Copy link
Contributor

Context:
As part of Catalyst's work on identifying 10 demos to compile with catalyst, we convert "Symmetry-invariant quantum machine learning force fields", a machine learning workflow that calls a training step function repeatedly and thus can have significant performance boosts with catalyst compilation.

Description of the Change:
Convert the demo to use qjit instead of jax.jit

Benefits:
Demonstration of qjit advantage

Possible Drawbacks:
Because lightning does not support differentiation through QubitUnitary, we have to resort to finite difference method for gradients, which brings a big performance degradation.

Related GitHub Issues:
[sc-72938]

@paul0403
Copy link
Contributor Author

paul0403 commented Dec 18, 2024

To me here are the possible paths forward:

(a) make lightning work with differentiating through qubit unitary (will take a bit of time)
(b) decompose qubit unitary into "standard" gateset, although unsure whether this decomposition itself can be jitted or not
(c) decrease the batch size and the number of traning steps so the demo can finish running in a reasonable amount of time

Personally, (c) makes the most sense for me at this stage.

Comment on lines +488 to +490
num_batches = 200 # 5000 # number of optimization steps
batch_size = 5 # 256 # number of training data per batch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This smaller-sized run can finish in a reasonable amount of time (around 5 minutes)

Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md on your branch with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@josh146
Copy link
Member

josh146 commented Dec 18, 2024

@paul0403 I recommend not adding the demo here -- I am in the process of moving all demos out of the Catalyst docs and into pennylane.ai/qml, to ensure that:

  • We have them in a single place to ensure that they stay up to date
  • In the QML repo, they are tested for accuracy regularly through integration tests

@paul0403
Copy link
Contributor Author

I am in the process of moving all demos out of the Catalyst docs and into pennylane.ai/qml

I was not aware of this! Thanks for letting me know!

@dime10 dime10 closed this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants