Skip to content

[WIP][bugfix] restore LR scheduler progress on resume - #664

Draft
WhiteSwan1 wants to merge 1 commit into
alibaba:masterfrom
WhiteSwan1:bugfix/restore-lr-scheduler
Draft

WhiteSwan1 wants to merge 1 commit into
alibaba:masterfrom
WhiteSwan1:bugfix/restore-lr-scheduler

Conversation

@WhiteSwan1

Copy link
Copy Markdown
Collaborator

Summary

Training checkpoints currently restore model and optimizer state but do not save LR scheduler progress, so resumed training restarts the learning rate schedule.

Add an opt-in --restore_lr_scheduler CLI flag, defaulting to false to preserve existing behavior. It works independently of --ignore_restore_optimizer. Checkpoints save per-rank scheduler state, and restoration also updates optimizer learning rates before the first resumed batch. Epoch-based schedules advance before the epoch checkpoint is saved.

For legacy checkpoints without scheduler state, reconstruct progress from the saved batch index or completed epoch count using the unchanged LR configuration. Report an error when the required progress is unavailable. Training with no existing checkpoint still starts normally.

The restore policy is a CLI option rather than a TrainConfig field: it is a launch-time decision, keeps existing configurations unchanged, and needs no protobuf change. Saved-state restoration requires the same world size, scheduler types/order, and local parameter-group counts.

Test Plan

  • Run scheduler, checkpoint, training-loop, optimizer, and prompt regression tests in the repository's PyTorch 2.13 environment: 179 tests passed. Coverage includes default behavior, cold start, independent optimizer restoration, legacy reconstruction, and step/epoch resume boundaries.
  • Reuse the existing two-rank CPU/Gloo checkpoint test to verify rank-local learning rates and the next scheduler step after restoration.
  • pre-commit run -a: all hooks passed. pyrefly check: 0 errors.

Checkpoints omitted LR scheduler state, so resumed training restarted the schedule even when optimizer state was restored. Save per-rank scheduler state and restore it with an opt-in CLI flag, reconstruct legacy progress when needed, and persist epoch advancement before checkpointing.
@WhiteSwan1 WhiteSwan1 changed the title WIP: [bugfix] restore LR scheduler progress on resume [WIP][bugfix] restore LR scheduler progress on resume Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant