Skip to content

Classify the certifier's primitive faults as light or heavy without the oracle - #1066

Closed
perlinm wants to merge 11 commits into
mainfrom
perf/certifier-light-faults
Closed

perlinm wants to merge 11 commits into
mainfrom
perf/certifier-light-faults

Conversation

@perlinm

@perlinm perlinm commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Motivation

Before it lists faults, certify_bounded_fault_propagation decides which primitive faults are heavy: those whose syndrome has no error of Pauli weight at most one. It asked the coset-leader oracle, with the threshold one, once for each distinct syndrome and once for each primitive fault with zero flags, in one Python call each. On a sample of 65 state-preparation circuits that was about 330,000 calls, mostly Python overhead. It took 7-19% of small and medium certification calls with the Brouwer-Zimmermann method, and about 100 ms of a call on a flagged preparation of the [[144,12,12]] gross code.

Changes

An error of weight at most one is the identity or a single-qubit error by the physical weight. By the CSS weight it is the product of an X error and a Z error on at most one qubit each, on any state. So the certifier now looks up syndromes in a hash table of these errors' syndromes, inside the compiled _get_light_pairs that already pairs light syndromes. That is one lookup per syndrome by the physical weight, and n + 1 by the CSS weight.

A heavy primitive fault that no pair of light primitive faults with nonzero flags covers gets a fixed error with its syndrome, built from destabilizers. By the CSS weight, its X and Z parts are replaced by single-qubit errors with the same syndromes where they exist. The oracle is asked only for the first heavy primitive fault with zero flags, which violates the bound, for the bound that the certificate reports. The new section "Deciding which primitive faults are heavy" of fault_propagation.md derives these steps.

Validation

On the 65 circuits, run with both methods, every certificate equals the previous code's in every field, and the counterexamples replay as violations with Stim. On all 300,351 distinct syndromes of the sample, the light/heavy split and the representatives equal the oracle's. test_light_syndromes_match_brute_force enumerates every error of weight at most one, under both weights. It runs on every state of up to four qubits and on random 70-qubit states, so that syndromes and both Pauli parts span two words. It checks the split, the representatives' syndromes and weights, and the fixed errors' syndromes. End-to-end cases on 65 qubits and on a three-qubit state that is not CSS check that these errors reach the search correctly.

Time of the classification and of whole calls (warm, single-threaded, medians):

Circuit and max_weight Classification Whole call, Brouwer-Zimmermann
[[144,12,12]] preparation, 5 77 → 28 ms (BZ), 92 → 29 ms (CC) about 1.03-1.05x
[[82,2,13]] preparation, 6 29 → 10 ms (BZ), 34 → 10 ms (CC)
MQT Hamming, 1 1.21x
SpiderCSS-49 (P1), 4 3.7 → 1.3 ms 1.15x

With the connected-cluster method, whole calls are 1-11% faster.

perlinm and others added 11 commits November 25, 2026 16:29
…he oracle

The certifier asked the oracle, with the threshold one, whether each distinct syndrome of a
primitive fault has an error of Pauli weight at most one, in one Python call per syndrome, and
likewise for each primitive fault with zero flags.  Such an error is the identity or a
single-qubit error by the physical weight, and the product of an X error and a Z error on at most
one qubit each by the CSS weight, on any state.  So the certifier now looks up the syndromes of
these errors in a hash table, in the compiled search that already pairs light syndromes: one lookup
per syndrome by the physical weight, and n + 1 by the CSS weight.  A heavy primitive fault that no
pair of light ones covers gets a fixed error from destabilizers, whose X and Z parts are replaced
by single-qubit errors with the same syndromes, where there are some, by the CSS weight.  The
oracle answers only for the first heavy primitive fault with zero flags, which violates the bound.

