RL icon indicating copy to clipboard operation
RL copied to clipboard

SingleController parity with legacy GRPO/PPO: remaining features and validation gaps

Open yuki-97 opened this issue 1 month ago • 9 comments

Purpose. Fill the remaining gaps between SingleController (SC) and the legacy GRPO/PPO paths, then deprecate the legacy paths once SC reaches parity. Follow-up to #2625.

Acceptance criteria. Run the existing in-scope functional/nightly/release/performance tests through SC while preserving their intended behavior and assertions. Long-context, large-scale, and performance runs are part of this acceptance work rather than separate missing-feature items. Disabling validation, changing optimizer-minibatch semantics, or skipping checks does not establish parity.

Audit method. This inventory is based on a static audit of main at 93e2791: implementations, shared worker paths, configuration inheritance, CLI overrides, and all functional/nightly/release/performance test definitions, including platform-specific and disabled entries. No GPU tests were executed during this audit. Linked tests illustrate the behavior to preserve; they do not imply that SC equivalents have passed.

Scope. This issue covers legacy GRPO/PPO workflows, including on-policy distillation. A capability is not considered missing if an SC path already supports it. Exhaustive model/backend/configuration combinations are outside this issue.

1. Missing features

  • [ ] Training-time validation: periodic/start/end validation, validation-specific sampling parameters, greedy/pass@k metrics, validation-based early stopping, and checkpoint ranking. Example: DeepScaleR training and checkpoint evaluation. @yuekaizhang
  • [ ] GDPO / component-wise reward advantages. Example: Gym multi-reward nightly. @bg51717
    • https://github.com/NVIDIA-NeMo/RL/pull/5287
    • https://github.com/NVIDIA-NeMo/RL/pull/5301
  • [ ] Multiple dataloaders and their resume behavior. Example: multiple-dataloader functional test. @WenzheWang
  • [ ] TRT-LLM generation backend. Example: non-colocated async functional test. @shuyixiong
    • #5100
  • [ ] Automodel training backend. Examples: GRPO functional test, PPO functional test. @sharonyu-115
    • track issue: #5090
  • [ ] Automodel online draft co-training: DSpark, DFlash, and EAGLE3. Examples: DSpark, DFlash, EAGLE3. @yuekaizhang
  • [ ] NVFP4 per-token rollout. Example: GB200 per-token rollout test. @zhangyimi @sharonyu-115
  • [x] Dynamic sampling. Examples: DAPO release test, ProRLv2 functional test. @RayenTian
    • in-order sampler: #4588
    • streaming sampler: #4784
    • token capture path: https://github.com/NVIDIA-NeMo/RL/pull/5202
  • [x] Reward shaping, reward scaling, and length penalty. The DAPO configuration exercises reward scaling and overlong-response shaping. SC also explicitly rejects grpo.length_penalty. @RayenTian
    • reward shaping: #4882
    • reward scaling: #4878
    • length penalty: https://github.com/NVIDIA-NeMo/RL/pull/5206

2. Missing implementation details

  • [ ] loss_fn.seq_logprob_error_in_loss: filtering inside the training forward and normalizing gradients over surviving samples. Pre-training sequence filtering does not preserve this behavior. Example: single-forward nightly with survivor assertions. @snivertynv

3. Needs explicit SC E2E validation

These items have implementation or shared-code paths, but this audit did not establish explicit SC E2E validation for the capability itself. They are not confirmed missing features.

4. Equivalent alternatives — No action needed

  • Legacy async configuration is expressed through the SC entrypoint and async_rl samplers; choose the sampler according to the required staleness semantics.
  • PPO generation warmup lead is represented by sampler warmup lookahead.
  • Full-batch training is selected with min_groups_for_streaming_train = num_prompts_per_step.
  • PPO full-batch actor/critic multi-epoch training already has SC test coverage. Example: SC PPO nightly.
  • Training-data dumps are available through async_rl.log_full_train_data and DebugWriter.
  • Colocated generation has a Megatron SC path. Example: colocated SC functional test.
  • Drain-before-refit is implemented by the Dynamo SC path. Example: Dynamo SC functional test.
  • MOPD already has SC paths and top-k/full-vocabulary test definitions; additional teacher-assignment combinations are not tracked here.
  • invalid_tool_call_advantage and malformed_thinking_advantage have supported SC paths.
  • GSPO, router replay with CP/PP, basic checkpoint/recovery, and Omni image/video already have SC test definitions and are excluded from the generic validation-gap list.

5. Not planned for now

