Skip to content

sc/kernels: default to bit-reversed Owen mask + rescale-scrambling#18

Open
heroarmor wants to merge 1 commit into
mainfrom
change/scramble-defaults-on
Open

sc/kernels: default to bit-reversed Owen mask + rescale-scrambling#18
heroarmor wants to merge 1 commit into
mainfrom
change/scramble-defaults-on

Conversation

@heroarmor
Copy link
Copy Markdown
Collaborator

What

Flip two env-var defaults so the better-quality scramble settings are on by default (no env vars required):

knob old default new default effect
SC_OWEN_MODE counter bitrev bit-reversed Owen mask — same equipartition as counter, but breaks adjacent-D correlation resonance
SC_SCRAMBLE_RESCALE 0 (off) 1 (on) scramble the rescale path (halve / short stoc_len) by default

SC_DISABLE_OWEN stays 0 (scrambling enabled). sc_matmul already defaults granularity="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 for halve without scramble). Making SC_SCRAMBLE_RESCALE=1 the default makes halve usable out of the box (x1.056). bitrev is a strictly-no-worse mask family than counter.

Verified on CPU (no env vars set): default mask resolves to bitrev (≠ counter), and the rescale path scrambles by default.

⚠️ Behavior change

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:

SC_OWEN_MODE=counter SC_SCRAMBLE_RESCALE=0

Independent of #17 (multi-GPU device guard) — touches different lines (kernels.py vs matmul.py); the two can merge in any order.

🤖 Generated with Claude Code

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>
@heroarmor heroarmor force-pushed the change/scramble-defaults-on branch from 0ac2a7f to 5e0cd48 Compare May 23, 2026 21:24
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.

1 participant