Which primitive faults are light, and so every verdict, is unchanged, and on CSS states the
representatives are the errors that the oracle returned, so the certificates are too.  The step is
about two to three times faster on states of 50 to 150 qubits.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The tests of the classification and the fixed representatives used at most four qubits, so they
could not catch code that drops the upper words of a syndrome.  A test on 65 qubits now checks
syndromes with bits on both sides of the word boundary, on |0...0> by either weight, and by CSS
weight on a state that is not CSS: which syndromes are light, the syndromes and weights of the
errors that represent them, and the violations and bounds that the search reports.  The test of
the products of light pairs no longer requires a fixed representative to differ from such a
product, which may equal it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
A heavy primitive fault gets the product of the representatives of two light primitive faults only
if both have nonzero flags, since only those are paired, so the guide and the comment now say so.
The test of syndromes in two words gains a CSS state on which the Z part of the fixed error has
bits in both words, so that code that drops the upper word of a Z part fails it.  The brute-force
test of the light syndromes takes the three states of one qubit once each, rather than random
states that repeat them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The test of syndromes in two words now uses a state of X stabilizers on which the only Z error with
the syndrome 2 acts on qubits 0, 1, and 64, so the Z part of its fixed error has bits in both words,
and on which the single Z errors have syndromes in both words.  Code that drops the upper word of a
Z part, or of the syndromes of the single Z errors, fails it.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The test of the state of X stabilizers on which a Z error acts on qubits in two words now runs by
either weight, and checks the light error for the syndrome of Z on qubit 0.  It also says that the
lightest errors with the syndrome 2 weigh three, rather than all of them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hand-written cases

The brute-force test of the light syndromes and the fixed errors now also runs on three states of
70 qubits, whose syndromes and errors have bits in two words: a random state, a CSS state of X
stabilizers alone, whose fixed errors are Z errors on any qubit, and a CSS state with both X and Z
stabilizers, with its stabilizers in random order.  It enumerates the errors of Pauli weight at most
one and their syndromes, and checks the light syndromes and the representatives of these and of
random syndromes.  The hand-written cases on 65 qubits that it covers are gone.  Two remain, which
check that the search reports a violating fault with bits in both words, at fault weight one and
at fault weight two.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…t on a state that is not CSS

The brute-force test checks representatives before the fault lister reads them, so the test of
syndromes in two words again checks, by either weight, that the search reports a violating fault
whose heavy fault's lightest errors have Z parts in both words.  The test of the CSS weight also
checks that a state that is not CSS gets the CSS weight, on three qubits where X on one qubit and Z
on another weigh one.  The brute-force test runs on one random state of each size from two to four
qubits, rather than ten, and says that its syndromes and X and Z parts on 70 qubits span two words.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…d-written cases

The brute-force test of the light syndromes now also runs the search on random states of three to
six qubits, CSS and not, by either weight, against brute force over all their Pauli errors.  For
random flags and syndromes, it checks that the search reports a violating fault of the smallest
fault weight with a valid bound, and that the fault lister gets the primitive faults with nonzero
flags, the heavy ones first, each with a representative that has its syndrome and Pauli weight at
most one if it is light, or at most two if its syndrome is the sum of those of two light ones.

The hand-written cases that it covers are gone: the products of light representatives on three
qubits, the CSS weight on a state that is not CSS, and the faults on 65 qubits.  The case on 70
qubits remains, and now says that its heavy syndrome, below 2**64, gets a fixed error from both
words.  The random states come from a helper.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…s that cancel

The search reports the same violating fault in every version, so the brute-force test of the light
syndromes now checks that the fault lister gets the heavy primitive faults and then the light ones,
each in DEM order, and that a violating primitive fault with zero flags is the first in DEM order.
Two cases on |0...0> check the reported fault of fault weight two when two violating faults
compete, one for the order of the heavy primitive faults and one for that of the light ones.

The test of words now runs on either side of 64 and 128 qubits, where syndromes with only their
first or their last bit must be light, and on 65 qubits checks the representatives that the lister
gets for two heavy syndromes in the first word, whose fixed errors need both words.  The test of
light pairs uses syndromes in three words, so that lookups with colliding hashes compare the third.
The test of the CSS weight gains a case where a heavy primitive fault's representative is the
product of two light ones in which a Z error cancels.

The three states of one qubit are gone from the brute-force test, which catches the same faults in
the search without them.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The test of words now runs by either weight on either side of 64 and 128 qubits.  On |0...0>,
syndromes with only their first or their last bit must be light, and the lister must get
representatives with the syndromes of their primitive faults, among them the fixed error of a
heavy syndrome with its last bit.  Near 128 qubits, where the search takes longer by the physical
weight, the light and fixed errors of the physical weight are checked alone.

The test of light pairs now draws its first list, its second list, and its syndromes with lengths
that vary independently, each empty, of one syndrome, or longer, so that a first list can be longer
or shorter than the second, with ordinary and colliding hashes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@perlinm

perlinm commented Nov 26, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: not worth the added complexity

@perlinm perlinm closed this Nov 26, 2026
@perlinm
perlinm deleted the perf/certifier-light-faults branch November 26, 2026 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant