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
363 stars 160 forks source link

RFC for Identity insertion noise scaling #335

Closed rmlarose closed 2 years ago

rmlarose commented 4 years ago

Insert n identity gates in a circuit which scales certain errors by elapsing time. Suggested in recent discussions by alpha users.

andreamari commented 4 years ago

+1 Sounds like a very reasonable scaling method and I think we should provide it. Possible problem: identity gates may be considered as virtual gates by some backends and in this case the method won't work.

willzeng commented 4 years ago

I'm interested in this method. Do we have a use case yet for where it would be better than unitary folding?

In my head unitary folding's advantage is that it duplicates exactly the gates that you were running and so if the noise is not uniform across gates than the unitary folding will still scale things appropriately.

andreamari commented 4 years ago

Adding identities could help to effectively simulate a slow execution of a circuit but I agree that, differently from unitary folding, this would be insensitive to the noise model of specific gates. Taking into consideration this fact, maybe it makes more sense to insert entire layers (moments) of identities, instead of appending identities to gates. An identity layer would corresponds to a physical time pause which could effectively scale the effective decoherence time of the qubits (not the gate noise).

purva-thakre commented 3 years ago

@rmlarose @willzeng @andreamari

How do you want the identity gates to be inserted ? If I use the method used for unitary folding i.e. U(U^* U)^n then 2 moments of identities are inserted i.e. n such moments are inserted into the circuit U(I I)^n.

If I instead use U(I)^n then the formula for scale factor changes i.e. this formula calculating needed number of gates will change to (ngates * (scale_factor - 1.0)). Here, only one moment of identity is inserted.

andreamari commented 3 years ago

@purva-thakre I think your second proposal is better and the formula that you suggested should be correct. However, the best way to confirm that everything works as expected is to add many tests :-)

github-actions[bot] commented 3 years ago

This issue had no activity for 2 months, and will be closed in one week unless there is new activity. Cheers!

purva-thakre commented 3 years ago

Working on this. Should be able to mark above linked PR as ready for review soon.

github-actions[bot] commented 3 years ago

This issue had no activity for 2 months, and will be closed in one week unless there is new activity. Cheers!

purva-thakre commented 2 years ago

Reopening this because previous linked PR was incomplete and needed a better design. See @andreamari comment (from Discord)

my suggestion is that since folding and id_insertions are actually quite different, it is probably easier to code id_insertions from scratch without necessarily following the existing code of unitary folding

image

github-actions[bot] commented 2 years ago

This issue had no activity for 2 months, and will be closed in one week unless there is new activity. Cheers!

github-actions[bot] commented 2 years ago

This issue had no activity for 2 months, and will be closed in one week unless there is new activity. Cheers!

purva-thakre commented 2 years ago

Link to the RFC : https://docs.google.com/document/d/1hbd9frjYiSy0WujA0iCccc-oMO4Q-kZc2G4b3lkJHdk/edit?usp=sharing

andreamari commented 2 years ago

Thanks @purva-thakre, the RFC looks very good!

andreamari commented 2 years ago

Closing this since the RFC has been accepted

nathanshammah commented 2 years ago

@purva-thakre we can move onto opening a list of detailed issued to implement the RFC.

purva-thakre commented 2 years ago

@nathanshammah The RFC does have issues at the end. I am close to finishing off the tests for the scaling function and after this I only have to make changes to the documentation. Do you want me to make 1 issue for the documentation changes ?

nathanshammah commented 2 years ago

Yes, what about opening single issues on github? What about adding one for the documentation like this one https://github.com/unitaryfund/mitiq/issues/1448 (it has sub issues that will be easier to assign and to avoid getting stuck). Btw I think the RFC is quite beautifully explaining the concept and we should try to port as much information as possible (and your diagrams) into the actual docs.