Skip to main content

Source-available Rust/Python quantum error correction decoder package for QEC research, PyMatching-compatible validation, belief-matching, BP-OSD/qLDPC workflows, CPU/GPU batch decoding, and reproducible benchmark evidence

Project description

QECTOR Decoder v3

Python and Rust quantum error correction decoder package.

QECTOR Decoder v3 helps researchers and developers test quantum error correction decoder workflows from Python, with native Rust performance paths and reproducible benchmark artifacts.

Common search terms: quantum error correction, QEC decoder, quantum decoder Python, Rust quantum error correction, PyMatching-compatible decoder, Stim workflow, Sinter benchmark, BP-OSD, LDPC, qLDPC, surface code decoder, MWPM decoder, union find decoder, belief matching, PyO3, maturin, QECTOR.

Website: https://www.qector.store
PyPI: https://pypi.org/project/qector-decoder-v3/
DOI: https://doi.org/10.5281/zenodo.20825980
Repository: https://github.com/GuillaumeLessard/qector-decoder
Commercial licensing: https://www.qector.store


Installation

Recommended command:

pip install qector-decoder-v3

Verify the install:

python -c "from qector_decoder_v3 import UnionFindDecoder, BlossomDecoder; print('QECTOR OK')"

Optional extras:

pip install "qector-decoder-v3[stim]"
pip install "qector-decoder-v3[bench]"
pip install "qector-decoder-v3[all]"

Windows note

Use the pip bound to your active standard Python environment. Do not force py -m pip unless you have checked which interpreter the Windows launcher selected.

On some systems, py can select a free-threaded interpreter such as python3.13t.exe. QECTOR v0.5.x publishes standard CPython wheels, not cp313t free-threaded wheels.

Working Windows command:

pip install qector-decoder-v3
python -c "from qector_decoder_v3 import UnionFindDecoder, BlossomDecoder; print('QECTOR OK')"

Check launcher targets with:

py -0p

Supported public wheels

Platform Wheel status
Linux x86_64 Published
Windows x64 Published
macOS arm64 / Apple Silicon Published
macOS Intel x86_64 Not published in v0.5.x public CI
CPython free-threaded builds such as cp313t Not published in v0.5.x

Supported Python classifiers are standard CPython 3.9 to 3.13.


Quick start

import numpy as np
from qector_decoder_v3 import UnionFindDecoder, BlossomDecoder

check_to_qubits = [[0, 1], [1, 2], [2, 3], [3, 4]]
n_qubits = 5
syndrome = np.array([0, 1, 0, 0], dtype=np.uint8)

uf = UnionFindDecoder(check_to_qubits, n_qubits)
print(uf.decode(syndrome))

mwpm = BlossomDecoder(check_to_qubits, n_qubits)
print(mwpm.decode(syndrome))

Batch decoding:

import numpy as np
from qector_decoder_v3 import BatchDecoder

checks = [[0, 1], [1, 2], [2, 3], [3, 4]]
syndromes = np.random.randint(0, 2, size=(4096, 4), dtype=np.uint8)

cpu = BatchDecoder(checks, n_qubits=5)
corrections = cpu.parallel_batch_decode(syndromes)
# single-shot also works (v0.5.3+):
corrections_single = cpu.decode(syndromes[0])
print(corrections.shape)

API surface

Stim / DEM integration

import stim
from qector_decoder_v3.stim_compat import (
    from_stim_detector_error_model,
    stim_circuit_to_check_matrix,  # identical alias
    to_stim_decoder,
    stim_decoder_from_dem,
)

dem = stim.Circuit.generated(
    "surface_code:rotated_memory_x", distance=5
).detector_error_model(decompose_errors=True)

c2q, nq = from_stim_detector_error_model(dem)
# or equivalently: stim_circuit_to_check_matrix(dem)

decoder = stim_decoder_from_dem(dem)

Sinter integration

import sinter
from qector_decoder_v3.sinter_compat import (
    QectorSinterDecoder,
    QectorDecoderWrapper,   # backward-compat alias for QectorSinterDecoder
    qector_sinter_decoders,
)

samples = sinter.collect(
    num_workers=4,
    tasks=tasks,
    decoders=["qector_belief", "qector_blossom", "qector_unionfind"],
    custom_decoders=qector_sinter_decoders(),
)

# standalone single-syndrome decode (v0.5.3+, no Sinter required):
dec = QectorSinterDecoder("blossom")
obs = dec.decode(syndrome, dem=dem)

BeliefMatching raw H constructor (v0.5.3+)

import numpy as np
from qector_decoder_v3.belief_matching import BeliefMatching

# From a Stim DEM (recommended for circuit-level noise):
bm = BeliefMatching.from_detector_error_model(dem)

# From a raw check matrix H (uniform prior p=0.1):
H = np.array([[1, 1, 0], [0, 1, 1]], dtype=np.uint8)
bm = BeliefMatching(H, p=0.05)
obs = bm.decode(syndrome)

