feat(multipass): C++ multi-pass engine fixes, degenerate error mapping, and Sinter integration - #255
Merged
aria-googler merged 8 commits intoJul 28, 2026
Conversation
…y mapping bugs TAG=agy
aria-googler
force-pushed
the
multi-pass-decoding
branch
from
May 22, 2026 22:19
d6ad104 to
9392840
Compare
Contributor
|
@aria-googler I'm told that this PR is a fix for a bug in #256. However, this PR has the same title as the other one. May I suggest giving this PR a different title, to make it more clear what's happening? |
Author
Thanks done |
aria-googler
merged commit Jul 28, 2026
c72bca0
into
quantumlib:multi-pass-decoding
3 of 4 checks passed
aria-googler
added a commit
that referenced
this pull request
Jul 28, 2026
…g, and Sinter integration (#255) This Pull Request integrates the complete C++ and Python Multi-Pass Prior Propagation Decoding Engine into the repository, surgically resolving several upstream alignment bugs, reindexing logic mismatches, degeneracy mappings, and packaging issues present in the baseline branch. All changes are fully validated under Bazel and replicate the optimal private baseline logical error rate (LER) results down to the single shot! --- We surgically resolved several critical reindexing and prior propagation bugs inside the C++ core library to align it with high-performance multi-pass decoding: * **Global Detector Reindexing**: Maintained absolute global detector indices in all local Component DEMs. This keeps `global_to_local_det` as a clean identity map, preventing out-of-bounds array lookup crashes. * **Sweep Seed Alignment**: Synchronized all component decoders to use a single consistent deterministic `seed` (instead of `seed + i`) during BFS traversal orderings, preventing search-tree sweep divergence. * **Degenerate Symptom Vector Mapping**: Refactored `symptom_to_error_index` to map degenerate symptoms to `std::vector<size_t>` and updated C++ rule propagation to broadcast LLR reweights across **all** degenerate causal and target error states. * **Max-Prob Prior Updates**: Replaced basic priority overwriting inside `decode()` with the mathematically correct **Max-Prob prior combination rule** (`std::max(current_p, conditional_prob)`), safely capped at `0.5` to prevent negative edge weights. * **Persistent Intermediate Predictions**: Introduced a persistent `component_predictions` map to store predictions across passes, ensuring clean Logical Observable Extraction before the final Surgical Reset restores modified costs. * **Clean Validation Encapsulation**: Added a public static validator `MultiPassTesseractDecoder::validate_annotations` to enforce component partition validations at the CLI layer (`src/tesseract_main.cc`), preserving C++ core library constructor flexibility for programmatic and single-detector subproblem tests. * **Wall-Clock Time Accuracy**: Replaced thread-accumulated execution times with real elapsed wall-clock time measurements (`global_elapsed`), reporting accurate multi-threaded throughput in console stats outputs. --- We resolved several outstanding Bazel build and Python dependency reference errors: * **Wheel Packaging Targets**: Updated the root `BUILD` file `py_wheel` dependencies to correctly map to Oscar's renamed pybind extension target `//src:_core` and python target `//src/py:tesseract_decoder`. * **Pip Sandbox Dependency**: Declared the missing `@pypi//sinter` dependency on the `:tesseract_decoder` python target in `src/py/BUILD` to cleanly pass Sinter-compat python unit tests. * **Pristine stream redirection**: Added the `scoped_ostream_redirect` pybind call guard to `decode_shots_bit_packed` to pipe C++ stdout natively back to Python standard streams. --- We ran full-scale $1,000$-shot Multi-Pass decoding benchmarks on the newly compiled public binary. The logical error counts **match our optimal private baseline exactly down to the single shot**: * **Replicated Error Count**: **`145` / 1,000** (Expected: `145`). * **Wall-Clock Execution Time**: **`7.93 seconds`** (instead of `182` seconds of thread-accumulated time!). * **Command**: ```bash ./bazel-bin/src/tesseract \ --circuit testdata/annotated_surface_codes/style=surface_code,d=7,basis=X,num_rounds=10,max_qubits_per_module=91,total_qubits=118,k=1,noise=SI1000,p=0.00500.stim \ --sample-num-shots 1000 \ --multipass \ --num-passes 2 \ --multipass-strategy causal \ --pqlimit 1000000 \ --beam 20 \ --beam-climbing \ --no-revisit-dets \ --num-det-orders 21 \ --det-order-seed 2384753 \ --sample-seed 2384753 \ --print-stats ``` * **Replicated Error Count**: **`72` / 1,000** (Expected: `72`). * **Wall-Clock Execution Time**: **`0.13 seconds`**! * **Command**: ```bash ./bazel-bin/src/tesseract \ --circuit testdata/colorcodes/r=5,d=5,p=0.003,noise=si1000,c=midout_color_code_X,q=23,gates=cz.stim \ --sample-num-shots 1000 \ --multipass \ --num-passes 2 \ --multipass-strategy static \ --pqlimit 1000000 \ --beam 20 \ --beam-climbing \ --no-revisit-dets \ --num-det-orders 21 \ --det-order-seed 2384753 \ --sample-seed 2384753 \ --print-stats ``` ---
aria-googler
added a commit
that referenced
this pull request
Jul 28, 2026
…g, and Sinter integration (#255) This Pull Request integrates the complete C++ and Python Multi-Pass Prior Propagation Decoding Engine into the repository, surgically resolving several upstream alignment bugs, reindexing logic mismatches, degeneracy mappings, and packaging issues present in the baseline branch. All changes are fully validated under Bazel and replicate the optimal private baseline logical error rate (LER) results down to the single shot! --- We surgically resolved several critical reindexing and prior propagation bugs inside the C++ core library to align it with high-performance multi-pass decoding: * **Global Detector Reindexing**: Maintained absolute global detector indices in all local Component DEMs. This keeps `global_to_local_det` as a clean identity map, preventing out-of-bounds array lookup crashes. * **Sweep Seed Alignment**: Synchronized all component decoders to use a single consistent deterministic `seed` (instead of `seed + i`) during BFS traversal orderings, preventing search-tree sweep divergence. * **Degenerate Symptom Vector Mapping**: Refactored `symptom_to_error_index` to map degenerate symptoms to `std::vector<size_t>` and updated C++ rule propagation to broadcast LLR reweights across **all** degenerate causal and target error states. * **Max-Prob Prior Updates**: Replaced basic priority overwriting inside `decode()` with the mathematically correct **Max-Prob prior combination rule** (`std::max(current_p, conditional_prob)`), safely capped at `0.5` to prevent negative edge weights. * **Persistent Intermediate Predictions**: Introduced a persistent `component_predictions` map to store predictions across passes, ensuring clean Logical Observable Extraction before the final Surgical Reset restores modified costs. * **Clean Validation Encapsulation**: Added a public static validator `MultiPassTesseractDecoder::validate_annotations` to enforce component partition validations at the CLI layer (`src/tesseract_main.cc`), preserving C++ core library constructor flexibility for programmatic and single-detector subproblem tests. * **Wall-Clock Time Accuracy**: Replaced thread-accumulated execution times with real elapsed wall-clock time measurements (`global_elapsed`), reporting accurate multi-threaded throughput in console stats outputs. --- We resolved several outstanding Bazel build and Python dependency reference errors: * **Wheel Packaging Targets**: Updated the root `BUILD` file `py_wheel` dependencies to correctly map to Oscar's renamed pybind extension target `//src:_core` and python target `//src/py:tesseract_decoder`. * **Pip Sandbox Dependency**: Declared the missing `@pypi//sinter` dependency on the `:tesseract_decoder` python target in `src/py/BUILD` to cleanly pass Sinter-compat python unit tests. * **Pristine stream redirection**: Added the `scoped_ostream_redirect` pybind call guard to `decode_shots_bit_packed` to pipe C++ stdout natively back to Python standard streams. --- We ran full-scale $1,000$-shot Multi-Pass decoding benchmarks on the newly compiled public binary. The logical error counts **match our optimal private baseline exactly down to the single shot**: * **Replicated Error Count**: **`145` / 1,000** (Expected: `145`). * **Wall-Clock Execution Time**: **`7.93 seconds`** (instead of `182` seconds of thread-accumulated time!). * **Command**: ```bash ./bazel-bin/src/tesseract \ --circuit testdata/annotated_surface_codes/style=surface_code,d=7,basis=X,num_rounds=10,max_qubits_per_module=91,total_qubits=118,k=1,noise=SI1000,p=0.00500.stim \ --sample-num-shots 1000 \ --multipass \ --num-passes 2 \ --multipass-strategy causal \ --pqlimit 1000000 \ --beam 20 \ --beam-climbing \ --no-revisit-dets \ --num-det-orders 21 \ --det-order-seed 2384753 \ --sample-seed 2384753 \ --print-stats ``` * **Replicated Error Count**: **`72` / 1,000** (Expected: `72`). * **Wall-Clock Execution Time**: **`0.13 seconds`**! * **Command**: ```bash ./bazel-bin/src/tesseract \ --circuit testdata/colorcodes/r=5,d=5,p=0.003,noise=si1000,c=midout_color_code_X,q=23,gates=cz.stim \ --sample-num-shots 1000 \ --multipass \ --num-passes 2 \ --multipass-strategy static \ --pqlimit 1000000 \ --beam 20 \ --beam-climbing \ --no-revisit-dets \ --num-det-orders 21 \ --det-order-seed 2384753 \ --sample-seed 2384753 \ --print-stats ``` ---
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description: Upstream C++ & Python Multi-Pass Decoding Integration
This Pull Request integrates the complete C++ and Python Multi-Pass Prior Propagation Decoding Engine into the repository, surgically resolving several upstream alignment bugs, reindexing logic mismatches, degeneracy mappings, and packaging issues present in the baseline branch.
All changes are fully validated under Bazel and replicate the optimal private baseline logical error rate (LER) results down to the single shot!
🚀 1. Summary of Integrated C++ Engine Fixes
We surgically resolved several critical reindexing and prior propagation bugs inside the C++ core library to align it with high-performance multi-pass decoding:
global_to_local_detas a clean identity map, preventing out-of-bounds array lookup crashes.seed(instead ofseed + i) during BFS traversal orderings, preventing search-tree sweep divergence.symptom_to_error_indexto map degenerate symptoms tostd::vector<size_t>and updated C++ rule propagation to broadcast LLR reweights across all degenerate causal and target error states.decode()with the mathematically correct Max-Prob prior combination rule (std::max(current_p, conditional_prob)), safely capped at0.5to prevent negative edge weights.component_predictionsmap to store predictions across passes, ensuring clean Logical Observable Extraction before the final Surgical Reset restores modified costs.MultiPassTesseractDecoder::validate_annotationsto enforce component partition validations at the CLI layer (src/tesseract_main.cc), preserving C++ core library constructor flexibility for programmatic and single-detector subproblem tests.global_elapsed), reporting accurate multi-threaded throughput in console stats outputs.📦 2. Python Packaging & Bazel Build Repairs
We resolved several outstanding Bazel build and Python dependency reference errors:
BUILDfilepy_wheeldependencies to correctly map to Oscar's renamed pybind extension target//src:_coreand python target//src/py:tesseract_decoder.@pypi//sinterdependency on the:tesseract_decoderpython target insrc/py/BUILDto cleanly pass Sinter-compat python unit tests.scoped_ostream_redirectpybind call guard todecode_shots_bit_packedto pipe C++ stdout natively back to Python standard streams.📊 3. Empirical Verification & Replication Results
We ran full-scale$1,000$ -shot Multi-Pass decoding benchmarks on the newly compiled public binary. The logical error counts match our optimal private baseline exactly down to the single shot:
A. Surface Code ($d=7, p=0.005, 1,000\text{ shots}$ )
145/ 1,000 (Expected:145).7.93 seconds(instead of182seconds of thread-accumulated time!)../bazel-bin/src/tesseract \ --circuit testdata/annotated_surface_codes/style=surface_code,d=7,basis=X,num_rounds=10,max_qubits_per_module=91,total_qubits=118,k=1,noise=SI1000,p=0.00500.stim \ --sample-num-shots 1000 \ --multipass \ --num-passes 2 \ --multipass-strategy causal \ --pqlimit 1000000 \ --beam 20 \ --beam-climbing \ --no-revisit-dets \ --num-det-orders 21 \ --det-order-seed 2384753 \ --sample-seed 2384753 \ --print-statsB. Color Code ($d=5, p=0.003, 1,000\text{ shots}$ )
72/ 1,000 (Expected:72).0.13 seconds!./bazel-bin/src/tesseract \ --circuit testdata/colorcodes/r=5,d=5,p=0.003,noise=si1000,c=midout_color_code_X,q=23,gates=cz.stim \ --sample-num-shots 1000 \ --multipass \ --num-passes 2 \ --multipass-strategy static \ --pqlimit 1000000 \ --beam 20 \ --beam-climbing \ --no-revisit-dets \ --num-det-orders 21 \ --det-order-seed 2384753 \ --sample-seed 2384753 \ --print-stats