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
347 stars 145 forks source link

Tutorial : Use ZNE & REM to simulate time evolution of gauge invariant models #1794

Open purva-thakre opened 1 year ago

purva-thakre commented 1 year ago

Issue Description

In https://arxiv.org/pdf/2109.15065, the authors used Zero-Noise Extrapolation and Readout-Error Mitigation available in Mitiq to investigate the real-time evolution of gauge invariant plaquette models. We want to replicate these results on a quantum simulator in the form of a tutorial in Mitiq's docs.

Details about the circuit of interest and extrapolation

As the authors consider multiple scenarios in the Results section, replicate the results from one graph each in Figures 10, 11, and 12. To compare the results in your tutorial, each plot will have

  1. ideal simulation of the circuit
  2. noisy simulation of the circuit
  3. REM
  4. REM + ZNE

See this tutorial on how to combine REM and ZNE.

Author’s Code

The authors have provided their code for the paper of interest.

Note that this repo was last updated 2 years ago. Since then, the dependencies in their requirements.txt file have moved to newer versions. For example, Qiskit 1.0 introduced some major breaking changes to their API. Running the author's code in a virtual environment with installed dependencies from mitiq/requirements will lead to failures. So, the tutorial also involves making changes to the author's code before inserting the code blocks in your tutorial.

Format

The tutorial will be added as a .md file in docs/source/examples. A template is available at docs/source/examples/template.md. In addition, make sure you list your tutorial in docs/source/examples/examples.md for you to be able to see the build locally or in a PR.

References should be added in docs/source/refs.bib

Each tutorial has to have a thumbnail for it to show in the docs build. Add the thumbnail image to docs/source/_thumbnails/your_image.png and also list it in nbsphinx_thumbnails block of docs/source/conf.py

jordandsullivan commented 2 months ago

Context for this issue: using a quantum simulator is fine for this tutorial.

anonymousr007 commented 1 month ago

Hi @cosenal and @purva-thakre, Nice to meet you.

I am Rishabh Singh, and I have been learning about quantum computing since 2020.

Best Regards Rishabh Singh LinkedIn | GitHub

jordandsullivan commented 1 month ago

Great, looking forward to your contributions @anonymousr007 :)

Sabhyata21 commented 1 month ago

Hey ! I am a PhD student working on Quantum Simulation of lattice Gauge Theories. I am interested in working on this issue. Let's team up - discord: Sabhyata21

purva-thakre commented 1 month ago

Hi @anonymousr007 and @Sabhyata21, based on the rules of UnitaryHACK both of you are free to work on this issue and create a PR for it.

You typically get assigned to an issue and a PR once you are close to completing it successfully so that the bot knows who the bounty will go to. For now, I am going to unassign @anonymousr007.

AbdullahKazi500 commented 1 month ago

Hi @jordandsullivan and @purva-thakre I am currently checking out this issue seems cool to me I went through the resources especially the paper very intriguing indeed I had two basic questions on the implementation

Why does the Hamiltonian $H{Z2}$ induce a two-state Rabi oscillation in a single plaquette system when all spins are initially aligned? Can you Explain how the off-diagonal plaquette term $\prod{i \in \text{plaquette}} \sigma_i^x$ drives the oscillation in the constrained Hilbert space defined by the Z2 gauge theory. any explanation behind how the competition between the coupling strength $J$ and the external field $h$ leads to this oscillatory behavior, considering the two super-selection sectors of the Hilbert space.

How does the Hamiltonian $H_{U(1)}$ of the U(1) quantum link model enforce local U(1) gauge symmetry and constrain the dynamics in a single plaquette system? and what areee the roles of the coupling constants $K$ and $\mu$ in representing interactions among links and fluxes through plaquettes.

jordandsullivan commented 1 month ago

Hi @AbdullahKazi500 , thanks for your interest! So it sounds like your questions are pretty technical to the foundations of the paper itself rather than implementation. I would say it might be better to start by establishing a firm foundation for your understanding by studying the paper and related mathematical concepts before diving into implementation.

Answering your specific questions would likely require more space than we have in this comments section, and it's probably not the best venue for learning those concepts anyhow. Some of the other folks interested in working on this issue who have more background in the area may have resource recommendations.

The error mitigation schemes can still be implemented in the form of a tutorial if you have a high level understanding of the Hamiltonians used by the authors. Plus, the authors have provided their code (linked in the issue description), so you could check that out to gain understanding with a hands-on example and extend from there.

AbdullahKazi500 commented 1 month ago

Hi @AbdullahKazi500 , thanks for your interest! So it sounds like your questions are pretty technical to the foundations of the paper itself rather than implementation. I would say it might be better to start by establishing a firm foundation for your understanding by studying the paper and related mathematical concepts before diving into implementation.

