fix: remove gauge bias in random_vector() — complex Gaussian sampling - #1
Open
PFmix wants to merge 1 commit into
Open
fix: remove gauge bias in random_vector() — complex Gaussian sampling#1PFmix wants to merge 1 commit into
PFmix wants to merge 1 commit into
Conversation
Real-uniform sampling (2*random()-1) restricted fallback vectors to the real axis, and abs(vec[0]) forced the first component non-negative (|00> bias for +ZZ targets). Together these cause all-open (s_ij=+1) to score ~0.075 higher in S^tomo than gauge-equivalent all-walled and unfrustrated configurations on a 120-qubit square lattice at STEPS=2 (~20% inflation). Replace with a complex Gaussian draw (randn + 1j*randn), which samples uniformly from the full complex unit sphere after normalization. Closes ~25-44% of the gauge gap depending on STEPS; SVG maze and max-frustrated configs are unaffected (mixed-sign distributions where the asymmetry averages out across edges). Co-Authored-By: Claude Sonnet 4.6 <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.
Problem
random_vector()inset_relationshiphad two compounding biases:np.array([2*random()-1 for _ in range(4)], dtype='complex')draws only from the real axis; the imaginary degrees of freedom are never explored.
vec[0] = abs(vec[0])forces the first component non-negative,biasing fallback vectors toward |00⟩ for +ZZ targets.
Together these introduce a gauge anomaly: all-open (s_ij = +1 everywhere) scores
systematically higher in S^tomo than gauge-equivalent all-walled (s_ij = −1) and
unfrustrated Mattis configurations. On a 120-qubit square lattice at STEPS=2, the gap
reaches ~0.075 (~20% relative inflation for all-open).
Root cause
random_vector()is called as a fallback inmake_vecwhen the projected vectororthogonalises to zero. For the initial |+>^N state, this fallback is structurally
guaranteed for −ZZ edges (analytically: |P_{-ZZ} @ vecs[1]|² = 0 exactly) but never
triggered for +ZZ edges. The sign-asymmetric fallback frequency, combined with the
biased sampling, inflates +ZZ scores relative to −ZZ.
Fix
Replace the two biased lines with a single complex Gaussian draw: