I tried to run an Estimator primitive program by using the Qiskit Runtime ibmq_qasm_simulator and passing a specific NoiseModel created from a real device backend. However, it seems that the simulator is not loading correctly the noise model because the expectation value I get has zero variance (I would expect a small deviation due to noise).
How can we reproduce the issue?
from qiskit import QuantumCircuit
from qiskit.quantum_info import SparsePauliOp
from qiskit_aer.noise import NoiseModel
from qiskit_ibm_runtime import QiskitRuntimeService, Options, Session, Estimator
circ = QuantumCircuit(1)
circ.x(0)
O = SparsePauliOp(['Z'])
service = QiskitRuntimeService()
backend = service.get_backend('ibm_nairobi')
noise_model = NoiseModel.from_backend(backend)
simulator = service.get_backend('ibmq_qasm_simulator')
simulator.set_options(noise_model=noise_model)
options = Options(resilience_level=0)
with Session(service=service, backend=simulator) as session:
estimator = Estimator(session=session, options=options)
job = estimator.run(circuits=circ, observables=O, shots=10000)
print(job.result())
Since the quantum circuit is preparing the state $| 1 \rangle = X | 0 \rangle$ and I'm computing the expectation valued of the Pauli $Z$ operator, the result, in case of no noise, is deterministic: $\langle Z \rangle = \langle 1 | Z | 1 \rangle = -1$. However, loading the noise model as in the example above, it should be possible to observe a small deviation from this value, together with a non-zero variance.
Environment
What is happening?
I tried to run an
Estimator
primitive program by using the Qiskit Runtimeibmq_qasm_simulator
and passing a specificNoiseModel
created from a real device backend. However, it seems that the simulator is not loading correctly the noise model because the expectation value I get has zero variance (I would expect a small deviation due to noise).How can we reproduce the issue?
EstimatorResult(values=array([-1.]), metadata=[{'variance': 0.0, 'shots': 10000}])
What should happen?
Since the quantum circuit is preparing the state $| 1 \rangle = X | 0 \rangle$ and I'm computing the expectation valued of the Pauli $Z$ operator, the result, in case of no noise, is deterministic: $\langle Z \rangle = \langle 1 | Z | 1 \rangle = -1$. However, loading the noise model as in the example above, it should be possible to observe a small deviation from this value, together with a non-zero variance.