Skip to content

Multi pass decoding#255

Open
aria-googler wants to merge 5 commits into
quantumlib:multi-pass-decodingfrom
aria-googler:multi-pass-decoding
Open

Multi pass decoding#255
aria-googler wants to merge 5 commits into
quantumlib:multi-pass-decodingfrom
aria-googler:multi-pass-decoding

Conversation

@aria-googler
Copy link
Copy Markdown

@aria-googler aria-googler commented May 22, 2026

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 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.

📦 2. Python Packaging & Bazel Build Repairs

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.

📊 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}$)

  • Replicated Error Count: 145 / 1,000 (Expected: 145).
  • Wall-Clock Execution Time: 7.93 seconds (instead of 182 seconds of thread-accumulated time!).
  • Command:
    ./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

B. Color Code ($d=5, p=0.003, 1,000\text{ shots}$)

  • Replicated Error Count: 72 / 1,000 (Expected: 72).
  • Wall-Clock Execution Time: 0.13 seconds!
  • Command:
    ./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 aria-googler requested a review from a team as a code owner May 22, 2026 21:59
@aria-googler aria-googler requested review from LalehB and removed request for a team May 22, 2026 21:59
@aria-googler aria-googler force-pushed the multi-pass-decoding branch from d6ad104 to 9392840 Compare May 22, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant