Qiskit / qiskit-aer

Aer is a high performance simulator for quantum circuits that includes noise models
https://qiskit.github.io/qiskit-aer/
Apache License 2.0
483 stars 359 forks source link

Fastest way to simulate noisy quantum circuits #1979

Open simonecantori opened 11 months ago

simonecantori commented 11 months ago

I want to classically simulate quantum circuits with noise. I'm interested in simple noise models, such as depolarizing noise, bitflip, etc.

If I use the following noise model:

prob_2 = 0.001 error_2 = noise.depolarizing_error(prob_2, 2) noise_model = noise.NoiseModel() noise_model.add_all_qubit_quantum_error(error_2, ['cx']) basis_gates = noise_model.basis_gates sim_ideal = Aer.get_backend('aer_simulator') sim = AerSimulator(noise_model=noise_model, basis_gates=basis_gates)

with 10000 shots, the simulation is really slow compared to the ideal case. I have also tried to write a script that simulate the quantum circuit with the density matrix formalism, but for many qubits becomes slow.

I would like to simulate a quantum circuit with a computational time comparable to the ideal simulation (without noise) for high number of qubits. I'm okay with using simple noise models (even not applied to each gate if necessary).

Specifically, I'm simulating quantum circuits with 14 qubits, 30 Ry gates per qubit (so 30 x 14 single qubit gates) and 30 CNOT gates per neighobur pairs (so 30 x 13 CNOTs). In my device, for the ideal quantum circuit, the simulation time is 1s, while for the noisy one it's like 20/30s.

yaelbh commented 11 months ago

I don't think there's a way to make the simulation run time with noise comparable to the ideal one. The reason is that, in the ideal case, we exploit the lack of noise (and mid-circuit measurements) for performance optimization: the circuit is simulated only once, regardless of the number of shots, and only in the measurements we sample.

This optimization certainly can't be applied in the presence of noise, because each shot ends up with a different state vector.