unitaryfund / mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.
https://mitiq.readthedocs.io
GNU General Public License v3.0
344 stars 145 forks source link

Example stacking DDD and ZNE #2345

Closed jordandsullivan closed 1 month ago

jordandsullivan commented 2 months ago

Description

Tutorial to combine ZNE and DDD.


License

Before opening the PR, please ensure you have completed the following where appropriate.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.22%. Comparing base (2ff8134) to head (b70e53f). Report is 4 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #2345 +/- ## ======================================= Coverage 98.22% 98.22% ======================================= Files 87 87 Lines 4059 4059 ======================================= Hits 3987 3987 Misses 72 72 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

nathanshammah commented 1 month ago

Thanks @jordandsullivan. To solve the issue that the notebook doesn't render in the documentation, you just need to add it to the TOC tree in the examples file. Eventually we use md files, but as a temporary file, it should work fine also with .ipynb format. The jupytext extension allows you to edit the md file as a notebook.

nathanshammah commented 1 month ago

My suggestion is that the executor should be only called by ZNE. The DD part is a "pre-processing", with input the initial circuit (e.g., GHZ state) and output the DD compiled quantum circuit. This is fed to ZNE. This should remove incompatibility types. ddd.insert_ddd_sequences should be used. See the documentation here and here.

jordandsullivan commented 1 month ago

My suggestion is that the executor should be only called by ZNE. The DD part is a "pre-processing", with input the initial circuit (e.g., GHZ state) and output the DD compiled quantum circuit. This is fed to ZNE. This should remove incompatibility types. ddd.insert_ddd_sequences should be used. See the documentation here and here.

Thanks for the tip @nathanshammah , that did it. Now the question is mainly how to find a combination of error levels and circuit depth for which using DDD and ZNE together is in fact useful. Unfortunately, DDD seems to do best when you insert a lot of idle time in the circuit (which I modeled by inserting identity gates), while ZNE does significantly worse. ZNE itself shines in lower depth circuits.

Perhaps it would be useful to do a characterization sweep of the range of noise levels or circuit depths at which each technique was useful?

jordandsullivan commented 1 month ago

I'm not sure why the output does not seem to be getting included in the docs build :/ https://mitiq--2345.org.readthedocs.build/en/2345/examples/combine_ddd_zne.html

cosenal commented 1 month ago

@jordandsullivan hm? I can see the output in the doc build.

jordandsullivan commented 1 month ago

@cosenal Ah I just needed to do a hard reload (CMD+SHIFT+R) in my browser. It's showing up for me now :)

cosenal commented 1 month ago

LGTM!