Answering your specific questions would likely require more space than we have in this comments section, and it's probably not the best venue for learning those concepts anyhow. Some of the other folks interested in working on this issue who have more background in the area may have resource recommendations.

The error mitigation schemes can still be implemented in the form of a tutorial if you have a high level understanding of the Hamiltonians used by the authors. Plus, the authors have provided their code (linked in the issue description), so you could check that out to gain understanding with a hands-on example and extend from there.

Talking about the quadratic extrapolation as mentioned by @purva-thakre I have a few more doubts on the error mitigation technique that would be implemented here Suppose a quantum algorithm's runtime exhibits quadratic scaling with input size. Given runtime measurements for input sizes ( n = 10 ), ( n = 20 ), and ( n = 30 ), perform quadratic extrapolation to estimate the algorithm's runtime for ( n = 40 ). How does the uncertainty in the extrapolated runtime evolve with increasing input size, and what computational complexities can arise in accurately predicting algorithmic performance beyond the measured data points?

and also Suppose if we say a physical system exhibits quadratic behavior in response to varying parameters, with observed data points at ( x = 1 ), ( x = 2 ), and ( x = 3 ). if we Employ quadratic extrapolation to predict the system's behavior at ( x = 4 ), taking into account the uncertainty associated with the extrapolated result. How does the choice of regression method impact the accuracy of the extrapolated prediction, and what computational challenges arise in mitigating extrapolation errors when dealing with limited or noisy data?

purva-thakre commented 1 month ago

@AbdullahKazi500 Your questions are more in-depth and only partially related to this issue. You only require a high-level understanding of the Hamiltonians used, the circuits used, and the inference methods to build the tutorial.

It might be better to use a search engine to build your foundational understanding of these concepts on your own. As Jordan said, the comments do not provide enough space to begin a discussion over things that might require multiple lectures.

If you have specific questions about the paper, you should ask a question to the authors. Keep in mind, they might not reply before the hackathon ends.

AbdullahKazi500 commented 1 month ago

@AbdullahKazi500 Your questions are more in-depth and only partially related to this issue. You only require a high-level understanding of the Hamiltonians used, the circuits used, and the inference methods to build the tutorial.

It might be better to use a search engine to build your foundational understanding of these concepts on your own. As Jordan said, the comments do not provide enough space to begin a discussion over things that might require multiple lectures.

If you have specific questions about the paper, you should ask a question to the authors. Keep in mind, they might not reply before the hackathon ends.

so will it be okay if someone can implement a basic example of the RME and ZNE Code to address this issue without looking into theoretical details

purva-thakre commented 1 month ago

I think you are misunderstanding what we are trying to communicate to you. High level knowledge is completely different from a deep dive.

You do need a high-level understanding of the Hamiltonian and the circuits along with the QEM methods used. If you lack the foundational understanding of what the authors tried to do, how can a tutorial be implemented? Assuming that this is where you are stuck, I am sure there are other open bountied issues that do not presume a user knows graduate-level physics beforehand.

AbdullahKazi500 commented 1 month ago

I think you are misunderstanding what we are trying to communicate to you. High level knowledge is completely different from a deep dive.

You do need a high-level understanding of the Hamiltonian and the circuits along with the QEM methods used. If you lack the foundational understanding of what the authors tried to do, how can a tutorial be implemented? Assuming that this is where you are stuck, I am sure there are other open bountied issues that do not presume a user knows graduate-level physics beforehand.

but I think it is nowhere mentioned in the issue description that it would requires us to have a graduate level physics prerequisite I do have a background in Physics especially statistical mechanics ,multi-physics simulation, non linear dynamics ,classical mechanics and light matter interaction, I mean understanding the paper is not that hard for me but what is actually needed here from the paper is what I am trying to ask the intricate details which needs to be addressed I mean without asking questions how can someone make a PR just like that I hope you are getting my point here : )

AbdullahKazi500 commented 1 month ago
  • ideal simulation of the circuit
  • noisy simulation of the circuit
  • REM
  • REM + ZNE

What type of noise model should be applied to simulate the noisy environment? Should it include depolarizing errors, coherent errors, or other types of noise How should the readout error be modeled and incorporated into the simulation? Should we use a calibration matrix obtained from experimental data, or should we simulate readout errors directly in the simulation? you might be thinking that why am I asking so much questions when the source code is already given so to answer that I am trying to see whether I can build the code from scratch or try adding some features that is why such questions I hope asking Questions is not an issue

AbdullahKazi500 commented 1 month ago

Okay I got it but going forward it will be hard for me to take on this issue with the limited time I would like to contribute to this once the hackathon is over and there is still not any merged PR thank you for your time

jordandsullivan commented 3 weeks ago

Hi @Sabhyata21, are you still interested in working on this issue?