diff --git a/crates/ml/src/cuda_pipeline/experience_kernels.cu b/crates/ml/src/cuda_pipeline/experience_kernels.cu index 23df9e388..9d4864fae 100644 --- a/crates/ml/src/cuda_pipeline/experience_kernels.cu +++ b/crates/ml/src/cuda_pipeline/experience_kernels.cu @@ -629,7 +629,7 @@ extern "C" __global__ void experience_state_gather( * +3: momentum = close_now vs midpoint of N-bar range (0=bottom, 1=top) */ const int lookbacks[4] = {5, 15, 60, 240}; - int mtf_base = market_dim + 8; + int mtf_base = market_dim + 14; /* after 14 portfolio features (8 base + 6 plan) */ for (int lb = 0; lb < 4; lb++) { int Nlb = lookbacks[lb]; int past_idx = bar_idx - Nlb; diff --git a/crates/ml/src/trainers/dqn/trainer/constructor.rs b/crates/ml/src/trainers/dqn/trainer/constructor.rs index 6ce11f2fa..0db7a4eec 100644 --- a/crates/ml/src/trainers/dqn/trainer/constructor.rs +++ b/crates/ml/src/trainers/dqn/trainer/constructor.rs @@ -49,8 +49,8 @@ impl DQNTrainer { // Align input_dim to 8 so the log matches the actual model dimensions. // (device not yet created, so use the formula directly -- CUDA always aligns) let ofi_pre = !hyperparams.mbp10_data_dir.is_empty(); - // 42 market + 12 portfolio (8 base + 4 plan progress) + 16 multi-timeframe = 70 base, +20 OFI = 90 - let input_dim: usize = if ofi_pre { 96 } else { 72 }; // (90+7)&!7=96, (70+7)&!7=72 + // 42 market + 14 portfolio (8 base + 6 plan) + 16 multi-timeframe = 72 base, +20 OFI = 92 + let input_dim: usize = if ofi_pre { 96 } else { 72 }; // (92+7)&!7=96, (72+7)&!7=72 let output_dim: usize = 5; let hidden_dims: Vec = match hyperparams.hidden_dim_base { Some(base) => { @@ -252,7 +252,7 @@ impl DQNTrainer { // of falling back to scalar FMA. The extra columns are zero-padded at the // data pipeline boundaries (GpuPreloadedData and train_batch CPU path). let ofi_enabled = !hyperparams.mbp10_data_dir.is_empty(); - let raw_state_dim: usize = if ofi_enabled { 90 } else { 70 }; // 42 market + 12 portfolio + 16 MTF + (20 OFI) + let raw_state_dim: usize = if ofi_enabled { 92 } else { 72 }; // 42 market + 14 portfolio + 16 MTF + (20 OFI) let full_state_dim = (raw_state_dim + 7) & !7; // aligned: 88 with OFI, 72 without // state_dim is always the FULL padded dimension. The GpuDqnTrainer