Please comment in this issue to let us know if you need any of these features.

  • Multiple optimizer minibatches within one rollout batch. SC requires rollout-batch size to equal policy global-batch size. This is separate from PPO repeating full-batch training over multiple epochs. Example: legacy Megatron functional test.
  • Explicit sync path. Synchronous behavior in SC can be achieved with the in_order sampler and staleness=0.
  • grpo.calculate_advantages_on_gpu: the legacy GPU baseline/std calculation path is not wired into SC. Reference: legacy implementation.
  • grpo.debug_payload_metrics: legacy payload-debug instrumentation and aggregation are not wired through. References: generation configuration, training-loop aggregation.
  • Per-worker vLLM timeline plots. SC has aggregate telemetry, but the legacy per-worker visualization is not wired through. Reference: SC logging TODO.
  • Colocated train and generation. Only Megatron generation backend is supported now.

yuki-97 avatar Nov 03 '26 15:11 yuki-97

I'd like to contribute the multiple dataloaders and resume behavior item in this tracker. Is anyone already working on the SingleController implementation?

On main 5939fa53, setup still rejects data.use_multiple_dataloader=True. I propose this first increment:

  • GRPO with the in_order sampler, initially staleness=0 and dynamic sampling disabled.
  • Step-bounded training: explicit max_num_steps and max_num_epochs: null, matching the existing infinite multi-dataloader contract without inventing an epoch length.
  • Deterministic, stateless task mixing through the existing custom-dataloader interface, including cycling an exhausted source. Stateful/adaptive selection, streaming samplers, PPO and Gym fan-out remain outside this increment.
  • Save/restore every source's cursor and shuffle state together with the source/task configuration. Restore the existing admitted/buffered rollout ownership before consuming new data, so resuming does not introduce skipped or duplicated logical prompt groups. This is not an exactly-once guarantee for external environment side effects.

I would reuse the existing checkpoint barrier and sidecar publication path. My preferred SC format is a composite dataloader state in the existing train_dataloader.pt, keeping single-dataloader checkpoints unchanged. Missing source state or an incompatible task/source mapping would fail before dispatch rather than silently restart a source.

I noticed #2454 already makes the shared MultipleDataloaderWrapper lazy, picklable and checkpointable for legacy async GRPO. I do not want to duplicate that work or build a competing SC-only wrapper. Would you prefer splitting/adopting the shared wrapper changes first, or coordinating the SC consumer against that PR? I would keep legacy async collector changes outside my scope.

Validation would compare uninterrupted and resumed task/sample sequences on CPU, cover source exhaustion, source-state mismatch and checkpoint/admission races, then run a small supported model on 2–4 A800s with a stop/restart. GPU acceptance would check continued optimizer steps and matched logical training input; no large-scale fault-tolerance or convergence claim.

If this boundary is suitable, I'd be happy to own the SC integration and its tests/docs. Please flag any existing owner or preferred checkpoint format before I start the production implementation.

WenzheWang avatar Nov 15 '26 12:11 WenzheWang

hi @WenzheWang , thanks for your interest and appreciate the help! currently no one is working on the multiple dataloaders, let me put your name there.

I would keep legacy async collector changes outside my scope.

yes, it makes sense, just focus on the single controller path is sufficient.

I would reuse the existing checkpoint barrier and sidecar publication path. My preferred SC format is a composite dataloader state in the existing train_dataloader.pt, keeping single-dataloader checkpoints unchanged.

for the ckpt format, wdyt keep the same with the legacy sync path like below? so that we won't have bw compat issue.

if master_config.data["use_multiple_dataloader"]:
    for (
        task_name,
        task_dataloader,
    ) in wrapped_dataloader.dataloaders.items():
        save_dataloader_state(
            task_dataloader.state_dict(),
            checkpoint_path,
            suffix=f"_{task_name}",
        )
else:
    save_dataloader_state(
        wrapped_dataloader.state_dict(), checkpoint_path
    )

yuki-97 avatar Nov 18 '26 03:11 yuki-97

SGLang generation on SC: #5282 covers the grpo_sglang_async.sh target (pickling fix for the generation handle, an SC SGLang recipe, and a smoke that keeps that test's assertion). The fault-tolerance target is not covered yet: SGLang fault tolerance is rejected at SC setup for now, and I will follow up on it separately.

shikicloud avatar Nov 18 '26 08:11 shikicloud

I'd like to take 1. Training-time validation if nobody is on it. Here is a proposed first increment, built from what SC already has.

What's already there on main: SC setup builds val_dataset and the validation env handles but drops them (_val_env_handles). RolloutManager.run_rollout(sample) returns a PromptGroupRecord without pushing to the data plane. _save_checkpoint already strips the val_reward sentinel, and validate_single_controller_config rejects any checkpointing.metric_name that isn't train:.

PR 1 (GRPO, non-colocated generation):

  • Remove the val_period/val_at_start/val_at_end rejection. Run validation at the same points as legacy (val_at_start before step 1, every val_period steps from val_start_at, val_at_end after the last step). Each run happens after that step's refit, so it scores the step's weights.
  • While validation runs, pause dispatch of new training rollouts and let in-flight ones finish (as the legacy async loop pauses its collector). Validation prompts go through run_rollout, so they never enter the buffer or affect staleness accounting, and val_num_generations_per_prompt, max_val_samples and val_batch_size behave as in legacy.
  • Validation sampling (policy.generation.val_temperature/val_top_p/val_top_k) needs a per-request sampling override on the rollout path. If none exists yet, PR 1 adds it.
  • Metrics: move legacy's accuracy / avg_length / pass@k / env-metric aggregation into one helper that both loops call, so the numbers stay comparable. Log under validation/ and write val_data_step{N}.jsonl as legacy does.
  • Checkpoint ranking: accept checkpointing.metric_name: val:<metric> on SC, using the latest validation result with legacy's semantics.
  • Tests: CPU unit tests for scheduling (which steps validate), the metric helper (legacy parity), pause/resume around validation, and val: top-k ranking; plus an SC functional test modelled on an existing legacy validation one, for CI.

PR 2: validation-based early stopping (stop_at_validation_metric/threshold), NeMo-Gym validation if PR 1 doesn't already cover it, and colocated Megatron generation (stand down / wake around validation). PPO validation after that.

Does this split work for you? Any constraint I should know first, such as whether validation should share the generation fleet with in-flight training rollouts rather than pausing them?

lonexreb avatar Nov 22 '26 23:11 lonexreb

hi @lonexreb , thanks for your interest and appreciate the help! let me ask around the team first to check whether there's someone working on it and get back to you.

yuki-97 avatar Nov 23 '26 07:11 yuki-97

hi @lonexreb , FYI @yuekaizhang is working on this, and thanks again for your help!

yuki-97 avatar Nov 24 '26 03:11 yuki-97

Hi @yuki-97, is the Megatron LoRA E2E validation item in section 3 still available? I’d like to port the existing async LoRA test to SingleController, keeping the small Qwen2.5 model, disaggregated async vLLM, and merged refit. I’d retain the reward and generation-KL checks and verify that a post-refit rollout actually uses the updated policy. Would that be a useful first PR? Thanks!

WEIXILIN0307 avatar Nov 24 '26 13:11 WEIXILIN0307

hi @WEIXILIN0307 , yea that's still available and this will be a useful PR. thanks for help and put your name there~

yuki-97 avatar Nov 25 '26 16:11 yuki-97

Hi @yuki-97, is the "Additional loss/advantage capabilities" item still open? I'd like to take it.

SingleController uses the same loss and advantage estimator classes as the legacy GRPO/PPO path, so for these it's mostly about whether the right inputs reach them and whether there are tests. I looked at each one:

  • adaptive-ppo-clip already works. The SingleController step loop updates k, it's saved in checkpoints, and grpo_score_centering_gym_single_controller.sh tests it (with score centering on).
  • positive-example NLL is accepted with the default normalization but doesn't do anything. The loss only adds the NLL term when "rewards" in data, and SingleController doesn't send rewards to the training step (they're not in DP_TRAIN_FIELDS), so positive_nll_loss is always 0, with no warning. Legacy GRPO has the same problem, which #3792 fixes. Legacy PPO is fine because it passes total_reward as rewards, and SingleController already has a total_reward column, so the fix should be small.
  • Reinforce++, seq-mask-tis and length-adaptive GAE seem to be wired through, but there are no SingleController tests for them.
  • CISPO is wired through too, but the example nightly can't be ported as is because it trains several minibatches per step, which SingleController doesn't support yet.

What I'd do:

  1. Fix positive-example NLL on SingleController, with a test that fails on main today.
  2. Add CPU tests that run Reinforce++ (with KL in the reward), seq-mask-tis and length-adaptive GAE through the SingleController advantage/loss path and compare with the legacy results.
  3. Add a small 2-GPU SingleController smoke run covering these, including CISPO with one minibatch per step.

For the NLL fix, should it use the raw reward or the reward after shaping/scaling?

Srivatsan6923 avatar Nov 26 '26 23:11 Srivatsan6923