Skip to content

feat(single-controller): support two-source GRPO checkpoint resume - #5300

Open
WenzheWang wants to merge 7 commits into
NVIDIA-NeMo:mainfrom
WenzheWang:wenzhe/sc-multiple-dataloader-resume
Open

WenzheWang wants to merge 7 commits into
NVIDIA-NeMo:mainfrom
WenzheWang:wenzhe/sc-multiple-dataloader-resume

Conversation

@WenzheWang

@WenzheWang WenzheWang commented Nov 19, 2026 •

Copy link
Copy Markdown
  • I, the PR author, have personally reviewed every line of this PR.

What and why

Enable step-bounded SingleController GRPO training with two data sources and resumable per-task dataloader cursors.

Setup builds two task loaders through the existing MultipleDataloaderWrapper and defers iterator creation until consumption. Checkpoints write train_dataloader_<task>.pt, following the legacy sync layout requested in #5044. Resume loads both task cursors, checks the saved data configuration, and restores native replay and rollout ownership. Pending prompts are resolved using task name and sample index, so equal indices in different datasets identify their own records. Rollout trace events also retain named task identity across runs and restored records.

The initial mode uses the in_order sampler with zero lookahead, a deterministic stateless custom callback, a positive step limit, and dynamic sampling disabled. Checkpointed runs retain native replay state. Single-source checkpoint layout and legacy wrapper iteration remain supported.

flowchart LR
    A[Two task dataloaders] --> B[Step-bounded GRPO stream]
    B --> C[Native rollout and replay ownership]
    C --> D[Checkpoint]
    A --> E[Per-task dataloader state files]
    E --> D
    D --> F[Restore both task cursors and native optimizer]
    F --> B
Loading

Issues

Related to #5044, specifically the multiple-dataloaders and resume item.

Usage

Configure SingleController GRPO with two distinct tasks in data.train and the following overrides. The shipped callback takes one batch from each source and cycles an exhausted source.

data:
  use_multiple_dataloader: true
  num_prompts_per_dataloader: 1
  custom_dataloader: examples.custom_dataloader.custom_dataloader.example_custom_dataloader
grpo:
  num_prompts_per_step: 2
  max_num_epochs: null
  max_num_steps: 20
  use_dynamic_sampling: false
async_rl:
  sampler:
    name: in_order
    max_lookahead_versions: 0
checkpointing:
  save_data_plane: true
  load_replay_buffer: true

Keep the same data configuration when resuming. Both task cursor files and the matching native checkpoint metadata are required.

Convergence / perf / functionality proof

  • CPU regression on the merge with main f3b2d532. Job 916268 passed 224 tests, including two-source cursor resume, task-qualified replay, legacy single-source restore, and recovery metadata compatibility. Ruff lint, import order, and formatting passed.

  • Type check and source identity. Job 916271 ran full-project Pyrefly 1.4.0 with zero errors and verified 2,254 source paths and file modes before and after execution.

  • Optional Forest coverage. Seven NeMo-Gym-marked tests stopped at import in job 916270. The candidate and main reference the same older Gym module path. These cases are outside the 224 passing tests.

  • Earlier evidence. Jobs 916119 and 916124 covered 202 CPU tests on the 0be64f47 merge. The 619 tests on e77523fe and the two-A800 stop/restart on 84374efb remain scoped to those sources.

  • Real trainer: Qwen3-0.6B on 2×A800, using two distinct task sources. The uninterrupted baseline completed steps 1–2. A separate run saved at step 1 and exited, then a new trainer restored that checkpoint and completed step 2. Four optimizer updates were executed in total.

  • Resume state: native optimizer restore was enabled (load_optim=true, finetune=false). Both task-specific dataloader files were restored; each final step-2 cursor file matched its corresponding baseline SHA256. All three phases exited successfully, all loss/gradient values were finite, and every skipped-step metric was zero.

Step-2 metric Baseline Restored run
Loss 6.077906164136948e-6 5.647351827064995e-6
Gradient norm 0.014102637767791748 0.01309905294328928

This establishes functional two-source stop/restart for the tested recipe. The asynchronous checkpoint cut does not establish an identical uninterrupted training trajectory; the values above are the observed results. No convergence or performance gain is claimed.

Earlier seven-module CPU sweep on e77523fe (set CPU_PYTHON to the existing Linux test environment):

PYTHONPATH="$PWD" uv --offline --no-config run --no-project --no-sync --python "$CPU_PYTHON" \
  python -m pytest --noconftest -p no:cacheprovider -q -o addopts= -m "not nemo_gym" \
  tests/unit/single_controller/test_checkpointing.py \
  tests/unit/single_controller/test_checkpoint_dispatch_races.py \
  tests/unit/single_controller/test_tq_replay_buffer.py \
  tests/unit/single_controller/test_rollout_trace.py \
  tests/unit/experience/test_rollout_recovery.py \
  tests/unit/experience/test_rollout_recovery_capture_copy.py \
  tests/unit/data/test_multiple_dataloader.py

Needs upstream changes

None.

AI assistance was used for this contribution.

PR commands and CI
  • /ok to test <full-commit-sha> starts repository CI after maintainer validation.
  • /review requests the repository review service.
  • Contributor guidelines

Build step-bounded GRPO streams from two task dataloaders and preserve
their native per-task checkpoint files. Restore task cursors together
with replay ownership and resolve pending prompts by task and sample ID.

Retain legacy eager iteration and validate unsupported configurations.

Signed-off-by: Wenzhe Wang <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Nov 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.

@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Nov 19, 2026
Merge main 84374ef while retaining per-task loader and native replay state.
Snapshot deferred checkpoint cursors and cover two-source setup and restore.

AI assistance was used for this change.

Signed-off-by: Wenzhe Wang <[email protected]>
@github-actions github-actions Bot added the CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) label Nov 23, 2026
@WenzheWang
WenzheWang marked this pull request as ready for review November 23, 2026 03:38
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 23, 2026
Preserve named task identity across rollout trace runs and restored records.
Clarify single-dataloader limits for replay-free and MSC checkpoints.

AI assistance was used for this change.

Signed-off-by: Wenzhe Wang <[email protected]>

@WenzheWang WenzheWang left a comment

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.

The six-file follow-up addresses the earlier local findings on task identity in rollout traces, checkpoint recovery without replay and MSC support. No actionable findings remain within this review scope.

This follow-up rechecked the affected callers, trace readers and support descriptions, using the earlier complete local review for unchanged code. Five specialist lanes, an independent devil’s advocate in separate discovery and challenge passes, and a separate comment editor completed the follow-up.

The existing 205-case CPU results match the exact committed patch. Earlier 936-case CPU and two-A800 stop/restart evidence was reused only for unchanged code. No new tests or GPU runs were started for this review.

nemo-rl-review: kind=self harness=codex/0.171.0-alpha.13 model=gpt-6.1-sol effort=high review-pr-team=v2 reviewed=d3147a6

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Nov 23, 2026
@WenzheWang

Copy link
Copy Markdown
Author

The author self-review for d3147a6 is recorded here. The follow-up passed 205 targeted CPU cases; the earlier 936-case CPU and two-A800 stop/restart results are retained only for unchanged paths.

Could a maintainer vet this PR for NVIDIA runner access and route it to a reviewer for SingleController data loading and checkpoint recovery? The current-head pull-request workflows are awaiting approval. The legacy Self-review status is also still red, although the newer self-review checks passed; please help reconcile that gate.

Merge main d93ba7d while retaining per-task checkpoint and trace identity.
Validate affected CPU paths and preserve the existing trainer evidence.

AI assistance was used for this change.

Signed-off-by: Wenzhe Wang <[email protected]>
Merge main e77523f while preserving claimed replay order and capture ownership.
Clarify how to align repeated samples when comparing rollout traces.

AI assistance was used for this change.

Signed-off-by: Wenzhe Wang <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Nov 27, 2026
@terrykong terrykong removed the Documentation Improvements or additions to documentation label Nov 28, 2026
Merge main 0be64f4 and retain task-qualified prompt rehydration.
Update the privileged checkpoint fixture for per-suffix dataloader state.

AI assistance was used for this change.

Signed-off-by: Wenzhe Wang <[email protected]>
@svcnvidia-nemo-ci svcnvidia-nemo-ci added complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:medium May change training results. Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) labels Dec 2, 2026
Merge main f3b2d53 and retain the per-task cursor and replay identity.
Validate the affected CPU paths and keep the earlier trainer evidence scoped.

AI assistance was used for this change.

Signed-off-by: Wenzhe Wang <[email protected]>

This branch has not been deployed

No deployments
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) community-request complexity:high Large or cross-cutting change. Set by Autobot PR classify (skills/pr-classify) convergence-risk:medium May change training results. Set by Autobot PR classify (skills/pr-classify) proof:convergence Needs convergence proof (W&B runs). Set by Autobot PR classify (skills/pr-classify) proof:functionality Needs proof that it works. Set by Autobot PR classify (skills/pr-classify) waiting-on-maintainers Waiting on maintainers to respond

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants