Files
foxhunt/crates
jgrusewski a3fd02a957 fix(early-stop): log real training epoch, not internal call counter
EarlyStopping::should_stop incremented an internal current_epoch field
on every call. But training_loop.rs:2944 gates invocations behind
`epoch + 1 >= min_epochs_before_stopping` — so the internal counter
drifts from the real training epoch whenever min_epochs_before_stopping
> 1. Triggered at real epoch 17 would log "triggered at epoch 8" (the
call count), misleading when debugging run trajectories.

Fix: should_stop now takes the epoch as a parameter and uses it for
both the log message and best_epoch tracking. The internal current_epoch
field is removed — it had no semantic meaning (it was just call count).

Also removes current_epoch from restore()'s signature since the field
no longer exists.

Touches: should_stop, reset, restore; best_epoch now tracks real
training epochs rather than call counts.

Existing caller in training_loop.rs:2958 updated to pass `epoch`
(already available in scope — the outer loop variable).

All 7 existing unit tests updated and passing.

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