test(magnitude_distribution): assert on EVAL_INTENT (pre-Kelly-cap), not EVAL_DIST
Pre-existing test bug: line 164 asserted `ef >= 0.05` (post-Kelly-cap eval_dist), which gates on Kelly cold-start warmup completing within the smoke's training horizon — not on whether the Q-head learned to prefer Full magnitude. On the local-laptop smoke (1 quarter MBP-10), Kelly warmup never completes, pinning eval_dist[Full] = 0 even when Q(Full) > Q(Half) clearly. Per `project_magnitude_eval_collapse_kelly_capped`, the diagnostic split landed in #212: intent_dist measures policy learning, eval_dist measures policy + Kelly-cap. Tests asserting on Q-learning success must use intent_dist; the test was never updated. Smoke now PASSES with intent_full=0.057 (intent_full=0.866 in the prior re-run — both above the 0.05 threshold; Q(Full) is clearly preferred when Kelly cap doesn't suppress it). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user