Git Product home page Git Product logo

Comments (6)

stavros11 avatar stavros11 commented on August 15, 2024

I tried to think a bit how to implement some noise models in order to conclude the basic quality of life improvements and I would like to share some thoughts before starting the implementation.

First, if I understand correctly, in the most general case, mixtures and density matrix are equivalent in terms of computational cost: they both require keeping track of a 2^n x 2^n object. I agree with Adrian that the best approach is the density matrix, since it is easier to formalize.

The way I would implement the basic noise model with this approach is the following:

  • Support channels in the __call__ of gates. If the __call__ input is a state vector it will fall back to our current implementation but if it is a density matrix it would use a new einsum implementation that applies gates to density matrices as rho -> G rho G.
  • Add a new bitflip error gate with custom __call__: rho -> (1 - p) rho + p X rho X.
  • Add a new phaseflip error gate with custom __call__: rho -> (1 - p) rho + p Z rho Z.
  • Circuit execution always starts using pure state vectors and switches to density matrices when the first error gate is found. If this is the case, it continues the simulation with the density matrix.
  • Extend callbacks and measurements to density matrices keeping the same API.

All this is relatively simple to code and I think relatively clean from the user perspective. My main concern is that the density matrix doubles the number of qubits, which means that we can simulate up to 13 qubits with noise on a single GPU. In that sense, would this approach be useful at all?

As always, there is a cheaper in memory / expensive in computation alternative. This would be to stick to the state vector simulator and add probabilistic gates (for bitflip would apply X with probability p, etc). Then we just re-run the simulation several times and the probabilistic gates act differently (randomly) in each run. We can also cache the configurations so that we do not repeat calculations and if we run the circuit 2^n times we get the whole thing (up to some strong assumptions). This would allow us to go up to 27 qubits on GPU with the cost of having to run many more times (not necessarily bad if GPU is fast).

@scarrazza, which approach sounds more useful?

from qibo.

scarrazza avatar scarrazza commented on August 15, 2024

Thanks for the comment. The GPU multi-shot procedure is a clever workaround to memory limitations.
I suggest to focus on the GPU first, and then eventually test a full density matrix with CPU fallback.

from qibo.

AdrianPerezSalinas avatar AdrianPerezSalinas commented on August 15, 2024

Hi all,

I think that is a clever approach, it could take into account previous knowledge on the errors to minimize the number of circuits ran.

With regard to the fact that mixtures and density are computationally equivalent. I do not think they are. The number of objects carried for the mixtures grow as errors happen (or do not happen). After a given number of errors ~ number of qubits, there are more objects for a mixture than for a density matrix. This is because the number of different possibilities grows exponentially.

from qibo.

stavros11 avatar stavros11 commented on August 15, 2024

With regard to the fact that mixtures and density are computationally equivalent. I do not think they are. The number of objects carried for the mixtures grow as errors happen (or do not happen). After a given number of errors ~ number of qubits, there are more objects for a mixture than for a density matrix. This is because the number of different possibilities grows exponentially.

Many thanks for the comment!

Indeed, what I wrote above is correct only if number of errors = number of qubits. If we need to introduce more than one error per qubit (which is more likely the case, as errors can happen between any of the gates that we apply), then the complexity of the density matrix will remain at 2^(2n) while the mixtures will be exponentially many more. This can be a problem with the multi-shot approach too, because running the circuit only 2^n times may not be sufficient to give a good statistics for the errors...

from qibo.

AdrianPerezSalinas avatar AdrianPerezSalinas commented on August 15, 2024

Indeed, I had not thought it like that. In principle, it could be added a previous study in terms of probability to occur a given set of errors. That is nothing but combinatorics and multiplying probabilities, but the number of calculations could become absurdly huge, and at the end of the day most of them will never happen.

from qibo.

AdrianPerezSalinas avatar AdrianPerezSalinas commented on August 15, 2024

Hi there,
I bring you here documents on "channels", just to give examples on what I told this morning

https://cirq.readthedocs.io/en/stable/noise.html
http://www.theory.caltech.edu/people/preskill/ph219/chap3_15.pdf

from qibo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.