Make two-qubit gate leakage suppression and seepage pair-local in the general noise model - #671
Make two-qubit gate leakage suppression and seepage pair-local in the general noise model#671ciaranra wants to merge 1 commit into
Conversation
… general noise model
|
Reviewed. No objection; it needs a The fix is two lines and they are the right two
This is a good example of a defect that reads as correct: The claims about the tests are true, and I checked the finer oneThe description says three of the four tests fail on the previous code and the fourth passes on both by design. Reverting both lines:
The finer claim is the one worth having verified. Reverting only the seepage loop failed only Comparing the batched call against the same model driven pair by pair, and then comparing the following 16 RNG draws, is the right shape for the seepage claim specifically: matching operations alone would not establish that each leaked qubit gets exactly one seepage attempt, since a duplicated attempt that happens to draw the same outcome would still emit the same gates. The RNG stream is what makes that observable. Verification
Note on the behaviour changeSeeded output does change for batched two-qubit gates with a leaked qubit, which is correct: the previous behaviour was the bug. The captured-bytes test pinning single-pair output is the right way to bound the blast radius, since single-pair gates are the common case and their streams must not move. Worth being explicit in the release notes that batched multi-pair seeded runs will not reproduce byte-for-byte across this change. |
Summary
GeneralNoiseModel::apply_tq_faultsprocesses a batched two-qubit gate pair by pair, but two decisions inside that loop looked at the whole gate instead of the current pair: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 theCZon[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-enginescargo clippy -p pecos-engines --all-targets --all-features -- -D warningscargo fmt -p pecos-engines -- --checkContext
First of the separable changes ahead of the state-transition noise channel work; that work's compatibility fixture will be captured after this lands.