Repository navigation
Read prep/meas noise keys by failing basis in the color-code circuits - #104
Merged
Merged
Conversation
The color-code Stim builder and the color-code DEM precompute read p_prep_X, p_prep_Z, p_meas_X and p_meas_Z by the applied Pauli (Z-basis reset/measure used the *_X keys), while the surface-code builder, the config comments and the README name a key by the basis that fails (Z-basis reset/measure uses the *_Z keys and is applied as X_ERROR). With a non-uniform noise model the color-code path applied the X-basis rates to the Z basis and vice versa. Move the color-code readers to the surface-code convention: - qec/color_code/memory_circuit.py: add_reset, add_single_error, add_measure_reset, add_measure and the data-readout flip injected in the final round. - qec/precompute_dem.py: build_single_p_marginal_color_code (ancilla prep/meas, data prep and final data-readout entries). Models with p_prep_X == p_prep_Z and p_meas_X == p_meas_Z, which includes every shipped config, produce the same circuits and probability vectors as before. Tests: add test_color_code_prep_meas_key_convention.py and update the two expectations in test_color_augmented_dem_precompute.py that pinned the previous convention. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Ivan Basov <ibasov@nvidia.com>
bmhowe23
approved these changes
Nov 19, 2026
ivanbasov
added a commit
that referenced
this pull request
Nov 19, 2026
With #104 merged, the color-code circuits read the prep/meas keys by the failing basis, as the surface-code circuits do. Drop the sentence that said they read them the other way and the surface-code scoping of the parameter-name note. The example itself still covers the surface code only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Ivan Basov <ibasov@nvidia.com>
ivanbasov
added a commit
that referenced
this pull request
Nov 19, 2026
* Document noise learning with CUDA-Q QEC for pre-decoder training Add NOISE_LEARNING.md: how to estimate the 25-parameter noise model from detector data with cudaq-qec 0.9.0 (nv_qldpc.learn_noise, parametric mode) and write it as a data.noise_model block for training. Link it from the "Noise model" section of the README. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Ivan Basov <ibasov@nvidia.com> * Fit one noise model to both bases in the noise learning guide Address review comments on the noise learning guide. The example combined the two single-basis results parameter by parameter. One memory basis fixes the preparation and measurement parameters only together with two CNOT parameters, so values taken from different runs do not form a consistent set. The example now fits the one set of 25 parameters that reproduces the mechanism rates learned in both bases; the two experiments together fix all 25. Also state that the device must run the MemoryCircuit schedule, scope the parameter-name note and the swap step to the surface-code circuits, say what a single-basis result can be used for, and correct the description of the learn_physical_params command-line tool. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Ivan Basov <ibasov@nvidia.com> * Update the noise learning guide for the color-code key convention With #104 merged, the color-code circuits read the prep/meas keys by the failing basis, as the surface-code circuits do. Drop the sentence that said they read them the other way and the surface-code scoping of the parameter-name note. The example itself still covers the surface code only. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Signed-off-by: Ivan Basov <ibasov@nvidia.com> --------- Signed-off-by: Ivan Basov <ibasov@nvidia.com> Co-authored-by: Claude Fable 5.2 <noreply@anthropic.com>
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.
What
The four prep/meas keys of
data.noise_modelare named by the basis that fails:p_prep_Z/p_meas_Zbelong to Z-basis reset/measurement (applied asX_ERROR),p_prep_X/p_meas_Xto X-basis (applied asZ_ERROR). The surface-code builder,conf/config_public.yamland the README follow this.The color-code path paired them the other way (Z-basis reset/measurement took
p_prep_X/p_meas_X), so a non-uniform noise model had its X-basis and Z-basis rates exchanged. This PR gives the color-code path the same pairing as the surface code. The Pauli applied for each basis is unchanged; only the key that supplies the probability changes.Changes
qec/color_code/memory_circuit.py:add_reset,add_single_error,add_measure_reset,add_measure, and the data-readout flip of the final round.qec/precompute_dem.py:build_single_p_marginal_color_code, so the Torch probability vector keeps matching the Stim circuit.qec/noise_model.py: docstring only.Impact
Behaviour changes only for the color code with
p_prep_X != p_prep_Zorp_meas_X != p_meas_Z; exchange the values within each pair to reproduce earlier results.All configs under
conf/,NoiseModel.from_single_p,NoiseModel.from_si1000and the pretrained models use equal values within each pair. For these the color-code circuit and probability vector are byte-identical before and after (checked at d=5, both bases).Tests
test_color_code_prep_meas_key_convention.py: a single non-zero key produces the expected instruction on the expected qubits; the color builder agrees with the surface builder; the DEM precompute agrees with the Stim circuit. Fails onmain, passes here.test_color_augmented_dem_precompute.py, which pinned the old pairing with four distinct values:test_color_single_qubit_noise_probabilities_follow_pauli_labels(renamed..._follow_basis_labels) andtest_color_stim_and_dem_data_noise_locations_match.unittest discover528 tests, 57 skipped, 1 failure (test_required_model_files_present, pretrained weights not present locally);pyteston the color tests 315 passed, 11 skipped;yapfclean.🤖 Generated with Claude Code