Skip to content

Make two-qubit gate leakage suppression and seepage pair-local in the general noise model - #671

Open
ciaranra wants to merge 1 commit into
devfrom
fix/pair-local-p2-leakage
Open

Make two-qubit gate leakage suppression and seepage pair-local in the general noise model#671
ciaranra wants to merge 1 commit into
devfrom
fix/pair-local-p2-leakage

Conversation

@ciaranra

@ciaranra ciaranra commented Sep 2, 2026

Copy link
Copy Markdown
Member

Summary

GeneralNoiseModel::apply_tq_faults processes a batched two-qubit gate pair by pair, but two decisions inside that loop looked at the whole gate instead of the current pair:

  • the leaked-input check scanned every qubit of the batched gate, so one leaked qubit anywhere suppressed the ideal gate and ordinary p2 sampling for every pair;
  • the seepage loop in the emission branch also walked every qubit of the batched gate, so seepage was attempted for the same leaked qubit once per pair, drawing RNG repeatedly.

Both are now scoped to the pair being processed. For a gate with a single pair, behavior and RNG consumption are unchanged.

Behavior change

Seeded output changes for batched two-qubit gates (more than one pair in one gate) when at least one qubit is leaked: unaffected pairs now execute and sample noise as they would as standalone gates, and each leaked qubit gets exactly one seepage attempt at its own pair site. Single-pair gates reproduce their previous byte stream, pinned by a captured-bytes test.

Tests

  • tq_leakage_only_removes_the_affected_pair: a leaked qubit in pair [0, 1] no longer suppresses the CZ on [2, 3].
  • tq_emission_and_seepage_are_pair_local: the batched call reproduces the operations and the subsequent RNG stream of driving the same seeded model pair by pair.
  • tq_seepage_scan_is_pair_local: with leaked qubits in both pairs, each gets one seepage attempt; reverting only the seepage loop makes this test fail on the RNG stream.
  • single_pair_tq_leakage_keeps_captured_legacy_bytes: single-pair output is byte-identical to the previous implementation.

The first three fail on the previous code; the fourth passes on both by design.

Verification

  • cargo test -p pecos-engines
  • cargo clippy -p pecos-engines --all-targets --all-features -- -D warnings
  • cargo fmt -p pecos-engines -- --check

Context

First of the separable changes ahead of the state-transition noise channel work; that work's compatibility fixture will be captured after this lands.

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