Machine Learning for Practical Quantum Error Mitigation
[Nature Machine Intelligence (NMI) (2024), NMI open read,
arXiv, IBM Seminar Video ]
- Installation
- Instructions for Use
- Demos
- Source Data
- Generic Decorator for Qiskit Estimator Primitives
- Citation
- How to Give Feedback
- Contribution Guidelines
- References and Acknowledgements
- License
Quantum computers are actively competing to surpass classical supercomputers, but quantum errors remain their chief obstacle. The key to overcoming these on near-term devices has emerged through the field of quantum error mitigation, enabling improved accuracy at the cost of additional runtime. In practice, however, the success of mitigation is limited by a generally exponential overhead. Can classical machine learning address this challenge on today's quantum computers? Here, through both simulations and experiments on state-of-the-art quantum computers using up to 100 qubits, we demonstrate that machine learning for quantum error mitigation (ML-QEM) can drastically reduce overheads, maintain or even surpass the accuracy of conventional methods, and yield near noise-free results for quantum algorithms. We benchmark a variety of machine learning models -- linear regression, random forests, multi-layer perceptrons, and graph neural networks -- on diverse classes of quantum circuits, over increasingly complex device-noise profiles, under interpolation and extrapolation, and for small and large quantum circuits. These tests employ the popular digital zero-noise extrapolation method as an added reference. We further show how to scale ML-QEM to classically intractable quantum circuits by mimicking the results of traditional mitigation results, while significantly reducing overhead. Our results highlight the potential of classical machine learning for practical quantum computation.
We provide two datasets and notebooks for demonstration. The first demo shows our ML-QEM method mimicking digital ZNE + Pauli twirling on a 100Q TFIM Trotter circuit. The second demo shows our ML-QEM mitigating the expectation values of a 4Q TFIM Trotter circuit on real hardware, outperforming digital ZNE.
Other notebooks (with prefix "hXX", e.g., h01_mbd.ipynb), python scripts, and datasets can be found in this folder. Specifically, circuit-level features and MLP models can be found in mlp.py, and GNN models can be found in gnn.py.
The Excel sheets contain the source data for the Figures in our paper. Datasets can be found and loaded using the script.
We also introduce a generic decorator for Qiskit Estimator primitives. This decorator converts the Estimator into a LearningEstimator, granting it the capability to perform a postprocessing step. During this step, we apply the mitigation model to the noisy expectation value to produce the final mitigated results. This manipulation maintains the object types, so we can utilize the LearningEstimator as a regular Estimator primitive within the entire Qiskit application and algorithm ecosystem without any further modifications.
The decorator requires a model as one of the arguments. We provide several default models, such as Scikit-learn, PyTorch, and TensorFlow, and examples of how to train and use them. The source code, documentation, and examples can be found in the main branch.
Using the code, please cite the paper (arXiv link here):
@article{ML-QEM,
title={Machine Learning for Practical Quantum Error Mitigation},
author={Haoran Liao and Derek S. Wang and Iskandar Sitdikov and Ciro Salcedo and Alireza Seif and Zlatko K. Minev},
year={2023},
journal={arXiv:2309.17368},
}
We encourage your feedback! You can share your thoughts with us by:
- Opening an issue in the repository
For information on how to contribute to this project, please take a look at our contribution guidelines.
[1] Qiskit https://qiskit.org/
[2] Qiskit-terra https://github.com/Qiskit/qiskit-terra
[3] PyTorch https://pytorch.org/
[4] PyTorch geometric https://pytorch-geometric.readthedocs.io/en/latest/
[5] Zlatko Minev for 🤽 🌊