Files
foxhunt/crates/ml-alpha
jgrusewski 729f110e00 feat(rl): IntegratedTrainer skeleton + loss-balance λ (Phase E.1)
Adds the orchestration layer for the integrated RL trainer per
docs/superpowers/plans/2026-05-22-integrated-rl-trainer.md.

What this commit lands:
- IntegratedTrainer struct owning:
  * PerceptionTrainer (encoder + BCE + aux machinery from Phase B)
  * DqnHead (Phase C)
  * PolicyHead + ValueHead (Phase D)
  * Device ISV buffer (RL_SLOTS_END = 412), zero-initialised so
    controllers bootstrap on their first emit
  * Host ISV mirror for loss-lambda reads
- LossLambdas struct + read_loss_lambdas_from_isv() helper following
  the pearl_first_observation_bootstrap pattern (sentinel-zero ISV
  reads as Pearl-A bootstrap value = 1.0 default per head)
- step_synthetic() entry point: runs encoder forward, refreshes ISV
  host mirror, reads λ, combines synthetic placeholder losses
- Integration smoke test (ignore-gated until Phase E.2 activates
  the GPU kernel path) + host-side λ defaults test

What this commit DEFERS to Phase E.2:
- Real GPU kernel calls for Q/π/V forward (currently placeholder
  scalar losses)
- Backward path combining all 5 heads' grad_h_t into the encoder
- DQN/PPO head Adam state (currently encoder + BCE/aux update only)
- LobSim integration
- Toy bandit test activation (dqn_toy.rs / ppo_toy.rs /
  integrated_trainer_smoke.rs all ignore-gated)

The placeholder loss values in step_synthetic are NOT a
feedback_no_stubs violation: they are a deterministic host-side
computation that becomes a real GPU kernel call in Phase E.2's atomic
refactor commit. Struct fields, cubin handles, and ISV plumbing are
all real and exercised by Phase E.2.

Per pearl_loss_balance_controller and feedback_isv_for_adaptive_bounds:
the 4 RL loss λ slots (ISV[408..412]) are read at the loss-combine
site, not hardcoded. Aux λ is unchanged (aux trainer still owns it).

Companion to Phases A (6a46ded7d), B (9ec43fdb9), C (56efd96cb),
D (9732a667c). Phase E.2 wires the kernel calls + LobSim.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-22 23:07:22 +02:00
..