Back to News
quantum-computing

Stim's gauge detector frame corrections

Yotam Vaknin
Loading...
6 min read
0 likes
⚡ Quantum Brief
I can't find any documentation in STIM, but I think the logic lives in check_for_gauge and remove_gauge in stim/simulators/error_analyzer.cc. TSIM generates DEMs by replacing non-deterministic observables with detectors, using STIM's detector error model generation, and then promoting them back to observables. If error(0.5) D1 D2 D3 is present in the circuit, then what stim does is find every instance of D3 present in the sensitivity data and multiply D1 D2 D3 into it in order to clear the D3. You'll need to complete a few actions and gain 15 reputation points before being able to upvote.
AI Audio Summary
0:00 / 0:00
Click to play
figure-16.webp
Quantum News · Media Library

Quantum Computing is part of Stack Overflow’s open communities: specialist spaces where curiosity is welcome, knowledge is shared freely, and the best answers rise to the top. Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work. Bring the best of human thought and AI automation together at your work. Learn more Bring the best of human thought and AI automation together at your work. TSIM generates DEMs by replacing non-deterministic observables with detectors, using STIM's detector error model generation, and then promoting them back to observables. This creates some ambiguity since STIM does some frame correction relative to non-deterministic detectors. I'm trying to understand exactly how this process goes, because I get similar circuits that result in differently gauged DEM. I can't find any documentation in STIM, but I think the logic lives in check_for_gauge and remove_gauge in stim/simulators/error_analyzer.cc. I can't really follow the logic myself, and I tried to use AI but it wasn't particularly helpful either. I would really appreciate some guidance here, thanks! You can think of a Z basis reset as forcing a Z_ERROR(0.5) right after the reset (and similar for measurement and for other bases) due to heisenberg uncertainty. When a detector anticommutes with a reset, it is affected by this error. Normally a detector being sensitive to this error this indicates a mistake, and so stim raises an exception, but if you turn on allow_gauge_detectors=True then it instead inserts the error into the DEM. The idea is that if you have multiple gauge detectors with the same reset sensitivities then they can be cancelled out by multiplying the gauges together, forming a proper detector, and sometimes it might be nicer to work with the gauges rather than the full detectors. In principle, the presence of the 50% errors are sufficient for the decoder to figure out how to merge gauge detecors into real detectors. And so the story could end there. However, there is a major performance problem that can arise if you leave the gauge story at simply inserting the 50% errors. The issue is that gauge detectors have a very nasty tendency to have unbounded extent. For example, consider this detector in the gauge 2x2 surface code: If you split this detector into two gauges then you get this (note crumble tracks forwards so you see region extending forever forwards; for the dem conversion it'd instead be forever backwards): Notice how the sensitivity region of the detector gauges is not a subset of the sensitivity region of the detector. Instead of appearing and disappearing within some bounded region, they stick around. Even a million rounds away, those gauge sensitivities would still be present on those qubits. And they'd be accompanied by their friends: the million other gauges produced in the million other rounds. As a result, instead of error(000.1) D1000 D1001 you will end up with error(000.1) D1000 D1003 D0 D1 D10 D11 D20 D21 D30 D31 D40 D41 ... D990 D991 (where all those extra detectors listed by the error are gauges that cancel out once you multiply them together to form the actual detectors you care about). This is very bad. It makes the dem quadratically expensive to produce. Also, it makes the dem quadratically expensive to understand (if a decoder even bothers trying at all with that mess). It has totally ruined the locality of the description of the fault tolerance. To fix this, stim does something a bit weird but based on the fact that ultimately you don't care about the detector gauges; you care about about the detectors formed by products the gauges. If error(0.5) D1 D2 D3 is present in the circuit, then what stim does is find every instance of D3 present in the sensitivity data and multiply D1 D2 D3 into it in order to clear the D3. It treats the gauge as a degree of freedom that can be removed by gaussian elimination. This (typically) restores the locality, or at least bounds how bad the non-locality can get, basically fixing the quadratic overhad problem. (It's also provably observably equivalent to the unfixed model, in that the probability distribution of detector samples implied by the models are the same.) So, in addition to adding the error, stim attempts to cancel out these annoying gauge terms by using a bit of gaussian elimination. This fixes some problems, and introduces others (in particular it makes the "obvious" sensitivity region of a gauge detector not correspond to what is showing in the dem). This messing up of the sensitivity region is particularly surprising for observables, since you care a lot more about where they go, which is probably why you noticed it at all. ...This maybe justifies adding an allow gauge observables option, with the key difference vs detectors being that they only have this 50/50 error thing done rather than the elimination step. But honestly you can approximate this already using OBSERVABLE_INCLUDE(0) X0 Y1 Z2 type stuff so I'm not sure it's really needed... Thanks for contributing an answer to Quantum Computing Stack Exchange! Use MathJax to format equations. MathJax reference. To learn more, see our tips on writing great answers. By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy. To subscribe to this RSS feed, copy and paste this URL into your RSS reader. This comment attacks a person or group. Learn more in our Abusive behavior policy. This comment is rude or condescending. Learn more in our Code of Conduct. A problem not listed above. Try to be as specific as possible. You'll need to complete a few actions and gain 15 reputation points before being able to upvote. Upvoting indicates when questions and answers are useful. What's reputation and how do I get it? Instead, you can save this post to reference later. Site design / logo © 2026 Stack Exchange Inc; user contributions licensed under CC BY-SA . rev 2026.9.3.

Read Original

Tags

quantum-investment
government-funding
quantum-computing

Source Information

Source: Quantum Computing Stack Exchange

Discussion

0 professional contributions

Sign in to join this professional discussion.

Be the first to add a constructive contribution.