Repository navigation
feat(sc): add ready-first staleness sampler - #3582
Merged
terrykong merged 7 commits intoAug 18, 2026
Merged
Conversation
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]>
Contributor
Author
|
/ok to test 869f9ca |
saumishr
reviewed
Aug 11, 2026
Address review feedback on NVIDIA-NeMo#3582: samplers should not be named after a framework. The distinguishing behavior is the selection policy -- whichever group is ready first gets trained, across weight versions -- so rename ArealAdmissionSampler / areal_admission to ReadyFirstSampler / ready_first (class, config union literal, validator messages, tests) and drop the AReaL framing from the sampler docstring. No functional change. Signed-off-by: haitian-nvidia <[email protected]>
Contributor
Author
|
/ok to test 3ed8a5f |
mehraakash
reviewed
Aug 12, 2026
mehraakash
reviewed
Aug 13, 2026
The ready_first sampler never discards a rollout: every admitted group stays selectable until trained, so the evict_stale_samples knob and its hard-window selection/eviction mode are removed. evict() is now an unconditional no-op, select() keeps every ready group at or below the trainer version, and the hard-window unit tests are dropped. Also add a runnable example recipe, grpo-llama3.1-8b-instruct-2n8g-ready-first-single-controller.yaml, showing the sampler with the loss configuration its validator requires (use_importance_sampling_correction=true, force_on_policy_ratio=false). Signed-off-by: haitian-nvidia <[email protected]>
Contributor
Author
|
/ok to test 4873a61 |
…ssion-sampler # Conflicts: # nemo_rl/algorithms/single_controller_utils/config.py # tests/unit/single_controller/test_single_controller_setup.py
Contributor
Author
|
/ok to test 76a65d8 |
Every recipe YAML must have a same-named tests/test_suites driver script listed in a suite file (enforced by test_all_recipe_yamls_accounted_for_in_test_suites, which failed in CI as 235 recipe YAMLs vs 234 suite entries). Add the grpo-llama3.1-8b-instruct-2n8g-ready-first-single-controller.sh driver (same 10-step run and metric checks as the streaming2 base recipe) and register it in nightly.txt under the Single Controller section. Signed-off-by: haitian-nvidia <[email protected]>
Contributor
Author
|
/ok to test ed3c3d5 |
The driver script only exists to satisfy the recipe/suite pairing check for the example recipe; it was not meant to consume nightly compute. Every .sh under tests/test_suites must be listed in a suite file, so register it in disabled.txt (zero nightly cost, the same pattern the circle_click recipe uses) instead of nightly.txt, whose 3928 GPU-hour budget the entry pushed to 3949. Signed-off-by: haitian-nvidia <[email protected]>
Contributor
Author
|
/ok to test f58772895b1968e4e37124a9e13212328f13b09c |
@haitian-nvidia, there was an error processing your request: See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/2/ |
Contributor
Author
|
/ok to test f587728 |
…ssion-sampler # Conflicts: # tests/test_suites/disabled.txt
Contributor
Author
|
/ok to test 1c0b047 |
saumishr
approved these changes
Aug 18, 2026
mehraakash
approved these changes
Aug 18, 2026
saumishr
added a commit
to saumishr/RL
that referenced
this pull request
Aug 19, 2026
Every part of the dropped-prompt path is keyed on target_step, and InOrderSampler is the only built-in that stamps one: _GatedSampler._stamp returns None, neither WeightFifoSampler nor ReadyFirstSampler overrides it, and WindowedSampler.admit returns None outright. _credit_shortfall, _take_replacement and _promote_into_step all early-return on None, so under any of those a prompt that is given up on is never subtracted from the step waiting for it. The step's target stays at the full num_prompts_per_step and min_step_batch_fraction is never consulted. The consequence is not an inert knob. Under weight_fifo the run stalls with no error at all: select always takes min(in_window) and _finalize_selection returns (None, 0) below min_prompt_groups, while the default evict only drops weights strictly below the window, so the short version is never cleared. The same admit() gate that stops the rollout pump running ahead also stops it reaching exhaustion, so _rollout_exhausted never sets, the train pump sleeps 5ms and re-asks forever, and the job holds its GPUs until the wall clock kills it. Under windowed and ready_first it is bounded but late -- the hole migrates batch to batch and the final step has none left to borrow from, failing hours in with "rollout exhausted before a complete training step was assembled". Rejected rather than warned about, unlike its neighbours in this function: those each describe a coherent thing to have asked for, whereas there is no run that wants a tolerance setting to convert a recoverable prompt failure into a stall. A zero budget stays exempt and keeps the existing warning, because no drop is tolerated then and the shortfall path is unreachable regardless of sampler. The guard names the exempt samplers rather than the affected ones, so a sampler added later is covered by default. That is not hypothetical: ready_first (NVIDIA-NeMo#3582) landed between this branch's base and this rebase, inheriting the None stamp like the rest, and an allow-list -- along with a test restating the same list -- would have let it through silently. The test reads the sampler names off the discriminated union for the same reason. Signed-off-by: Saurabh Mishra <[email protected]>
This was referenced Aug 21, 2026
3 tasks done
4 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do ?
Ports the staleness-admission policy from #2940 (AReaL) onto the current
SingleController sampler interface as a new built-in
ReadyFirstSampler(
name="ready_first").max_staleness_versions(eta) batchesahead of the trainer version, reusing the shared
_GatedSamplerdispatchcounter; the controller keeps no duplicate staleness state.
instead of draining one version at a time.
trained on, so late stragglers remain usable and no rollout is discarded.
ReadyFirstSamplerConfigjoins the discriminatedSamplerConfigunion,create_sampler(), andrequired_buffer_capacity_for_config()(capacity =
num_prompts_per_step * (eta + 1)).validate_single_controller_config()rejectsready_firstunlessloss_fn.use_importance_sampling_correction=trueandloss_fn.force_on_policy_ratio=false, soprev_logprobsare real and usedas the behavior-policy correction. The check fails before any setup factory
allocates resources.
Issues
Related: #2940 (original AReaL PR this admission policy is ported from).
Usage
See the full runnable recipe at
examples/configs/recipes/llm/grpo-llama3.1-8b-instruct-2n8g-ready-first-single-controller.yaml.Before your PR is "Ready for review"
Pre checks:
Additional Information
selection, no-eviction straggler handling, config parsing/capacity) and a
setup test for the new validator guard. Both affected unit-test files pass
on this branch.
vLLM) under
ready_firstcompletes with finite losses.