vabarbosa / Fun-with-Quantum

A quantum coin game and other fun stuff to illustrate the power and beauty of quantum Computing
Apache License 2.0
1 stars 0 forks source link

Update GHZ Game on real devices #5

Open vabarbosa opened 2 months ago

vabarbosa commented 2 months ago

The GHZ Game on real devices notebook needs to be updated for Qiskit 1.2 and fix any broken links, typo, etc.

Links

davidemoretti1 commented 1 month ago

working on it

davidemoretti1 commented 1 month ago

@vabarbosa I met lots of problems on this notebook, I'll try to resume them in the best way:

  1. from qiskit.utils.mitigation import complete_meas_cal, CompleteMeasFitter are not anymore supported, plus I'll explain in the following points why they are not useful anymore
  2. First chapter Comparing IBM quantum devices use FakeBackends like FakeManila etc to do a comparison but the backends used Fake backend with only 5 qubits, I chose new fake backends mostly of 127 qubits, for obvious reasons -> they are much more accurate than the previous
  3. Chapter 2 Manually optimizing circuit it's something we don't do anymore and in fact the "optimized" circuit does 0.5% better but I have reasons to think it's random -> I would recommend to delete the chapter
  4. Chapter 3 Qiskit Transpiler Optimization I would talk about the new primitives approach and mostly about the pass manager and the new transpiler optimization levels etc.
  5. chapter 4 Measurement Error mitigation I would talk about error mitigation and maybe error suppression but I need some advices here because I noticed the error mitigations are different from estimator and sampler and i think i got the difference between the two but I want some suggestions either way.

So as you can see the notebook, in my opinion and please let me know yours, it's to re-write. I can do it but it will take me some time. i think it's worth to know if there is already a notebook that present these themes so I don't do a duplicate. If you have any knowledge on this please let me know.

P.S.: I definitely think this tutorial for transpilation may be very helpful, as I already said to you Va we need to remove backend.run from everywhere.

JanLahmann commented 1 month ago

Hi @davidemoretti1 , thanks a lot for the detailed review of this demo. It was kind of expected that it is incompatible with Qiskit 1.x in its current form, and will need a number of changes. The main purpose of the demo/notebook is education and highlighting important aspects when running circuits on a real device (or a mock device) vs a perfect, noise-free simulator. It uses just three Qubits, but many effects of error and noise can be explained, and approaches to mitigate these.

Some comments on your specific remarks:

  1. Yes, it might make sense to use current devices and their mock/fake versions. Please keep an eye on the aspects we want to highlight, e.g. swap gates might be necessary because of the coupling map and then add to the noise. Question: do the results for new fake devices and the real devices match? (that would be nice, and show the accuracy of the noise model that is included in the fake devices)
  2. Yes, such a manual optimization is not needed anymore. However, I think it is a nice illustration of the importance of choosing the best qubits of a device (which now can be done with transpire passes)
  3. Yes, that should be updated.
  4. For the GHZ game, we need to sample from a probability distribution (IIRC, we do just one shot), so only the sampler is applicable and not the estimator. That also implies that the typical error mitigation methods (ZNE, PEC) cannot be used as they only apply to the estimator. Maybe we can highlight the different optimization_levels, what techniques are applied in each of them and how the result (winning probability for the GHZ game) improves. In the original notebook, I found it very impressive how the winning odds can be improved from 70% or so to 95%.