Stim: a fast stabilizer circuit simulator

Craig Gidney

Google Inc., Santa Barbara, California 93117, USA

Find this paper interesting or want to discuss? Scite or leave a comment on SciRate.


This paper presents “Stim", a fast simulator for quantum stabilizer circuits. The paper explains how Stim works and compares it to existing tools. With no foreknowledge, Stim can analyze a distance 100 surface code circuit (20 thousand qubits, 8 million gates, 1 million measurements) in 15 seconds and then begin sampling full circuit shots at a rate of 1 kHz. Stim uses a stabilizer tableau representation, similar to Aaronson and Gottesman's CHP simulator, but with three main improvements. First, Stim improves the asymptotic complexity of deterministic measurement from quadratic to linear by tracking the $inverse$ of the circuit's stabilizer tableau. Second, Stim improves the constant factors of the algorithm by using a cache-friendly data layout and 256 bit wide SIMD instructions. Third, Stim only uses expensive stabilizer tableau simulation to create an initial reference sample. Further samples are collected in bulk by using that sample as a reference for batches of Pauli frames propagating through the circuit.

Quantum stabilizer circuits are simple enough to be efficiently simulated, but rich enough to represent important quantum effects like teleportation and error correction. Stim can analyze many stabilizer circuits tens of times faster than previous tools, and then collect samples tens of thousands of times faster than previous tools. This is useful because analyzing and simulating stabilizer circuits is a foundational part of quantum error correction research.

► BibTeX data

► References

[1] Scott Aaronson and Daniel Gottesman. Improved simulation of stabilizer circuits. Physical Review A, 70 (5): 052328, 2004. 10.1103/​PhysRevA.70.052328.

[2] Thomas Alexander, Lev Bishop, Andrew Cross, Jay Gambetta, Ali Javadi-Abhari, Blake Johnson, and John Smolin. "a new openqasm for a new era of dynamic circuits". https:/​/​​qiskit/​a-new-openqasm-for-a-new-era-of-dynamic-circuits-87f031cac49, 2020. Accessed: 2021-01-26.

[3] Simon Anders and Hans J Briegel. Fast simulation of stabilizer circuits using a graph-state representation. Physical Review A, 73 (2): 022334, 2006. 10.1103/​PhysRevA.73.022334.

[4] Dave Bacon. Operator quantum error-correcting subsystems for self-correcting quantum memories. Physical Review A, 73 (1): 012340, 2006. 10.1103/​PhysRevA.73.012340.

[5] Sergey Bravyi and Dmitri Maslov. Hadamard-free circuits expose the structure of the clifford group. arXiv preprint arXiv:2003.09412, 2020. URL https:/​/​​abs/​2003.09412.

[6] Sergey Bravyi, Dan Browne, Padraic Calpin, Earl Campbell, David Gosset, and Mark Howard. Simulation of quantum circuits by low-rank stabilizer decompositions. Quantum, 3: 181, 2019. 10.22331/​q-2019-09-02-181.

[7] Kaifeng Bu and Dax Enshan Koh. Efficient classical simulation of clifford circuits with nonstabilizer input states. Physical review letters, 123 (17): 170502, 2019. 10.1103/​PhysRevLett.123.170502.

[8] Rui Chao, Michael E Beverland, Nicolas Delfosse, and Jeongwan Haah. Optimization of the surface code design for majorana-based qubits. Quantum, 4: 352, 2020. 10.22331/​q-2020-10-28-352.

[9] Qiskit Contributors. Qiskit: An open-source framework for quantum computing. 2019. 10.5281/​zenodo.2562110.

[10] A. G. Fowler, M. Mariantoni, J. M. Martinis, and A. N. Cleland. Surface codes: Towards practical large-scale quantum computation. Phys. Rev. A, 86: 032324, 2012. URL https:/​/​​10.1103/​PhysRevA.86.032324. arXiv:1208.0928.

[11] Craig Gidney and Austin G Fowler. Efficient magic state factories with a catalyzed $|ccz\rangle$ to $2|t\rangle $ transformation. Quantum, 3: 135, 2019. 10.22331/​q-2019-04-30-135.

[12] Craig Gidney, Austin Fowler, and Michael Newman. Informal private conversations about simulation bottlenecks, 2021.

[13] Daniel Gottesman. Stabilizer codes and quantum error correction. arXiv preprint quant-ph/​9705052, 1997. URL https:/​/​​abs/​quant-ph/​9705052.

[14] David Gross. Hudson’s theorem for finite-dimensional quantum systems. Journal of mathematical physics, 47 (12): 122107, 2006. 10.1063/​1.2393152.

[15] Clare Horsman, Austin G Fowler, Simon Devitt, and Rodney Van Meter. Surface code quantum computing by lattice surgery. New Journal of Physics, 14 (12): 123011, 2012. 10.1088/​1367-2630/​14/​12/​123011.

[16] Jakob Nielsen Hořeňovský. "response times: The 3 important limits". https:/​/​​articles/​response-times-3-important-limits/​, 1993. Accessed: 2021-01-26.

[17] Martin Hořeňovský. "generating random numbers using c++ standard library: the problems". https:/​/​​generating-random-numbers-using-c-standard-library-the-problems/​, 2020. Accessed: 2021-01-26.

[18] "Yack" (https:/​/​​users/​11887/​yack). Answer to "how many n-qubit stabilizer states are there?". Quantum Stack Exchange, 2020. URL https:/​/​​a/​11781/​119. URL:https:/​/​​a/​11781/​119 (version: 2021-01-27).

[19] Yifei Huang and Peter Love. Approximate stabilizer rank and improved weak simulation of clifford-dominated circuits for qudits. Physical Review A, 99 (5): 052307, 2019. 10.1103/​PhysRevA.99.052307.

[20] Yifei Huang and Peter Love. Feynman-path-type simulation using stabilizer projector decomposition of unitaries. Physical Review A, 103 (2), February 2021. 10.1103/​physreva.103.022428. URL https:/​/​​10.1103/​physreva.103.022428.

[21] Intel. Intel intrinsics guide (_mm256_and_si256). https:/​/​​sites/​landingpage/​IntrinsicsGuide/​#text=_mm256_and_si256&expand=301, 2021. Accessed: 2021-01-26.

[22] Angela Karanjai, Joel J Wallman, and Stephen D Bartlett. Contextuality bounds the efficiency of classical simulation of quantum processes. arXiv preprint arXiv:1802.07744, 2018. URL https:/​/​​abs/​1802.07744.

[23] Emanuel Knill. Quantum computing with realistically noisy devices. Nature, 434 (7029): 39–44, 2005. 10.1038/​nature03350.

[24] Shota Nagayama, Austin G Fowler, Dominic Horsman, Simon J Devitt, and Rodney Van Meter. Surface code error correction on a defective lattice. New Journal of Physics, 19 (2): 023050, 2017. 10.1088/​1367-2630/​aa5918.

[25] Jakob Nielsen. Usability engineering. Morgan Kaufmann, 1994.

[26] Peter Norvig. "approximate timing for various operations on a typical pc". http:/​/​​21-days.html#answers, 2014. Accessed: 2021-01-26.

[27] Patrick Rall, Daniel Liang, Jeremy Cook, and William Kretschmer. Simulation of qubit quantum circuits via pauli propagation. Physical Review A, 99 (6): 062337, 2019. 10.1103/​PhysRevA.99.062337.

[28] Quantum AI team and collaborators. Cirq, October 2020. URL https:/​/​​10.5281/​zenodo.4062499.

[29] Matthew Ware, Guilhem Ribeill, Diego Riste, Colm Ryan, Blake Johnson, and Marcus P da Silva. Experimental pauli-frame randomization on a superconducting qubit. In APS March Meeting Abstracts, volume 2017, pages L46–004, 2017. 10.1103/​PhysRevA.103.042604.

[30] Wikipedia. Advanced Vector Extensions — Wikipedia, the free encyclopedia. http:/​/​​w/​index.php?title=Advanced%20Vector%20Extensions&oldid=1021841294, 2021. [Online; accessed 11-May-2021].

