Skip to content

Conversation

@noajshu
Copy link
Contributor

@noajshu noajshu commented Aug 29, 2025

In the paper we used detector indices to sort them and make the det orders. This was actually an accident where we were trying to use the 3d coordinates (xyt) from Stim but used Stim incorrectly (my bad).
This got fixed in a77f5e7 where we started using the actual xyt coordinates.
This seems to offer a better tradeoff between beam and error rate, but also led to issue #103 because at the same large beam we get worse performance (likely because there are more distinct orderings which means more ways to get stuck)
We also added BFS det ordering in bf62f84 and then made it the default in 0471d4e
Unfortunately due to a bug in p-ranav's argparse: p-ranav/argparse#413
flags with implicit_value(false) do not work with store_into, which means the --no-det-order-bfs arg had no effect.

Here, we refactor the det order creation to have 3 arguments:

  --det-order-bfs                                                         Use BFS-based detector ordering (default if no method specified) 
  --det-order-index                                                       Randomly choose increasing or decreasing detector index order 
  --det-order-coordinate                                                  Random geometric detector orientation ordering 

We also eliminate --no-det-order-bfs which had no effect anyways.

This is an example where the --det-order-index is faster:

bazel build src:all
./bazel-bin/src/tesseract --sample-num-shots 100 --circuit testdata/colorcodes/r\=11\,d\=11\,p\=0.001\,noise\=si1000\,c\=superdense_color_code_X\,q\=181\,gates\=cz.stim  --sample-seed 71734  --threads 64  --beam 20 --beam-climbing   --num-det-orders 21  --pqlimit 1000000 --det-order-seed 2384257  --print-stats  --no-revisit-dets --det-order-coordinate 
num_shots = 100 num_low_confidence = 0 num_errors = 0 total_time_seconds = 340.9752209999999

./bazel-bin/src/tesseract --sample-num-shots 100 --circuit testdata/colorcodes/r\=11\,d\=11\,p\=0.001\,noise\=si1000\,c\=superdense_color_code_X\,q\=181\,gates\=cz.stim  --sample-seed 71734  --threads 64  --beam 20 --beam-climbing   --num-det-orders 21  --pqlimit 1000000 --det-order-seed 2384257  --print-stats  --no-revisit-dets --det-order-index
num_shots = 100 num_low_confidence = 0 num_errors = 0 total_time_seconds = 142.994753

This is achieved via a new enum class DetOrder in utils. It is also now exposed via python API:

tesseract_decoder.utils.build_det_orders(
        _DETECTOR_ERROR_MODEL,
        num_det_orders=1,
        method=tesseract_decoder.utils.DetOrder.DetIndex,
        seed=0,

Fixes #103

@noajshu noajshu requested review from LalehB and oscarhiggott August 29, 2025 21:01
Copy link
Contributor

@oscarhiggott oscarhiggott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@oscarhiggott oscarhiggott merged commit 1294710 into quantumlib:main Aug 29, 2025
4 checks passed
@NoureldinYosri NoureldinYosri mentioned this pull request Sep 5, 2025
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.

2x perf regression

2 participants