When running the attached Bernstein-Vazirani gate on IBM Q, with 1024 shots on ibmq_16_melbourne, I receive the expected result of "00110" with 26.563% success. I notice that there is a lot of noise in the results and am curious about what the cause of this could be? Is there any way to reduce this noise in order to get a higher chance of success for my expected result?




1 Answer 1


How many shots were you using? and on which device?

Theoretically, you only need one shot for this algorithm, but because current devices are noisy, hence the name NISQ (Noisy Intermediate-Scale Quantum), we need to do a lot more experiments here. The maximum number of shots on IBM's machine is 8192 so I would use that.

It is important to note that not all devices are the same. Some are more noisy than other.

One way to improve your result is through error mitigations. At a higher level, there are two places where errors can occur. The first place is through the gate operations when you run your algorithm, and the second is through the measurement process. You can mitigate the measurement error by creating $2^n$ eigenstates and measure them to create a calibration matrix $M$. In your case, it would be $2^5 = 32$ additional circuits to do this. Look here at this document for more detail and how to do it within Qiskit setting: https://qiskit.org/textbook/ch-quantum-hardware/measurement-error-mitigation.html

Here is the code to do this for your circuit:

from qiskit import IBMQ , BasicAer, Aer, QuantumCircuit,  ClassicalRegister, QuantumRegister, execute
from qiskit.compiler import transpile
from qiskit.transpiler import PassManager
from qiskit.aqua import QuantumInstance
from qiskit.ignis.mitigation.measurement import complete_meas_cal, CompleteMeasFitter, MeasurementFilter
from qiskit.visualization import plot_histogram

provider = IBMQ.load_account()
backend = provider.get_backend('ibmq_16_melbourne') 

quantum_instance = QuantumInstance(backend, shots = 8192,
                                   pass_manager = None, initial_layout = None, optimization_level = 3,
                                   measurement_error_mitigation_cls = CompleteMeasFitter, cals_matrix_refresh_period = 0)

qc = QuantumCircuit(6,6)
for i in range(6):
for i in range(6):
qc.draw('mpl', plot_barriers=False ) 
Result = quantum_instance.execute(qc)
counts = Result.get_counts(qc)
print('This is the counts result of the simulation:' ,counts)

Hope this help.

  • $\begingroup$ I ran the algorithm with 1024 shots on ibmq_16_melbourne. Thanks for the information! I am a student currently in my first quantum class, so it is very helpful to me. $\endgroup$
    – GRT
    Commented Oct 30, 2020 at 19:02
  • $\begingroup$ ibmq_16_melbourne is quite noisy so I would increase it to 8192 shots, and see how the result will improve. $\endgroup$
    – KAJ226
    Commented Oct 30, 2020 at 19:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.