Files
foxhunt/docs
jgrusewski 1c150d1901 fix(sp4): Layer B fix-up — restore Adam coverage for tensors [33..163)
Layer B's 3-way DQN main Adam split (commit 58ffb3a48) covered only
tensors [0..33) (DqnTrunk + DqnValue + DqnBranches per
param_group_buffers mapping). Tensors [33..163) — bottleneck, VSN
bottleneck, GLU, KAN, regime gate, spacing, multi-horizon value heads,
risk, ISV encoder, VSN per-group, aux heads, MoE — were silently no
longer Adam-updated. Their grads still computed, m/v state still
allocated, but no parameter step applied. Detected by code-quality
reviewer; would have surfaced at L40S smoke as ~70% network freeze
attributable to Sharpe noise.

Fixes:
1. 4th sub-launch added to launch_adam_update: trunk-extras tail
   covering tensors [33..163), tagged ParamGroup::DqnTrunk for shared
   bounds, with SP4_ENGAGE_OFFSET_DISABLED for Pearl C engagement
   (rolls into trunk's accounting since they share WEIGHT_BOUND/
   WD_RATE).
2. MAX_BLOCKS_PER_ADAM grown 256 → 4096 to accommodate trunk-extras's
   block count (production cfg ~2400 blocks). SP4_ENGAGE_BUF_LEN
   auto-updates: 11 × 4096 = 45056 ints. All 4 Curiosity-sub-launch
   offset constants auto-derive from MAX_BLOCKS_PER_ADAM.
3. Coverage debug_assert_eq added: trunk + value + branches +
   trunk_extras must equal total_params. Prevents future regressions.
4. read_group_adam_bounds(group) -> (clamp, wd) helper introduced on
   GpuDqnTrainer; 6 verbose 2-line ISV-read patterns in
   fused_training.rs collapsed to one-liners (TLOB + IQL high + IQL
   low + IQN parallel + Attn parallel + Attn sequential + IQN
   sequential = 7 call sites). The 4-way Adam loop in
   launch_adam_update also uses the helper.
5. 9 stale doc-comments referring to "100 × Q_ABS_REF.max(1.0)"
   updated to current "ISV[WEIGHT_BOUND[group]].max(EPS_CLAMP_FLOOR)"
   contract (curiosity_training_kernel.cu, gpu_curiosity_trainer.rs
   ×2, iqn_dual_head_kernel.cu ×3, iql_value_kernel.cu,
   attention_backward_kernel.cu, dqn_utility_kernels.cu ×2,
   gpu_dqn_trainer.rs historical SP3 reference).
6. launch_adam_update + pearl_c_post_adam_engagement_check + audit
   doc updated to reflect actual 4-way coverage and trunk-extras's
   engagement folding into DqnTrunk.

Per feedback_no_partial_refactor: trunk-extras consumers (= no
dedicated SP4 producer yet) and bound (= reused trunk's
WEIGHT_BOUND/WD_RATE) ship together with the launch fix in this
commit. A future task may introduce dedicated SP4 producers for
sub-trunk regions (VSN, MoE, etc.) once warranted by signal analysis.

Refs: 58ffb3a48 (Layer B atomic consumer migration).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 11:47:42 +02:00
..