Skip to content

feat(draft): support optimizer schedule overrides - #3707

Merged
terrykong merged 45 commits into
NVIDIA-NeMo:mainfrom
seonjinn:seonjinn/draft-cotrain-optimizer-overrides-20260818
Sep 18, 2026
Merged

terrykong merged 45 commits into
NVIDIA-NeMo:mainfrom
seonjinn:seonjinn/draft-cotrain-optimizer-overrides-20260818

Conversation

@seonjinn

@seonjinn seonjinn commented Aug 19, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Adds opt-in learning-rate, minimum-LR, and weight-decay overrides for draft parameters.
  • Applies overrides only to tagged draft parameters.
  • Preserves existing optimizer behavior when overrides are unset or disabled.

Scope

Draft normalization and bias parameters use zero weight decay. Target optimizer groups and the global scheduler contract remain unchanged.

Validation

  • Exact head: f658f69b972732fe28596959e8dd6dc0829b66fc
  • 27 current-head GitHub checks pass; remaining unit jobs are queued.

Focused evidence

  • Real optimizer/scheduler trajectories and deterministic draft-update tests passed; latest-main composition passed config, optimizer, Ruff, format, and Pyrefly checks.

Dependencies / Remaining

Depends on #3701. The branch-up-to-date check is the only current failure.

@seonjinn
seonjinn requested review from a team as code owners August 19, 2026 00:15
@copy-pr-bot

copy-pr-bot Bot commented Aug 19, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@seonjinn

Copy link
Copy Markdown
Contributor Author

Self-review: review-pr-team

Reviewed the PR4-only range on top of #3701, including config validation, parameter selection, Megatron Bridge override semantics, disabled/default behavior, checkpoint surface, and tests.

No unresolved correctness, security, design, or test findings remain. The final branch contains two signed-off commits and only six PR4 files.

Validation: OCI-Hsg job 6300114 completed successfully with 8 config/setup tests, 6 MCore provider/setup tests, Ruff 0.9.9, format, and configured Pyrefly with zero errors.

@seonjinn
seonjinn force-pushed the seonjinn/draft-cotrain-optimizer-overrides-20260818 branch from 6906243 to 232323b Compare August 20, 2026 07:53
@seonjinn seonjinn added the CI:L2 Run doctests, unit tests, functional tests, and convergence tests label Aug 20, 2026
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 232323b

@seonjinn

Copy link
Copy Markdown
Contributor Author

/review-pr-team

@seonjinn seonjinn left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Self-review before requesting reviewers.

Method: a focused review agent (with anchors verified against actual file reads) cross-checking every scheduler/override mechanic against the vendored Megatron-LM source; the real-scheduler LR trajectory in the test suite was independently recomputed and matches.

Verified clean: parameter tagging is attribute-based over the whole draft tree (provider-agnostic -- naming conventions from the eagle-ttt/dspark provider PRs cannot miss it); the unset/disabled path is traced to byte-identical optimizer behavior (no extra param group, so pre-PR checkpoints resume unchanged); warmup/decay stay on the single shared step counter; and the min-LR inversion guard is present and tested.

One finding (inline, fixed in the follow-up commit): the weight-decay override silently composes to zero for draft norm/bias params via Megatron's standard wd_mult=0.0 -- now documented and pinned by a test.

Process: rebase onto #3701's current head (8774f1d3d added a near-miss config-typo validator to Eagle3DraftConfig, which this PR extends -- no conflict expected). No unit/L0 CI has run on this exact head; posting /ok to test on the post-fix head.

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test f658f69

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test d151128

@seonjinn

Copy link
Copy Markdown
Contributor Author

CI triage: the 13 L0 shard failures were one collection error — this test file imports megatron.bridge at module level, which breaks pytest COLLECTION on every non-mcore shard (the mcore mark only deselects at run time). First real CI run on this PR surfaced it. Fixed on the new head with pytest.importorskip before the megatron imports.

…erge

Signed-off-by: seonjinn <[email protected]>

# Conflicts:
#	examples/run_grpo.py
#	nemo_rl/models/megatron/draft/utils.py
#	nemo_rl/models/policy/teacher_worker_group.py
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Sep 12, 2026
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 1610cc5

…-main-merge

Signed-off-by: seonjinn <[email protected]>

