Skip to main content

bloqade-decoders

The QEC user interface providing integration with popular open-source decoders for the Bloqade SDK.

By default, the following decoders from the ldpc package and their corresponding interfaces are immediately available for decoding use upon installation of this package:

  • BP+OSD - through bloqade.decoders.BpOsdDecoder
  • BP+LSD - through bloqade.decoders.BpLsdDecoder
  • Belief Find - through bloqade.decoders.BeliefFindDecoder

Interfaces also exist for the following optional decoders, which are not included as dependencies by default:

  • MWPF - through bloqade.decoders.MWPFDecoder (MWPF)
  • Tesseract - through bloqade.decoders.TesseractDecoder (Tesseract)
  • MLE (MILP) - through bloqade.decoders.MILPDecoder, finds the most likely error pattern via mixed-integer programming (PuLP; HiGHS works out of the box, CPLEX/COPT/Gurobi backends optional)
  • MLE (Gurobi, deprecated) - through bloqade.decoders.GurobiDecoder; use MILPDecoder instead
  • MLD (Table Lookup) - through bloqade.decoders.TableDecoder, builds a lookup table from sampled data

Sinter-compatible adapters for MLE and MLD are also available through bloqade.decoders.sinter_interface.

You can install them separately or specify you would like them included with the bloqade-decoders installation through the additional instructions below.

Installation

For access to the ldpc-package originating decoders and their respective interfaces, just do the following:

pip install bloqade-decoders

To add the tesseract decoder you can do:

pip install bloqade-decoders[tesseract]

Or for MWPF do:

pip install bloqade-decoders[mwpf]

For MLE via PuLP (HiGHS is bundled; CPLEX, COPT, and Gurobi are also supported as solver backends):

pip install bloqade-decoders[milp]

For the deprecated Gurobi-based MLE decoder (a full Gurobi license is needed for larger problems, but small models work with the size-limited license bundled with gurobipy):

pip install bloqade-decoders[mle]

For MLD:

pip install bloqade-decoders[mld]

You can combine multiple extras:

pip install bloqade-decoders[mwpf, tesseract, milp, mle, mld, sinter]

Usage

The decoding interfaces are designed to align as closely as possible with the decoders themselves in terms of arguments. The only major difference is you're expected to pass in a Detector Error Model (DEM) to instantiate the interface.

Furthermore, all decoder interfaces are designed to accept the detector results of a single shot OR a batch of shots as a numpy ndarray of booleans, with the result being the observable correction (also as an ndarray of booleans).

from bloqade.decoders import BpOsdDecoder
import numpy as np
import stim

dem = stim.DetectorErrorModel("""
    error(0.1) D0
    error(0.1) D0 D1
    error(0.1) D1 L0
""")
# Pretend that circuit was executed twice,
# with two sets of detector results.
syndromes = np.array([[False, False], [False, True]])

# instantiate decoder, passing in desired arguments as you would
# the original decoder interface.
decoder = BpOsdDecoder(dem, bp_method="product_sum")

decoded_observable = decoder.decode(syndromes)
# decoded_observable should give you
# np.array([[False], [True]])

MLE / MLD Decoders

The MILPDecoder takes a DEM directly (note: must use decompose_errors=False):

from bloqade.decoders import MILPDecoder

decoder = MILPDecoder(dem)  # HiGHS backend by default
# or pick another PuLP solver backend
decoder = MILPDecoder(dem, solver="COPT", RelGap=0.0, AbsGap=0.0)

corrections = decoder.decode(syndromes)

To see different solver options, as per the PuLP documentation, you can run

import pulp as pl
solver_list = pl.listSolvers()
print(solver_list)
# ['GLPK_CMD', 'PYGLPK', 'CPLEX_CMD', 'CPLEX_PY', 'CPLEX_DLL', 'GUROBI', 'GUROBI_CMD', 'MOSEK', 'XPRESS', 'COIN_CMD', 'COINMP_DLL', 'CHOCO_CMD', 'MIPCL_CMD', 'SCIP_CMD', 'CPSAT', ...]

The GurobiDecoder is deprecated; use MILPDecoder(dem, solver="GUROBI") instead.

The TableDecoder takes a DEM directly and trains by sampling from that DEM:

from bloqade.decoders import TableDecoder

decoder = TableDecoder(dem)
# or choose a training sample count
decoder = TableDecoder(dem, num_shots=100_000)

corrections = decoder.decode(syndromes)

Quick Start

For a short demonstration of using the TableDecoder and GurobiDecoder, you can refer to this script.

Metadata

Release files for bloqade-decoders 0.7.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bloqade-decoders 0.7.0
File Size Uploaded Provenance Actions
bloqade_decoders-0.7.0.tar.gz 186.4 kB With provenance Details for bloqade_decoders-0.7.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bloqade-decoders 0.7.0
File Interpreter ABI Platform Actions
bloqade_decoders-0.7.0-py3-none-any.whl Python 3 none any Details for bloqade_decoders-0.7.0-py3-none-any.whl

Total release size: 224.5 kB

Release files / bloqade_decoders-0.7.0.tar.gz

Download URL bloqade_decoders-0.7.0.tar.gz
Size 186.4 kB
Tags Source
SHA-256 checksum
How to use checksums
cc124043da78b45e8f4182766f57c3fac2361e0b8d6d4e3ff111357a9a93ce62
BLAKE2b-256 checksum
How to use checksums
c10d758a2fbe43e916c018e2a632fca7a8a3ff62a0d78ec8b5235a9f4e67b208
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Release files / bloqade_decoders-0.7.0-py3-none-any.whl

Download URL bloqade_decoders-0.7.0-py3-none-any.whl
Size 38.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
786eaba7b4c5c71ee773cd0a2ecbf4094112521b98d872075d5e4468db5a0bfc
BLAKE2b-256 checksum
How to use checksums
fbfc1c040c2298bbfef1048a3f13d17bbd2ede8994ab62d753459483609145c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

Security for bloqade-decoders 0.7.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for bloqade_decoders-0.7.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 21, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page