feat(dqn): register fold-boundary reset for MoE ISV slots

Slots 118..126 reset to 1/K=0.125 (uniform gate initial); slot 126 resets
to ln(8)=2.0794 (max entropy). Producers land in Phase 2 (task 2.4 ISV
producer kernel); consumers in Phase 3 (HEALTH_DIAG line + per-step
launch).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-04-27 18:10:21 +02:00
parent 3a6654989a
commit 1cb894cca6
3 changed files with 37 additions and 0 deletions

View File

@@ -358,6 +358,20 @@ impl StateResetRegistry {
category: ResetCategory::FoldReset,
description: "ISV[AUX_LABEL_SCALE_EMA_INDEX=117] — aux next-bar label-scale EMA (mean(|next_states[:, 0]|) at α=0.05); GPU aux_label_scale_ema_update kernel fills (Plan 4 Task 6 / Plan 5 Task 5 follow-up); consumer kernels read slot 117 to divide label by max(scale, 1e-6) before the residual; cold-start 1.0 (multiplicative identity, NOT 0.0) reapplied at fold boundary",
},
// Mixture-of-Experts per-expert utilization (slots 118..126).
// Reset to 1/K = 1/8 = 0.125 (uniform-gate initial).
RegistryEntry {
name: "isv_moe_expert_util_ema",
category: ResetCategory::FoldReset,
description: "ISV[MOE_EXPERT_UTIL_EMA_BASE..MOE_EXPERT_UTIL_EMA_BASE+8) — per-expert gate-weight EMA (α=0.05); GPU moe_expert_util_ema_update kernel fills (Phase 2 task 2.4); reset to uniform 1/K=0.125 at fold boundary",
},
// MoE gate-distribution entropy EMA (slot 126).
// Reset to ln(8) ≈ 2.0794 (max entropy at uniform initial gate).
RegistryEntry {
name: "isv_moe_gate_entropy_ema",
category: ResetCategory::FoldReset,
description: "ISV[MOE_GATE_ENTROPY_EMA_INDEX=126] — entropy of batch-mean gate distribution, EMA α=0.05; reset to ln(8)≈2.0794 at fold boundary (max entropy at uniform initial gate); GPU moe_gate_entropy_ema_update kernel fills (Phase 2 task 2.4)",
},
];
Self { entries }
}

View File

@@ -4818,6 +4818,24 @@ impl DQNTrainer {
);
}
}
"isv_moe_expert_util_ema" => {
if let Some(ref fused) = self.fused_ctx {
for k in 0..crate::cuda_pipeline::gpu_dqn_trainer::MOE_EXPERT_UTIL_EMA_COUNT {
fused.trainer().write_isv_signal_at(
crate::cuda_pipeline::gpu_dqn_trainer::MOE_EXPERT_UTIL_EMA_BASE + k,
1.0_f32 / crate::cuda_pipeline::gpu_dqn_trainer::MOE_EXPERT_UTIL_EMA_COUNT as f32,
);
}
}
}
"isv_moe_gate_entropy_ema" => {
if let Some(ref fused) = self.fused_ctx {
fused.trainer().write_isv_signal_at(
crate::cuda_pipeline::gpu_dqn_trainer::MOE_GATE_ENTROPY_EMA_INDEX,
(crate::cuda_pipeline::gpu_dqn_trainer::MOE_EXPERT_UTIL_EMA_COUNT as f32).ln(),
);
}
}
"isv_gamma_dir_eff" | "isv_gamma_mag_eff" | "isv_gamma_ord_eff" | "isv_gamma_urg_eff" => {
// D.2 per-branch gamma slots. Reset to 0.0 at fold boundary;
// per_branch_gamma_update GPU kernel re-populates on next epoch-boundary launch.

View File

@@ -2,6 +2,11 @@
**Status:** Populated during Plan 1 Task 6 (A.5 orphan audit). Updated on every commit per Invariant 7.
MoE ISV slot reset registration (2026-04-27): registered fold-boundary
reset entries for the 8 `MOE_EXPERT_UTIL_EMA` slots (reset to 1/K=0.125)
and the `MOE_GATE_ENTROPY_EMA_INDEX` slot (reset to ln(8)). Producers
land in Phase 2 task 2.4; consumers in Phase 3.
MoE ISV slot reservation (2026-04-27): reserve slots 118126 for the
upcoming MoE redesign monitoring — 8 slots `MOE_EXPERT_UTIL_EMA[0..8]`
for per-expert gate-weight EMA + 1 slot `MOE_GATE_ENTROPY_EMA_INDEX=126`