Files
foxhunt/crates
jgrusewski 4c1ed1d953 fix(per-horizon-cfc): extend block-diagonal mask to heads_w1 (Smoke 2 fix)
Diagnostic Smoke 2 (lob-backtest-sweep-kw7f6 at d2d34b6d4) confirmed
empirically:
- Per-horizon logit distributions near-uniform (mean spread 0.05, std
  spread 0.02), explaining mean_run_len ratio = 1.04x (vs target >=10x)
- heads_w1 inspection: 100% dense at off-bucket positions (32,768/32,768
  nonzero), magnitude ratio off/in ~= 1.0
- GRN kernel grep confirmed heads_w1 is the SOLE remaining HIDDEN_DIM-
  reading path bypassing bucket-routing (heads_w_skip already restricted;
  heads_w2/gate/main operate within HEAD_MID_DIM only)

Extends the existing heads_w_skip block-diagonal 3-layer defense to
heads_w1 with mask shape [N_HORIZONS x HEAD_MID_DIM x HIDDEN_DIM]:

- heads_w1_mask_init_kernel at transition: zero off-bucket params +
  build mask
- heads_w1_zero_off_bucket_kernel on Adam (m, v) moments at transition
  (prevents momentum from re-introducing off-bucket weights)
- heads_w1_grad_mask_apply_kernel per-step: zero off-bucket gradient
  before Adam
- heads_w1_zero_off_bucket_kernel per-step post-Adam: belt+suspenders
  for eps drift

GPU oracle tests verify mask init, grad mask apply, and post-Adam
invariance under simulated training (3 new tests for the 3-D heads_w1
shape; mirrors the existing heads_w_skip oracle tests).

ml-alpha lib: 33 passed.
GPU oracle tests on RTX 3050 sm_86: 19 passed (16 prior + 3 new).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-21 23:08:36 +02:00
..