Cited by

[1] Xhek Turkeshi, "Measurement-induced criticality as a data-structure transition", Physical Review B 106 14, 144313 (2022).

[2] Piotr Sierant and Xhek Turkeshi, "Controlling Entanglement at Absorbing State Phase Transitions in Random Circuits", Physical Review Letters 130 12, 120402 (2023).

[3] Alex Townsend-Teague, Julio Magdalena de la Fuente, and Markus Kesselring, "Floquetifying the Colour Code", Electronic Proceedings in Theoretical Computer Science 384, 265 (2023).

[4] Leandro Stefanazzi, Kenneth Treptow, Neal Wilcer, Chris Stoughton, Collin Bradford, Sho Uemura, Silvia Zorzetti, Salvatore Montella, Gustavo Cancelo, Sara Sussman, Andrew Houck, Shefali Saxena, Horacio Arnaldi, Ankur Agrawal, Helin Zhang, Chunyang Ding, and David I. Schuster, "The QICK (Quantum Instrumentation Control Kit): Readout and control for qubits and detectors", Review of Scientific Instruments 93 4, 044709 (2022).

[5] Thomas Grurl, Jürgen Fuß, and Robert Wille, 2023 IEEE 53rd International Symposium on Multiple-Valued Logic (ISMVL) 141 (2023) ISBN:978-1-6654-6416-1.

[6] Yangsen Ye, Tan He, He-Liang Huang, Zuolin Wei, Yiming Zhang, Youwei Zhao, Dachao Wu, Qingling Zhu, Huijie Guan, Sirui Cao, Fusheng Chen, Tung-Hsun Chung, Hui Deng, Daojin Fan, Ming Gong, Cheng Guo, Shaojun Guo, Lianchen Han, Na Li, Shaowei Li, Yuan Li, Futian Liang, Jin Lin, Haoran Qian, Hao Rong, Hong Su, Shiyu Wang, Yulin Wu, Yu Xu, Chong Ying, Jiale Yu, Chen Zha, Kaili Zhang, Yong-Heng Huo, Chao-Yang Lu, Cheng-Zhi Peng, Xiaobo Zhu, and Jian-Wei Pan, "Logical Magic State Preparation with Fidelity beyond the Distillation Threshold on a Superconducting Quantum Processor", Physical Review Letters 131 21, 210603 (2023).

[7] Piotr Sierant and Xhek Turkeshi, "Universal Behavior beyond Multifractality of Wave Functions at Measurement-Induced Phase Transitions", Physical Review Letters 128 13, 130605 (2022).

[8] Craig Gidney, Michael Newman, and Matt McEwen, "Benchmarking the Planar Honeycomb Code", Quantum 6, 813 (2022).

[9] Adrien Suau, Gabriel Staffelbach, and Aida Todri-Sanial, "qprof: A gprof-Inspired Quantum Profiler", ACM Transactions on Quantum Computing 4 1, 1 (2023).

[10] Anbang Wu, Gushu Li, Hezi Zhang, Gian Giacomo Guerreschi, Yufei Ding, and Yuan Xie, Proceedings of the 49th Annual International Symposium on Computer Architecture 337 (2022) ISBN:9781450386104.

[11] Misty A. Wahl, Andrea Mari, Nathan Shammah, William J. Zeng, and Gokul Subramanian Ravi, 2023 IEEE International Conference on Quantum Computing and Engineering (QCE) 888 (2023) ISBN:979-8-3503-4323-6.

[12] Jaime Alvarado-Valiente, Javier Romero-Álvarez, Enrique Moguel, José García-Alonso, and Juan M. Murillo, "Technological diversity of quantum computing providers: a comparative study and a proposal for API Gateway integration", Software Quality Journal (2023).

[13] Thien Nguyen, Dmitry Lyakh, Eugene Dumitrescu, David Clark, Jeff Larkin, and Alexander McCaskey, "Tensor Network Quantum Virtual Machine for Simulating Quantum Circuits at Exascale", ACM Transactions on Quantum Computing 4 1, 1 (2023).

[14] Theerapat Tansuwannont, Balint Pato, and Kenneth R. Brown, "Adaptive syndrome measurements for Shor-style error correction", Quantum 7, 1075 (2023).

[15] Kenton M. Barnes, Tomasz Bialas, Okan Buğdayci, Earl T. Campbell, Neil I. Gillespie, Kauser Johar, Ram Rajan, Adam W. Richardson, Luka Skoric, Canberk Topal, Mark L. Turner, and Abbas B. Ziad, 2023 IEEE International Conference on Quantum Computing and Engineering (QCE) 375 (2023) ISBN:979-8-3503-4323-6.

[16] Niel de Beaudrap and Steven Herbert, "Fast Stabiliser Simulation with Quadratic Form Expansions", Quantum 6, 803 (2022).

[17] Younghun Kim, Jeongsoo Kang, and Younghun Kwon, "Design of quantum error correcting code for biased error on heavy-hexagon structure", Quantum Information Processing 22 6, 230 (2023).

[18] Alexander Tianlin Hu and Andrey Boris Khesin, "Improved graph formalism for quantum circuit simulation", Physical Review A 105 2, 022432 (2022).

[19] Dimitrios Thanos, Tim Coopmans, and Alfons Laarman, Lecture Notes in Computer Science 14216, 199 (2023) ISBN:978-3-031-45331-1.

[20] Kaavya Sahay, Junlan Jin, Jahan Claes, Jeff D. Thompson, and Shruti Puri, "High-Threshold Codes for Neutral-Atom Qubits with Biased Erasure Errors", Physical Review X 13 4, 041013 (2023).

[21] Jaime Alvarado-Valiente, Javier Romero-Álvarez, Danel Arias, Erik B. Terres, Jose Garcia-Alonso, Enrique Moguel, Pablo García Bringas, and Juan M. Murillo, Lecture Notes in Computer Science 14001, 180 (2023) ISBN:978-3-031-40724-6.

[22] Robin Harper and Steven T. Flammia, "Learning Correlated Noise in a 39-Qubit Quantum Processor", PRX Quantum 4 4, 040311 (2023).

[23] Avimita Chatterjee, Koustubh Phalak, and Swaroop Ghosh, 2023 IEEE International Conference on Quantum Computing and Engineering (QCE) 70 (2023) ISBN:979-8-3503-4323-6.

[24] Benjamin Bichsel, Anouk Paradis, Maximilian Baader, and Martin Vechev, "Abstraqt: Analysis of Quantum Circuits via Abstract Stabilizer Simulation", Quantum 7, 1185 (2023).

[25] Xhek Turkeshi, Marco Schirò, and Piotr Sierant, "Measuring nonstabilizerness via multifractal flatness", Physical Review A 108 4, 042408 (2023).

[26] Mingyu Kang, Wesley C. Campbell, and Kenneth R. Brown, "Quantum Error Correction with Metastable States of Trapped Ions Using Erasure Conversion", PRX Quantum 4 2, 020358 (2023).

[27] Satvik Maurya, Chaithanya Naik Mude, William D. Oliver, Benjamin Lienhard, and Swamit Tannu, Proceedings of the 50th Annual International Symposium on Computer Architecture 1 (2023) ISBN:9798400700958.

[28] Jianxin Chen, Dawei Ding, Cupjin Huang, and Linghang Kong, "Linear cross-entropy benchmarking with Clifford circuits", Physical Review A 108 5, 052613 (2023).

[29] Stefano Markidis, Proceedings of the SC '23 Workshops of The International Conference on High Performance Computing, Network, Storage, and Analysis 1478 (2023) ISBN:9798400707858.

[30] Oscar Higgott, "PyMatching: A Python Package for Decoding Quantum Codes with Minimum-Weight Perfect Matching", ACM Transactions on Quantum Computing 3 3, 1 (2022).

[31] Áron Márton and János K. Asbóth, "Coherent errors and readout errors in the surface code", Quantum 7, 1116 (2023).

