Measurement Error Mitigation on Quantum Inspire


This example is written for the Spin-2 backend. If it is offline or the authentication unsuccessful, the code will fallback to simulation using Qiskit Aer.

What does it do and what is it used for?

For quantum devices, in particular spin-qubits, the measurement error is significant with respect to other sources of errors. We can reduce the effect of measurement errors using measurement error mitigation. This is particularly important when different qubits have different readout fidelities or when there is a cross-talk between the qubit readouts. Reducing the measurement error can be essential for the improvement of the performance of a quantum algorithm.

For more details see Qiskit textbook on measurement error mitigation and Mitiq documentation.

How does it work?

We will be measuring a Bell state first without error mitigation, and then apply the measurement error mitigation tools available in Qiskit to improve the result. We perform the calculations on real hardware (or on the Qiskit QASM simulator when the hardware is not available). Below we will go through this process in detail.

For information on an advanced technique for measurement error mitigation, have a look at the references at the bottom of the notebook.

To install the required dependencies for this notebook, run:

pip install qiskit quantuminspire requests

Example Code

Imports and definitions

Set up connection to QI

We expect the user to have set up the token authentication as described here in order to be able to access the Spin-2 backend in the following cells.

Error mitigation for Spin-2

Run error mitigation test on a Bell state $(\left|00\right\rangle+\left|11\right\rangle)/\sqrt{2}$.

In Qiskit we mitigate the noise by creating a measurement filter object. Then, taking the results from above, we use this to calculate a mitigated set of counts.

To see the results most clearly, let's plot both the noisy and mitigated results.

Note that the skew between the two qubits has reduced significantly.

Measurement of the error matrix

The process of measurement error mitigation can also be done using the existing tools from Qiskit. This handles the collection of data for the basis states, the construction of the matrices, and the calculation of the inverse. The latter can be done using the pseudoinverse, as we saw above. However, the default is an even more sophisticated method which is using least-squares fitting.

As an example, let's stick with doing error mitigation for a pair of qubits. For this, we define a two-qubit quantum register, and feed it into the function complete_meas_cal.

This creates a set of circuits that are used to take measurements for each of the four basis states of two qubits: $\left|00\right\rangle$, $\left|01\right\rangle$, $\left|10\right\rangle$ and $\left|11\right\rangle$.

Let's now run these circuits.

With the results we can construct the calibration matrix, which we have been calling $M$.

Want to know more?

Readout rebalancing

Note that the error mitigation protocol described above does not change the execution of the quantum algorithms. There is another mitigation technique called readout rebalancing that does change the executed algorithms. Readout rebalancing places strategic $X$ gates before measurements in order to reduce the variability in the measurement results. Check out the paper Readout Rebalancing for Near Term Quantum Computers and the corresponding notebook for more information.