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 56 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
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!

pyproject.toml Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
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.

Thanks @cosenal and @natestemen , I have left just a couple of minor suggestions, and I will check in with you about the timeline.

leveraging JIT compilation through Catalyst.

.. image:: ../_static/demo_thumbnails/regular_demo_thumbnails/thumbnail_zne_catalyst.png
:width: 65%
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
:width: 65%
:width: 70%

To fit the intended design.

Digital zero-noise extrapolation with Catalyst
==============================================

In this tutorial, you will learn how to use error mitigation, and in particular
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
In this tutorial, you will learn how to use error mitigation, and in particular
In this tutorial, you will learn how to use :doc:`error mitigation <tutorial_error_mitigation>`, and in particular

This is just a suggestion.

Comment on lines +2 to +3
Digital zero-noise extrapolation with 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
Digital zero-noise extrapolation with Catalyst
==============================================
Digital zero-noise extrapolation (ZNE) with Catalyst
====================================================


ZNE in particular is also offered out of the box in PennyLane as a *differentiable* error mitigation technique,
for usage in combination with variational workflows. More on this in the tutorial
:doc:`Differentiating quantum error mitigation transforms <tutorial_diffable-mitigation>`.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would you want to add this as a related Demo, as well?

"title": "Digital zero-noise extrapolation with Catalyst",
"authors": [
{
"username": "cosenal"
Copy link
Contributor

Choose a reason for hiding this comment

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

@cosenal , if you add a Headline to your profile, it will also show up in the author bio summary under the Demo.

results by running circuits at varying noise levels and extrapolating back to a hypothetical
zero-noise case. While this tutorial won't delve into the theory behind ZNE in detail (for which we
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
Contributor

Choose a reason for hiding this comment

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

Suggested change
and the references therein), let's first review what happens when using the protocol in practice.
and the references therein), let's first review what happens when using the protocol in practice, in three stages.

Could we set the expectations like this or in a similar way? As a first-time reader, the structure confused me a bit.

zero-noise case. While this tutorial won't delve into the theory behind ZNE in detail (for which we
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
Contributor

Choose a reason for hiding this comment

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

I think this is a great way to explain the steps, but I'm a bit confused by how these three stages related to the following sections. Could we maybe align those two a bit better? Even if you just refer to specific stages within the text/code, that would already be valuable.

---------------------------

The first step for demoing an error mitigation routine is to define a circuit.
Here we build a simple mirror circuit starting off a unitary 2-design.
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
Here we build a simple mirror circuit starting off a unitary 2-design.
Here we build a simple mirror circuit starting off a `unitary 2-design <https://en.wikipedia.org/wiki/Quantum_t-design>`__.

Let's include a web reference.

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.

10 participants