Comments (6)
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 asrho -> 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.
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.
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.
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.
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.
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)
- DBI tests are not correctly using the backend HOT 2
- Transpiler fails if run twice on the same circuit
- Inconsistencies on gate definitions coming from `Gate.controlled_by` and `Circuit.gates_of_type`
- Question about `SymbolicHamiltonian.circuit` HOT 2
- `QCNN` backend issues
- Transpiler moving measurements on wrong qubit
- Testing different backends
- DBI example in docs trying to use `qibojit` HOT 2
- Gate Set Tomography wishlist
- Expectation for observable does not take into account constants HOT 7
- Math input error in docs HOT 1
- Clifford test failing randomly
- Looping Behavior in Qibo SABRE HOT 2
- Expose reference email address
- Migrating to NumPy 2.0
- test_process_fidelity_and_infidelity() test failed HOT 1
- qulacs is always a dependency HOT 1
- Complex numbers in samples and frequencies HOT 6
- `MeasurementOutcomes` samples return type HOT 7
- `SymbolicHamiltonian` as a callback leading to mismatched circuit sizes HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qibo.