2
$\begingroup$

I'm trying to understand the theory behind how a Stim Detector Error Model is created from a circuit. It is mentioned in the documentation that during analyzing the errors in the circuit, the circuit is analyzed backwards. What is the advantage of a backward analysis as compared to analysing the circuit forwards? Could you give me an example to show this advantage?

$\endgroup$

1 Answer 1

2
$\begingroup$

In Stim circuits you declare detectors and observables after the measurements defining them have already happened. This creates a problem when analyzing the circuit forwards: you haven't yet been told where the observables are, so you don't know where they are, so you can't tell yet whether each error will flip an observable or not.

It is still possible to analyze forwards. In the backwards analysis you push the observable and detector declarations backwards through the circuit, to see which errors they touch. You can instead push errors forwards through the circuit, to see which measurements and detectors and observables they affect. But this creates a performance problem.

A circuit will easily have 100x more error mechanisms than detectors. That's 100x more things to push forwards than you would have had to push backwards. Also, when you push an error forwards, it will not cancel out; inserting an error at the start of the circuit typically flips measurements all the way to the end. Whereas detectors are designed to have small sensitivity regions, meaning they quickly cancel out when being propagated backwards. So not only do you have 100x more things to push around, they will travel 100x farther! That's why Stim doesn't do the analysis forwards; because it'd be ten thousand times slower.

Fixing this tradeoff between analyzing-forwards vs analyzing-fast would require detectors and observables to be declared before their sensitivity regions instead of after. For example, if Stim circuits required you to annotate the resets that detectors/observables were about to be prepared by, then the necessary information would be present for doing a fast forward analysis. This would be pretty beneficial honestly, since it would allow you to produce the DEM in a streaming fashion as the circuit executed.

$\endgroup$
2
  • $\begingroup$ Awesome, thanks very much! A small follow-up question: I understand the rules of propagating an error through a circuit, but how does one propagate a detector (backwards) through a circuit? $\endgroup$ Jan 8 at 12:21
  • 1
    $\begingroup$ @curiousquantum Observables propagate by the exact same rules as errors, so you track observables backwards as if you were solving for where errors came from in the previous step. More simply, moving an observable backwards through an operation is equivalent to propagating an error forwards through its inverse. This logic is packaged up in stim.PauliString.before and stim.PauliString.after. $\endgroup$ Jan 8 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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