diff --git a/crates/ml/src/trainers/dqn/trainer/mod.rs b/crates/ml/src/trainers/dqn/trainer/mod.rs index 691a42dac..a1dbb4cec 100644 --- a/crates/ml/src/trainers/dqn/trainer/mod.rs +++ b/crates/ml/src/trainers/dqn/trainer/mod.rs @@ -1466,6 +1466,18 @@ impl DQNTrainer { .map_err(|e| anyhow::anyhow!("guard reset: {e}"))?; } + // Task 2.5 Bug #5 — reset controller fire counters + total-epochs + + // prev-controller snapshot at fold boundary. Without this, Track 3 + // C2/C5 fold-boundary artefacts (cosine-annealed tau jumps when + // train_step resets, cql_alpha schedule drift across folds) would + // accumulate into a multi-fold running count, misrepresenting the + // per-fold fire rate for the controller_activity smoke gate. + // `last_anti_mult` is within-epoch state (reset in reset_epoch_state) + // and not reset here. + self.controller_fire_counts = ControllerFireCounts::default(); + self.controller_total_epochs = 0; + self.prev_controller_values = ControllerPrevValues::default(); + // Keep gpu_data — the full dataset is already on GPU via init_from_fxcache. // Clearing it would force a redundant re-upload on the next fold.