feat(sp22-vnext): Phase F-3 — K=3 CE EMA producer + ISV slot
Adds observability infrastructure for Phase F smoke validation: new ISV slot AUX_TRADE_OUTCOME_CE_EMA_INDEX = 538 tracks the K=3 head's batch-mean sparse cross-entropy EMA. Producer kernel registered + cubin-built; launcher wireup follows in Phase F-3b commit. Changes: - sp22_isv_slots.rs: new pub const AUX_TRADE_OUTCOME_CE_EMA_INDEX = 538 - gpu_dqn_trainer.rs ISV_TOTAL_DIM: 538 → 539 - NEW kernel aux_outcome_ce_ema_kernel.cu: single-thread single-block direct-to-ISV EMA writer with Pearl A first-observation bootstrap. Fixed α=0.05 (slow-moving observability). NULL-tolerant + NaN-guarded. - build.rs: kernel registered; cubin compiles (3.2 KB) Why dedicated kernel (not extension of aux_heads_loss_ema_update): The K=2/K=5 EMA writes through Pearls A+D's 2-stage producer scratch. Extending it would require allocating a new scratch slot, threading Pearls A+D mapping, and touching apply_pearls_ad_kernel. The K=3 head's CE is OBSERVABILITY ONLY in this commit — no Pearls A+D adaptive α needed. Minimum-scope direct-to-ISV path. Re-routable through Pearls A+D if K=3 CE later becomes a controller anchor. Smoke validation signal interpretation: - Cold-start: ISV[538] = 0.0 (FoldReset sentinel) - First step with B_valid > 0: Pearl A bootstrap → ISV[538] = first CE - Typical uniform-K=3 cold-start CE: ln(3) ≈ 1.098 - Learning signal: CE drops from ~1.098 toward 0.5-0.7 over epochs - Falsification signal: CE pinned at ln(3) for many epochs → head can't learn (label noise / under-capacity / outcomes unconditional) Phase F-3b follow-up: - Trainer launcher call after aux_heads_loss_ema_update - HEALTH_DIAG snap layout extension + console column - Reset registry entry (FoldReset sentinel 0) Verification: - cargo check -p ml clean. - cargo test -p ml --lib → 1016/0 green. Audit: docs/dqn-wire-up-audit.md Phase F-3 section. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18226,3 +18226,30 @@ The K=3 head now influences policy behavior via TWO paths:
|
||||
- **Phase E**: dW backward gradient validation — the Phase D dW kernel emits 12 partials; Phase E would add unit tests confirming the gradient direction is correct + Adam updates the prior in the right direction.
|
||||
- **Phase F**: Validation smoke at structural prior — first end-to-end smoke run with the full K=3 + plan-conditioning + atom-shift stack. Decisive test of the spec's hypothesis.
|
||||
- **B5b-2** (deferred): Collector trade plan launch (resolves train/inference asymmetry from B5b).
|
||||
|
||||
#### Phase F-3 (kernel + ISV slot) — K=3 trade-outcome CE EMA producer (2026-05-14)
|
||||
|
||||
Adds the observability infrastructure for Phase F's smoke validation: a new ISV slot (`AUX_TRADE_OUTCOME_CE_EMA_INDEX = 538`) tracks the K=3 head's batch-mean sparse cross-entropy EMA. Producer kernel `aux_outcome_ce_ema_update` is registered + cubin-built; launcher wireup follows in a Phase F-3b commit alongside HEALTH_DIAG console-output extension.
|
||||
|
||||
**Changes**:
|
||||
- `sp22_isv_slots.rs`: new `pub const AUX_TRADE_OUTCOME_CE_EMA_INDEX: usize = 538`
|
||||
- `gpu_dqn_trainer.rs::ISV_TOTAL_DIM`: bumped 538 → 539 (allocates slot 538 in the bus)
|
||||
- New kernel `aux_outcome_ce_ema_kernel.cu`: single-thread single-block direct-to-ISV EMA writer with Pearl A first-observation bootstrap. Fixed α=0.05 (slow-moving observability signal). NULL-tolerant on `isv_signals`. NaN-guarded.
|
||||
- `build.rs`: kernel registered; cubin compiles (3.2 KB)
|
||||
|
||||
**Why dedicated kernel (not extension of `aux_heads_loss_ema_update`)**:
|
||||
The existing K=2/K=5 aux-loss EMA writes through Pearls A+D's 2-stage producer scratch buffer (`producer_step_scratch_buf`). Extending it would require allocating a new scratch slot, threading Pearls A+D mapping, and touching `apply_pearls_ad_kernel`. The K=3 head's CE is for OBSERVABILITY ONLY in this commit — no Pearls A+D adaptive α needed. The dedicated direct-to-ISV kernel is the minimum-scope path. If K=3 CE later becomes a controller anchor (e.g., for a SP11-style adaptive weight on K=3 alignment reward), it can be re-routed through Pearls A+D at that point.
|
||||
|
||||
**Smoke validation signal interpretation**:
|
||||
- Cold-start: `ISV[538] = 0.0` (FoldReset sentinel)
|
||||
- First step with `B_valid > 0`: Pearl A bootstrap fires → `ISV[538] = first_CE_observation`
|
||||
- Typical cold-start CE for uniform K=3 prediction: `ln(3) ≈ 1.098`
|
||||
- **Expected learning signal**: CE drops from ~1.098 toward something meaningfully lower (e.g., 0.5-0.7) over the first few epochs — evidence the K=3 head is learning real trade-outcome structure
|
||||
- **Spec falsification signal**: CE pinned at ~ln(3) for many epochs → head can't learn (label noise, under-capacity, or trade outcomes are genuinely market-state-unconditional)
|
||||
|
||||
**Phase F-3 follow-up (deferred to next commit)**:
|
||||
- Trainer-side launcher call: append `aux_outcome_ce_ema_update` after the existing `aux_heads_loss_ema_update` launch in the per-step training graph
|
||||
- HEALTH_DIAG snap layout extension: add `aux_outcome_ce_ema` field + console column
|
||||
- State reset registry entry: `AUX_TRADE_OUTCOME_CE_EMA_INDEX` as FoldReset sentinel 0
|
||||
|
||||
**Verification**: `cargo check -p ml` clean; `cargo test -p ml --lib` → **1016/0 green**.
|
||||
|
||||
Reference in New Issue
Block a user