Conversation
Let the LookupDecoder declare erasure when no observable flip is sufficiently more likely than the alternatives, via a new confidence_ratio parameter. Accumulate group probabilities in log-space to avoid underflow, and factor lookup-table construction into two helper methods. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Instead of storing a best-guess flip and flipping the erasure bit, omit ambiguous syndromes from the lookup table so they decode to erasure via default_correction, exactly like a syndrome that was never enumerated. A positive confidence_ratio now auto-enables the erasure bit (and conflicts with add_erasure_bit=False) rather than requiring the caller to set it. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI-assisted summary
This PR lets
LookupDecoderdecline to commit to a logical prediction when a syndrome is ambiguous, rather than always guessing the single most likely observable flip.Behavior. When a syndrome is consistent with more than one observable flip, the decoder groups the candidate errors (of weight ≤
max_weight) by the observable flip they induce and gives each group a net probability. With a positiveconfidence_ratio, the decoder assigns an ambiguous syndrome the most likely flip iff that flip is at leastconfidence_ratiotimes as likely as all the other flips combined — i.e.prob_top >= confidence_ratio * prob_rest. Otherwise, the syndrome is omitted from the lookup table, so it decodes to erasure.A positive
confidence_ratiotherefore auto-enables the erasure bit, settingadd_erasure_bit=True. At the extreme,confidence_ratio=np.infkeeps only syndromes with a single consistent observable flip, erasing every syndrome that has any competing flip.Implementation notes.
logaddexp) to avoid underflow when summing the tiny probabilities of individual errors._build_syndrome_map_from_errors/_build_syndrome_map_from_observable_flips).KeyErrorfor syndromes whose only consistent errors have zero probability, and rejects negative/NaNratios.