Files
foxhunt/docs/dqn-wire-up-audit.md
jgrusewski 3cb083f182 feat(dqn-v2): B.3 + C.5 GPU-only replay seed warm-start + CQL α ramp
Plan 3 Tasks 8 + 9. Single commit because Task 9 directly consumes Task 8's
seed-fraction signal; no useful intermediate state.

ISV tail-append:
- [82] SEED_STEPS_TARGET_INDEX — config replay_seed_steps (CPU constructor write)
- [83] SEED_STEPS_DONE_INDEX — GPU-incremented per collect_experiences_gpu
- [84] SEED_FRAC_EMA_INDEX — adaptive EMA of (1 - done/target)
- Fingerprint shifted [80,81] → [85,86]; ISV_TOTAL_DIM 82 → 87

GPU-only design (per user direction "fully gpu driven no cpu involvement"):
- 4 scripted policies as ONE CUDA kernel (scripted_policy_kernel.cu)
- Per-sample policy mix (40% uniform LCG / 20% momentum / 20% mean-rev /
  20% vwap-deviation) deterministic by `i % 5`
- Action source switched at launch boundary (CPU per-epoch read of ISV slot
  decides which kernel to dispatch; the action computation itself is 100% GPU)
- No CPU physics mirror — existing GPU `experience_env_step` runs unchanged

seed_step_counter_update_kernel.cu:
- Single-thread cold-path; increments DONE, computes FRAC = max(0, 1-done/target)
- Adaptive α matches Task 3/4 convention (α_base × (1 + 0.5×|clamp(sharpe,±2)|))

cql_alpha_seed_update_kernel.cu (Task 9):
- target = config.cql_alpha × max(0, 1 - seed_frac)
- During seed phase (frac=1) → target=0 → CQL α decays to 0 (no pessimism on
  exploration data); as frac → 0 → CQL α ramps to config value
- Updates ISV[CQL_ALPHA_INDEX=48]; CQL gradient kernel reads slot 48 via
  pinned device-mapped ISV (Plan 1 Task 12 consumer pattern unchanged)

Registry: SEED_STEPS_DONE + SEED_FRAC_EMA both FoldReset; CQL_ALPHA flipped
SchemaContract → FoldReset; SEED_STEPS_TARGET stays SchemaContract.

Read-only monitors (mirror PlanThresholdMonitor / StateKlMonitor pattern):
- monitors/seed_monitor.rs — surfaces ISV[82..85) for HEALTH_DIAG +
  controller_activity smoke fire-rate
- monitors/cql_alpha_monitor.rs — surfaces ISV[48] + ISV[84] dependency

Smoke (RTX 3050 Ti, 3 folds × 5 epochs, dqn-smoketest profile with
replay_seed_steps=1000 override so seed phase completes mid-fold):
- All 3 folds saved best-checkpoint
- Fold 2 best Sharpe = 92.4938 at epoch 1 (target range 80-120) ✓
- Per-fold val_metric: f0=3.80 / f1=9.73 / f2=20.24 (loss-based)
- HEALTH_DIAG[3..4] cql_alpha=0.0500 with health=0.49 → base ≈ 0.10 from ISV[48],
  consistent with kernel ramping toward final×(1-frac); regime gate
  (1-regime)×health applies on top
- 11 cargo check warnings (matches pre-task baseline; no new warnings)
- 6/6 monitor unit tests pass (read/diagnose/observe×fire_rate)

Smoke override rationale: smoke runs ~200 samples per collect (4 episodes ×
50 timesteps) × 5 epochs × 3 folds ≈ 3000 total. Default 100k target would
keep entire smoke in seed phase. Override to 1000 lets the seed→network
transition complete mid-fold so the CQL α ramp is observable.

Per pearl_one_unbounded_signal_per_reward.md: cql_alpha is bounded (clamped
to config_final × (1 - seed_frac) ∈ [0, config_final]), composes safely with
downstream CQL loss.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-25 09:13:39 +02:00

52 KiB
Raw Blame History

DQN v2 Wire-Up Audit

Status: Populated during Plan 1 Task 6 (A.5 orphan audit). Updated on every commit per Invariant 7.

Legend:

  • Wired — consumed by production training + val path.
  • Partial — consumed on one side only (training OR val, or forward OR backward).
  • Orphan — built but no production consumer in the DQN path.
  • Ghost — consumer path is stubbed or only loads the kernel without launching it.
  • OUT-of-DQN-scope — has production consumers outside the DQN path (supervised, PPO, etc.); correct-as-is per Part E.

DQN-path definition: trainers/dqn/ (training loop + fused CUDA ops) + cuda_pipeline/ (GPU kernels wired into those trainers) + validation/ harness when evaluating DQN policy.

Task 2 / Task 3 Seed Rows (preserved)

Module / kernel Consumer path Classification Notes Action
trainers/dqn/state_reset_registry.rs training_loop.rs::reset_named_state via fold_reset_entries() + soft_reset_entries() Wired A.1 primary implementation (Plan 1 Task 3)
training_loop.rs::reset_named_state consumer of StateResetRegistry::fold_reset_entries + soft_reset_entries Wired A.1 Task 3 dispatch + D.5 SoftReset dispatch
D.5 SoftReset dispatch (isv_grad_balance_targets, isv_grad_scale_limit) training_loop.rs::reset_named_state — writes bootstrap values (1.0 for targets, 2.0 for limit). EMA-based convergence from bootstrap over ~50 epochs via grad_balance_isv_update kernel's adaptive-rate EMA (α ∈ [0.01, 0.30], implicit decay_bars). Wired Plan 2 Task 4 D.5

DQN Core Training Modules