[32] Ilkwon Byun, Junpyo Kim, Dongmoon Min, Ikki Nagaoka, Kosuke Fukumitsu, Iori Ishikawa, Teruo Tanimoto, Masamitsu Tanaka, Koji Inoue, and Jangwoo Kim, Proceedings of the 49th Annual International Symposium on Computer Architecture 366 (2022) ISBN:9781450386104.

[33] Thomas Grurl, Christoph Pichler, Jürgen Fuß, and Robert Wille, 2023 36th International Conference on VLSI Design and 2023 22nd International Conference on Embedded Systems (VLSID) 301 (2023) ISBN:979-8-3503-4678-7.

[34] Jason Gavriel, Daniel Herr, Alexis Shaw, Michael J. Bremner, Alexandru Paler, and Simon J. Devitt, "Transversal injection for direct encoding of ancilla states for non-Clifford gates using stabilizer codes", Physical Review Research 5 3, 033019 (2023).

[35] Max McGinley, Sthitadhi Roy, and S. A. Parameswaran, "Absolutely Stable Spatiotemporal Order in Noisy Quantum Systems", Physical Review Letters 129 9, 090404 (2022).

[36] Thomas R. Scruby, Michael Vasmer, and Dan E. Browne, "Non-Pauli errors in the three-dimensional surface code", Physical Review Research 4 4, 043052 (2022).

[37] Craig Gidney, "A Pair Measurement Surface Code on Pentagons", Quantum 7, 1156 (2023).

[38] Asim Sharma and Avah Banerjee, 2023 IEEE International Conference on Quantum Computing and Engineering (QCE) 82 (2023) ISBN:979-8-3503-4323-6.

[39] Lucas Berent, Lukas Burgholzer, and Robert Wille, Proceedings of the 28th Asia and South Pacific Design Automation Conference 709 (2023) ISBN:9781450397834.

[40] Suhas Vittal, Poulami Das, and Moinuddin Qureshi, Proceedings of the 50th Annual International Symposium on Computer Architecture 1 (2023) ISBN:9798400700958.

[41] Luka Skoric, Dan E. Browne, Kenton M. Barnes, Neil I. Gillespie, and Earl T. Campbell, "Parallel window decoding enables scalable fault tolerant quantum computation", Nature Communications 14 1, 7040 (2023).

[42] Yilun Zhao, Yu Chen, He Li, Ying Wang, Kaiyan Chang, Bingmeng Wang, Bing Li, and Yinhe Han, 2023 IEEE/ACM International Conference on Computer Aided Design (ICCAD) 1 (2023) ISBN:979-8-3503-2225-5.

[43] Piotr Sierant, Marco Schirò, Maciej Lewenstein, and Xhek Turkeshi, "Measurement-induced phase transitions in (d+1) -dimensional stabilizer circuits", Physical Review B 106 21, 214316 (2022).

[44] Oscar Higgott, Thomas C. Bohdanowicz, Aleksander Kubica, Steven T. Flammia, and Earl T. Campbell, "Improved Decoding of Circuit Noise and Fragile Boundaries of Tailored Surface Codes", Physical Review X 13 3, 031007 (2023).

[45] Craig Gidney, Michael Newman, Austin Fowler, and Michael Broughton, "A Fault-Tolerant Honeycomb Memory", Quantum 5, 605 (2021).

[46] Neereja Sundaresan, Theodore J. Yoder, Youngseok Kim, Muyuan Li, Edward H. Chen, Grace Harper, Ted Thorbeck, Andrew W. Cross, Antonio D. Córcoles, and Maika Takita, "Demonstrating multi-round subsystem quantum error correction using matching and maximum likelihood decoders", Nature Communications 14 1, 2852 (2023).

[47] Tanmay Singal, Che Chiang, Eugene Hsu, Eunsang Kim, Hsi-Sheng Goan, and Min-Hsiu Hsieh, "Counting stabiliser codes for arbitrary dimension", Quantum 7, 1048 (2023).

