quantumlib / Stim

A fast stabilizer circuit library.
Apache License 2.0
305 stars 88 forks source link

Distance of color_code:memory_xyz #756

Open peter-janderks opened 2 months ago

peter-janderks commented 2 months ago

@lucasberent and I are trying to benchmark a decoder using the circuit "color_code:memory_xyz"

If I run

d = 3
p = 0.01
circuit = stim.Circuit.generated(
    rounds=10*d,
    distance=d,
    after_clifford_depolarization=p,
    after_reset_flip_probability=p,
    before_measure_flip_probability=p,
    before_round_data_depolarization=p,
    code_task=f'color_code:memory_xyz',
)
error_mechanisms = circuit.search_for_undetectable_logical_errors(
    dont_explore_edges_increasing_symptom_degree=False,
    dont_explore_detection_event_sets_with_size_above=9999,
    dont_explore_edges_with_degree_above=9999,
    canonicalize_circuit_errors=True,
)
print(len(error_mechanisms))

The output is 2 For distance 5 I get len(error_mechanisms)=3

Is this expected behaviour? For the built-in surface code circuits I do get len(error_mechanisms) = d

Strilanc commented 2 months ago

It's very plausible that the ordering chosen by the circuit is reducing the distance. I wrote that circuit before I really understood the details of making these circuits, and before I'd worked on color codes, so it's weird in several ways. I'm open to fixing the code distance, but in general I'm not open to making the circuit generation "perfect".

In general, stim's circuit generation is not intended to make amazing circuits that people will want to use forever. That's impossible, because realistically everyone wants something slightly different in their circuits. The circuit generation is designed to make getting-started circuits that can be used as examples, before people move on to making their own thing.