jgrusewski
a6087a0b23
feat(sp21): T2.2 Phase 5+6 combined — E6/E7 signal-driven PER alpha scaling (atomic)
Wires E6 (compute_winner_indices) + E7 (compute_hindsight_labels)
outputs into the PER priority update kernel via signal-driven ISV
slots. Phases 5 and 6 combined into one atomic commit per
feedback_no_deferrals_for_complementary_fixes — both attack the
same consumer kernel (per_update_pa) with non-overlapping refactor
scopes (E6 contributes one ISV-mediated scalar, E7 contributes
another, kernel composes both into alpha_boost).
Plan revision (briefed and accepted 2026-05-11):
- E6's literal Vec<usize> of val bar indices CANNOT directly bump
training-PER priorities — val and training have separate coord
systems (no bar-index → buffer-slot mapping).
- E7's true synthetic injection requires val state retention
infrastructure (n_windows × max_len × state_dim scratch buffer)
— significant scope expansion deferred to Phase 6.5.
- The MEANINGFUL signal in both phases is scalar aggregations of
the per-trade tape: E6 winner concentration (top-decile-mean
P&L / all-mean P&L) and E7 hindsight magnitude (mean
|counterfactual_pnl|). Both compose multiplicatively into
per_update_pa's alpha_eff.
ISV slot allocation:
- WINNER_CONCENTRATION_INDEX = 525
- HINDSIGHT_MAGNITUDE_INDEX = 526
- ISV_TOTAL_DIM 525 → 527 (bus extension)
- Layout fingerprint adds 2 SLOT entries
- Compile-time test asserts SP21_SLOT_END (527) ≤ ISV_TOTAL_DIM
Signal semantics:
- winner_concentration: top_decile_mean_pnl / max(all_mean_pnl, EPS).
> 1.0 = top decile dominates; ≈ 1.0 = uniform; ≤ 0 → 0.0 sentinel
(losing strategy, signal ill-defined).
- hindsight_magnitude: mean(|counterfactual_pnl|). Higher = larger
missed opportunities.
- Cold start: both at 0.0 sentinel; kernel short-circuits to
alpha_eff = alpha (no-op).
ABI surgery (minimal):
- per_update_pa: ONE new arg `const float* __restrict__ isv_signals`
at end. NULL-tolerant. Reads slots 525/526 device-side, composes
boost_delta (bounded [0, 0.4]), applies alpha_eff = alpha + delta.
- update_priorities_gpu launcher: passes existing
self.isv_signals_dev_ptr (already on struct, settable via
set_isv_signals_ptr — same infra per_insert_pa uses for
recovery_oversample). Zero new public API.
Producer wireup:
- enrichment.rs: 2 new helpers (compute_winner_concentration,
compute_hindsight_magnitude); EnrichmentResult gains 2 fields
(winner_concentration, hindsight_magnitude); run_enrichments
populates both; log line extended.
- training_loop.rs: post-enrichment block writes both ISV slots
via fused.trainer().write_isv_signal_at.
Files changed:
- crates/ml/src/cuda_pipeline/sp21_isv_slots.rs: +2 slot consts
- crates/ml/src/cuda_pipeline/gpu_dqn_trainer.rs: ISV_TOTAL_DIM bump
+ fingerprint
- crates/ml-dqn/src/per_kernels.cu: per_update_pa ABI + boost logic
- crates/ml-dqn/src/gpu_replay_buffer.rs: launcher passes ISV ptr
- crates/ml/src/trainers/dqn/trainer/enrichment.rs: 2 helpers + 2
fields + populate
- crates/ml/src/trainers/dqn/trainer/training_loop.rs: write 2 slots
- docs/dqn-wire-up-audit.md: 2026-05-11 audit entry
Verification (passing):
- cargo check -p ml --tests --features cuda: 0 errors
- cargo test -p ml --lib sp21_isv_slots: 3/3
- sp20_aggregate_inputs_test: 12/12
- sp20_phase1_4_wireup_test: 2/2
- sp20_emas_compute_test: 4/4
- sp20_controllers_compute_test: 7/7
- sp21_per_trade_predicted_q_test: 3/3
Total: 34 tests, 0 failures. Behavioral gate (alpha_eff lift on
post-warmup val passes) is the upcoming smoke training run.
Deferred follow-up (Phase 6.5): true E7 hindsight synthetic
experience injection via val state retention + per_insert_pa
extension. Significant infrastructure (n_windows × max_len ×
state_dim scratch + insert API extension). Documented in audit.
After this commit (T2.2 Phases 7-8 + 6.5 deferred):
- Phase 7: E8 curriculum weights → segment sampling
- Phase 8: signal-drive remaining controller GAINS
- Phase 6.5: synthetic hindsight injection (deferred — needs val
state buffer infrastructure)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 23:07:12 +02:00
..
2026-02-23 11:19:58 +01:00
2026-05-10 21:35:58 +02:00
2026-05-10 22:19:28 +02:00
2026-04-30 17:26:25 +02:00
2026-05-07 23:36:07 +02:00
2026-04-27 22:19:41 +02:00
2026-05-10 23:07:12 +02:00
2026-04-25 12:29:47 +02:00
2026-04-28 23:54:45 +02:00
2026-05-09 18:17:38 +02:00
2026-05-09 13:52:00 +02:00
2026-04-26 10:36:03 +02:00
2026-05-09 11:26:17 +02:00