Skip to main content

Thank you for visiting You are using a browser version with limited support for CSS. To obtain the best experience, we recommend you use a more up to date browser (or turn off compatibility mode in Internet Explorer). In the meantime, to ensure continued support, we are displaying the site without styles and JavaScript.

Quantum-enhanced Markov chain Monte Carlo


Quantum computers promise to solve certain computational problems much faster than classical computers. However, current quantum processors are limited by their modest size and appreciable error rates. Recent efforts to demonstrate quantum speedups have therefore focused on problems that are both classically hard and naturally suited to current quantum hardware, such as sampling from complicated—although not explicitly useful—probability distributions1,2,3. Here we introduce and experimentally demonstrate a quantum algorithm that is similarly well suited to current hardware, but which samples from complicated distributions arising in several applications. The algorithm performs Markov chain Monte Carlo (MCMC), a prominent iterative technique4, to sample from the Boltzmann distribution of classical Ising models. Unlike most near-term quantum algorithms, ours provably converges to the correct distribution, despite being hard to simulate classically. But like most MCMC algorithms, its convergence rate is difficult to establish theoretically, so we instead analysed it through both experiments and simulations. In experiments, our quantum algorithm converged in fewer iterations than common classical MCMC alternatives, suggesting unusual robustness to noise. In simulations, we observed a polynomial speedup between cubic and quartic over such alternatives. This empirical speedup, should it persist to larger scales, could ease computational bottlenecks posed by this sampling problem in machine learning5, statistical physics6 and optimization7. This algorithm therefore opens a new path for quantum computers to solve useful—not merely difficult—sampling problems.

This is a preview of subscription content, access via your institution

Access options

Rent or buy this article

Prices vary by article type



Prices may be subject to local taxes which are calculated during checkout

Fig. 1: Ising model representations.
Fig. 2: Average-case convergence-rate simulations.
Fig. 3: Convergence-rate experiment.
Fig. 4: Magnetization estimate experiment.
Fig. 5: Quantum speedup mechanism.

Data availability

