I was looking into the stim library (very new to it) and was wondering if someone who has been using it or has experience with DEMs could explain a little of the following.

  • What exactly are detector error models within the stim library?
  • What are the scope of use for DEMs?
  • $\begingroup$ Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. $\endgroup$
    – Community Bot
    Dec 23, 2023 at 8:22

1 Answer 1


A dem is a detector error model, not a decoder error model. See the Detector Error Model File Format (.dem) file format spec in stim's docs. Stim includes functionality for extracting a dem from a circuit, and has a limited ability to suggest decompositions while doing so.

A dem is a simplified representation of the error model of a circuit, where errors are described by which detectors and observables they affect. This is easier for decoders to consume than a circuit, because it doesn't require simulating how errors propagate through Clifford gates in order to understand how they relate to the checks being performed. A dem is essentially just a straight edge-list representation of the hyper graph the decoder would want to build anyways. The only fancyness is the dem may compress the information using repeat blocks, and may include suggested decompositions of hyper edges into normal edges.

Dem's are great for simple circuit noise models like "depolarize qubit X by amount Y at time Z". They aren't as good for noise models with hysteresis, like leakage or cosmic ray hits, because each different trajectory would require its own error mechanism and there are too many trajectories to list. In situations like that it would make more sense for the decoder to have the original circuit, so it can derive trajectories on demand as needed instead of having to list them all out.


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.