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

ZNE demo using catalyst #1207

Open
wants to merge 48 commits into
base: master
Choose a base branch
from

Conversation

natestemen
Copy link

@natestemen natestemen commented Sep 5, 2024

Title: Digital Zero-Noise Extrapolation with Catalyst

Summary: A simple tutorial walking through how to use the latest features of Catalyst's implementation of ZNE.


If you are writing a demonstration, please answer these questions to facilitate the marketing process.

  • GOALS — Why are we working on this now?

    Promote the capabilities of Catalyst.

  • AUDIENCE — Who is this for?

    Quantum application scientists, and error mitigation researchers.

  • KEYWORDS — What words should be included in the marketing post?

    Error mitigation, JIT

  • Which of the following types of documentation is most similar to your file?
    (more details here)

  • Tutorial
  • Demo
  • How-to

@rmoyard rmoyard self-requested a review September 5, 2024 15:39
@josh146 josh146 marked this pull request as ready for review September 5, 2024 22:40
@josh146 josh146 changed the title ZNE demo using catalyst [Draft] ZNE demo using catalyst Sep 5, 2024
Copy link

@vprusso vprusso left a comment

Choose a reason for hiding this comment

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

I know this is still a WIP and some of the chunks I made comments are are block-commented out, so happy to take subsequent passes on this as it is developed!

1. an example quantum circuit to run
2. a way to execute circuits

The circuits we use here will be ..., and the method of execution will be a noisy simulation
Copy link

Choose a reason for hiding this comment

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

The circuits we use here will be ..., . Is the ellipsis a placeholder for types of circuits used?

Copy link
Author

Choose a reason for hiding this comment

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

Yup exactly! @cosenal is going to fill in some of the code, and I wasn't sure what he was changing the circuits too :)

demonstrations/tutorial_zne_catalyst.py Outdated Show resolved Hide resolved
demonstrations/tutorial_zne_catalyst.py Outdated Show resolved Hide resolved
print(mitigated_circuit())

##############################################################################
# But there's still a big unanswered question! _If I can do this all in PennyLane, what is Catalyst
Copy link

Choose a reason for hiding this comment

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

This is actually a great question and one that took me a while to thoroughly understand and appreciate!

natestemen and others added 12 commits September 7, 2024 08:59
Co-Authored-By: Vincent Russo <[email protected]>
------------------------------------------------------------------------------------------------------------

**Title:** How to implement VQD with PennyLane

**Summary:**

**Relevant references:**

**Possible Drawbacks:**

**Related GitHub Issues:**

----
If you are writing a demonstration, please answer these questions to
facilitate the marketing process.

* GOALS — Finding first excitation energy is necessary to model reaction


* AUDIENCE — Chemistry researchers, beginners in quantum computing.


* KEYWORDS — Quantum Chemistry


