1
$\begingroup$

In stim we can use the .compile_detector_sampler().sample() to sample a detection event. However, there might be different ground truth errors that lead to the same detection event. Is there a way to extract the actual ground truth error which led to the detection event?

I was thinking of using this to create a dataset for a low-level neural network decoder. The decoder would take a detection event (syndromes) as input and output the qubits which encountered an error.

$\endgroup$

1 Answer 1

1
$\begingroup$

The circuit sampling code doesn't have an option for this, but the detector error model sampling code does. stim.CompiledDemSampler.sample has a return_errors argument that you can set to True.

circuit = stim.Circuit(...)
dem = circuit.detector_error_model()
sampler = dem.compile_sampler()
dets, obs, errs = sampler.sample(shots=1024, return_errors=True)

The reason this isn't supported for circuits is because many error mechanisms have multiple possible symptoms so it would be more complex to index all possible symptoms. In principle it can be done, I just didn't want to have to pick and explain an indexing convention. Also, there are more redundancies where different errors produce the same detection events and perturbations of the observable.

For the machine learning use case, you can also consider injecting magical measurements of the stabilizers and the logical observable. As long as you don't use these magical measurements in any DETECTOR or OBSERVABLE_INCLUDE instruction, and we're not talking about a gauge code where the measurements keep anticommuting with the system state, the decoding problem should stay the same. But now you can use the magical measurements as a ground truth for the current state of the stabilizers and the observable at any one time.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.