I'm aware Stim doesn't have the best capability for sampling arbitrary time-correlated errors. I was wondering what would be the best way to hack together the basic error model:

  1. Before each round, each data qubit has a probability p of experiencing a random Pauli error
  2. If an error occurs, the (exact same) error repeats for the next n - 1 rounds
  3. Error sequences can't overlap

At first, I thought about manually adding in random Pauli sequences to the generated circuit, but then you would need to rebuild the circuit before sampling each shot. Otherwise I would think you need to use stim.TableauSimulator() like in the leakage error example. Is there a more efficient solution?


1 Answer 1


One hacky way to do a time-correlated error is to store the error on an unused ancilla qubit. For example, start the circuit with X_ERROR(p) 999 where 999 is an unused qubit. Then add a CX 999 q operation into each round, where q is the qubit that you want a correlated failure on. The CX will propagate the X error, if it happened, from 999 to q. Once you're done all the time correlations of the error, you can use R 999 to clear it.

Since you have multiple data qubits, you will probably need to do this trick multiple times using multiple ancilla qubits (one per data qubit). You can have one independent time correlated error active per ancilla qubit you use.

  • $\begingroup$ Is there a way to set a timer on R so that it's executed n time steps after the error? Otherwise I can only think of implementing n + 1 ancillas per data qubit with staggered error and reset operations if I wanted there to be a chance of an error sequence starting at each time step. $\endgroup$
    – jfids
    Commented Sep 15, 2023 at 0:51
  • $\begingroup$ @jfids No there's nothing like that. Time correlations is something stim doesn't do very well; you have to use the n+1 ancillas or the tableau simulator. $\endgroup$ Commented Sep 15, 2023 at 0:55

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.