Skip to content

fix: reject scheduler min_lr greater than optimizer lr#3091

Closed
dumko2001 wants to merge 2 commits into
PrimeIntellect-ai:mainfrom
dumko2001:fix/scheduler-min-lr-le-lr
Closed

fix: reject scheduler min_lr greater than optimizer lr#3091
dumko2001 wants to merge 2 commits into
PrimeIntellect-ai:mainfrom
dumko2001:fix/scheduler-min-lr-le-lr

Conversation

@dumko2001

@dumko2001 dumko2001 commented Jul 20, 2026

Copy link
Copy Markdown

Summary

  • scheduler.min_lr is bounded ge=0 but never checked against optim.lr. When min_lr > lr, CosineAnnealingLR(eta_min=min_lr) interpolates upward, so the "minimum" LR becomes the peak and the run trains above its configured lr for the whole schedule. Nothing raises.
  • Example with lr=1e-3, min_lr=1e-2: the LR climbs from 0.001 to 0.010 across the decay. The linear path already errors on LinearLR(start_factor=min_lr/lr), but only from deep inside torch.
  • Fix: check the relation where both values are visible.
    • Single-run: a TrainerConfig validator fails fast at config load.
    • Multi-run RL: a config-validation hook (registered in setup_multi_scheduler, master-rank only, alongside validate_lora_rank) rejects a run whose per-run optim.lr < scheduler.min_lr through the normal config_validation_error.txt path, so one bad run is skipped instead of crashing the shared trainer.
    • setup_scheduler keeps a defensive ValueError as a last line. The constant scheduler has no min_lr and is untouched.

Verification

A single-run cosine config with min_lr > optim.lr raises ValueError at construction. The multi-run hook returns (False, ...) for a per-run optim.lr below min_lr and (True, "") otherwise. min_lr <= lr is accepted.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@dumko2001
dumko2001 marked this pull request as ready for review July 20, 2026 11:41

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ea9b161e37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +100 to +101
raise ValueError(f"scheduler.min_lr ({scheduler_config.min_lr}) must be <= optim.lr ({lr})")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Reject invalid multi-run configs before scheduling

When max_concurrent_runs > 1, a run-specific orch.toml can set optim.lr below the trainer scheduler's min_lr. This check then runs inside MultiLoRAOptimizer.optimizer_creation_hook during MultiRunManager.synchronize_state() (which invokes creation hooks on every rank without exception handling), so one invalid newly discovered run raises here and terminates the shared trainer instead of being rejected through the existing register_config_validation_hook / config_validation_error.txt path in runs.py. Register this constraint as a multi-run config validation hook before the run is synchronized.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — fixed in 6baedcb. In multi-run this now registers a config-validation hook in setup_multi_scheduler (master rank, alongside validate_lora_rank) that rejects a run whose per-run optim.lr < scheduler.min_lr via the normal config_validation_error.txt path, so one bad run is skipped instead of crashing the shared trainer. The setup_scheduler raise stays as a defensive last line — it's now unreachable for bad multi-run configs since the hook rejects them before the run is created.

…r crash)

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@dumko2001

Copy link
Copy Markdown
Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 6baedcb0aa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@mikasenghaas

mikasenghaas commented Jul 22, 2026

Copy link
Copy Markdown
Member

x

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.

2 participants