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.3-cp313-cp313-win_amd64.whl (517.5 kB view details)

Uploaded CPython 3.13Windows x86-64

qector_decoder_v3-0.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (616.3 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.3-cp313-cp313-macosx_11_0_arm64.whl (544.8 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

qector_decoder_v3-0.5.3-cp312-cp312-win_amd64.whl (517.2 kB view details)

Uploaded CPython 3.12Windows x86-64

qector_decoder_v3-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (616.1 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.3-cp312-cp312-macosx_11_0_arm64.whl (544.9 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

qector_decoder_v3-0.5.3-cp311-cp311-win_amd64.whl (517.1 kB view details)

Uploaded CPython 3.11Windows x86-64

qector_decoder_v3-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (616.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.3-cp311-cp311-macosx_11_0_arm64.whl (549.0 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

qector_decoder_v3-0.5.3-cp310-cp310-win_amd64.whl (517.3 kB view details)

Uploaded CPython 3.10Windows x86-64

qector_decoder_v3-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (616.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.3-cp310-cp310-macosx_11_0_arm64.whl (549.4 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

qector_decoder_v3-0.5.3-cp39-cp39-win_amd64.whl (518.6 kB view details)

Uploaded CPython 3.9Windows x86-64

qector_decoder_v3-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (617.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

qector_decoder_v3-0.5.3-cp39-cp39-macosx_11_0_arm64.whl (550.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

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

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 add65ef0119636e826e99b9c3797becf19fddbf6938ce28506f4db94583379da
MD5 f2e03e31e55b6ab5507fa5a7d1528d1d
BLAKE2b-256 7be911814a444c82943b23a1b0b98d99a5c3904d39e71c9c011e4b58cb7ff844

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b3a29b29956a2e7450d51f41ec554901f0aca7d2b66089eff558f98725db6178
MD5 2ed2587c714c5e57085a0501d6971b95
BLAKE2b-256 071301f8626c7872bb54848d42f39fd66481a7e4ac3e6298350e59c6cee9314d

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 785950b652d7b29d5c427266785fca4259b61e603552783e6050ce90c01d941e
MD5 b1da36c145a7f996273e26e0e3aff28c
BLAKE2b-256 3915460e8fac12bf4ec6e23143b3fadefda9b127bf509cf614cef8d91a2754f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4bdd2c7d2781bd79c021dbb1eb7c12eb5c7a309dc4604ace09bf27c5fd5a76d1
MD5 37d98f50ef2da4ccc328cb2367605b38
BLAKE2b-256 29657da94788607105c46e7c5dfa404e7d7045d84783b632a7561345008451fa

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c00d9362fc1b583aed208a681bcbdd9c1765228f8a163aa4294f98bd85d7d100
MD5 b6fcf83f280d9e54e8b7289750a16edf
BLAKE2b-256 a860097afdf64c51968c275777f65dfba1d59f91bfb44daf8405dbbb39fe6be2

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3a33335b4e9450bbab098ea858bb7e9860e13a3c71ed2987bed4ce8791a9b098
MD5 1d52aabad3ecff1c0344bb362ef374aa
BLAKE2b-256 c45a3e5b1212d134d85711570dc0fa328949f94a0521d7354e040bb4d56fbe1b

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 33245801002ea988df8d5a61c3072a7456f83ea1f8601fee7f7aa316c15dbe77
MD5 d48be47f8a475eef60054fffba59ab38
BLAKE2b-256 c2ef544b06a9069d9ac040a847536b9c9af45e5867df8a819e50e3f474d51849

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ecb3dc3449356a9a7318adf21d5c465877ba1c836fbbbc98ba54bc0ece16f9cf
MD5 021a1309fb862708aa941f2281112742
BLAKE2b-256 4e3f71bd66d2cc59c3176206d42ca6151999f15180776581acf69a99bc28fb18

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dcca67d93e936151be46987d1cd40258ccaa34242eab1358e9e82a88f4c96fa1
MD5 002d7096b14f04f2ab115170c4e4ccdf
BLAKE2b-256 6c17b888fa8011d47d414d7fe9cda5c4fffc97ddd60fc54ed67ebf51149c7e2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 7d21119c74212705547d11fd9352666c6b8ebcb9cbc289a3da3f1937690a5c4e
MD5 5b45a93cd7e2c1911c9d06928c28a3f8
BLAKE2b-256 3f10565d8f4087532eedc873126964b70726e8cd9a05da1b56348b62bd916652

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fd38526136fd3bc8986719cf13e927355854823522a65999db2ab8c88fc2e891
MD5 0aba16a8fda34381664b10a593c9ce04
BLAKE2b-256 2ea7e80cdebe9b531bf49380e4b49437b79dc0e250f956cda5c58db500684b96

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0d73144959cff6b2044a7917ade6eb3d1014df7ab411679eb76e3d1e5843cdb0
MD5 b03ed849f84dc763e9a4524bb67da422
BLAKE2b-256 4699ba56e233daeec150e925a1307865783e79e2212c223993d3c9d097003baf

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 f37c1f76e9f19784e5c9030b0d0b921656e9c1e36699b83ba1c5622996ca10bd
MD5 c3edece91addaa33ab02f543cb486a76
BLAKE2b-256 7ccfd89b47c703a0c16eeb329c2a2e490b21c7b2cb48de4813cc920955484d52

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cb1810d783a0b0e4f548d604979e5a02602e20c17e7f1e83110740e8ddb3d9d2
MD5 1c043cc1f925e4e8d4f848155ab1b405
BLAKE2b-256 3badd39de5822c324f72e4784bddd1d25ff576246197035ed9ad7a0034b6f75c

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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.3-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for qector_decoder_v3-0.5.3-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f28cdd5795f94fda8331f7700bb5e74a059cdbb4b6d11bf79003cf48835ae2a5
MD5 db1cf7b33465ea9bc527a54a47b7c320
BLAKE2b-256 197d2baae8567f320104ba4ee45f8f922fb4be4c2537a108a2d7be16eb682366

See more details on using hashes here.

Provenance

The following attestation bundles were made for qector_decoder_v3-0.5.3-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