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 error mitigation batch transform #1813

Merged
merged 85 commits into from
Oct 29, 2021
Merged

Add error mitigation batch transform #1813

merged 85 commits into from
Oct 29, 2021

Conversation

trbromley
Copy link
Contributor

@trbromley trbromley commented Oct 27, 2021

Context:

Adds a mitigate_with_zne tape transform to implement error mitigation using ZNE and unitary folding.

Description of the Change:

Adds transforms.mitigate.mitigate_with_zne along with documentation and tests.

Benefits:

  • First version of error mitigation in PennyLane
  • Integrates with the mitiq library for folding and extrapolation support

Possible Drawbacks:

  • We are only implementing a very simple version of mitigation (ZNE + unitary folding). Though this seems ok for a first attempt, and anyone who wants to dig deeper should use the PL-mitiq integration available directly in mitiq.
  • Differentiability is not supported when using Mitiq as a backend.

@codecov
Copy link

codecov bot commented Oct 27, 2021

Codecov Report

Merging #1813 (dd90a50) into master (2b3566e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1813   +/-   ##
=======================================
  Coverage   98.96%   98.96%           
=======================================
  Files         217      218    +1     
  Lines       16337    16368   +31     
=======================================
+ Hits        16168    16199   +31     
  Misses        169      169           
Impacted Files Coverage Δ
pennylane/transforms/__init__.py 100.00% <100.00%> (ø)
pennylane/transforms/insert_ops.py 100.00% <100.00%> (ø)
pennylane/transforms/mitigate.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b3566e...dd90a50. Read the comment docs.

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.

Thanks @trbromley! Have left comments and suggestions, but a very nice PR

.github/workflows/tests.yml Outdated Show resolved Hide resolved
Comment on lines +109 to +110
The unmitigated circuit result is ``0.33652776`` while the ideal circuit result is
``0.23688169`` and we can hence see that mitigation has helped reduce our estimation error.
Copy link
Member

Choose a reason for hiding this comment

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

not required at all for merging! but it would be nice to see the unmitigated execution and ideal execution somewhere 😆 Note here though, would be too much for the entry example. Maybe a bigger example inside UsageDetails.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤔 How about we provide a link to the demo (when available)?

pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
pennylane/transforms/mitigate.py Show resolved Hide resolved
pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
Copy link
Contributor Author

@trbromley trbromley left a comment

Choose a reason for hiding this comment

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

Thanks @josh146

pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
Comment on lines +109 to +110
The unmitigated circuit result is ``0.33652776`` while the ideal circuit result is
``0.23688169`` and we can hence see that mitigation has helped reduce our estimation error.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤔 How about we provide a link to the demo (when available)?

pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
pennylane/transforms/mitigate.py Outdated Show resolved Hide resolved
@trbromley trbromley merged commit 394b46b into master Oct 29, 2021
@trbromley trbromley deleted the mitigate_transform branch October 29, 2021 19:54
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.

5 participants