plan(dqn-v2): mark Task 6a, 6b LANDED with iteration history

This commit is contained in:
jgrusewski
2026-04-25 00:51:10 +02:00
parent 5ebebc564a
commit efb4e529a4

View File

@@ -945,7 +945,11 @@ Fingerprint shifts to `[79,80]`; `ISV_TOTAL_DIM` grows from 78 (post-Task-4) to
> **IMPORTANT — task ordering**. Task 6 must land AFTER Task 4. If Task 4 is skipped, Task 6's tail-start index drops to 75. Recompute slot constants from the current `ISV_TOTAL_DIM` at implementation time — never hard-code from this plan.
### Task 6a: Persistence credit (held through drawdown, took profit)
### Task 6a: Persistence credit — ✅ LANDED `777341776`
> **Actual outcome.** `PS_INTRA_TRADE_MIN_PNL = 39` added; `PS_STRIDE` grew 39 → 40 with 6 hardcoded-stride sites + 7 comment mentions migrated in lockstep. MIN_PNL tracked per bar alongside MAX_PNL; reset at 5 MAX_PNL reset sites. Consumer fires on `segment_complete && reward > 0 && drawdown_depth > 1e-6f`, adds `shaping × conviction × |min_pnl| × tanh(reward/|min_pnl|)` to `reward` and `rc[5]`. Smoke fold-2 best Sharpe jumped 84.44 → 100.10; HEALTH_DIAG `reward_split bonus=17.21` confirms firing.
#### Original design (for reference)
**Files:**
- Modify: `crates/ml/src/cuda_pipeline/state_layout.cuh` — add 1 PS slot `PS_INTRA_TRADE_MIN_PNL`; grow `PS_STRIDE` 39 → 40.
@@ -966,6 +970,10 @@ Fingerprint shifts to `[79,80]`; `ISV_TOTAL_DIM` grows from 78 (post-Task-4) to
```
- Self-scaling rationale: `tanh(reward / drawdown_depth)` saturates at ±1 when reward ≫ drawdown (full credit) and approaches 0 when reward ≈ drawdown (no surprise). No tuned coefficients.
### Task 6b: Regime-shift penalty — ✅ LANDED `5ebebc564`
> **Actual outcome.** `PS_REGIME_SHIFT_BAR = 40` added; `PS_STRIDE` grew 40 → 41 via 6 stride sites. Detector fires first bar where `|regime_now - PS_PLAN_ENTRY_REGIME|` exceeds `clamp(0.25 × |clamp(sharpe, 2, 2)|, 0.05, 0.5)`. Consumer on exit: `penalty = shaping × conviction × bars_late_frac × |reward|` (bounded by |reward|). Smoke fold-2 best Sharpe: 117.92. **Iteration note:** first formula multiplied by `ISV[Q_DIR_ABS_REF] × |reward|` simultaneously — absolute Q-magnitude (550) amplified |reward| by 20×, flipping trade outcomes and destabilising training. Fixed by dropping `q_scale` multiplier. Pearl: pick exactly ONE unbounded scaling signal per reward term; bound everything else.
### Task 6b: Regime-shift penalty (held past regime flip)
**Files:**