* Which of the following types of documentation is most similar to your
file?
(more details
[here](https://www.notion.so/xanaduai/Different-kinds-of-documentation-69200645fe59442991c71f9e7d8a77f8))
    
- [x] Tutorial
- [x] Demo
- [x] How-to

[sc-64060]

---------

Co-authored-by: Guillermo Alonso-Linaje <[email protected]>
Co-authored-by: soranjh <[email protected]>
Co-authored-by: Ivana Kurečić <[email protected]>
Co-authored-by: Ivana Kurečić <[email protected]>
…1184)

## Ticket
-
[sc-70154-update-qml-readme-to-highlight-image-standards](https://app.shortcut.com/xanaduai/story/70154/update-qml-readme-to-highlight-image-standards)

## Changes
- Add instructions to `README.md` about image standards to be followed
while writing demos this QML repository.
- Requirements sources from this
[doc](https://www.notion.so/xanaduai/Image-standards-for-web-projects-264c09e45a8941a597918b878a2f1a5e)
- Since QML is public & the notion doc is private (accessible by Xanadu
only) added the relevant standards in text form in the `README.md`

## Preview
-
https://github.com/PennyLaneAI/qml/blob/2e9da1bb2bef3cd8a2eb504459f686ab20b9ec0c/README.md
@cosenal
Copy link

cosenal commented Sep 19, 2024

@josh146 @dime10 @nathanshammah The tutorial is ready for review.
(I am not the owner of the PR, so I can't change the title, but please ignore the [Draft] label)

@natestemen natestemen changed the title [Draft] ZNE demo using catalyst ZNE demo using catalyst Sep 20, 2024
Copy link
Contributor

@ikurecic ikurecic left a comment

Choose a reason for hiding this comment

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

Thank you, @natestemen . I've left some comments and suggestions for non-technical aspects of the Demo. Please let me know if you have any questions or concerns.

After you take a look at these comments, we will still be missing @josh146 's approval, and then it will be ready for merging and we can coordinate the launch via Discord.

Comment on lines 5 to 10
"id": "alessandro_cosentino",
"affiliation": "Unitary Fund"
},
{
"id": "nate_stemen",
"affiliation": "Unitary Fund"
Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @cosenal and @natestemen ! We've actually had a recent update and your author info will get pulled from your pennylane.ai profiles instead of the repository files. That way you can update all the info independently, without making pull requests, and add additional links and other stuff.

Could you please alter this section as follows?

Suggested change
"id": "alessandro_cosentino",
"affiliation": "Unitary Fund"
},
{
"id": "nate_stemen",
"affiliation": "Unitary Fund"
"username": "username_here"
},
{
"username": "username_here"

You just go to pennylane.ai, create an account (if you don't have one already), and then set up your profile(s). The information that gets pulled is the picture, name, and headline, but please feel free to add anything else you'd like.

Please let me know if I can help.

Copy link

Choose a reason for hiding this comment

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

@ikurecic do we also remove the files in _static/authors then?

Copy link
Contributor

Choose a reason for hiding this comment

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

@cosenal , yes, you can remove those files.

Comment on lines +13 to +14
"dateOfPublication": "2024-09-09T00:00:00+00:00",
"dateOfLastModification": "2024-09-09T00:00:00+00:00",
Copy link
Contributor

Choose a reason for hiding this comment

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

tk

Comment on lines 21 to 30
"previewImages": [
{
"type": "thumbnail",
"uri": "/_static/demo_thumbnails/regular_demo_thumbnails/thumbnail_qrack_catalyst_integration.png"
},
{
"type": "large_thumbnail",
"uri": "/_static/demo_thumbnails/large_demo_thumbnails/thumbnail_large_qrack_catalyst_integration.png"
}
],
Copy link
Contributor

Choose a reason for hiding this comment

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

tk

demonstrations/tutorial_zne_catalyst.metadata.json Outdated Show resolved Hide resolved
demonstrations/tutorial_zne_catalyst.py Outdated Show resolved Hide resolved
demonstrations/tutorial_zne_catalyst.py Outdated Show resolved Hide resolved
Comment on lines 116 to 117
# The probability of error is specified by the value of the `noise` constructor argument (or
# the `QRACK_GATE_DEPOLARIZATION` environment variable).
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you mean this?

Suggested change
# The probability of error is specified by the value of the `noise` constructor argument (or
# the `QRACK_GATE_DEPOLARIZATION` environment variable).
# The probability of error is specified by the value of the ``noise`` constructor argument (or
# the ``QRACK_GATE_DEPOLARIZATION`` environment variable).

demonstrations/tutorial_zne_catalyst.py Outdated Show resolved Hide resolved
demonstrations/tutorial_zne_catalyst.py Outdated Show resolved Hide resolved
],
"seoDescription": "Digital Zero-Noise Extrapolation with Catalyst",
"doi": "",
"canonicalURL": "/qml/demos/tutorial_zne_catalyst",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"canonicalURL": "/qml/demos/tutorial_zne_catalyst",

Removing due to today's repository update.

# whenever the device of choice is not supported by Catalyst. To help,
# we conlcude with a landscape of the QEM techniques available on Pennylane.
#
# .. list-table::
Copy link
Contributor

Choose a reason for hiding this comment

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

The resultant table doesn't look super perfect in the preview, in case you want to tweak something with the widths? Or even use an image instead.
image

Copy link

Choose a reason for hiding this comment

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

Regarding this table, Romain mentioned on Discord that those zne functions in Catalyst are not yet differentiable. @rmoyard is that still the case? In which case, should I remove the checkmark from the Catalyst/Differentiable cell?

"previewImages": [
{
"type": "thumbnail",
"uri": "/_static/demo_thumbnails/regular_demo_thumbnails/thumbnail_qjit_compile_grovers_algorithm_with_catalyst.png"
Copy link

@cosenal cosenal Oct 9, 2024

Choose a reason for hiding this comment

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

@ikurecic are those thumbnails just placeholders?

Copy link
Contributor

Choose a reason for hiding this comment

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

@cosenal , whoops, I mistakenly put the wrong thumbnails in, thanks so much for noticing. I'll fix this now.

Copy link
Contributor

Choose a reason for hiding this comment

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

That should be fixed now. Thanks for the tip.

Comment on lines 274 to 279
##############################################################################
# About the authors
# -----------------
# .. include:: ../_static/authors/alessandro_cosentino.txt
#
# .. include:: ../_static/authors/nate_stemen.txt
Copy link
Author

Choose a reason for hiding this comment

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

@ikurecic should this stay here, or is this created as part of the build process now?

Copy link
Contributor

Choose a reason for hiding this comment

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

@natestemen You can remove it. It doesn't cause any trouble to keep it, but you can remove it.

Comment on lines 13 to 14
Using ZNE with PennyLane
------------------------
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to either rename this section (for example, 'Demo overview') or simply put in an image (the OGthumbnail at 70% width) instead of the section title?
It's quite a confusing structure for readers as it is right now.

Copy link

Choose a reason for hiding this comment

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

I agree, good suggestion. Done in bc166cf

Comment on lines +32 to +33
What is zero-noise extrapolation (ZNE)
-----------
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
What is zero-noise extrapolation (ZNE)
-----------
What is zero-noise extrapolation (ZNE)
--------------------------------------

Copy link
Member

@josh146 josh146 left a comment

Choose a reason for hiding this comment

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

Tutorial looks great 😍

Comment on lines +38 to +39
recommend reading the `Mitiq docs <https://mitiq.readthedocs.io/en/stable/guide/zne-5-theory.html>`_
and the references therein), let's first review what happens when using the protocol in practice.
Copy link
Member

Choose a reason for hiding this comment

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

nice!

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.

9 participants