Skip to content

feat(algorithms): AReaL decoupled-PPO async training on the SingleController - #2940

Draft
haitian-nvidia wants to merge 13 commits into
NVIDIA-NeMo:yukih/sc-entrypointfrom
haitian-nvidia:haitianj/areal-sc
Draft

haitian-nvidia wants to merge 13 commits into
NVIDIA-NeMo:yukih/sc-entrypointfrom
haitian-nvidia:haitianj/areal-sc

Conversation

@haitian-nvidia

Copy link
Copy Markdown
Contributor

What does this PR do ?

Adds an AReaL-style decoupled-PPO async-RL training path on the SingleController — a standalone SingleControllerArealActor with a two-phase train loop (full-batch barrier → frozen π_prox → per-minibatch optimizer steps) on top of the TransferQueue data plane.

Usage

The AReaL decoupled-PPO objective reuses existing machinery — it is ClippedPGLossFn with the always-on importance-sampling correction (π_prox/π_behav) and no KL term; the only new runtime logic is the controller's two-phase loop. Launch via the SC entrypoint + the AReaL recipe:

uv run examples/run_grpo_single_controller.py \
    --config examples/configs/recipes/llm/grpo-llama3.1-8b-instruct-2n8g-areal-single-controller.yaml

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests? — AReaL unit tests across tests/unit/single_controller/test_areal_train_pump.py, plus
    nightly functional entries.
  • Did you run the unit tests and functional tests locally? — 67/67 AReaL unit tests pass in the nemo-rl
    container; functional recipe added to tests/test_suites/nightly.txt.
  • Did you add or update any necessary documentation? — in-code docstrings cover the controller. (No docs/ site change.)

@copy-pr-bot

copy-pr-bot Bot commented Jun 25, 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.

@haitian-nvidia
haitian-nvidia changed the base branch from main to yukih/sc-entrypoint June 26, 2026 05:09
@yuki-97
yuki-97 force-pushed the yukih/sc-entrypoint branch 3 times, most recently from e0513e5 to 1e0107e Compare June 28, 2026 12:17
@haitian-nvidia
haitian-nvidia force-pushed the haitianj/areal-sc branch 3 times, most recently from dde2684 to 307f5cb Compare July 9, 2026 04:17
@yuki-97
yuki-97 force-pushed the yukih/sc-entrypoint branch from d1b196c to d803d4c Compare July 15, 2026 12:15
Signed-off-by: haitian-nvidia <[email protected]>
Initialize and shut down NeMo-Gym environments in the AReaL entrypoint.

  Add multi-node launch and DataPlane configuration.

  Enforce full-step rollout claims and report generation token metrics.

  Support preinstalled TransferQueue environments and deduplicate replicated TP/CP/PP training metrics.

  Guard Megatron-only KV recompute configuration from vLLM runs.

Signed-off-by: haitian-nvidia <[email protected]>
Signed-off-by: haitian-nvidia <[email protected]>
Avoid accessing an uninitialized reference model in SingleController when reference_policy_kl_penalty is zero.

Signed-off-by: haitian-nvidia <[email protected]>
The train pump reduced only the last minibatch's finish_train_step
result (aggregate_step_metrics(step_results[-1])), so with
M = rl_step_samples // train_global_batch_size > 1 the first M-1
optimizer results were dropped: global_valid_toks / total_flops (and
thus valid_tokens_per_sec_per_gpu) were undercounted ~M×, and
train/loss was a single-minibatch slice.

Add aggregate_step_metrics_multi_minibatch, which reduces the whole
list of finish results:
- per-microbatch metric lists are concatenated, then the existing GRPO
  min/max/mean/sum rules apply; summed keys are rescaled by 1/M since
  each result's lists are already normalized within its own minibatch
  (a result's list sums to that minibatch's mean), keeping kl_penalty,
  probs_ratio, moe/* and mtp/* at legacy-comparable magnitudes instead
  of M× inflated
- loss and grad_norm are averaged across optimizer results
- total_flops and global_valid_seqs/toks are summed for correct
  throughput accounting
- lr/wd/num_ranks come from the final optimizer result
- M == 1 delegates to aggregate_step_metrics (behavior unchanged)

aggregate_step_metrics itself is untouched and keeps serving the base
single-controller path. Add unit tests for the reducer and update the
train-pump publish test to the new semantics.

Signed-off-by: haitian-nvidia <[email protected]>
- consume ready rollouts without enforcing sampler order
- make stale rollout eviction configurable
- tune the NanoV3 recipe and multinode launcher for larger async runs

Signed-off-by: haitian-nvidia <[email protected]>
haitian-nvidia added a commit to haitian-nvidia/RL that referenced this pull request Aug 11, 2026
Port the AReaL decoupled-PPO admission policy from PR NVIDIA-NeMo#2940 onto the
current SingleController sampler interface as a new built-in
ArealAdmissionSampler (name="areal_admission"):

- admission gates dispatch to at most `max_staleness_versions` (eta)
  batches ahead of the trainer version, reusing the shared _GatedSampler
  dispatch counter; the controller keeps no duplicate staleness state
- selection is ready-first across weight versions (mixed-version
  batches) instead of draining one version at a time
- a typed `evict_stale_samples` knob (default false) controls both the
  selection lower bound and eviction together: false keeps late
  stragglers trainable and never evicts; true applies the hard window
  [v - eta, v] to selection and evicts ready groups below it, skipping
  uncommitted slots to avoid racing commit()
- ArealAdmissionSamplerConfig joins the discriminated SamplerConfig
  union, create_sampler(), and required_buffer_capacity_for_config()
  (capacity = num_prompts_per_step * (eta + 1))
- validate_single_controller_config() rejects areal_admission unless
  loss_fn.use_importance_sampling_correction=true and
  loss_fn.force_on_policy_ratio=false, so prev_logprobs are real and
  used as the behavior-policy correction (decoupled PPO), and fails
  before any setup factory allocates resources

Covered by sampler-interface unit tests (admission gating, mixed-version
selection, both eviction modes, config parsing/capacity) and setup
tests for the new validator guards. Verified e2e: 10-step M=1 run
(Llama-3.1-8B, Megatron TP2 + non-colocated vLLM) under
areal_admission completes with finite losses.

Signed-off-by: haitian-nvidia <[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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant