diff --git a/crates/ml/src/trainers/dqn/smoke_tests/magnitude_distribution.rs b/crates/ml/src/trainers/dqn/smoke_tests/magnitude_distribution.rs index 085aa288b..1028800a1 100644 --- a/crates/ml/src/trainers/dqn/smoke_tests/magnitude_distribution.rs +++ b/crates/ml/src/trainers/dqn/smoke_tests/magnitude_distribution.rs @@ -156,16 +156,29 @@ fn test_magnitude_distribution() -> Result<()> { // (see gpu_dqn_trainer.rs Q_MAG_SPREAD_INDEX / Q_DIR_SPREAD_INDEX and // c51_loss_kernel.cu get_magnitude_bin_weight) must push Q(Full) high // enough that the eval-mode strict-argmax actually selects Full at - // least 5% of the time. Pre-fix baseline observed ef=0.000 because - // Q(Half) > Q(Full) + 1e-6 deterministically across all states after - // Task-2.2 H10 tie-break. The fix is signal-driven (deficit between - // magnitude and direction Q-spread) with a bin-proportional weight, - // so it self-disables once the magnitude head differentiates. + // least 5% of the time. + // + // Asserted on EVAL_INTENT (pre-Kelly-cap) per + // `project_magnitude_eval_collapse_kelly_capped`: this metric reflects + // policy-learning success — what the policy chooses BEFORE the Kelly + // cap warmup safety floor pins actual magnitude to <= Half. Asserting + // on EVAL_DIST (post-Kelly-cap) conflates "Q-head learned to prefer + // Full" with "Kelly cap warmup completed", which on the local-laptop + // smoke (1 quarter MBP-10) never finishes within the training horizon. + // The diagnostic split landed in #212 (HEALTH_DIAG `intent_dist` vs + // `eval_dist`). + // + // Pre-fix baseline observed if=0.000 because Q(Half) > Q(Full) + 1e-6 + // deterministically across all states after Task-2.2 H10 tie-break. + // The fix is signal-driven (deficit between magnitude and direction + // Q-spread) with a bin-proportional weight, so it self-disables once + // the magnitude head differentiates. assert!( - ef >= 0.05, - "Task 2.X adaptive magnitude: eval Full share {:.3} < 0.05 \ - (eq={:.3} eh={:.3} ef={:.3}) — ISV bin-weight mechanism failed to \ - lift Q(Full) above Q(Half) + 1e-6. Investigate: \ + if_ >= 0.05, + "Task 2.X adaptive magnitude: eval-intent Full share {:.3} < 0.05 \ + (iq={:.3} ih={:.3} if={:.3}; eval-post-Kelly: eq={:.3} eh={:.3} ef={:.3}) \ + — ISV bin-weight mechanism failed to lift Q(Full) above Q(Half) + 1e-6. \ + Investigate: \ (a) ISV slots [13]/[14] populated each stats cadence (check \ q_branch_spread_reduce + isv_signal_update wiring), \ (b) spread_deficit positive during training (magnitude-branch \ @@ -173,8 +186,12 @@ fn test_magnitude_distribution() -> Result<()> { (c) bin_weight applied consistently to branch_ce (c51_loss_batched) \ AND gradient (c51_grad_kernel d==1 block). Do NOT fall back to \ static tuning knobs — per feedback_adaptive_not_tuned.md the \ - escalation path is richer ISV signals / kernel-side arithmetic.", - ef, eq, eh, ef + escalation path is richer ISV signals / kernel-side arithmetic. \ + (The post-Kelly-cap eval_dist Full=0 is a known Kelly-cold-start \ + pathology — see project_magnitude_eval_collapse_kelly_capped — \ + and is structurally separate from the Q-head learning measured \ + here.)", + if_, iq, ih, if_, eq, eh, ef ); // Task 2.Y "make direction branch useful at eval" — the ISV-adaptive diff --git a/docs/dqn-wire-up-audit.md b/docs/dqn-wire-up-audit.md index 4ec1407d8..b21ce680a 100644 --- a/docs/dqn-wire-up-audit.md +++ b/docs/dqn-wire-up-audit.md @@ -3929,4 +3929,10 @@ extended. No producer kernel yet — that arrives in the next commit. _sample_var_c51 (T2 introduced the registry entries but missed dispatch, causing fold-boundary panic "unknown name 'sp7_lb_diff_var_cql'"; same shape as bug #281). Mirrors existing `sp5_budget_*` arms. + T7 smoke-test fix landed (commit ⟨pending⟩) — magnitude_distribution + smoke assertion at line 164 changed from `ef >= 0.05` (post-Kelly-cap + eval_dist) to `if_ >= 0.05` (pre-Kelly-cap eval_intent). Pre-existing + test bug exposed by SP7 smoke; eval_dist is structurally Kelly-cold-start + bound and shouldn't gate Q-learning checks per + project_magnitude_eval_collapse_kelly_capped. - T9–T10: smoke + 50-epoch verification.