Skip to content

Fix multi-qubit noise broadcast in Stim MSM mode#4731

Draft
bmhowe23 wants to merge 1 commit into
NVIDIA:mainfrom
bmhowe23:pr-fix-msm-mode
Draft

Fix multi-qubit noise broadcast in Stim MSM mode#4731
bmhowe23 wants to merge 1 commit into
NVIDIA:mainfrom
bmhowe23:pr-fix-msm-mode

Conversation

@bmhowe23

@bmhowe23 bmhowe23 commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator

Note: it's debatable whether we should pursue merging this, as this bug only seems to affect MSM mode, which could go away now that the new DEM mode is being used, but I am posting anyway.

Related: NVIDIA/cudaqx#606

A noise channel attached to a multi-qubit gate is broadcast independently across each group of num_targets qubits in the sampling path (via Stim's multi-target semantics) and the DEM path. The MSM path, which injects errors into x_table/z_table by hand, only iterated num_targets and indexed qubits[0], so for a single-qubit-tagged channel applied to >1 qubit (e.g. the QEC library's two_qubit_depolarization / two_qubit_bitflip) every qubit past the first was silently dropped from the MSM and any MSM-derived DEM, while the sampled syndromes still contained that noise.

Make the MSM branch mirror the broadcast: enumerate each group of num_targets qubits, giving each group its own error id, and update the msm_size pass's mechanism count to match. Throw if the qubit count is not a positive multiple of num_targets.

Add Stim MSM regression tests for the two-qubit depolarization and bit-flip broadcast cases.

A noise channel attached to a multi-qubit gate is broadcast independently
across each group of `num_targets` qubits in the sampling path (via Stim's
multi-target semantics) and the DEM path. The MSM path, which injects errors
into `x_table`/`z_table` by hand, only iterated `num_targets` and indexed
`qubits[0]`, so for a single-qubit-tagged channel applied to >1 qubit (e.g.
the QEC library's `two_qubit_depolarization` / `two_qubit_bitflip`) every
qubit past the first was silently dropped from the MSM and any MSM-derived
DEM, while the sampled syndromes still contained that noise.

Make the MSM branch mirror the broadcast: enumerate each group of
`num_targets` qubits, giving each group its own error id, and update the
`msm_size` pass's mechanism count to match. Throw if the qubit count is not
a positive multiple of `num_targets`.

Add Stim MSM regression tests for the two-qubit depolarization and bit-flip
broadcast cases.

Signed-off-by: Ben Howe <bhowe@nvidia.com>
@github-actions

github-actions Bot commented Jun 12, 2026

Copy link
Copy Markdown

CI Summary (push) — ✅ passed

Run #27439403152 · ✅ 6 · ⏩ 7 · ❌ 0 · ⛔ 0

Top-level jobs (13)
Job Result
binaries ⏩ skipped
build_and_test ✅ success
config_devdeps ✅ success
config_source_build ⏩ skipped
config_wheeldeps ✅ success
devdeps ✅ success
docker_image ⏩ skipped
gen_code_coverage ⏩ skipped
metadata ✅ success
python_metapackages ⏩ skipped
python_wheels ⏩ skipped
source_build ⏩ skipped
wheeldeps ✅ success
⏩ Skipped jobs (7) — intentionally skipped on PR builds; run on merge_group / workflow_dispatch
Job
binaries
config_source_build
docker_image
gen_code_coverage
python_metapackages
python_wheels
source_build
All sub-jobs (42) — every matrix leg, with links
Job Status Link
Build and test (amd64, gcc12, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, gcc12, openmpi) / Dev environment (Python) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Python) ✅ success view
CI Summary ❔ in_progress view
Configure build (devdeps) ✅ success view
Configure build (source_build) ⏩ skipped view
Configure build (wheeldeps) ✅ success view
Create CUDA Quantum installer ⏩ skipped view
Create Docker images ⏩ skipped view
Create Python metapackages ⏩ skipped view
Create Python wheels ⏩ skipped view
Gen code coverage ⏩ skipped view
Load dependencies (amd64, gcc12) / Caching ✅ success view
Load dependencies (amd64, gcc12) / Finalize ✅ success view
Load dependencies (amd64, gcc12) / Metadata ✅ success view
Load dependencies (amd64, llvm) / Caching ✅ success view
Load dependencies (amd64, llvm) / Finalize ✅ success view
Load dependencies (amd64, llvm) / Metadata ✅ success view
Load dependencies (arm64, gcc12) / Caching ✅ success view
Load dependencies (arm64, gcc12) / Finalize ✅ success view
Load dependencies (arm64, gcc12) / Metadata ✅ success view
Load dependencies (arm64, llvm) / Caching ✅ success view
Load dependencies (arm64, llvm) / Finalize ✅ success view
Load dependencies (arm64, llvm) / Metadata ✅ success view
Load source build cache ⏩ skipped view
Load wheel dependencies (amd64, 12.6) / Caching ✅ success view
Load wheel dependencies (amd64, 12.6) / Finalize ✅ success view
Load wheel dependencies (amd64, 12.6) / Metadata ✅ success view
Load wheel dependencies (amd64, 13.0) / Caching ✅ success view
Load wheel dependencies (amd64, 13.0) / Finalize ✅ success view
Load wheel dependencies (amd64, 13.0) / Metadata ✅ success view
Load wheel dependencies (arm64, 12.6) / Caching ✅ success view
Load wheel dependencies (arm64, 12.6) / Finalize ✅ success view
Load wheel dependencies (arm64, 12.6) / Metadata ✅ success view
Load wheel dependencies (arm64, 13.0) / Caching ✅ success view
Load wheel dependencies (arm64, 13.0) / Finalize ✅ success view
Load wheel dependencies (arm64, 13.0) / Metadata ✅ success view
Prepare cache clean-up ✅ success view
Retrieve PR info ✅ success view
✅ Required checks (6/6) — declared in .github/required-checks.yml for push
Required check Status Link
Build and test (amd64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Debug) ✅ success view
Build and test (arm64, llvm, openmpi) / Dev environment (Python) ✅ success view
Build and test (amd64, gcc12, openmpi) / Dev environment (Debug) ✅ success view
Build and test (amd64, gcc12, openmpi) / Dev environment (Python) ✅ success view

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