diff --git a/crates/ml/src/trainers/dqn/trainer.rs b/crates/ml/src/trainers/dqn/trainer.rs index 5ccc5c972..e7093d4b0 100644 --- a/crates/ml/src/trainers/dqn/trainer.rs +++ b/crates/ml/src/trainers/dqn/trainer.rs @@ -1850,10 +1850,11 @@ impl DQNTrainer { let configured = self.hyperparams.gpu_n_episodes; if configured >= 128 { match detect_gpu_hardware() { + // Cap at GPU experience collector's buffer limit (4096) Ok(hw) => configured.max(hw.optimal_n_episodes( state_dim, self.hyperparams.gpu_timesteps_per_episode, - )), + )).min(4096), Err(_) => configured, } } else { @@ -1892,10 +1893,11 @@ impl DQNTrainer { let configured = self.hyperparams.gpu_n_episodes; if configured >= 128 { match detect_gpu_hardware() { + // Cap at GPU experience collector's buffer limit (4096) Ok(hw) => configured.max(hw.optimal_n_episodes( state_dim, self.hyperparams.gpu_timesteps_per_episode, - )), + )).min(4096), Err(_) => configured, } } else { @@ -2001,7 +2003,8 @@ impl DQNTrainer { aligned_sd, self.hyperparams.gpu_timesteps_per_episode, ); - let chosen = configured.max(optimal); + // Cap at GPU experience collector's buffer limit (4096) + let chosen = configured.max(optimal).min(4096); if chosen != configured { info!( "GPU auto-scaled n_episodes: {} → {} (SMs={}, VRAM={:.0}MB)",