Development · master
About these docs

What it does

Measurements in, decoder data back out

RSMP stores a reversible, circuit-derived representation. Unpacking with the original circuit recovers the measurement stream and derives detector and observable outputs.

Public contests

Need a dataset contestants cannot score from directly?

RSMP is intentionally lossless and private. For public decoder benchmarks, use rstim export_decoder_dataset instead: publish only contestant inputs, and keep the answer bundle private.

Two public dataset modes

Detector mode publishes detector-event rows in shots.b8 and keeps logical answers in private answers.b8.

Blinded measurement mode publishes raw measurement rows, privately randomizes the logical state with mask bits, and scores against private answers.b8.

Run it

Pack and verify

Requires rstim on PATH. If you installed only rustqec with Cargo, add the Stim-style CLI below; the native package already includes it. Run in a scratch directory. The example below provides its complete input.

cargo install --locked rstim --version 0.3.0 --bin rstim --features cli,codegen-css,shot-viewer

This deterministic example resets one qubit, applies an X error with probability 1, then measures a detector and observable. Create the input in your current working directory:

cat > circuit.stim <<'STIM'
R 0
X_ERROR(1) 0
M 0
DETECTOR rec[-1]
OBSERVABLE_INCLUDE(0) rec[-1]
STIM
rstim sample --in circuit.stim --shots 4 --out_format b8 --out samples.b8
rstim pack_samples --circuit circuit.stim --shots 4 --in samples.b8 --in_format b8 --out samples.rsmp
rstim unpack_samples --circuit circuit.stim --in samples.rsmp --verify_only

Expected: samples.b8 contains four one-bit rows (4 bytes); samples.rsmp is created and verification exits successfully. Use the original circuit for unpacking. The compression ratios below belong to a different, named benchmark fixture.

Measured result

88.02% smaller than raw b8

Pinned surface-code case: d=11, 100 rounds, 1,024 shots.

FormatBytesShare of raw
Raw b81,552,384100.00%
Direct Zstandard325,56520.97%
RSMP v1186,02811.98%
RSMP v1 measured compression summary
How the reversible transform works

Measurements are XORed with a noiseless reference and separated into detector syndromes plus free coordinates. The decoder rebuilds the same transform from the circuit.

Scope and limits

RSMP v1 requires the original circuit, does not support sweep-bit circuits, and provides sequential rather than random shot access. Large-scale sizes are projections, not measurements.

Evidence and format references