[bug fix] Fix 25p noise and noise upscaling#75
Merged
Conversation
This was referenced May 1, 2026
ivanbasov
approved these changes
May 1, 2026
39b1ca5 to
30ce0d5
Compare
Co-authored-by: Kevin Mato <kmato@nvidia.com>
0672d08 to
d655aa8
Compare
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.
Summary
Resolves #20
Resolves #80
This does not affect the published paper results; they report uniform depolarizing noise and were trained via the scalar
p_errorpath, which is unchanged.Authored by: @kvmto
Changes
noise_modelend-to-end (training/train.py,data/generator_torch.py,qec/precompute_dem.py,qec/surface_code/memory_circuit_torch.py): forward the active 25p model from the trainer to the data generator, DEM precompute, andMemoryCircuitTorch. Newp_overridelets cached DEM structure be reused with a freshly built probability vector.build_single_p_marginal: emitp_prep_X/p_prep_Zfor ancilla-prep entries instead of0.0.qec/noise_model.py, fixes Update noise scaling #20): keepP_prep_X/P_prep_ZandP_meas_X/P_meas_Zseparate, and compare0.5 × P_idle_spam_raw. Thep = 6e-3config now sits exactly at target.qec/precompute_dem.py): write versioned metadata +NoiseModel.sha256()into.p.npz; structural mismatch rebuilds in memory, structural match reuses cachedH/Aand refreshesp. Legacy metadata-free artifacts still load.Tests
New tests in
code/tests/test_noise_model.pyandcode/tests/test_torch_setup.pycover: canonicalsha256stability, the new 7-channel grouping, thep = 6e-3at-target case, DEM precompute producing 25p (not scalar-derived) probabilities, metadata round-trip, generator usingnoise_modelfor in-memory and on-disk DEM, structural-match cache reuse with refreshedp, and legacy metadata-free artifacts still loading.