CUDA / GPU

from qector_decoder_v3 import CUDABatchDecoder

# Always check availability before constructing
if CUDABatchDecoder.is_available():
    dec = CUDABatchDecoder(check_to_qubits, n_qubits)
    corrections = dec.batch_decode(syndromes)
else:
    print("No CUDA GPU detected — use BatchDecoder for CPU batch decoding")

Independent validation (v0.5.3)

Validated by independent automated test suite (87/87 checks PASS on v0.5.3). Platform: Windows 10, AMD Ryzen 16-core, NVIDIA GTX 1660 Ti (CUDA 7.5), Python 3.11, PyMatching 2.4.0. Full artifact: benchmark_results/results_v053_retest.json.

v0.5.3 API fixes (all 3 verified):

Fix Before After
BatchDecoder.decode(syndrome) absent (only parallel_batch_decode) present, 1-row batch wrapper
BeliefMatching(H, p=0.1) TypeError (expected _Matrices) accepts raw numpy H, uniform prior
QectorSinterDecoder.decode(syndrome, dem) absent present, DEM cached on first call
Claim Result
30 decoder x code combinations, 100% syndrome-valid corrections Confirmed
pymatching_compat bit-identical to PyMatching 2.4.0 Confirmed
Blossom LER within 0.00% of PyMatching on repetition code d=3-9 Confirmed
Blossom LER within 1.78% of PyMatching on rotated surface code d=3-7 Confirmed
CUDA batch 100% CPU-agreeing at all tested batch sizes (GTX 1660 Ti) Confirmed
CUDA batch 6.9-7.7x faster than CPU batch at 100k shots Confirmed
Workbench single-decode rep d=5 Blossom: 285,713 dec/s, p50 3.50 us, p99 9.50 us Confirmed
AutoDecoder backends: cpu, cuda GTX 1660 Ti, opencl=False Confirmed
Workbench JSON/CSV/PDF export pipeline end-to-end Confirmed
LookupTableDecoder table_size for rep d=5: 64 entries Confirmed
d=101 stress decode completes without error Confirmed
Invalid input rejected with clear ValueError / TypeError Confirmed

Single-shot latency reference (us/decode, 2000 samples, independently validated)

Decoder rep d=5 rep d=9 surf d=3 surf d=5
UnionFindDecoder 9.3 10.0 12.2 10.1
FastUnionFindDecoder 9.5 10.2 11.4 12.1
BlossomDecoder 10.6 10.6 14.8 16.8
SparseBlossomDecoder 11.8 10.6 11.5 29.2
CPUBatchDecoder 11.2 9.7 9.5 10.7
LookupTableDecoder 8.7 10.7 9.5

LookupTableDecoder is the fastest single-shot decoder on rep d=5 (precomputed table, 64 entries, O(1) lookup).

Known limitations

  • Union-Find is ~3x less accurate than MWPM — expected speed/accuracy trade-off.
  • Single-round code-capacity noise does not produce surface-code distance scaling. Use circuit-level Stim DEM with qector_sinter_decoders() for threshold curves.
  • SparseBlossom batch may return different (but valid) corrections than single-shot on degenerate syndromes. Benign matching degeneracy.
  • CUDABatchDecoder raises RuntimeError cleanly when no CUDA GPU is present. Use CUDABatchDecoder.is_available() to check first.

License

Source-available. Commercial use requires written licensing through https://www.qector.store.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

qector_decoder_v3-0.5.4-cp313-cp313-win_amd64.whl (518.3 kB view details)

Uploaded CPython 3.13Windows x86-64

qector_decoder_v3-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (616.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.4-cp313-cp313-macosx_11_0_arm64.whl (546.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

qector_decoder_v3-0.5.4-cp312-cp312-win_amd64.whl (517.9 kB view details)

Uploaded CPython 3.12Windows x86-64

qector_decoder_v3-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (616.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.4-cp312-cp312-macosx_11_0_arm64.whl (546.0 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qector_decoder_v3-0.5.4-cp311-cp311-win_amd64.whl (518.0 kB view details)

Uploaded CPython 3.11Windows x86-64

qector_decoder_v3-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (616.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.4-cp311-cp311-macosx_11_0_arm64.whl (550.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qector_decoder_v3-0.5.4-cp310-cp310-win_amd64.whl (518.3 kB view details)

Uploaded CPython 3.10Windows x86-64

qector_decoder_v3-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (617.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.4-cp310-cp310-macosx_11_0_arm64.whl (550.7 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

qector_decoder_v3-0.5.4-cp39-cp39-win_amd64.whl (519.5 kB view details)

Uploaded CPython 3.9Windows x86-64

qector_decoder_v3-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (618.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.4-cp39-cp39-macosx_11_0_arm64.whl (551.8 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file qector_decoder_v3-0.5.4-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f1ef2d37b68258109874ed32542f476ce88f9e4725710c84f32c4a10a0cac36a
MD5 06509f90b188bd3ac96d2496914a50f0
BLAKE2b-256 58561b73dc7832574bc0913b045cc46ffc67435014700574ef653f5567870215

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp313-cp313-win_amd64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 6c3e20f63d9801e4525182818ef4130ebb5ad09c3a8c8cb7319756f047c39993
MD5 37fea4ddd62829236943867eedb0af1c
BLAKE2b-256 bb28bc836210d2c4734a75a9a2be683d31464b4abc025da6a077e10af15878dd

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e24d0db913d1f584b2754894ab487bedb803bd623d996871ab36107e5c663e4b
MD5 3683e8a9760dc66b408814b31b61d096
BLAKE2b-256 d0b448736da56dd54562f4aa4e21081d809b85f18c81ed434cb4c043e1a7d2cf

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp313-cp313-macosx_11_0_arm64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4d2ee3f212d5614f81683bd4d7bf40aaaf6316b048ae4bab6168a66feae00eb8
MD5 5e84f39658c6866ad1edfed157e56d95
BLAKE2b-256 c882eb97c2a40f98157d8a12e2b3c84466fa7672170031368c45885c634981b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp312-cp312-win_amd64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b1f0a0372d5fca5cd8793ee68cc9e7fb31fc63e7bdd009fedb18d130b3fa05d4
MD5 10d624b40ea43cf0597dd744d6e90e66
BLAKE2b-256 70cffa2c9c3769f407baaac9168a6a05024d5cb0093e4e0251f9061645dd1392

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f53912dccc579c635cf03b849169571d8117efc67a20f293f54b068314607b07
MD5 fa4f7a6c555658a107a79ec45e2f95b6
BLAKE2b-256 da824c85046c4e6c784037e60f71b87d3d7faa1d9cba98317d6c42e8770d4885

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp312-cp312-macosx_11_0_arm64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fb75fbabdd05d6424b8558cf580027e25fb605183f581ca5024bfe855e31ed34
MD5 213fcfc9f31ad556bc0adf56fedeb675
BLAKE2b-256 ceaa0063d46e130d2b8ccf7ce1cebd131d17b7e5ffb46244e766c1dd9afbf53f

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp311-cp311-win_amd64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cd65a41031b460170cb57f24a43c3536b698e29a5be90320eb1e58eb673a612e
MD5 c8b389932a09575860b47e53a91ce11e
BLAKE2b-256 0044348fa44e4657074047db7b40596e5cafdd10870dda8016df3b190e4bcc51

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 e3e3c6d9c4889af871d2631e6148f8e262d7eed2acb6e2707cc3562d0509a36a
MD5 9237710669f10e3931cfda6f507b7891
BLAKE2b-256 dd6b3c247d458c1b4001cf2ace829fd443585ae0e185fe64b8144f0bfd492d63

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp311-cp311-macosx_11_0_arm64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c7ab4528a68f00f94fbee55bc0367d0d5cf4edc4a3761e0a058096c7e7c6191c
MD5 4ce8614349848060290dca8d7b374396
BLAKE2b-256 5fdcadcf02e94a14fb8c447ad71b0cd68b1990c4b1323295d4bb0c589084c783

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp310-cp310-win_amd64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 12ab259f7981a12136636bfa08d5def750cf034091862c84a6552074dbfba673
MD5 6da28c34edfede197adf3ce6ed6a6a5a
BLAKE2b-256 1147263ec52bcdfebe3fa6c5c435ad305da1a716ffc3204212b0bab6c22432ff

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 667d7e30ddeb44624f041a838af7ce600350886355704bd5f99b7440ab9dee40
MD5 531620566cfa36da82b1f97224c5d615
BLAKE2b-256 e346d2bceff3418a258b4a0ab2d5719b19ea46f79f636a0f9d1db5c10d1521ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp310-cp310-macosx_11_0_arm64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 6109a12c260c28c122f71244ba8cecd5ea69af720550f9e275b94c4eae0fe9f0
MD5 42324c0e78eb81d2a973248c419c921b
BLAKE2b-256 7c2d36f6bcfca93d53c59877634b6ad5d71e87fb71410a876641a1b28c46db74

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp39-cp39-win_amd64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 08eb7f8d7e794f3f19c03327a03728ecf0bcc163e918b6e7abfdcc9973113fec
MD5 a01f0876e725322c508416c65c81dbe8
BLAKE2b-256 decbc53d83a4b0390bcf26dad7c4f93f5efed48fb4b88ffeea4f293f8c0b1da6

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file qector_decoder_v3-0.5.4-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.4-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 1276e1d0b7213c07e0582d9da8ab4fb90c9c6e92d5e0660b3fdb368348488497
MD5 15ea44b7334b24d2f97f1a35ea4fa712
BLAKE2b-256 cdcd898dc4660c34e1e0e738678f4e39b433596d184ee09dc5015c89e4e69779

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.4-cp39-cp39-macosx_11_0_arm64.whl:

Publisher: CI.yml on GuillaumeLessard/qector-decoder

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page