[48] Kaitlin N. Smith, Michael A. Perlin, Pranav Gokhale, Paige Frederick, David Owusu-Antwi, Richard Rines, Victory Omole, and Frederic Chong, Proceedings of the 50th Annual International Symposium on Computer Architecture 1 (2023) ISBN:9798400700958.

[49] Matt McEwen, Dave Bacon, and Craig Gidney, "Relaxing Hardware Requirements for Surface Code Circuits using Time-dynamics", Quantum 7, 1172 (2023).

[50] Alexander M. Dalzell, Sam McArdle, Mario Berta, Przemyslaw Bienias, Chi-Fang Chen, András Gilyén, Connor T. Hann, Michael J. Kastoryano, Emil T. Khabiboulline, Aleksander Kubica, Grant Salton, Samson Wang, and Fernando G. S. L. Brandão, "Quantum algorithms: A survey of applications and end-to-end complexities", arXiv:2310.03011, (2023).

[51] Antonio deMarti iOlius, Patricio Fuentes, Román Orús, Pedro M. Crespo, and Josu Etxezarreta Martinez, "Decoding algorithms for surface codes", arXiv:2307.14989, (2023).

[52] Qian Xu, J. Pablo Bonilla Ataides, Christopher A. Pattison, Nithin Raveendran, Dolev Bluvstein, Jonathan Wurtz, Bane Vasic, Mikhail D. Lukin, Liang Jiang, and Hengyun Zhou, "Constant-Overhead Fault-Tolerant Quantum Computation with Reconfigurable Atom Arrays", arXiv:2308.08648, (2023).

[53] Linnea Grans-Samuelsson, Ryan V. Mishmash, David Aasen, Christina Knapp, Bela Bauer, Brad Lackey, Marcus P. da Silva, and Parsa Bonderson, "Improved Pairwise Measurement-Based Surface Code", arXiv:2310.12981, (2023).

[54] Alex Townsend-Teague, Julio Magdalena de la Fuente, and Markus Kesselring, "Floquetifying the Colour Code", arXiv:2307.11136, (2023).

[55] Kieran Young, Marcus Scese, and Ali Ebnenasir, "Simulating Quantum Computations on Classical Machines: A Survey", arXiv:2311.16505, (2023).

[56] Misty A. Wahl, Andrea Mari, Nathan Shammah, William J. Zeng, and Gokul Subramanian Ravi, "Zero noise extrapolation on logical qubits by scaling the error correction code distance", arXiv:2304.14985, (2023).

[57] Dimitrios Thanos, Tim Coopmans, and Alfons Laarman, "Fast equivalence checking of quantum circuits of Clifford gates", arXiv:2308.01206, (2023).

[58] David Winderl, Qunsheng Huang, Arianne Meijer-van de Griend, and Richie Yeung, "Architecture-Aware Synthesis of Stabilizer Circuits from Clifford Tableaus", arXiv:2309.08972, (2023).

[59] Craig Gidney, "Inplace Access to the Surface Code Y Basis", arXiv:2302.07395, (2023).

[60] Craig Gidney and Dave Bacon, "Less Bacon More Threshold", arXiv:2305.12046, (2023).

[61] Suhas Vittal, Poulami Das, and Moinuddin Qureshi, "ERASER: Towards Adaptive Leakage Suppression for Fault-Tolerant Quantum Computing", arXiv:2309.13143, (2023).

[62] Naphan Benchasattabuse, Michal Hajdušek, and Rodney Van Meter, "Architecture and protocols for all-photonic quantum repeaters", arXiv:2306.03748, (2023).

[63] Christophe Piveteau, Christopher T. Chubb, and Joseph M. Renes, "Tensor Network Decoding Beyond 2D", arXiv:2310.10722, (2023).

[64] Wang Fang and Mingsheng Ying, "SymPhase: Phase Symbolization for Fast Simulation of Stabilizer Circuits", arXiv:2311.03906, (2023).

The above citations are from Crossref's cited-by service (last updated successfully 2023-12-07 02:58:04) and SAO/NASA ADS (last updated successfully 2023-12-07 02:58:04). The list may be incomplete as not all publishers provide suitable and complete citation data.