Documentation
Guides & tutorials
Five hands-on walkthroughs, in order — from a zero-dependency toric-code decode to circuit-level qLDPC decoding, picking the right decoder, reaching rare logical-error rates, and plugging into Stim's collection framework. Each snippet runs against the built module.
Build from source first: maturin develop --release
Before you start
- Build the Rust core into your active environment with
maturin develop --release, then checkimport gleanworks. - The first guide needs nothing else. From the second onward, install the optional extras you
use:
pip install stim(circuits + detector error models),numpy(array ergonomics + the estimators), andsinter(the last guide). - New to the API surface? Keep the API reference open alongside these guides.
- 1
Quick start
Build a toric code, inject an error, decode it, and measure a logical error rate — with no external dependencies.
- 2
Circuit-level decoding from a Stim DEM
The real workflow: ingest a flattened Stim detector error model and decode batches of syndromes entirely in Rust.
- 3
Choosing a decoder
BP+OSD-CS, relay-BP, or BP+OTF — what each of the three paradigms is good at, and how to swap between them on one DEM.
- 4
Rare-event estimation
Reach 10⁻⁷ logical error rates without 10⁹ shots, using the decoder-agnostic glean.dss and glean.splitting estimators.
- 5
sinter integration
Plug Glean into Stim’s sinter.collect(...) pipeline as a drop-in, picklable decoder.