The data supporting the findings of this study are available in the Zenodo repository (

Code availability

Simulation and data analysis code is available at


  1. Arute, F. et al. Quantum supremacy using a programmable superconducting processor. Nature 574, 505–510 (2019).

    Article  ADS  CAS  PubMed  Google Scholar 

  2. Wu, Y. et al. Strong quantum computational advantage using a superconducting quantum processor. Phys. Rev. Lett. 127, 180501 (2021).

    Article  ADS  CAS  PubMed  Google Scholar 

  3. Zhong, H.-S. et al. Phase-programmable Gaussian boson sampling using stimulated squeezed light. Phys. Rev. Lett. 127, 180502 (2021).

    Article  ADS  CAS  PubMed  Google Scholar 

  4. Dongarra, J. & Sullivan, F. Guest editors’ introduction to the top 10 algorithms. Comput. Sci. Eng. 2, 22–23 (2000).

    Article  Google Scholar 

  5. Ackley, D. H., Hinton, G. E. & Sejnowski, T. J. A learning algorithm for Boltzmann machines. Cogn. Sci. 9, 147–169 (1985).

    Article  Google Scholar 

  6. Huang, K. Statistical Mechanics (Wiley, 2008).

  7. Kirkpatrick, S., Gelatt, C. D. & Vecchi, M. P. Optimization by simulated annealing. Science 220, 671–680 (1983).

    Article  ADS  MathSciNet  CAS  PubMed  MATH  Google Scholar 

  8. Ising, E. Beitrag zur Theorie des Ferromagnetismus. Z. Phys. 31, 253–258 (1925).

    Article  ADS  CAS  MATH  Google Scholar 

  9. & Lucas, A. Ising formulations of many NP problems. Front. Phys. 2, 5 (2014).

    Article  Google Scholar 

  10. Barahona, F. On the computational complexity of Ising spin glass models. J. Phys. A 15, 3241–3253 (1982).

    Article  ADS  MathSciNet  Google Scholar 

  11. Levin, D. and Peres, Y. Markov Chains and Mixing Times (American Mathematical Society, 2017).

  12. Metropolis, N., Rosenbluth, A. W., Rosenbluth, M. N., Teller, A. H. & Teller, E. Equation of state calculations by fast computing machines. J. Comp. Phys. 21, 1087–1092 (1953).

    CAS  MATH  Google Scholar 

  13. Hastings, W. K. Monte Carlo sampling methods using Markov chains and their applications. Biometrika 57, 97–109 (1970).

    Article  MathSciNet  MATH  Google Scholar 

  14. Andrieu, C., de Freitas, N., Doucet, A. & Jordan, M. I. An introduction to MCMC for machine learning. Mach. Learn. 50, 5–43 (2003).

    Article  MATH  Google Scholar 

  15. Swendsen, R. H. & Wang, J.-S. Nonuniversal critical dynamics in Monte Carlo simulations. Phys. Rev. Lett. 58, 86–88 (1987).

    Article  ADS  CAS  PubMed  Google Scholar 

  16. Wolff, U. Collective Monte Carlo updating for spin systems. Phys. Rev. Lett. 62, 361–364 (1989).

    Article  ADS  CAS  PubMed  Google Scholar 

  17. Houdayer, J. A cluster Monte Carlo algorithm for 2-dimensional spin glasses. Eur. Phys. J. B 22, 479–484 (2001).

    Article  ADS  CAS  Google Scholar 

  18. Zhu, Z., Ochoa, A. J. & Katzgraber, H. G. Efficient cluster algorithm for spin glasses in any space dimension. Phys. Rev. Lett. 115, 077201 (2015).

    Article  ADS  PubMed  Google Scholar 

  19. Goodfellow, I., Bengio, Y. & Courville, A. Deep Learning (MIT Press, 2016).

  20. Callison, A., Chancellor, N., Mintert, F. & Kendon, V. Finding spin glass ground states using quantum walks. New J. Phys. 21, 123022 (2019).

    Article  MathSciNet  Google Scholar 

  21. Lloyd, S. Universal quantum simulators. Science 273, 1073–1078 (1996).

    Article  ADS  MathSciNet  CAS  PubMed  MATH  Google Scholar 

  22. Anis Sajid, M. et al. Qiskit: An open-source framework for quantum computing (2021).

  23. Ambegaokar, V. & Troyer, M. Estimating errors reliably in Monte Carlo simulations of the Ehrenfest model. Am. J. Phys. 78, 150–157 (2010).

    Article  ADS  Google Scholar 

  24. Szegedy, M. in 45th Annual IEEE Symposium on Foundations of Computer Science 32–41 (IEEE, 2004).

  25. Richter, P. C. Quantum speedup of classical mixing processes. Phys. Rev. A 76, 042306 (2007).

    Article  ADS  Google Scholar 

  26. Somma, R. D., Boixo, S., Barnum, H. & Knill, E. Quantum simulations of classical annealing processes. Phys. Rev. Lett. 101, 130504 (2008).

    Article  ADS  CAS  PubMed  Google Scholar 

  27. Wocjan, P. & Abeyesinghe, A. Speedup via quantum sampling. Phys. Rev. A 78, 042336 (2008).

    Article  ADS  Google Scholar 

  28. Harrow, A. W. & Wei, A. Y. in Proceedings of the Fourteenth Annual ACM-SIAM Symposium on Discrete Algorithms 193–212 (SIAM, 2020).

  29. Lemieux, J., Heim, B., Poulin, D., Svore, K. & Troyer, M. Efficient quantum walk circuits for Metropolis-Hastings algorithm. Quantum 4, 287 (2020).

    Article  Google Scholar 

  30. Arunachalam, S., Havlicek, V., Nannicini, G., Temme, K. & Wocjan, P. in 2021 IEEE International Conference on Quantum Computing and Engineering (QCE) 112–122 (IEEE, 2021).

  31. Dumoulin, V., Goodfellow, I. J., Courville, A. & Bengio, Y. in Proceedings of the Twenty-Eighth AAAI Conference on Artificial Intelligence 1199–1205 (AAAI Press, 2014).

  32. Benedetti, M., Realpe-Gómez, J., Biswas, R. & Perdomo-Ortiz, A. Estimation of effective temperatures in quantum annealers for sampling applications: a case study with possible applications in deep learning. Phys. Rev. A 94, 022308 (2016).

    Article  ADS  Google Scholar 

  33. Nelson, J., Vuffray, M., Lokhov, A. Y., Albash, T. & Coffrin, C. High-quality thermal Gibbs sampling with quantum annealing hardware. Phys. Rev. Appl. 17, 044046 (2022).

    Article  ADS  CAS  Google Scholar 

  34. Wild, D. S., Sels, D., Pichler, H., Zanoci, C. & Lukin, M. D. Quantum sampling algorithms for near-term devices. Phys. Rev. Lett. 127, 100504 (2021).

    Article  ADS  CAS  PubMed  Google Scholar 

  35. Wild, D. S., Sels, D., Pichler, H., Zanoci, C. & Lukin, M. D. Quantum sampling algorithms, phase transitions, and computational complexity. Phys. Rev. A 104, 032602 (2021).

    Article  ADS  MathSciNet  CAS  Google Scholar 

  36. Cerezo, M. et al. Variational quantum algorithms. Nat. Rev. Phys. 3, 625–644 (2021).

    Article  Google Scholar 

  37. Bharti, K. et al. Noisy intermediate-scale quantum algorithms. Rev. Mod. Phys. 94, 015004 (2022).

    Article  ADS  MathSciNet  CAS  Google Scholar 

  38. Babbush, R. et al. Focus beyond quadratic speedups for error-corrected quantum advantage. PRX Quantum 2, 010103 (2021).

    Article  Google Scholar 

  39. Swendsen, R. H. & Wang, J.-S. Replica Monte Carlo simulation of spin-glasses. Phys. Rev. Lett. 57, 2607–2609 (1986).

    Article  ADS  MathSciNet  CAS  PubMed  Google Scholar 

  40. Baldwin, C. L. & Laumann, C. R. Quantum algorithm for energy matching in hard optimization problems. Phys. Rev. B 97, 224201 (2018).

    Article  ADS  CAS  Google Scholar 

  41. Smelyanskiy, V. N. et al. Nonergodic delocalized states for efficient population transfer within a narrow band of the energy landscape. Phys. Rev. X 10, 011017 (2020).

    CAS  Google Scholar 

  42. Smelyanskiy, V. N., Kechedzhi, K., Boixo, S., Neven, H. & Altshuler, B. Intermittency of dynamical phases in a quantum spin glass. Preprint at (2019).

  43. Brooks, S., Gelman, A., Jones, G. & Meng, X.-L. Handbook of Markov Chain Monte Carlo (CRC Press, 2011).

  44. Andrieu, C. & Thoms, J. A tutorial on adaptive MCMC. Stat. Comput. 18, 343–373 (2008).

    Article  MathSciNet  Google Scholar 

  45. Mazzola, G. Sampling, rates, and reaction currents through reverse stochastic quantization on quantum computers. Phys. Rev. A 104, 022431 (2021).

    Article  ADS  MathSciNet  CAS  Google Scholar 

  46. Sherrington, D. & Kirkpatrick, S. Solvable model of a spin-glass. Phys. Rev. Lett. 35, 1792–1796 (1975).

    Article  ADS  Google Scholar 

  47. Suzuki, M. Decomposition formulas of exponential operators and Lie exponentials with some applications to quantum mechanics and statistical physics. J. Math. Phys. 26, 601–612 (1985).

    Article  ADS  MathSciNet  CAS  MATH  Google Scholar 

  48. Wallman, J. J. & Emerson, J. Noise tailoring for scalable quantum computation via randomized compiling. Phys. Rev. A 94, 052325 (2016).

    Article  ADS  Google Scholar 

  49. Earnest, N., Tornow, C. & Egger, D. J. Pulse-efficient circuit transpilation for quantum applications on cross-resonance-based hardware. Phys. Rev. Res. 3, 043088 (2021).

    Article  CAS  Google Scholar 

Download references


We thank K. Temme for discussions that helped shape the project, as well as E. Chen, N. Earnest-Noble, A. Eddins and D. Egger for help with the experiments.

Author information

Authors and Affiliations



D.L. led the theory and the experiments. G.M., R.V.M., M.M. and P.W. contributed to the theory. In particular, D.L. and G.M. independently proposed a variant of this algorithm that uses quantum phase estimation, described in Section V-B of the Supplementary Information. J.-S.K., G.M., R.V.M., M.M. and S.S. contributed to the design of the experiments and S.S. also contributed to their implementation. D.L. drafted the manuscript and supplementary information; all authors contributed to revising both.

Corresponding author

Correspondence to David Layden.

Ethics declarations

Competing interests

Elements of this algorithm are included in a patent filed by the International Business Machines Corporation with the US Patent and Trademark Office, for which D.L., R.V.M. and P.W. are inventors.

Peer review

Peer review information

Nature thanks Ashley Montanaro and the other, anonymous, reviewer(s) for their contribution to the peer review of this work. Peer reviewer reports are available.

Additional information

Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Supplementary information

Supplementary Information

This file contains supplementary sections 1–5 and supplementary references. Supplementary sections 1–5 include supplementary Tables 1–3 and supplementary Figs. 1–37. See contents page for details.

Peer Review File

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and Permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Layden, D., Mazzola, G., Mishmash, R.V. et al. Quantum-enhanced Markov chain Monte Carlo. Nature 619, 282–287 (2023).

Download citation

  • Received:

  • Accepted:

  • Published:

  • Issue Date:

  • DOI:

This article is cited by


By submitting a comment you agree to abide by our Terms and Community Guidelines. If you find something abusive or that does not comply with our terms or guidelines please flag it as inappropriate.


Quick links

Nature Briefing

Sign up for the Nature Briefing newsletter — what matters in science, free to your inbox daily.

Get the most important science stories of the day, free in your inbox. Sign up for Nature Briefing