Module / kernel Consumer path Classification Notes Action
trainers/dqn/mod.rs train_baseline_rl.rs, ml_training_service, hyperopt/adapters/dqn.rs Wired Entry point for DQN trainer
trainers/dqn/config.rs (DQNHyperparameters, DQNAgentType) trainer/constructor.rs, fused_training.rs, smoke tests, hyperopt adapter Wired Core config struct
trainers/dqn/data_loading.rs re-exported via dqn::mod; consumed by train_baseline_rl.rs Wired DBN + fxcache loading
trainers/dqn/early_stopping.rs (EarlyStopping) trainer/mod.rs, trainer/constructor.rs Wired Patience-based stopping
trainers/dqn/features.rs trainer/constructor.rs via extract_features_from_bars Wired Feature extraction for DQN
trainers/dqn/financials.rs trainer/metrics.rs via compute_epoch_financials Wired Sharpe / drawdown per epoch
trainers/dqn/fused_training.rs (FusedTrainingCtx) trainer/training_loop.rs, trainer/mod.rs Wired Core DQN fused-CUDA context
trainers/dqn/lr_scheduler.rs (LRScheduler) trainer/mod.rs::lr_scheduler, trainer/constructor.rs Wired Learning-rate schedule
trainers/dqn/monitoring.rs (MonitoringSummary) trainer/training_loop.rs, trainer/metrics.rs Wired Per-epoch action / Q monitoring
trainers/dqn/risk.rs trainer/constructor.rs via DrawdownMonitor, HybridPositionLimiter Wired Risk controllers in training
trainers/dqn/statistics.rs (FeatureStatistics, QValueStats) trainer/mod.rs, trainer/metrics.rs Wired Feature norm + Q stats
trainers/dqn/adversarial_self_play.rs (AdversarialSaboteur) trainer/constructor.rs, trainer/mod.rs Wired Adversarial perturbation during training
trainers/dqn/expert_demos.rs (ExpertDemoGenerator) trainer/training_loop.rs Wired Expert demo ratio injection
trainers/dqn/trainer/mod.rs (DQNTrainer) train_baseline_rl.rs, service layer Wired Top-level trainer struct
trainers/dqn/trainer/constructor.rs internal to DQNTrainer Wired Builder / init
trainers/dqn/trainer/action.rs internal to DQNTrainer Wired Action selection helpers
trainers/dqn/trainer/enrichment.rs internal to DQNTrainer Wired State enrichment
trainers/dqn/trainer/metrics.rs training_loop.rs Wired Epoch-boundary metric compilation + backtest eval
trainers/dqn/trainer/state.rs trainer/mod.rs Wired Mutable training state
trainers/dqn/trainer/training_loop.rs called from DQNTrainer::train() Wired Main epoch loop
trainers/dqn/adaptive_monitor.rs Read-only observer trait + harness (FireRateStats, DiagSnapshot, IsvBus<'a>); consumers added in Plan 1 Tasks 9-17 (atoms/gamma/kelly_cap/tau/epsilon/grad_balancer monitors) Wired (consumers added in same plan) C.6 GPU-drives-CPU-reads
trainers/dqn/monitors/grad_balancer_monitor.rs Read-only observer for grad_balance_isv_update kernel output (ISV slots 31..35); consumers: HEALTH_DIAG + controller_activity smoke Wired Plan 1 Task 17
trainers/dqn/monitors/tau_monitor.rs Read-only observer for tau_update kernel output (ISV slot 42); consumers: HEALTH_DIAG + controller_activity smoke Wired Plan 1 Task 13
cuda_pipeline/tau_update_kernel.cu GpuDqnTrainer::launch_tau_updateFusedTrainingCtx::launch_tau_updatetraining_loop.rs epoch boundary Wired Plan 1 Task 13 — cold-path (per-epoch)
trainers/dqn/monitors/epsilon_monitor.rs Read-only observer for epsilon_update kernel output (ISV slot 41); consumers: HEALTH_DIAG + controller_activity smoke Wired Plan 1 Task 14
cuda_pipeline/epsilon_update_kernel.cu GpuDqnTrainer::launch_epsilon_updateFusedTrainingCtx::launch_epsilon_updatetraining_loop.rs epoch boundary Wired Plan 1 Task 14 — cold-path (per-epoch)
trainers/dqn/monitors/gamma_monitor.rs Read-only per-branch observer; mean of ISV[43..47) = [GAMMA_DIR,MAG,ORD,URG]; consumers: HEALTH_DIAG + controller_activity smoke Wired Plan 2 Task 3 D.2
cuda_pipeline/per_branch_gamma_update_kernel.cu GpuDqnTrainer::launch_per_branch_gamma_updateFusedTrainingCtx::launch_per_branch_gamma_updatetraining_loop.rs epoch boundary Wired Plan 2 Task 3 D.2 — cold-path (per-epoch); replaces scalar gamma_update_kernel.cu
trainers/dqn/monitors/kelly_cap_monitor.rs Read-only observer for kelly_cap_update kernel output (ISV slot 47); consumers: HEALTH_DIAG + controller_activity smoke Wired Plan 1 Task 11
cuda_pipeline/kelly_cap_update_kernel.cu GpuDqnTrainer::launch_kelly_cap_updateFusedTrainingCtx::launch_kelly_cap_updatetraining_loop.rs epoch boundary; takes portfolio_states dev ptr + n_envs Wired Plan 1 Task 11 — cold-path (per-epoch)
trainers/dqn/monitors/atoms_monitor.rs Read-only observer for atoms_update kernel inputs (ISV v-range slots 23..31); consumers: HEALTH_DIAG + controller_activity smoke Wired Plan 1 Task 9 (test initial-value fixup post-land; local-smoke StateResetRegistry dispatch arms + hp_f32 helper added)
cuda_pipeline/atoms_update_kernel.cu GpuDqnTrainer::launch_atoms_updateFusedTrainingCtx::launch_atoms_updatetraining_loop.rs epoch boundary; replaces per-branch recompute_atom_positions CPU loop Wired Plan 1 Task 9 — cold-path (per-epoch + SGD step)
cuda_pipeline/q_quantile_kernel.cu GpuDqnTrainer::launch_q_quantile_reduceFusedTrainingCtx::launch_q_quantile_reducetraining_loop.rs epoch boundary; reads q_out_buf [N, total_actions], writes ISV[50..58) P5/P95 EMAs per branch Wired Plan 2 Task 1 C.1 — cold-path (per-epoch); consumer: update_eval_v_range reads Q_P05/Q_P95 to set quantile-based half-width
trainers/dqn/monitors/reward_component_monitor.rs Read-only observer for reward_component_ema kernel output (ISV slots 63..69); consumers: HEALTH_DIAG reward_split line + controller_activity smoke fire-rate tracking Wired Plan 3 Task 1 C.2
cuda_pipeline/reward_component_ema_kernel.cu GpuExperienceCollector::launch_reward_component_ema_inplacetraining_loop.rs (called after reward_contrib_fractions, before HEALTH_DIAG); reads reward_components_per_sample [N*L, 6], writes ISV[63..69) adaptive EMA (α=0.05) Wired Plan 3 Task 1 C.2 — hot-path (per-step); single-block 6-thread kernel
B.1 Flat opp-cost ISV scaling (experience_kernels.cu Flat branch) experience_env_step kernel (Flat position=0, not segment_complete branch); writes rc[4] to reward_components_per_sample; consumed by reward_component_ema → ISV[67] Wired Plan 3 Task 2 B.1 — opp-cost multiplied by isv_signals_ptr[21] (Q_DIR_ABS_REF_INDEX, EMA of max( Q_mean
cuda_pipeline/trade_rate_ema_kernel.cu GpuExperienceCollector::launch_trade_attempt_rate_ema_inplacetraining_loop.rs (called alongside launch_reward_component_ema_inplace each epoch); reads flat_to_pos_per_sample [N*L], reduces count on-GPU, writes ISV[TRADE_ATTEMPT_RATE_EMA_INDEX=71] adaptive EMA (α=α_base × (1+0.5×|sharpe|), α_base=0.05) Wired Plan 3 Task 3 B.2 — cold-path (per-epoch); single-block 1-thread reduction + EMA. No atomicAdd.
B.2 Flat→Positioned novelty bonus (experience_kernels.cu trade-lifecycle block) experience_env_step kernel (entering_trade path, AFTER opp-cost branch, BEFORE drawdown penalty); writes rc[5] and adds shaping_scale × bonus to reward; consumed by reward_component_ema → ISV[68] and drives PopArt denominator via total_reward_per_sample Wired Plan 3 Task 3 B.2 — novelty = max(0, 1 ISV[71]/max(1e-4, ISV[72])); bonus = conviction_core × vol_proxy × novelty; TRADE_TARGET_RATE frozen at epoch 5 from measured attempt-EMA (min 0.001). No tuned multiplier.
C.4 Temporal timing bonus on trade exit (experience_kernels.cu segment_complete block) experience_env_step kernel (inside segment_complete && segment_hold_time > 0 block, AFTER Layer 29 credits land in reward); accumulates += into rc[5] and adds timing_bonus to reward; consumed by reward_component_ema → ISV[68] (shares the bonus slot with B.2 — different (i,t) slots, so += is idempotent) Wired Plan 3 Task 5 C.4 — bars_early = max(0, segment_hold_time PS_PEAK_PNL_BAR); timing_bonus = shaping_scale × (bars_early / segment_hold_time) × |final_pnl| × conviction_core. Peak bar tracked in new portfolio-state slot PS_PEAK_PNL_BAR=38 (PS_STRIDE 38→39), snapshot alongside every MAX_PNL update, reset at every MAX_PNL reset site (entry/reverse/fold-reset). No tuned multiplier.
D.4a Persistence credit on profitable drawdown recovery (experience_kernels.cu segment_complete block) experience_env_step kernel (inside segment_complete && segment_hold_time > 0 block, IMMEDIATELY AFTER C.4 timing bonus, gated on reward > 0 AND drawdown_depth > 1e-6); accumulates += into rc[5] and adds persist_bonus to reward; consumed by reward_component_ema → ISV[68] (shares the bonus slot with B.2 entry + C.4 exit — different (i,t) slots per trade, so += is idempotent across all three) Wired Plan 3 Task 6a D.4a — drawdown_depth = max(0, PS_INTRA_TRADE_MIN_PNL); persist_bonus = shaping_scale × conviction_core × drawdown_depth × tanh(reward / max(1e-4, drawdown_depth)). MIN_PNL tracked in new portfolio-state slot PS_INTRA_TRADE_MIN_PNL=39 (PS_STRIDE 39→40), updated per-bar in the same block as MAX_PNL (fminf against pnl_pct), reset at every MAX_PNL reset site (entry/reverse/fold hard-reset/trade-complete soft-reset). Self-scaling tanh: saturates +1 when reward ≫ drawdown, ≈0 when reward ≈ drawdown. No tuned multiplier.
D.4b Regime-shift penalty for trades held past a regime flip (experience_kernels.cu segment_complete block) experience_env_step kernel: detector inside the active-trade block (after MIN/MAX_PNL update) writes PS_REGIME_SHIFT_BAR on the FIRST bar where |isv[11] PS_PLAN_ENTRY_REGIME| > clamp(0.25 × |clamp(sharpe, ±2)|, 0.05, 0.5); consumer inside segment_complete block IMMEDIATELY AFTER D.4a accumulates = into rc[5] and subtracts penalty from reward; consumed by reward_component_ema → ISV[68] (cancellation within rc[5] vs B.2/C.4/D.4a is intentional — that's what ISV[68] REWARD_BONUS_EMA tracks). Consumer also resets PS_REGIME_SHIFT_BAR = 0 after use. Wired Plan 3 Task 6b D.4b — bars_late = max(0, saved_hold_time PS_REGIME_SHIFT_BAR); penalty = shaping_scale × conviction_core × (bars_late / saved_hold_time) × ISV[Q_DIR_ABS_REF_INDEX=21] × |reward|. Shift-bar tracked in new portfolio-state slot PS_REGIME_SHIFT_BAR=40 (PS_STRIDE 40→41), reset at every MAX_PNL reset site (entry/reverse/fold hard-reset/trade-complete soft-reset) PLUS post-consumer (defensive). Self-scaling Q_DIR_ABS_REF coefficient (same B.1 pattern). Adaptive threshold tightens when |sharpe| is high. First-shift-only. No tuned multiplier.
D.4c Conviction consistency bonus on Flat→Positioned entry (experience_kernels.cu Flat branch + entering_trade block) experience_env_step kernel: producer inside the Flat branch (!segment_complete && position≈0, before opp-cost) updates two PS slots PS_PRE_ENTRY_CONVICTION_EMA (mean) and PS_PRE_ENTRY_CONVICTION_VAR_EMA (variance) via Welford-style EMA at α=0.05 on conviction_core. Consumer inside entering_trade block IMMEDIATELY AFTER B.2 novelty bonus computes ratio = stddev/mean; when ratio < 0.2 accumulates += into rc[5] and adds bonus to reward; consumed by reward_component_ema → ISV[68] (shares the bonus slot with B.2/C.4/D.4a/D.4b at different (i,t) slots; += is idempotent). Both EMA slots reset at every trade-lifecycle reset site (entry/reverse/fold hard-reset/trade-complete soft-reset) PLUS post-consumer (defensive). Wired Plan 3 Task 6c D.4c — bonus = shaping_scale × vol_proxy × stability × conviction_core where vol_proxy ∈ [0.0001, 0.01], stability = clamp(0, 1, 1 ratio/0.2), conviction_core ∈ [0,1]. Mirrors B.2 novelty-bonus structure exactly — ONE technically unbounded multiplicand (vol_proxy, bounded ≤ 0.01), all others bounded — per pearl_one_unbounded_signal_per_reward.md. Max bonus ≈ 0.01, same order as B.2. New portfolio-state slots PS_PRE_ENTRY_CONVICTION_EMA=41 and PS_PRE_ENTRY_CONVICTION_VAR_EMA=42; PS_STRIDE 41→43; PORTFOLIO_STRIDE 41→43 in all consumers (experience_kernels.cu, trade_stats_kernel.cu, gpu_experience_collector.rs, gpu_dqn_trainer.rs::launch_kelly_cap_update, ml-core::state_layout.rs). The 0.2 stability threshold is the single tuned constant retained for this first cut (commented; reviewer may demote to ISV-driven follow-up). α=0.05 matches Plan 3 Task 1 reward-EMA convention.
cuda_pipeline/plan_threshold_update_kernel.cu GpuExperienceCollector::launch_plan_threshold_update_inplacetraining_loop.rs (called alongside launch_reward_component_ema_inplace and launch_trade_attempt_rate_ema_inplace each epoch); reads readiness_per_sample [N*L] written by experience_env_step, reduces mean on-GPU, writes ISV[READINESS_EMA_INDEX=75] adaptive EMA (α=α_base × (1+0.5×|sharpe|), α_base=0.05), then derives ISV[PLAN_THRESHOLD_INDEX=49] = max(0.1, 0.5 × ema). Producer-only upgrade — consumer kernels (experience_kernels.cu 4 sites + backtest_plan_kernel.cu 1 site) unchanged. Wired Plan 3 Task 4 B.4 — cold-path (per-epoch); single-block 1-thread reduction + EMA. No atomicAdd.
trainers/dqn/monitors/plan_threshold_monitor.rs Read-only observer for plan_threshold_update kernel output (ISV slots 49 + 75); consumers: HEALTH_DIAG plan_threshold.eff / plan_threshold.readiness_ema + controller_activity smoke fire-rate tracking Wired Plan 3 Task 4 B.4
cuda_pipeline/state_kl_divergence_kernel.cu GpuExperienceCollector::launch_state_kl_inplacetraining_loop.rs (called once per validation epoch, AFTER compute_validation_loss populates chunked_states_buf, BEFORE next training epoch's reward kernels read ISV[79]); reads train-state sample (states_out) and val-state batch (chunked_states_buf from gpu_evaluator.val_state_sample()), per-OFI-dim Gaussian moment-match KL summed across [SL_OFI_START, SL_OFI_START+SL_OFI_DIM); writes ISV[STATE_KL_TRAIN_VAL_EMA=78] (adaptive EMA, α_base=0.05) + ISV[STATE_KL_AMPLIFICATION=79] (kernel-internal trailing-self ratio → 1 + clamp(ratio1, 0, 1) ∈ [1,2]). Single-block, one thread per OFI dim. No atomicAdd, no DtoH. Wired Plan 3 Task 7 C.3 — cold-path (per validation epoch). All α/threshold coefficients ISV-derived; no tuned constants per feedback_isv_for_adaptive_bounds.md.
C.3 B.1/B.2 KL-amp consumers (experience_kernels.cu Flat opp_cost + entering_trade B.2 bonus) experience_env_step kernel: B.1 site multiplies reward = -shaping_scale × holding_cost_rate × conviction_core × vol_proxy_flat × q_abs_ref × kl_amp_b1; B.2 site multiplies bonus_scaled = shaping_scale × bonus × kl_amp_b2. Both consumers use fmaxf(1.0, isv_signals_ptr[ISV_STATE_KL_AMP_IDX]) to no-op against cold-start. ISV_STATE_KL_AMP_IDX=79 macro defined in state_layout.cuh. Wired Plan 3 Task 7 C.3 — bounded amp ∈ [1, 2] stacks safely with B.1's existing q_abs_ref unbounded multiplicand per pearl_one_unbounded_signal_per_reward.md.
trainers/dqn/monitors/state_kl_monitor.rs Read-only observer for state_kl_moment_match kernel output (ISV slots 78 + 79); consumers: HEALTH_DIAG state_kl.train_val_ema / state_kl.amp + controller_activity smoke fire-rate tracking Wired Plan 3 Task 7 C.3
cuda_pipeline/scripted_policy_kernel.cu GpuExperienceCollector::launch_timestep_loop (per-timestep dispatch when seed_phase_active_cache=true); 4 policies (UNIFORM 40% / MOMENTUM 20% / MEAN_REV 20% / VWAP_DEV 20%) deterministically mixed by i % 5. Per-thread one sample. Reads batch_states[i, MARKET_START] for current close + portfolio_states[i, PS_PREV_CLOSE] for prev close; writes batch_actions[i] (factored dir*27 + mag*9 + ord*3 + urg) and conviction_buf[i] ∈ [0, 1] — same outputs the network's experience_action_select would have written. Direction-flip thresholds (±0.0001f momentum/reversal, ±5bp VWAP band) are noise-floor cutoffs, not scaling coefficients. Wired Plan 3 Task 8 B.3 — GPU-only seeded warm-start. CPU only orchestrates per-epoch dispatch (cold-path read of ISV[SEED_STEPS_DONE/TARGET]); the action computation itself is 100% GPU. No CPU physics mirror — existing experience_env_step runs unchanged.
cuda_pipeline/seed_step_counter_update_kernel.cu GpuExperienceCollector::launch_seed_step_counter_update_inplacetraining_loop.rs (called alongside the other Plan 3 EMA producers each epoch); single-block single-thread cold-path. Increments ISV[SEED_STEPS_DONE_INDEX=83] by n_samples, capped at ISV[SEED_STEPS_TARGET_INDEX=82], and EMAs the derived max(0, 1 - DONE/TARGET) into ISV[SEED_FRAC_EMA_INDEX=84]. Adaptive α=α_base × (1+0.5×|clamp(sharpe,2,2)|), α_base=0.05. Wired Plan 3 Task 8 B.3 — cold-path (per-epoch). No atomicAdd. SEED_FRAC_EMA cold-start 1.0 ensures Task 9's CQL ramp sees target=0 until the seed phase actually decays.
cuda_pipeline/cql_alpha_seed_update_kernel.cu GpuExperienceCollector::launch_cql_alpha_seed_update_inplacetraining_loop.rs (called alongside launch_seed_step_counter_update_inplace each epoch); single-block single-thread cold-path. EMAs ISV[CQL_ALPHA_INDEX=48] toward cql_alpha_final × max(0, 1 - ISV[SEED_FRAC_EMA_INDEX=84]) where cql_alpha_final = config.cql_alpha. Adaptive α matches Task 8 convention. Wired Plan 3 Task 9 C.5 — producer upgrade for ISV[CQL_ALPHA_INDEX=48]: SchemaContract → FoldReset. CQL gradient kernel consumer (already reading slot 48 per Plan 1 Task 12) unchanged.
trainers/dqn/monitors/seed_monitor.rs Read-only observer for seed_step_counter_update kernel output (ISV slots 82 / 83 / 84); consumers: HEALTH_DIAG seed.steps_target / seed.steps_done / seed.frac_ema + controller_activity smoke fire-rate tracking Wired Plan 3 Task 8 B.3
trainers/dqn/monitors/cql_alpha_monitor.rs Read-only observer for cql_alpha_seed_update kernel output (ISV slot 48 + dependency 84); consumers: HEALTH_DIAG cql_alpha.eff / cql_alpha.seed_frac + controller_activity smoke fire-rate tracking Wired Plan 3 Task 9 C.5

CUDA Pipeline — Rust Wrappers

Module / kernel Consumer path Classification Notes Action
cuda_pipeline/mod.rs (DqnGpuData, upload_slices) trainer/constructor.rs, fused_training.rs Wired Data upload to GPU
cuda_pipeline/gpu_dqn_trainer.rs (GpuDqnTrainer) fused_training.rs, trainer/mod.rs Wired Core GPU-side DQN weight / forward / grad ops
cuda_pipeline/fused_training.rs wrapper (FusedTrainingCtx) trainer/training_loop.rs Wired Wires all GPU ops into epoch loop
cuda_pipeline/batched_forward.rs gpu_dqn_trainer.rs — forward graph node Wired Batched SGEMM forward pass
cuda_pipeline/batched_backward.rs gpu_dqn_trainer.rs — backward graph node Wired Batched SGEMM backward pass (KAN gate included)
cuda_pipeline/shared_cublas_handle.rs fused_training.rs, gpu_iqn_head.rs, gpu_iql_trainer.rs, gpu_attention.rs, gpu_curiosity_trainer.rs (10 consumers) Wired Shared cuBLAS/cuBLASLt handle
cuda_pipeline/cublas_algo_deterministic.rs gpu_dqn_trainer.rs, gpu_curiosity_trainer.rs, gpu_iqn_head.rs (7 consumers) Wired Deterministic cuBLASLt algo selection
cuda_pipeline/gpu_weights.rs trainer/mod.rs, gpu_dqn_trainer.rs, hyperopt/adapters/dqn.rs (11 consumers) Wired Weight tensor layout constants
cuda_pipeline/gpu_action_selector.rs (GpuActionSelector) trainer/mod.rs, fused_training.rs, gpu_backtest_evaluator.rs Wired Epsilon-greedy + routed action selection
cuda_pipeline/gpu_monitoring.rs (GpuMonitor) fused_training.rs, trainer/metrics.rs, trainer/training_loop.rs Wired GPU-side monitoring_reduce launch
cuda_pipeline/gpu_training_guard.rs gpu_dqn_trainer.rs, trainer/training_loop.rs Wired NaN / gradient anomaly guard
cuda_pipeline/gpu_backtest_evaluator.rs (GpuBacktestEvaluator) trainer/metrics.rs (eval path) Wired Per-epoch GPU backtest evaluation
cuda_pipeline/gpu_experience_collector.rs fused_training.rs via TradeStats, financials.rs Wired Per-trade stats from experience buffer
cuda_pipeline/gpu_curiosity_trainer.rs fused_training.rs Wired Curiosity-driven intrinsic reward
cuda_pipeline/gpu_walk_forward.rs (GpuWalkForwardData) trainer/mod.rs (lazy-init field) Wired GPU walk-forward data structure
cuda_pipeline/gpu_her.rs (GpuHer) fused_training.rs Wired Hindsight Experience Replay
cuda_pipeline/gpu_iql_trainer.rs (GpuIqlTrainer) fused_training.rs (dual IQL instances) Wired IQL value network training
cuda_pipeline/gpu_iqn_head.rs (GpuIqnHead) fused_training.rs Wired IQN distributional head
cuda_pipeline/gpu_attention.rs (GpuAttention) fused_training.rs Wired Self-attention layer in DQN trunk
cuda_pipeline/gpu_tlob.rs (GpuTlob) fused_training.rs (training: forward pre-trunk, backward+Adam Phase 6); trainer/metrics.rs (val: set_tlob_from_training per-epoch weight sync + GpuBacktestEvaluator::submit_dqn_step_loop_cublas per-gather TLOB forward) Wired D.8 Plan 2 Task 6C — OFI[32]→TLOB[16] single-head SDP attention, Xavier random init, trained end-to-end. ISV[60]=TLOB_REGIME_FOCUS_EMA written at epoch boundary.
cuda_pipeline/decision_transformer.rs (DecisionTransformer) trainer/training_loop.rs Wired Decision Transformer pre-training step
cuda_pipeline/learning_health.rs (LearningHealth) fused_training.rs, trainer/training_loop.rs, trainer/constructor.rs, trainer/metrics.rs, meta_q_network.rs (11 consumers) Wired Health-band tracking for adaptive LR / early stopping
cuda_pipeline/q_snapshot.rs cuda_pipeline/mod.rs, gpu_dqn_trainer.rs Wired Q-value snapshot for double-DQN target
cuda_pipeline/meta_q_network.rs (MetaQNetwork) trainer/constructor.rs, trainer/mod.rs, trainer/training_loop.rs Wired Meta-learning Q-network
cuda_pipeline/q_value_provider.rs (QValueProvider trait) fused_training.rs impl, trainer/metrics.rs, hyperopt/adapters/dqn.rs Wired Trait for on-device Q-value computation in val path
cuda_pipeline/signal_adapter.rs hyperopt/adapters/dqn.rs, hyperopt/adapters/{ppo,mamba2,tft,kan,liquid,tlob,diffusion,tggn,xlstm}.rs Wired backtest_fitness scoring used by all hyperopt adapters
cuda_pipeline/multi_gpu.rs (MultiGpuConfig) trainer/constructor.rs, trainer/mod.rs Wired Multi-GPU detection and layout
cuda_pipeline/gpu_ppo_collector.rs (GpuPpoExperienceCollector) trainers/ppo.rs OUT-of-DQN-scope PPO-only consumer; correct-as-is
cuda_pipeline/gpu_statistics.rs (GpuStatistics) declared pub in cuda_pipeline/mod.rs; no call site outside the file Orphan GpuStatistics::compute never called; BatchStatistics struct unused Plan 2 D.2 audits + decides whether to wire into val path or delete
cuda_pipeline/cublaslt_debug.rs mod cublaslt_debug (private) inside cuda_pipeline/mod.rs; test-only OUT-of-DQN-scope Private debug/test module; not a public feature

CUDA Kernels (.cu files)

Module / kernel Consumer path Classification Notes Action
epsilon_greedy_kernel.cu (epsilon_greedy_select, epsilon_greedy_routed) gpu_action_selector.rs Wired Action selection kernel
monitoring_kernel.cu (monitoring_reduce) gpu_monitoring.rs Wired 12-bin action count + Q stats
c51_loss_kernel.cu gpu_dqn_trainer.rs (C51 loss compute) Wired C51 distributional loss
c51_grad_kernel.cu gpu_dqn_trainer.rs (C51 backward) Wired C51 gradient backward
mse_loss_kernel.cu gpu_dqn_trainer.rs (MSE warmup loss) Wired MSE loss for warmup phase
mse_grad_kernel.cu gpu_dqn_trainer.rs (MSE backward) Wired MSE gradient backward
iqn_dual_head_kernel.cu gpu_iqn_head.rs Wired IQN dual-head quantile computation
iqn_cvar_kernel.cu gpu_iqn_head.rs Wired IQN CVaR risk measure
iql_value_kernel.cu gpu_iql_trainer.rs Wired IQL value network kernel
cql_grad_kernel.cu gpu_dqn_trainer.rs (CQL backward) Wired Conservative Q-learning gradient
experience_kernels.cu gpu_backtest_evaluator.rs (BACKTEST_DQN_CUBIN), gpu_experience_collector.rs Wired Experience buffer ops + DQN backtest forward
reward_shaping_kernel.cu gpu_dqn_trainer.rs (reward shaping step) Wired Per-sample reward shaping
nstep_kernel.cu gpu_dqn_trainer.rs (n-step return) Wired N-step Bellman target
backward_kernels.cu gpu_dqn_trainer.rs (weight backward) Wired Weight gradient accumulation
bias_kernels.cu gpu_dqn_trainer.rs (bias grad) Wired Bias gradient kernels
relu_mask_kernel.cu gpu_dqn_trainer.rs (activation backward) Wired ReLU activation mask
ema_kernel.cu gpu_dqn_trainer.rs (target-net soft update) Wired EMA target-network update
q_stats_kernel.cu gpu_dqn_trainer.rs (Q-value stats for ISV) Wired Per-branch Q-value statistics
dqn_utility_kernels.cu gpu_dqn_trainer.rs (multiple utility ops) Wired Misc DQN GPU ops (advantage std, PopArt, etc.)
graph_utility_kernels.cu gpu_dqn_trainer.rs (CUDA graph utility ops) Wired Graph capture helper kernels
grad_decomp_kernel.cu gpu_dqn_trainer.rs, called via fused_training.rs::grad_decomp_launch_c51 Wired C51 gradient decomposition (Task 2.0 diagnostic)
branch_grad_balance_kernel.cu gpu_dqn_trainer.rs, called via fused_training.rs::launch_branch_grad_balance Wired Per-branch gradient L2-norm balancing
mamba2_temporal_kernel.cu (mamba2_scan_projected_fwd, mamba2_scan_projected_bwd, isv_temporal_route, etc.) gpu_dqn_trainer.rs::mamba2_forward + mamba2_backward, called in fused training loop (adam_grad child graph) Wired (grad-check validated, Plan 2 Task 2) Mamba2 selective SSM forward + backward (both paths implemented). D.1: kernel-level reference check + non-zero gradient propagation test confirm backward is not silently no-oping.
attention_kernel.cu gpu_attention.rs Wired Scaled dot-product attention forward
attention_backward_kernel.cu gpu_attention.rs, gpu_tlob.rs (reused for grad_norm+Adam kernels) Wired Attention backward pass
tlob_kernel.cu (tlob_sdp_forward, tlob_sdp_backward, tlob_write_states, tlob_read_grad_from_states) gpu_tlob.rs Wired D.8 Plan 2 Task 6C — TLOB SDP forward/backward, state scatter/read kernels
training_guard_kernel.cu (training_guard_check_and_accumulate) gpu_training_guard.rs Wired NaN / guard check kernel
backtest_env_kernel.cu (backtest_env_step) gpu_backtest_evaluator.rs (ENV_CUBIN) Wired Backtest environment step
backtest_metrics_kernel.cu gpu_backtest_evaluator.rs (METRICS_CUBIN) Wired Backtest metrics reduction
backtest_plan_kernel.cu (backtest_plan_diag_reduce, backtest_plan_state_isv) gpu_backtest_evaluator.rs (BACKTEST_PLAN_CUBIN) Wired Plan-ISV diagnostic reduction in val. D.6 (Plan 2 Task 6A): backtest_plan_state_isv now writes pisv[6] = remaining_fraction; stride updated to SL_PORTFOLIO_PLAN_DIM=7.
backtest_forward_ppo_kernel.cu (backtest_forward_ppo_kernel) gpu_backtest_evaluator.rs::evaluate_ppo (PPO_FORWARD_CUBIN) OUT-of-DQN-scope PPO-path backtest only; correct-as-is
backtest_forward_supervised_kernel.cu (signal_to_action_kernel) gpu_backtest_evaluator.rs::evaluate_supervised (SUPERVISED_SIGNAL_CUBIN) OUT-of-DQN-scope Supervised-model backtest only; correct-as-is
signal_adapter_kernel.cu signal_adapter.rs (loaded at construction) Wired Signal-to-action ISV bus adapter
statistics_kernel.cu (batch_statistics) gpu_statistics.rs (loaded but GpuStatistics has no call sites outside the file) Orphan Kernel compiled, wrapper struct exists, but never instantiated by any consumer Plan 2 D.2 — same resolution as gpu_statistics.rs
ppo_experience_kernel.cu gpu_ppo_collector.rs OUT-of-DQN-scope PPO collector; correct-as-is
her_episode_kernel.cu gpu_her.rs Wired HER episode boundary kernel
her_relabel_kernel.cu gpu_her.rs Wired HER goal relabelling kernel
curiosity_training_kernel.cu gpu_curiosity_trainer.rs Wired Curiosity intrinsic reward training
curiosity_inference_kernel.cu gpu_curiosity_trainer.rs Wired Curiosity inference forward
ensemble_kernels.cu batched_forward.rs / batched_backward.rs (ensemble ops in fused trainer) Wired Ensemble head combination
dt_kernels.cu decision_transformer.rs (DT_CUBIN) Wired Decision Transformer GPU ops
trade_stats_kernel.cu gpu_experience_collector.rs Wired Per-trade statistics accumulation
backtest_env_kernel.cu (backtest_env_step) gpu_backtest_evaluator.rs Wired Already listed above
common_device_functions.cuh prepended to all kernels at compile time by build.rs Wired Shared device helpers (BF16 wrappers, warp reduce)
state_layout.cuh included by kernels that reference state buffer layout Wired Named index constants for state buffer
trade_physics.cuh included by backtest_env_kernel.cu and others at compile time Wired Kelly / physics helpers shared across kernels

Model Modules — Supervised-Only (OUT-of-DQN-scope per Part E)

Module / kernel Consumer path Classification Notes Action
xlstm/mod.rs + xlstm/trainable.rs ensemble/adapters/xlstm.rs, hyperopt/adapters/xlstm.rs OUT-of-DQN-scope Supervised consumers; DQN does not import this. Part E: keep.
kan/mod.rs + kan/trainable.rs hyperopt/adapters/kan.rs only OUT-of-DQN-scope KAN splines in DQN trunk (batched_forward/backward) are inline in gpu_dqn_trainer.rs and do not import crate::kan. kan/ wraps ml-supervised KAN for hyperopt. Part E: keep.
tgnn/mod.rs + tgnn/trainable_adapter.rs hyperopt/adapters/tggn.rs, risk/mod.rs OUT-of-DQN-scope TGNN for supervised + risk path
tlob/mod.rs + tlob/trainable_adapter.rs hyperopt/adapters/tlob.rs, data_loaders/tlob_loader.rs Partial / OUT-of-DQN-scope TLOB transformer has hyperopt adapter; DQN trunk wiring scheduled for Plan 2 D.8 Plan 2 D.8 wires TLOB trunk into DQN
diffusion/mod.rs + diffusion/trainable.rs hyperopt/adapters/diffusion.rs, trainers/dqn/fused_training.rs (data aug only) Partial Diffusion model used for data augmentation in fused training but lacks a gradient backward path through DQN trunk Plan 2 tracks full integration
ppo/mod.rs + ppo/trainable_adapter.rs trainers/ppo.rs, gpu_ppo_collector.rs OUT-of-DQN-scope PPO training path; not DQN

Temporal/Recurrent Modules — DQN Integration Status

Module / kernel Consumer path Classification Notes Action
mamba/mod.rs + mamba/trainable_adapter.rs trainers/mamba2.rs, model_factory.rs, inference_validator.rs; Mamba2 temporal kernel wired fully in gpu_dqn_trainer.rs Wired (DQN trunk) + OUT-of-DQN-scope (supervised trainers/mamba2.rs) Forward and backward both implemented in mamba2_temporal_kernel.cu
liquid/mod.rs + liquid/adapter.rs trainers/liquid.rs supervised path only Deleted (DQN) D.7 audit (2026-04-24): liquid_tau_rk4_step kernel was a mathematical identity — ODE f(x)=(1/tau)*(1-x) has fixed point x=1.0; initialised to 1.0, it never deviated. liquid_mod_buf always held [1.0,1.0,1.0,1.0], so velocity_mod in c51_grad_kernel multiplied spread_scale by 1.0 unconditionally. No ISV slot existed (violates §4.C.6). Kernel, buf, and call removed. LiquidTrainableAdapter (supervised path) unchanged.
tft/mod.rs + tft/trainable_adapter.rs trainers/tft/trainer.rs has full forward + backward_step(); TrainableTFT::backward() returns error with explicit message that backward is via TFTTrainer::train() Partial TFT backward available via dedicated trainer; UnifiedTrainable::backward() slot returns informational error (not a stub — documented routing) Plan 4 E.1/E.3 — DQN concept adoption; full backward path tracked in task #76

Data Pipeline Modules

Module / kernel Consumer path Classification Notes Action
fxcache.rs (discover_and_load, FxCacheData) train_baseline_rl.rs, trainers/dqn/data_loading.rs Wired Primary training data format
feature_cache.rs fxcache.rs (cache key), hyperopt/adapters/dqn.rs, smoke tests Wired Cache key generation for .fxcache auto-discovery
data_pipeline/ (DatasetManager, PreparedDataset) lib.rs prelude re-export; integration/ modules Wired Dataset management abstraction
data_loaders/dbn_sequence_loader.rs data_loaders/mod.rs; internally used by dbn_tick_adapter.rs Wired DBN sequence loading for supervised models
data_loaders/dbn_tick_adapter.rs data_loaders/mod.rs Wired DBN tick-to-bar adapter
data_loaders/streaming_dbn_loader.rs data_loaders/mod.rs; tests/streaming_pipeline_edge_cases.rs (test consumer) Partial Test-only consumer at tests/streaming_pipeline_edge_cases.rs; if streaming DBN load is genuinely needed for production (memory-efficient data loading), wire into production path in a follow-up task; otherwise schedule for deletion after test utility is moved to dbn_sequence_loader. Reclassified Partial — test consumer confirmed
data_loaders/tlob_loader.rs (TLOBDataLoader) data_loaders/mod.rs; no external call sites found Orphan TLOB data loader built but not called outside its own module and mod.rs Plan 2 D.8 may wire; surface for user review
training/unified_trainer.rs (UnifiedTrainable trait) diffusion/trainable.rs, tlob/trainable_adapter.rs, mamba/trainable_adapter.rs, tft/trainable_adapter.rs, hyperopt adapters Wired Unified training trait for supervised models
training/unified_data_loader.rs Deleted (Task 6): zero production + zero test consumers confirmed. pub mod unified_data_loader removed from training.rs. DELETED
training/orchestrator.rs (TrainingOrchestrator) Deleted (Task 6): zero production + zero test consumers confirmed. pub mod orchestrator removed from training.rs. DELETED
training_pipeline.rs (ProductionTrainingError) lib.rs (two From impls: MLError + MLSafetyError); TrainingPipeline struct has no external instantiation Partial ProductionTrainingError used via From impl in lib.rs; TrainingPipeline struct itself may be dead — follow-up to extract error enum and delete struct separately. Reclassified Partial — error type wired, struct possibly unused
training_profile.rs (DqnTrainingProfile) train_baseline_rl.rs, hyperopt/adapters/dqn.rs, smoke tests Wired TOML-backed hyperparameter profiles
walk_forward.rs (FoldRange, WalkForwardConfig) train_baseline_rl.rs, validation/harness.rs Wired Walk-forward fold management

Evaluation / Validation Modules

Module / kernel Consumer path Classification Notes Action
validation/mod.rs (ValidatableStrategy) validation/harness.rs, hyperopt/adapters/dqn.rs Wired Validation trait + entry points
validation/harness.rs hyperopt/adapters/dqn.rs, trainer/metrics.rs Wired Walk-forward validation harness
validation/financial.rs validation/harness.rs Wired Financial metric computation for val
validation/regime_analysis.rs validation/harness.rs Wired Regime-conditional eval
validation/ppo_adapter.rs validation/harness.rs OUT-of-DQN-scope PPO-specific validation path
evaluation/mod.rs hyperopt/adapters/dqn.rs, trainer/metrics.rs, gpu_backtest_evaluator.rs Wired DQN evaluation engine
backtesting/ (GpuBacktestEvaluator, BarrierBacktester) trainer/metrics.rs, hyperopt/adapters/* Wired Backtesting framework

Supporting Infrastructure Modules

Module / kernel Consumer path Classification Notes Action
checkpoint/mod.rs model_registry.rs Wired Checkpoint save/load
inference.rs multiple service consumers (67 files by grep) Wired Inference entry points
inference_validator.rs (InferenceValidator) Deleted (Task 6): zero production + zero test consumers confirmed. No pub mod declaration found in any file. DELETED
model_factory.rs mamba path, lib.rs Wired Model construction factory
model_loader_integration.rs (ModelLoaderTrait) Deleted (Task 6): zero production + zero test consumers confirmed. No pub mod declaration found in any file. DELETED
model_registry.rs lib.rs, various consumers (3 by grep) Wired Model lifecycle registry
registry/mod.rs consumed by integration and service layer (10 consumers) Wired Operational model lifecycle
hyperopt/ (campaign, adapters) trainer/training_loop.rs, hyperopt smoke test Wired Bayesian hyperparameter optimisation
ensemble/ integration path, service layer Wired Multi-model ensemble
integration/ service layer Wired Service integration layer
flash_attention/mod.rs (FlashAttention3) transformers/hft_transformer.rs, trainers/tft/config.rs, benchmark/tft_benchmark.rs OUT-of-DQN-scope TFT / transformer path only; DQN uses gpu_attention.rs
features/ (FeatureVector, extract_ml_features) train_baseline_rl.rs, DQN trainer Wired Feature extraction
microstructure/ trainers/dqn/features.rs, OFI pipeline Wired VPIN, Kyle lambda, order-flow imbalance
regime/mod.rs DQN features, data pipeline (50 consumers) Wired Regime detection + signal
regime_detection/mod.rs lib.rs declaration only; zero consumers of the facade; zero direct uses of ml_regime_detection:: anywhere else Orphan Thin facade re-exporting ml-regime-detection crate. Zero consumers of the facade, zero direct uses of ml_regime_detection:: anywhere. The underlying ml-regime-detection/ workspace crate exists but appears unused. Deleting a whole workspace crate exceeds Task 6 scope — scheduled for a separate crate-cleanup task. Potentially superseded by ml_regime/ crate (50 consumers). CRATE-LEVEL-FOLLOWUP
risk/mod.rs (crate-level) DQN trainer constructor via DrawdownMonitor, KellyCriterionOptimizer Wired Risk management in training
preprocessing.rs features/, data pipeline Wired Log-return normalisation, outlier clipping
labeling/mod.rs features/, supervised training Wired Triple-barrier labelling
security/mod.rs lib.rs (1 consumer) Partial ML security / prediction validation; no DQN consumer found Surface for user review
stress_testing/mod.rs dqn/stress_testing.rs, ppo/stress_testing.rs Wired Stress-testing framework
paper_trading/mod.rs lib.rs declaration; tests/paper_trading_integration_test.rs (test consumer) Partial Test-only consumer at tests/paper_trading_integration_test.rs. Production trading-service uses its own paper_trading_executor (distinct module); this facade exists only for ML crate tests. Reclassified Partial — test consumer confirmed
observability/mod.rs integration/performance_monitor.rs Wired ML observability hooks
deployment/ lib.rs, integration layer Wired Model deployment + A/B testing
universe/mod.rs lib.rs, integration layer (5 consumers) Wired Asset universe management
asset_selection/mod.rs lib.rs, integration layer (referenced in universe path) Wired Asset selection logic
batch_processing.rs lib.rs, integration/ (multiple consumers) Wired Batch ML operations
bridge.rs lib.rs, trading-ML bridge Wired ML-Financial type bridge
data_loader.rs lib.rs, training service Wired Legacy data loader shim
data_validation/mod.rs lib.rs, data pipeline Wired Input validation for data pipeline
explainability/mod.rs lib.rs only (1 consumer) Partial SHAP / attribution; no DQN call site found Surface for user review
benchmarks.rs lib.rs, benchmark harness OUT-of-DQN-scope Benchmark entry point; not production training
benchmark/ benchmark harness OUT-of-DQN-scope GPU / model benchmarks; not production DQN path
portfolio_transformer.rs Deleted (Task 6): zero production + zero test consumers confirmed. pub mod portfolio_transformer removed from lib.rs. DELETED

Summary

Updated after Task 6 cleanup (2026-04-24): 5 confirmed-orphan files deleted, 3 Orphan rows reclassified Partial, 1 Orphan reclassified with crate-level follow-up action. Plan 1 Task 8 (revised, 2026-04-24): adaptive_controller.rs renamed → adaptive_monitor.rs; AdaptiveController replaced with read-only AdaptiveMonitor per spec §4.C.6 (GPU drives, CPU reads).

Plan 3 Task 1 C.2 (2026-04-24): reward_component_ema_kernel.cu + RewardComponentMonitor added. 6 ISV reward-EMA slots [63..69) allocated; fingerprint shifted [61..63) → [69..71); ISV_TOTAL_DIM 63 → 71. experience_kernels.cu extended with reward_components_per_sample [N*L, 6] output parameter. 2 new Wired rows.

Plan 3 Task 3 B.2 (2026-04-24): trade_rate_ema_kernel.cu added. 2 new ISV slots [71] TRADE_ATTEMPT_RATE_EMA and [72] TRADE_TARGET_RATE; fingerprint shifted [69..71) → [73..75); ISV_TOTAL_DIM 71 → 75. experience_kernels.cu gains flat_to_pos_per_sample [N*L] output + 2 ISV slot-idx scalar parameters; a novelty-scaled bonus (conviction × vol_proxy × novelty) is added to reward and captured in rc[5] at every Flat→Positioned transition. TRADE_TARGET_RATE frozen in training_loop.rs at epoch 5 from measured attempt-EMA (min 0.001). 2 new Wired rows.

Plan 3 Task 5 C.4 (2026-04-24): Temporal timing bonus on trade exit. No new ISV slot — accumulates into rc[5] bonus slot via += (B.2 at entry, C.4 at exit: different (i,t) slots). New portfolio-state slot PS_PEAK_PNL_BAR=38; PS_STRIDE 38 → 39; PORTFOLIO_STRIDE 38 → 39 in all consumers (experience_kernels.cu, trade_stats_kernel.cu, gpu_experience_collector.rs, gpu_dqn_trainer.rs::launch_kelly_cap_update, ml-core::state_layout.rs). Peak bar snapshotted alongside every MAX_PNL update, reset at every MAX_PNL reset site (entry, reverse, fold hard-reset, trade-complete soft-reset). timing_bonus = shaping_scale × (bars_early / hold_time) × |final_pnl| × conviction_core where bars_early = max(0, segment_hold_time PS_PEAK_PNL_BAR). No tuned multiplier. 1 new Wired row.

Plan 3 Task 6a D.4a (2026-04-24): Persistence credit on profitable drawdown recovery. No new ISV slot — accumulates into rc[5] bonus slot via += (now shared by B.2 entry, C.4 exit-timing, D.4a exit-persistence; all three fire at different (i,t) slots per trade, so += is idempotent). New portfolio-state slot PS_INTRA_TRADE_MIN_PNL=39; PS_STRIDE 39 → 40; PORTFOLIO_STRIDE 39 → 40 in all consumers (experience_kernels.cu, trade_stats_kernel.cu, gpu_experience_collector.rs, gpu_dqn_trainer.rs::launch_kelly_cap_update, ml-core::state_layout.rs). MIN_PNL tracked per-bar in the same block as MAX_PNL (fminf against pnl_pct), reset at every MAX_PNL reset site (entry, reverse, fold hard-reset, trade-complete soft-reset). persist_bonus = shaping_scale × conviction_core × drawdown_depth × tanh(reward / max(1e-4, drawdown_depth)) where drawdown_depth = max(0, PS_INTRA_TRADE_MIN_PNL); gated on reward > 0 && drawdown_depth > 1e-6. Self-scaling tanh ratio: saturates +1 when reward ≫ drawdown (full credit for riding through), ≈0 when reward ≈ drawdown (trivial recovery). No tuned multiplier. 1 new Wired row.

Plan 3 Task 4 B.4 (2026-04-24): plan_threshold_update_kernel.cu + PlanThresholdMonitor added. PRODUCER-ONLY upgrade for ISV[PLAN_THRESHOLD_INDEX=49]: cold-start 0.5 constructor write preserved, but per-epoch GPU kernel now overwrites the slot with max(0.1, 0.5 × ISV[READINESS_EMA_INDEX=75]). New ISV slot [75] READINESS_EMA (cold-start 1.0 so the derived threshold matches the legacy 0.5 default until the EMA adapts). Fingerprint shifted [73..75) → [76..78); ISV_TOTAL_DIM 75 → 78. experience_kernels.cu gains readiness_per_sample [N*L] output parameter; the kernel writes the broadcast readiness_ptr[0] value into every reached (i,t) slot, race-free. isv_plan_threshold reset category flipped SchemaContract → FoldReset; isv_readiness_ema registered as FoldReset. Consumer kernels (4 sites in experience_kernels.cu + 1 in backtest_plan_kernel.cu) unchanged. 2 new Wired rows.

Plan 3 Task 6b D.4b (2026-04-24): Regime-shift penalty — punish trades held past a detected regime flip. No new ISV slot — subtracts from rc[5] bonus slot via = (cancels against B.2/C.4/D.4a positive contributions within rc[5]; that cross-flow is exactly what ISV[68] REWARD_BONUS_EMA is meant to track). New portfolio-state slot PS_REGIME_SHIFT_BAR=40; PS_STRIDE 40 → 41; PORTFOLIO_STRIDE 40 → 41 in all consumers (experience_kernels.cu, trade_stats_kernel.cu, gpu_experience_collector.rs, gpu_dqn_trainer.rs::launch_kelly_cap_update, ml-core::state_layout.rs). New CUDA-side ISV macros ISV_Q_DIR_ABS_REF_IDX=21 and ISV_SHARPE_EMA_IDX=22 added to state_layout.cuh (mirror authoritative Q_DIR_ABS_REF_INDEX / SHARPE_EMA_INDEX in Rust trainer). Detector inside the active-trade block (after MIN/MAX_PNL update) writes PS_REGIME_SHIFT_BAR = hold_time on the FIRST bar where |isv[11] PS_PLAN_ENTRY_REGIME| > clamp(0.25 × |clamp(sharpe, 2, 2)|, 0.05, 0.5); first-shift-only (short-circuits on non-zero PS_REGIME_SHIFT_BAR). Consumer in segment_complete block IMMEDIATELY AFTER D.4a: bars_late = max(0, saved_hold_time PS_REGIME_SHIFT_BAR); penalty = shaping_scale × conviction_core × (bars_late / saved_hold_time) × ISV[21] × |reward|; reward = penalty; rc[5] = penalty; then defensively resets PS_REGIME_SHIFT_BAR = 0 (in addition to the 5 lifecycle resets at entry/reverse/fold hard-reset/trade-complete soft-reset). Adaptive threshold tightens when |sharpe| is high (confident trading warrants early detection); loosens under noisy training. Q_DIR_ABS_REF self-scaling matches B.1 opp-cost pattern. No tuned multiplier. 1 new Wired row.

Plan 1 Tasks 12/15/16 + pre-allocation (2026-04-24): No new modules added. Changes are ISV slot allocation + consumer migration only. Task 15 confirmed no-op (IQL_BRANCH_SCALE_FLOOR_INDEX already serves conviction-floor role). Tasks 12 and 16 migrate cql_alpha and plan-threshold consumers from config fields / hardcoded literals to ISV slots. 8 new ISV slots allocated ([39..47)); fingerprint tail moves from [37..39) to [47..49); ISV_TOTAL_DIM 39 → 49. GpuDqnTrainConfig gains total_epochs field (written to TOTAL_EPOCHS_INDEX at construction). write_isv_signal_at bound extended from ISV_DIM to ISV_TOTAL_DIM to allow writes beyond slot 22.

Plan 2 Task 6B D.3 (2026-04-24): IQL value head widened from 1 to 2 outputs (V_short + V_long). v_out_buf shape [B][B*2]. gemm_fwd_v M=1→2, gemm_bwd_dw3 M=1→2, gemm_bwd_dh2 K=1→2. W3 param block [H*1][H*2], b3 [1][2]. total_params += H+1. iql_expectile_loss kernel extended with num_heads argument. 4 consumer kernels in iql_value_kernel.cu updated to read v_out[b*2+0] + v_out[b*2+1]. Checkpoint compat break — retrain required.

Classification Count
Wired 84
Partial 10
Orphan (held for follow-up) 3
Ghost 0
OUT-of-DQN-scope 17
Total 112

The 3 remaining Orphan rows are:

  • cuda_pipeline/gpu_statistics.rs + statistics_kernel.cu — held for Plan 2 D.2 wire-or-delete decision.
  • data_loaders/tlob_loader.rs — held for Plan 2 D.8 TLOB trunk wiring.
  • regime_detection/mod.rs — crate-level cleanup task (whole workspace crate, exceeds Task 6 scope).

Orphan Resolution Index

Orphan Resolution Status
cuda_pipeline/gpu_statistics.rs + statistics_kernel.cu Wire into val path or delete if superseded by gpu_monitoring.rs Plan 2 D.2 — held
data_loaders/streaming_dbn_loader.rs Reclassified Partial: test consumer at tests/streaming_pipeline_edge_cases.rs RECLASSIFIED
data_loaders/tlob_loader.rs Plan 2 D.8 wires TLOB trunk — this loader may be needed then Plan 2 D.8 — held
training/unified_data_loader.rs Deleted (zero consumers) DELETED
training/orchestrator.rs Deleted (zero consumers) DELETED
training_pipeline.rs Reclassified Partial: ProductionTrainingError used via From impl in lib.rs RECLASSIFIED
inference_validator.rs Deleted (zero consumers) DELETED
model_loader_integration.rs Deleted (zero consumers) DELETED
paper_trading/mod.rs Reclassified Partial: test consumer at tests/paper_trading_integration_test.rs RECLASSIFIED
portfolio_transformer.rs Deleted (zero consumers) DELETED
regime_detection/mod.rs Crate-level follow-up scheduled (separate crate-cleanup task) CRATE-LEVEL-FOLLOWUP