Skip to content

[bug fix] Fix 25p noise and noise upscaling#75

Merged
bmhowe23 merged 1 commit intomainfrom
bmh/fix-25p-training
May 1, 2026
Merged

[bug fix] Fix 25p noise and noise upscaling#75
bmhowe23 merged 1 commit intomainfrom
bmh/fix-25p-training

Conversation

@bmhowe23
Copy link
Copy Markdown
Collaborator

@bmhowe23 bmhowe23 commented May 1, 2026

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_error path, which is unchanged.

Authored by: @kvmto

Changes

  • Wire noise_model end-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, and MemoryCircuitTorch. New p_override lets cached DEM structure be reused with a freshly built probability vector.
  • Fix build_single_p_marginal: emit p_prep_X / p_prep_Z for ancilla-prep entries instead of 0.0.
  • Fix grouped-totals / upscaling (qec/noise_model.py, fixes Update noise scaling #20): keep P_prep_X/P_prep_Z and P_meas_X/P_meas_Z separate, and compare 0.5 × P_idle_spam_raw. The p = 6e-3 config now sits exactly at target.
  • DEM artifact metadata (qec/precompute_dem.py): write versioned metadata + NoiseModel.sha256() into .p.npz; structural mismatch rebuilds in memory, structural match reuses cached H/A and refreshes p. Legacy metadata-free artifacts still load.

Tests

New tests in code/tests/test_noise_model.py and code/tests/test_torch_setup.py cover: canonical sha256 stability, the new 7-channel grouping, the p = 6e-3 at-target case, DEM precompute producing 25p (not scalar-derived) probabilities, metadata round-trip, generator using noise_model for in-memory and on-disk DEM, structural-match cache reuse with refreshed p, and legacy metadata-free artifacts still loading.

@ivanbasov ivanbasov force-pushed the bmh/fix-25p-training branch from 39b1ca5 to 30ce0d5 Compare May 1, 2026 20:22
Co-authored-by: Kevin Mato <kmato@nvidia.com>
@ivanbasov ivanbasov force-pushed the bmh/fix-25p-training branch from 0672d08 to d655aa8 Compare May 1, 2026 20:49
@bmhowe23 bmhowe23 changed the title [bug fix] Fix training with custom 25p noise and noise upscaling [bug fix] Fix 25p noise and noise upscaling May 1, 2026
@bmhowe23 bmhowe23 merged commit 02a15aa into main May 1, 2026
17 checks passed
@bmhowe23 bmhowe23 deleted the bmh/fix-25p-training branch May 1, 2026 22:51
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.

Training does not honor custom 25-parameter data.noise_model during training process Update noise scaling

2 participants