Skip to content

Error correction and mitigation

Stim

Maintained by quantumlib

Stim is a high-performance simulator focused on stabilizer circuits and error-correction workloads, and it is one of the clearest examples of a specialized tool doing one job extremely well.

C++Apache-2.0v1.0.0Flagship
Stim illustration

Resource snapshot

Category

Error correction and mitigation

Stars

736

Last pushed

May 22, 2026Updated 3mo ago

Open issues

80

What it is

Stim is not trying to be a general-purpose everything framework. Its value comes from being focused, fast, and explicit about the kinds of circuits and analyses it is built to support.

That specialization makes it especially useful for readers mapping the ecosystem. It shows how much serious quantum software is organized around a narrow but important workload instead of around a general beginner experience.

Who it's for

Researchers and advanced developers working on stabilizer simulation, noise analysis, or error-correction-adjacent workloads.

What you can build or learn

  • Benchmark specialized simulation workflows against broader-purpose tools.
  • Understand how error-correction-oriented tooling differs from general circuit SDKs.
  • Learn where performance specialization matters in the ecosystem.

Plays well with

Citation

BibTeX
@software{stim,
  title = {Stim},
  author = {Unknown},
  year = {2024},
}

License

Apache-2.0

SPDX identifier detected from the repository metadata or license files.

Repository README

Preview from the project README.

Rendered as Markdown inside a scrollable preview. Long READMEs stay contained; expand or open on GitHub for the full document.

~914 words · about 4 min readOpen on GitHub

Stim

High-performance simulation of quantum stabilizer circuits for quantum error correction.

◼︎︎  What is Stim? ◼︎︎  How do I use Stim? ◼︎  How does Stim work? ◼︎  How do I cite Stim? ◼︎  Subproject: Sinter decoding sampler ◼︎  Subproject: Crumble interactive editor

What is Stim?

Stim is a tool for high performance simulation and analysis of quantum stabilizer circuits, especially quantum error correction (QEC) circuits. Typically Stim is used as a Python package (pip install stim), though Stim can also be used as a command-line tool or a C++ library.

Stim's key features:

  1. Really fast simulation of stabilizer circuits. Have a circuit with thousands of qubits and millions of operations? stim.Circuit.compile_sampler() will perform a few seconds of analysis and then produce an object that can sample shots at kilohertz rates.

  2. Semi-automatic decoder configuration. stim.Circuit.detector_error_model() converts a noisy circuit into a detector error model (a Tanner graph) which can be used to configure decoders. Adding the option decompose_operations=True will additionally suggest how hyper errors can be decomposed into graphlike errors, making it easier to configure matching-based decoders.

  3. Useful building blocks for working with stabilizers, such as stim.PauliString, stim.Tableau, and stim.TableauSimulator.

Stim's main limitations are:

  1. There is no support for non-Clifford operations, such as T gates and Toffoli gates. Only stabilizer operations are supported.

  2. stim.Circuit only supports Pauli noise channels (eg. no amplitude decay). For more complex noise you must manually drive a stim.TableauSimulator.

  3. stim.Circuit only supports single-control Pauli feedback. For multi-control feedback, or non-Pauli feedback, you must manually drive a stim.TableauSimulator.

Stim's design philosophy:

  • Performance is king. The goal is not to be fast enough, it is to be fast in an absolute sense. Think of it this way. The difference between doing one thing per second (human speeds) and doing ten billion things per second (computer speeds) is 100 decibels (100 factors of 1.26). Because software slowdowns tend to compound exponentially, the choices we make can be thought of multiplicatively; they can be thought of as spending or saving decibels. For example, under default usage, Python is 100 times slower than C++. That's 20dB of the 100dB budget! A fifth of the multiplicative performance budget allocated to language choice! Too expensive! Although Stim will never achieve the glory of 30 GiB per second of FizzBuzz, it at least wishes it could.

  • Bottom up. Stim is intended to be like an assembly language: a mostly straightforward layer upon which more complex layers can be built. The user may define QEC constructions at some high level, perhaps as a set of stabilizers or as a parity check matrix, but these concepts are explained to Stim at a low level (e.g., as circuits). Stim is not necessarily the abstraction that the user wants, but Stim wants to implement low-level pieces simple enough and fast enough that the high-level pieces that the user wants can be built on top.

  • Backwards compatibility. Stim's Python package uses semantic versioning. Within a major version (1.X), Stim guarantees backwards compatibility of its Python API and of its command-line API. Note Stim DOESN'T guarantee backwards compatibility of the underlying C++ API.

How do I use Stim?

See the Getting Started Notebook.

Stuck? Get help on the quantum computing stack exchange and use the stim tag.

See the reference documentation:

How does Stim work?

See the paper describing Stim. Stim makes three core improvements over previous stabilizer simulators:

  1. Vectorized code. Stim's hot loops are heavily vectorized, using 256 bit wide AVX instructions. This makes them very fast. For example, Stim can multiply Pauli strings with 100 billion terms in one second.

  2. Reference Frame Sampling. When bulk sampling, Stim only uses a general stabilizer simulator for an initial reference sample. After that, it cheaply derives as many samples as needed by propagating simulated errors diffed against the reference. This simple trick is ridiculously cheaper than the alternative: constant cost per gate, instead of linear cost or even quadratic cost.

  3. Inverted Stabilizer Tableau. When doing general stabilizer simulation, Stim tracks the inverse of the stabilizer tableau that was historically used. This has the unexpected benefit of making measurements that commute with the current stabilizers take linear time instead of quadratic time. This is beneficial in error correcting codes, because the measurements they perform are usually redundant and so commute with the current stabilizers.

How do I cite Stim?

When using Stim for research, please cite:

@article{gidney2021stim,
  doi = {10.22331/q-2021-07-06-497},
  url = {https://doi.org/10.22331/q-2021-07-06-497},
  title = {Stim: a fast stabilizer circuit simulator},
  author = {Gidney, Craig},
  journal = {{Quantum}},
  issn = {2521-327X},
  publisher = {{Verein zur F{\"{o}}rderung des Open Access Publizierens
                in den Quantenwissenschaften}},
  volume = 5,
  pages = 497,
  month = jul,
  year = 2021
}

Contact

For any questions or concerns not addressed here, please email quantum-oss-maintainers@google.com.

Disclaimer

This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.

Copyright 2025 Google LLC.

Read on GitHub

Activity

Latest release

—

Watchers

16

Python support

—

Learn digest

Get monthly updates when library entries change.

Monthly digest: new library entries, updated flagships, and one editorial pick.

Related resources

Keep exploring nearby tools.

quantumlib

Cirq

Python framework for creating, editing, and running Noisy Intermediate-Scale Quantum (NISQ) circuits.

PythonApache-2.0Flagship

4,971 stars · Updated 3mo ago

unitaryfund

mitiq

Mitiq is an open source toolkit for implementing error mitigation techniques on most current intermediate-scale quantum computers.

PythonGPL-3.0Flagship

432 stars · Updated 3mo ago

MSRudolph

PauliPropagation.jl

A Julia library for Pauli propagation simulation of quantum circuits and quantum systems.

JuliaApache-2.0

138 stars · Updated 4mo ago

QISKit

qiskit

Qiskit is an open-source SDK for working with quantum computers at the level of extended quantum circuits, operators, and primitives.

PythonApache-2.0FlagshipQtangl relevant

7,412 stars · Updated 3mo ago

jacobmarks

QTop

Topological Quantum Computing Simulator

PythonGPL-3.0

38 stars · Updated 6y ago

Microsoft

QuantumKatas

Tutorials and programming exercises for learning Q# and quantum computing

Jupyter NotebookMITFlagshipArchive

4,862 stars · Updated 2y ago