-
-
Notifications
You must be signed in to change notification settings - Fork 166
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
Pauli Twirling (PT) User Guide #1848
Conversation
hi @Aaron-Robertson, if you add |
Codecov ReportAll modified lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1848 +/- ##
==========================================
+ Coverage 98.28% 98.31% +0.02%
==========================================
Files 86 86
Lines 4084 4084
==========================================
+ Hits 4014 4015 +1
+ Misses 70 69 -1
☔ View full report in Codecov by Sentry. |
Actually, I think there might be other cell execution issues. never mind! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see this filled out, @Aaron-Robertson !
My main concern is that the error-mitigated results displayed do not match the descriptions in the text, i.e. showing a worse result in the intro, and the low-level results not closely matching the results from execute_w_pt
.
The rest are minor wording suggestions.
docs/source/guide/pt-1-intro.md
Outdated
print(f"Error with mitigation (PT): {abs(ideal_value - mitigated_result) :.3}") | ||
``` | ||
|
||
Here we observe that the application of PT reduces the estimation error when compared |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately this doesn't seem to be the case in https://mitiq--1848.org.readthedocs.build/en/1848/guide/pt-1-intro.html .
At least part of the problem appears to be that there is no noise applied to obtain the "noisy" result.
docs/source/guide/pt-1-intro.md
Outdated
|
||
```{admonition} Note: | ||
PT is designed to mitigate the simple Markovian noise simulated in this example, | ||
but PT can still have a non-trivial effect on the final error, but it is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but PT can still have a non-trivial effect on the final error, but it is not | |
but PT can still have a non-trivial effect on the final error, although it is not |
docs/source/guide/pt-4-low-level.md
Outdated
Let's verify this fact: | ||
|
||
```{code-cell} ipython3 | ||
np.isclose( | ||
pt.execute_with_pt(circuit, executor), | ||
average, | ||
) | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the results displayed don't match the text- np.isclose
asserts False
, see https://mitiq--1848.org.readthedocs.build/en/1848/guide/pt-4-low-level.html .
@Aaron-Robertson, thanks this is a lot of useful documentation!
|
Thanks @andreamari @Misty-W!
Great point. I tried to capture aspects of it, but I'll be more explicit in calling it a noise transformation and/or tailoring technique. In this way, would it make sense to remove the expectation value examples from the PT section? Or simply state that the effect on the expectation value is as we would expect? |
We have the function Any option is good, as long as we don't give the wrong impression that PT mitigates noise. |
If the goal is to show pauli twirling works to tailor the noise, one option could be to look at the PTM (pauli transfer matrix) superoperator before & after. The discussion could be about how the off-diagonal terms are gone after pauli twirling. |
@Misty-W @Aaron-Robertson If we are moving past calculating an expectation value for pauli twirling, should we change |
I vote "yes"! |
@Aaron-Robertson Do you have any local changes for this PR? We changed the output of the twirling functions in #1977. I can take over from here and finish this PR as well. |
hi @purva-thakre and @Aaron-Robertson, I'm guessing this PR will probably need to go in the next release. Importantly, we've made good progress toward the pre-requisite of checking the PTM, and we can build up incrementally from there. |
Yep, the deadline for this one needs to be stretched to the next milestone. There were a few things outside the Pauli Twirling module that needed to be dealt with before tackling this PR. |
@Misty-W @Aaron-Robertson @andreamari @nathanshammah @natestemen Do either of you have access to the original images used in this PR? I need to make changes to them as the functions only tailor the noise with the new changes. If not, it's ok. I can create my own. |
It looks like an svg, so if you load it into inkscape (or similar), I believe you should be able to modify it? |
Never edited an svg before. I can give it a try. Thanks! |
1f0e8f6
to
905ca96
Compare
docs/source/guide/pt-1-intro.md
Outdated
Here, we observe that the application of the Pauli Twirling technique has kept the logic | ||
of the input circuit unchanged while introducing a combination of gates to twilred outputs. | ||
|
||
## Combine PT with ZNE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move Aaron's code here where the ideal expectation value is compared to the mitigated one.
b410504
to
6818ba8
Compare
Apparently the svg file for the PT workflow shows differently in some browsers, and in others it looks fine. If possible, it would be nice to fix this so that the text does not go beyond the image. Using |
Edit2: Looks like I have a bug. Apologies for the previous message! |
25ee6a2
to
9089e72
Compare
I suggest we merge this once all the tests pass and the new changes have been reviewed. I have created I think I need some more time on the PTM issue because there's either a bug in my code or my understanding of how Pauli Twirling is supposed to work is flawed. For some reason, I could see the magnitude of the off-diagonal terms in the PTM decrease but not go away completely. Either way, I need to work out the math first of what a CNOT and CZ does to the coefficients in a PTM. When I was discussing this problem with my adviser he pointed out Pauli Twirling single-qubits gates is straightforward as the twirling gate set is also in Edit: More on the non-local parts of a gate in |
304c58c
to
fe24627
Compare
fe24627
to
ff51d9f
Compare
@Misty-W This is ready to be merged on a tentative basis. There are warnings on every page of the user guide that the Pauli Twirling module is currently WIP. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved, with plan to update in the next milestone! Thanks for picking this up @purva-thakre!
Description
Fixes #1833
To-Dos before merging
License
Before opening the PR, please ensure you have completed the following where appropriate.