Quantum Computing Asked by Vitality on May 7, 2021
I’m using Qiskit and I have a Quantum Circuit (say, circuit
) that gives reasonable results when using the simulator, namely
sim_backend = provider.get_backend('qasm_simulator')
job = execute(circuit, sim_backend, shots=shots)
However, when switching to the true machine, namely
sim_backend = provider.get_backend('ibmq_16_melbourne')
I’m experiencing very noisy, meaningless results.
From my understanding, this is normal and, in these cases, error mitigation is performed by measuring the noise of the quantum circuit and then operating with this knowledge.
Could someone tell me which Qiskit routine I could use to mitigate noise and how?
EDIT
Following the comment by Davit Khachatryan and the answer by Martin Vesely, I have prepared the code below.
# --- Standard imports
%matplotlib inline
# Importing standard Qiskit libraries and configuring account
from qiskit import QuantumCircuit, execute, Aer, IBMQ
from qiskit.compiler import transpile, assemble
from qiskit.tools.jupyter import *
from qiskit.visualization import *
# Loading your IBM Q account(s)
provider = IBMQ.load_account()
# --- Imports
from qiskit import QuantumCircuit, execute, BasicAer
from qiskit.tools.monitor import job_monitor
import math
from numpy import linalg as LA
import numpy as np
#%config jupy = 'svg' # Makes the images look nice
import time
import matplotlib.pyplot as plt
nBits = 2
shots = 8192
# --- Computation of the calibration matrix
from qiskit.ignis.mitigation.measurement import (complete_meas_cal,CompleteMeasFitter)
from qiskit import *
qr = QuantumRegister(2)
meas_calibs, state_labels = complete_meas_cal(qr=qr, circlabel='mcal')
backend = provider.get_backend('ibmq_16_melbourne')
job = execute(meas_calibs, backend=backend, shots=1000)
job_monitor(job, interval = 3)
cal_results = job.result()
meas_fitter = CompleteMeasFitter(cal_results, state_labels, circlabel='mcal')
print(meas_fitter.cal_matrix)
# --- Execution of the noisy quantum circuit
qc = QuantumCircuit(nBits, nBits)
qc.x(1)
qc.measure(qc.qregs[0], qc.cregs[0])
job = execute(qc, provider.get_backend('ibmq_16_melbourne'), shots = shots)
#job = execute(qc, BasicAer.get_backend('qasm_simulator'), shots = shots)
job_monitor(job, interval = 3)
result = job.result()
print(result.get_counts())
# --- Error correction
# Get the filter object
meas_filter = meas_fitter.filter
# Results with mitigation
mitigated_results = meas_filter.apply(result)
mitigated_counts = mitigated_results.get_counts(0)
print(mitigated_counts)
The noisy quantum circuit returns:
{'00': 661, '11': 34, '10': 7494, '01': 3}
The error mitigated noise circuit returns:
{'00': 132.05699755089069, '11': 29.711709316932044, '01': 0.4405790117450936, '10': 8029.790714120432}
Is that what I should expect?
I will provide some general comments concerning noise in quantum computers.
Noise in quantum systems is normal phenomena as these systems are probabilistic by nature. Under current state of development, quantum computers unfortunately does not allow to build complex deep circuits.
You can of course use additional qubits to introduce error correction which can be almost perfect with sufficient number of qubits (so-called threshold theorem). But adding qubits and gates introduces another source of noise, so again depth of circuits is constrained.
When quantum computers are in higher state of development, error correction will also be able to mitigate noise more effectively than nowadays.
Concerning the backend you use - Melbourne. My experience is that this processor is very noisy in comparison with others provided in IBM Q. It seems that this is caused by higher number of qubits, so qubits influence each other increasing noise level.
Correct answer by Martin Vesely on May 7, 2021
As Martin Vesley has mentioned in his answer, there are some error correction techniques that require additional qubits and gates resources, and how we know the resources of nowadays QCs are limited, and that's why those techniques are not so useful today. But in 2017 new error correction techniques were proposed that don't require additional gates/qubits. As stated in the abstract of S. Endo et al [1] paper: two quantum error mitigation (QEM) techniques have been introduced recently, namely, error extrapolation (proposed by Y. Li and S. C. Benjamin [2] and K. Temme et al [3]) and quasiprobability decomposition (proposed by K. Temme et al [3]). How I understand, this Qiskit tutorial is an implementation of the second technique. The tutorial is written very nicely and intuitively, so I highly recommend it.
Here I will try to explain the first technique: error extrapolation. We want to estimate something from our circuit, let's call it $E^*$ (can be the expectation value of Hamiltonian or something else). Because of noise we always obtain a different value than $E^*$. Suppose we have a $lambda$ parameter (in this experimental paper [4] they used pulse duration as a parameter: the gates are implemented via microwave pulses) that we can change and run different experiments with given values of $lambda$. This give us different values for $E(lambda)$ from which we will be able to construct the following system of equations:
begin{cases} E(lambda_1) = E^* + Noise(lambda_1) E(lambda_2) = E^* + Noise(lambda_2) E(lambda_3) = E^* + Noise(lambda_3) ... end{cases}
By expressing the $Noise(lambda)$ with some suitable function (e.g. a polynomial function) one can solve the system of equation and find the desired $E^*$ value "without" noise. In some cases, it works XD. I mean there should be the satisfaction of some conditions (e.g good fitting of chosen function to the actual noise).
These techniques are increasing the circuit depth that can be used, but that increment, of course, is not limitless (more insights can be gained from the Fig.2 from the [4] paper).
Answered by Davit Khachatryan on May 7, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP