ILP Decoder
An implementation of the ILP decoder for circuit-level noise.
Included is a ilp_decoder.ILPDecoder class that can be configured using a stim.DetectorErrorModel and decodes shot data, directly outputting predicted observables (without sinter), as well as a ilp_decoder.ILPSinterDecoder class, which subclasses sinter.Decoder, for interfacing with sinter.
Installation
To install from pypi, run:
pip install ilp_decoder
To install from source, run:
pip install -e .
from the root directory.
Usage
Here is an example of how the decoder can be used directly with Stim:
import stim
import numpy as np
from ilp_decoder import ILPDecoder
num_shots = 100
d = 3
p = 0.001
circuit = stim.Circuit.generated(
"surface_code:rotated_memory_x",
rounds=d,
distance=d,
before_round_data_depolarization=p,
before_measure_flip_probability=p,
after_reset_flip_probability=p,
after_clifford_depolarization=p
)
sampler = circuit.compile_detector_sampler()
shots, observables = sampler.sample(num_shots, separate_observables=True)
decoder = ILPDecoder.from_circuit(circuit)
predicted_observables = decoder.decode_batch(shots)
num_mistakes = np.sum(np.any(predicted_observables != observables, axis=1))
print(f"{num_mistakes}/{num_shots}")
Sinter integration
To integrate with sinter, you can use the
ilp_decoder.ILPSinterDecoder class, which inherits from sinter.Decoder.
To use it, you can use the custom_decoders argument when using sinter.collect:
import sinter
from ilp_decoder import ILPSinterDecoder, sinter_decoders
samples = sinter.collect(
num_workers=4,
max_shots=1_000_000,
max_errors=1000,
tasks=generate_example_tasks(),
decoders=['ilp'],
custom_decoders=sinter_decoders()
print_progress=True,
)
Advanced ILP solvers
You can use whatever ILP solver supported by cvxpy instead of the default one highs, though
highs should be one of the fastest open-source solver available. If you have access to gurobi,
you may gain some extra speed boost (not tested).
Metadata
Release files for ilp-decoder 0.2.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ilp_decoder-0.2.2.tar.gz | 124.3 kB | Without provenance | Details for ilp_decoder-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ilp_decoder-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for ilp_decoder-0.2.2-py3-none-any.whl |
Total release size: 137.1 kB
Release files / ilp_decoder-0.2.2.tar.gz
| Download URL | ilp_decoder-0.2.2.tar.gz |
|---|---|
| Size | 124.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86706d01ea94ca3c609f1815d491852e5b9c7827f3a0c80b8f64d07152e7c3ef
|
|
BLAKE2b-256 checksum How to use checksums |
e0b4ab9b0a47955d16212cd5b8f9e7eedb454110fe895b6d2e77056a23d15744
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.14
|
Release files / ilp_decoder-0.2.2-py3-none-any.whl
| Download URL | ilp_decoder-0.2.2-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c992ec8b5536e70961201e68be111b39ed9d27609f4f58d95eb01039749784dd
|
|
BLAKE2b-256 checksum How to use checksums |
a665ac5c1b7d830de93d69d061ffaa5b9ae7d011501b09fb7637a86013326286
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.8.14
|
Security for ilp-decoder 0.2.2
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.