# Conflicts:
#	examples/run_grpo_single_controller.py
#	tests/unit/single_controller/test_entrypoint.py
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 6c91ad2

…-main-merge

# Conflicts:
#	nemo_rl/models/policy/draft_config.py
#	pyrefly.toml
#	tests/unit/models/policy/test_draft_config.py
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 1a50fcf

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 5eecae0

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 841a816

terrykong
terrykong previously approved these changes Sep 17, 2026
@terrykong
terrykong enabled auto-merge (squash) September 17, 2026 06:50
@seonjinn seonjinn added CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) and removed CI:L2 Run doctests, unit tests, functional tests, and convergence tests labels Sep 17, 2026
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test cbe7480

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test 67307b6

@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test bbb7ebc

Copied pull-request branches use push events, so Codecov needs an explicit PR number. Pass commit_parent for upload-coverage instead of base_sha, which is only supported by pr-base-picking. Preserve the coverage threshold and all training behavior.

Signed-off-by: seonjinn <[email protected]>
@github-actions github-actions Bot added the CI Relating to CI label Sep 18, 2026
@seonjinn

Copy link
Copy Markdown
Contributor Author

/ok to test d16b05c

@terrykong terrykong left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

approved, but @kajalj22 to confirm the cicd-main.yml change

@terrykong
terrykong merged commit 771c56c into NVIDIA-NeMo:main Sep 18, 2026
85 checks passed
yuekaizhang added a commit to yuekaizhang/RL that referenced this pull request Oct 7, 2026
Resolves 12 conflicts from 89 incoming upstream commits, notably:
- draft_config.py: merge our Eagle3/DSpark/DFlash discriminated union
  with upstream's new DraftOptimizerConfig (NVIDIA-NeMo#3707),
  adding `optimizer` to Eagle3DraftConfig (Megatron path only).
- run_grpo.py / run_grpo_single_controller.py: splice draft_full_refit
  wiring into upstream's new OTel setup-span instrumentation.
- vllm_backend.py: adopt upstream's _DRAFTER_OWNER_ATTRS refactor
  (same (drafter, speculator) tuple, now a class attribute).
- dtensor_policy_worker_v2.py: adopt upstream's LEARNING_RATE_KEY
  metric constant while keeping draft_lr logging.
- test_vllm_backend.py: concatenate our dspark/dflash/eagle3 refit
  tests with upstream's independent tied-embedding-alias tests.
- automodel/setup.py: follow upstream's resolve_model_class move from
  policy.utils to automodel.utils.

Verified via ruff check/format, YAML parse, and
python -m compileall across nemo_rl/examples/tests/tools.

Signed-off-by: Yuekai Zhang <[email protected]>
yeyu-nvidia added a commit to yeyu-nvidia/RL that referenced this pull request Nov 16, 2026
The Megatron train step takes the draft param group's lr only from
policy.draft.optimizer (NVIDIA-NeMo#3707); learning_rate is read by the Automodel TTT
path alone. A LiLiCorr config that set learning_rate and no optimizer block
therefore trained the drafter at the policy's RL lr. In a 45-step QA-MOPD run
that was 3e-6 against an intended 1e-4, and the drafter moved 2e-6 relative to
its init: effectively frozen, with draft loss still decreasing and nothing
reporting it.

When optimizer is unset, learning_rate now becomes optimizer.lr. An explicit
optimizer block still wins, because recipes inherit learning_rate from
grpo_math_1B.yaml whether or not it was meant for this draft.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ye Yu <[email protected]>
yeyu-nvidia added a commit to yeyu-nvidia/RL that referenced this pull request Nov 25, 2026
The Megatron train step takes the draft param group's lr only from
policy.draft.optimizer (NVIDIA-NeMo#3707); learning_rate is read by the Automodel TTT
path alone. A LiLiCorr config that set learning_rate and no optimizer block
therefore trained the drafter at the policy's RL lr. In a 45-step QA-MOPD run
that was 3e-6 against an intended 1e-4, and the drafter moved 2e-6 relative to
its init: effectively frozen, with draft loss still decreasing and nothing
reporting it.

When optimizer is unset, learning_rate now becomes optimizer.lr. An explicit
optimizer block still wins, because recipes inherit learning_rate from
grpo_math_1B.yaml whether or not it was meant for this draft.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Ye Yu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) CI Relating to CI Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants