Skip to content

Commit 1217aa7

Browse files
committed
feat: add --multipass, --num-passes, and --multipass-strategy CLI options
TAG=agy
1 parent baf8a93 commit 1217aa7

13 files changed

Lines changed: 2261 additions & 296 deletions

README.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,67 @@ Here are some tips for improving performance:
166166
* *DEM usage frequency output*: if `--dem-out` is specified, outputs estimated error frequencies.
167167
* *Statistics output*: includes number of shots, errors, low confidence shots, and processing time.
168168

169+
---
170+
171+
## Multi-Pass Graph Shattering
172+
173+
For loopy 3D syndrome hypergraphs (such as circuit-level color codes under circuit noise), monolithic MWPM/beam search scales exponentially slow. Tesseract implements **Multi-Pass Graph Shattering** to sever physical error correlation edges, breaking the monolithic graph into independent, planar-like CSS stabilizer components.
174+
175+
Priors (LLRs) are dynamically updated and propagated between passes using conditional probabilities to preserve physical logical accuracy while delivering up to **$1,000\times$ decoding speedups**.
176+
177+
### ⚠️ Strict Annotation Requirements (Limitations)
178+
To decode using graph shattering, Tesseract **must** be able to classify detectors into basis components. The input Stim circuit or Detector Error Model (DEM) **MUST** be annotated using one of the following conventions:
179+
1. **Basis Tags**: Detector instructions must contain standard basis metadata tags (e.g. `detector(0, 0) D0 {"basis": "X"}` or `detector(0, 0) D1 {"basis": "Z"}`).
180+
2. **Coordinate Conventions (Chromobius Style)**: Detector coordinates must contain at least 4 dimensions, where the 4th coordinate represents `color + 3 * basis` (Component 0: `0 <= coords[3] <= 2`, Component 1: `3 <= coords[3] <= 5`).
181+
182+
If an unannotated circuit/DEM is supplied with `--multipass` enabled, Tesseract will fail fast and throw a clear `std::invalid_argument` exception.
183+
184+
### CLI Options
185+
* `--multipass`: Enable multi-pass graph shattering (default = false).
186+
* `--num-passes`, `--num_passes`: Number of prior propagation passes (default = 2).
187+
* `1`: Uncorrelated independent CSS decoding (planar speedup, no reweighting).
188+
* `2`: Standard causally reweighted prior propagation decoding.
189+
* *Note: values > 2 are experimental and were never systematically benchmarked.*
190+
* `--multipass-strategy`, `--multipass_strategy`: Causal or static pass scheduling (default = causal).
191+
* `causal` (Recommended): Dynamically schedules stabilizer components sequentially based on physical prior causal flow (Component 0 decodes first, updates prior edge weights, Component 1 decodes using those LLRs).
192+
* `static`: Decodes all components in parallel without dynamic pass-to-pass LLR updates.
193+
194+
### CLI Examples
195+
196+
**1. Running Multi-Pass on Basis-Tag Annotated Surface Codes (using Long-Beam Settings):**
197+
```bash
198+
./bazel-bin/src/tesseract \
199+
--circuit testdata/annotated_surface_codes/style=surface_code,d=5,basis=X,num_rounds=10,max_qubits_per_module=49,total_qubits=64,k=1,noise=SI1000,p=0.00100.stim \
200+
--sample-num-shots 1000 \
201+
--multipass \
202+
--num-passes 2 \
203+
--multipass-strategy causal \
204+
--pqlimit 1000000 \
205+
--beam 20 \
206+
--beam-climbing \
207+
--no-revisit-dets \
208+
--num-det-orders 21 \
209+
--print-stats
210+
```
211+
212+
**2. Running Multi-Pass on Coordinate-Annotated Color Codes (using Long-Beam Settings):**
213+
```bash
214+
./bazel-bin/src/tesseract \
215+
--circuit testdata/colorcodes/r=5,d=5,p=0.003,noise=si1000,c=midout_color_code_X,q=23,gates=cz.stim \
216+
--sample-num-shots 1000 \
217+
--multipass \
218+
--num-passes 2 \
219+
--multipass-strategy causal \
220+
--pqlimit 1000000 \
221+
--beam 20 \
222+
--beam-climbing \
223+
--no-revisit-dets \
224+
--num-det-orders 21 \
225+
--print-stats
226+
```
227+
228+
---
229+
169230
## Python Interface
170231

171232
[Full Python wrapper documentation](src/py/README.md)

src/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ cc_binary(
251251
linkopts = OPT_LINKOPTS,
252252
deps = [
253253
":libtesseract",
254+
":libmulti_pass_tesseract_decoder",
254255
"@argparse",
255256
"@nlohmann_json//:json",
256257
"@stim//:stim_lib",

0 commit comments

Comments
 (0)