sc/kernels: default to bit-reversed Owen mask + rescale-scrambling#18
Open
heroarmor wants to merge 1 commit into
Open
sc/kernels: default to bit-reversed Owen mask + rescale-scrambling#18heroarmor wants to merge 1 commit into
heroarmor wants to merge 1 commit into
Conversation
Flip two env-var defaults so the better-quality scramble settings are on
out of the box (no env vars needed):
- SC_OWEN_MODE: "counter" -> "bitrev"
bit-reversed Owen mask: same equipartition as counter but breaks
adjacent-D correlation resonance.
- SC_SCRAMBLE_RESCALE: "0" -> "1"
scramble the rescale path (halve / short stoc_len) by default; the
unscrambled rescale path lets SC error accumulate across D and is
catastrophic at short stoc_len (the documented x4.215-PPL behavior).
SC_DISABLE_OWEN stays "0" (scrambling enabled). sc_matmul already defaults
granularity="per_row", so per-row needs no change.
NOTE: this changes numerical results for any consumer that does not set
these env vars explicitly, including scmp_llm's benchmark numbers. Set
SC_OWEN_MODE=counter / SC_SCRAMBLE_RESCALE=0 to restore legacy behavior.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0ac2a7f to
5e0cd48
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.
What
Flip two env-var defaults so the better-quality scramble settings are on by default (no env vars required):
SC_OWEN_MODEcounterbitrevSC_SCRAMBLE_RESCALE0(off)1(on)stoc_len) by defaultSC_DISABLE_OWENstays0(scrambling enabled).sc_matmulalready defaultsgranularity="per_row", so per-row needs no change.Why
The unscrambled rescale path lets SC error accumulate across D instead of averaging — catastrophic at short
stoc_len(the documented x4.215-PPL behavior forhalvewithout scramble). MakingSC_SCRAMBLE_RESCALE=1the default makeshalveusable out of the box (x1.056).bitrevis a strictly-no-worse mask family thancounter.Verified on CPU (no env vars set): default mask resolves to
bitrev(≠ counter), and the rescale path scrambles by default.This changes numerical results for any consumer that doesn't set these env vars explicitly, including
scmp_llm's documented benchmark numbers. Legacy behavior is one env var away:Independent of #17 (multi-GPU device guard) — touches different lines (
kernels.pyvsmatmul.py); the two can merge in any order.🤖 Generated with Claude Code