Skip to content

feat(sc): compute advantages in dedicated and sharded Ray actors - #4326

Merged
terrykong merged 18 commits into
NVIDIA-NeMo:mainfrom
saumishr:advantage-actor-main
Oct 4, 2026
Merged

terrykong merged 18 commits into
NVIDIA-NeMo:mainfrom
saumishr:advantage-actor-main

Conversation

@saumishr

@saumishr saumishr commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do ?

Moves advantage computation off the SingleController into a pool of dedicated CPU Ray actors, shards each call across that pool on prompt-group boundaries, and keys the group-relative baseline on the prompt group's id rather than on its prompt tokens.

The baseline key is the reason the three are one PR. calculate_baseline_and_std_per_prompt grouped rows by prompt tokens, so two groups that happen to share prompt text shared one baseline whenever they landed in the same call and got separate baselines when a shard split them. Under that key grpo is not shard-invariant, so num_advantage_workers moved the numerics. Keying on the controller's group id makes the shard-invariance claim true, and only then is the sharding safe to land.

num_advantage_workers defaults to 0, which keeps the historical in-controller path.

Issues

Fixes #4371.

Usage

Nano 3.5, RLVR, 344 GPUs run experiments with 8 Advantage Actors, 8192 GBS

~10% faster Step Time:

Screenshot 2026-09-28 at 10 03 01 PM

~97% faster Advantage Calculation Time

Screenshot 2026-09-28 at 10 02 30 PM
async_rl:
  # 0 (the default) keeps the stage in the controller process.
  num_advantage_workers: 8

Evidence for the measurement

  • Did it actually shard? Yes, on every call, in the two runs that can report it — but not provably in the run the screenshots measure. Two later runs logged advantage stage: N row(s) over 8 shard(s), pool=8 and never once logged a decline: ...-advshard on all 40 of its advantage calls and ...-advshard-s0 on all 115 of its (55 before a restart, 60 after), 155 in total, every one an 8-way split. Raw rg counts triple these, because Ray mirrors each driver line into the driver log, the owning worker's stderr and the W&B output log.
  • Why the screenshot run cannot confirm it. Its config did set num_advantage_workers: 8 and it did create the actors, but the per-call shard log line was added by this PR's own sharding commit, so the three candidate runs that predate it (...-advactor, ...-dolphin, ...-fixedeos) emit it zero times. At that revision every decline was silent — the bug this PR fixes — so "split 8 ways" and "declined and ran the whole chunk on one actor" are indistinguishable from those logs. That distinction matters for attribution: even a decline moves the stage out of the controller process, which could account for much of the speedup on its own. So the screenshots show that the stage got faster, and the two runs above show that sharding is what the code does; the screenshots alone do not prove the 97% came from sharding rather than from offloading.
  • Estimator: grpo, which is in SHARD_INVARIANT_ESTIMATORS, so the split was permitted rather than skipped.
  • Dataset, and do its prompts repeat? curriculum_v35_inescapable-sawfly.train.efforts0p15_qamathcode.jsonl, a NeMo-Gym curriculum blend of QA / math / code. Its prompts do repeat. Of the first 60,000 of its 99,840 rows: 50,048 prompts are distinct, 5,025 appear two or more times, 14,977 rows (25%) share their prompt text with another row, and one prompt appears 16 times. So the measured run is exactly the case where the old prompt-token key made the advantages a function of num_advantage_workers — which is why the fix for GRPO baseline groups rows by prompt text instead of by group id (single controller) #4371 is in this PR rather than following it.

A same-seed num_advantage_workers: 0 vs 8 A/B is not posted here for two reasons. First, with the baseline keyed on the group id the two are now exactly equal rather than approximately equal, and test_sharded_pool_matches_in_process asserts that equality row by row for both shard-invariant estimators — a convergence plot is a weaker statement than the test. Second, the async path cannot be seed-matched across the two configurations: under sampler: ready_first with max_staleness_versions: 1, group arrival order is a function of generation timing, so the two runs would not consume the same batches no matter what the advantage code does.

Before your PR is "Ready for review"

Pre checks:

  • Make sure you read and followed Contributor guidelines
  • Did you write any new necessary tests?
  • Did you run the unit tests and functional tests locally? Visit our Testing Guide for how to run tests
  • Did you add or update any necessary documentation? Visit our Document Development Guide for how to write, build and test the docs.

The unit tests have not been executed anywhere, including locally — the environment this was developed in has no torch and its pinned venv is a dangling symlink. The changed paths were verified by executing the real function bodies against stubs (the decline branch over all six cases, the splitter over 25 layouts) and by cross-checking the new controller fixture's attribute set against single_controller.py with an AST pass. That is not a substitute for the CI run; treat the unit-test lane as the first real execution.

Additional Information

@copy-pr-bot

copy-pr-bot Bot commented Sep 29, 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.

@saumishr saumishr 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.

Reviewed at 6a512a1f0. Two blocking issues, plus some cleanup.

The module does not import. single_controller_utils/utils.py uses @dataclass without importing it, so the entire single-controller path raises NameError at import time. Confirmed by executing the module.

The new sharding is only valid for two of the six estimators. split_meta_by_prompt_group preserves whole prompt groups, which covers the group-relative baseline, but gdpo, reinforce_plus_plus, raw_reward, and gae all additionally normalize over the whole batch. With num_advantage_workers >= 2 those four silently produce different advantages than a single-worker run. Details inline.

The rest is minor: a dead _advantage_input_fields, an unused field import, two unread fields on AdvantageRequest that the inventory test now pins, a soft=False pin that contradicts its sibling branch's stated rationale, and algo: Any where the union type is known.

Things I checked that are clean: reduce_advantage_pump_metrics(**self._step_log_dict) is a kwargs splat so the rewards/sample_masks/masked_advantages rename is consistent end to end and no test still passes the old kwargs; REWARD_KEY is "reward" so collapsing the masked and unmasked branches does not rename the metric; num_generations_per_prompt exists on both GRPOConfig and PPOConfig, so the unconditional read in _advantage_stage is safe for PPO; KVBatchMeta.slice carries tags and sequence_lengths along with the rows; and the config field follows the BaseModel-default-plus-exemplar-YAML convention with no reference_configs entry covering this exemplar.

Dropping the unrelated throughput metrics in the force-push was the right call -- the PR reads much more cleanly as a single concern now.

Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread nemo_rl/algorithms/advantage_actor.py Resolved
@saumishr saumishr added the CI:L2 Run doctests, unit tests, functional tests, and convergence tests label Sep 29, 2026
@saumishr
saumishr force-pushed the advantage-actor-main branch from 6a512a1 to 554bb3f Compare September 29, 2026 07:34
@saumishr

Copy link
Copy Markdown
Contributor Author

Addressed all seven at 554bb3f4 (was 6a512a1f); replies are threaded on each comment.

Both blocking issues are fixed and verified: the dataclass import by executing the module with the heavy deps stubbed (NameError before, clean after), and the sharding by gating the split on a new AdvantageStageConfig.shardable derived from the estimator name.

ruff check --select F,E9 and ruff format --check are clean on every changed file at both commits independently, so the branch stays bisectable. Ruff does report one F841 for num_prompts_per_step, but it reproduces identically against 7d4db003's own copy of single_controller.py, so it is pre-existing and I left it alone.

Commit split: everything except the sharding gate folded into commit 1; the shardable field, the gate, the log reason and the new tests into commit 2.

Still outstanding: the unit tests have not been executed anywhere (no torch in the environment I am working from), and the CMH numbers are still a TODO in the description.

@saumishr

Copy link
Copy Markdown
Contributor Author

/ok to test 554bb3f

@saumishr
saumishr force-pushed the advantage-actor-main branch from 554bb3f to 6f47152 Compare September 29, 2026 17:58
@saumishr

Copy link
Copy Markdown
Contributor Author

/ok to test 6f47152

Lint fix only. The failure was import ordering (ruff check --select I, the second ruff pre-commit hook): the advantage_stage import block sorted after setup in single_controller.py, and SHARD_INVARIANT_ESTIMATORS sorted after the classes in the test. Reproduced locally with the pinned ruff 0.9.9 and confirmed the fix is byte-identical to what the hook produced. Both commits now pass ruff check, ruff check --select I and ruff format --check independently.

No behaviour change -- the only edits are import order.

@saumishr

Copy link
Copy Markdown
Contributor Author

/ok to test 6f47152

@saumishr
saumishr force-pushed the advantage-actor-main branch from 6f47152 to 6d331f5 Compare September 29, 2026 18:17
@saumishr

Copy link
Copy Markdown
Contributor Author

/ok to test 6d331f5

Move advantage computation off the SingleController into a pool of
AdvantageActor workers sized by num_advantage_workers, with the stage
wiring extracted into single_controller_utils/advantage_stage.py.

At Ultra scale the in-controller stage blocked the controller's event
loop long enough to miss Ray's actor liveness ping, and it held a whole
cohort's advantage inputs in the controller's heap. num_advantage_workers
defaults to 0, which keeps the historical in-controller path.

Actor placement excludes the dedicated Ray head so the pool does not put
its host-memory peak beside the controller. On clusters with no
dedicated head _placement_node_ids returns empty and placement falls
back to soft SPREAD.

assert_metadata_only and its forbidden-key set move out of
rollout_reassembler_actor.py into nemo_rl/utils/rpc_guard.py so the
advantage actor can enforce the same metadata-only RPC contract on its
own boundary. That move is behaviour-preserving.

Signed-off-by: Saurabh Mishra <[email protected]>
Split each advantage call across the whole actor pool instead of handing
one actor the entire batch. This engages whenever the pool exists and
declines to a single call whenever the group layout cannot be proven.

Group boundaries come from num_generations_per_prompt. An earlier
revision keyed them on DATASET_SOURCE_TAG, which replay_buffer.py only
stamps when a dataset row carries a `dataset` key; datasets without one
made the splitter decline on every call while reporting timings
indistinguishable from the unsharded path.

Because that failure was silent, the stage now logs

    advantage stage: N row(s) over M shard(s), pool=P

so "over 1 shard(s)" identifies a decline immediately rather than
hiding behind an unchanged measurement.

Signed-off-by: Saurabh Mishra <[email protected]>
@saumishr
saumishr force-pushed the advantage-actor-main branch from 6d331f5 to 93c8818 Compare September 29, 2026 18:28
@saumishr

Copy link
Copy Markdown
Contributor Author

/ok to test 93c8818

test_pins_round_robin_off_the_head_when_one_exists failed the first time it
was ever executed. NodeAffinitySchedulingStrategy validates node_id on
construction -- it decodes as a 28-byte hex string and raises on a nil result
-- so the "aaa"/"bbb"/"head" stubs could never reach the assertion:

  ValueError: Invalid node_id 'aaa'. Node ID must be a valid hex string.

Only the pinning path constructs the strategy object, which is why the
SPREAD sibling passed and this one did not. The product code is unaffected.

13 passed on aws-cmh (GB300, aarch64) after the change; previously 4 passed
and the run aborted on maxfail before test_advantage_stage.py ran at all.

Signed-off-by: Saurav Muralidharan <[email protected]>
(cherry picked from commit 14de98bac1ac08e982460200d9cc4dee177dd2b5)
The advantage-stage tests build the controller with object.__new__ and set
the gates by hand, but the stage now reads them off _advantage_stage_config
and runs through _advantage_computer, both assigned only in __init__. The
stub left them missing, so _advantage_stage raised AttributeError before
reaching any assertion.

pyproject sets -x in addopts, so the run aborted at the first of these and
the remaining seven never reported. All eight are fixed together: every
attribute the changed path reads is now stamped, including the _opd_stat_*
accumulators that _absorb_advantage_outcome adds to unconditionally.

The helper derives the config from the gates the caller already set rather
than restating them, so a new field on AdvantageStageConfig does not need an
edit at every stub -- which is how this broke. _available_advantage_actors
is deliberately absent: the empty pool returns before it is touched.

Signed-off-by: Saurabh Mishra <[email protected]>
@saumishr

Copy link
Copy Markdown
Contributor Author

/ok to test f0cd64c

The gae stub is stamped shardable=False, which routes _advantage_stage
into the branch that names the estimator it declined to shard --
stage_cfg.algo.adv_estimator.name. The stub's _algo_cfg only carried
seq_logprob_error_threshold and overlong_filtering, so that read raised
AttributeError on a types.SimpleNamespace.

Nothing else on this path is missing. Inside _advantage_stage the only
other algo read is num_generations_per_prompt, which sits in the
shardable arm of a conditional expression and is never evaluated here;
in AdvantageComputer, overlong_filtering and
seq_logprob_error_threshold are already present, and the
invalid_tool_call/malformed_thinking reads are behind
message_level_advantage_penalties_enabled, which this stub sets False.

Signed-off-by: Saurabh Mishra <[email protected]>
…okens

calculate_baseline_and_std_per_prompt groups rows with
torch.unique(prompts, dim=0), and the single-controller path fed it the
prompt_ids_for_adv token column. Two distinct groups can carry identical
prompt text -- DAPO-Math-17k stores each of its 17,917 prompts 100 times,
about seven same-prompt pairs per 512-prompt chunk -- and the token key
gave those two groups one shared baseline whenever they landed in the
same call. Which groups shared therefore moved with the streaming chunk
boundaries, and after the advantage stage learned to shard, with
num_advantage_workers: two groups merged when one actor saw the whole
batch and separated when the split put them on different actors.

That also made SHARD_INVARIANT_ESTIMATORS wrong about grpo. It claims a
whole-group shard reproduces the whole-batch numbers, which only holds
once the key is per group.

The key already existed. The controller mints one group id per group and
pack_payload turns it into "{group_id}_g{i}", so this stamps it on the
row tags instead of leaving it implicit in a naming convention, and
AdvantageComputer.run turns the per-row ids into the [N, 1] integer
column the baseline compares. Every estimator already documents
prompt_ids as "identifying which prompt each sample belongs to", and
several ignore it outright, so an index is the documented shape. A row
with no tag raises: falling back to tokens is the bug.

split_meta_by_prompt_group now cuts where the tag changes rather than
assuming num_generations_per_prompt rows per group, so variable-size
groups are safe instead of silently mis-cut, and a trimmed trailing
group no longer makes the whole batch decline. An interleaved layout has
no contiguous whole-group cut, so it still declines.

prompt_ids_for_adv is no longer read on this path, so the stage stops
fetching it and AdvantageConfig.prompt_ids_field goes away.
_group_ids_from_meta reads the tag too, rather than keeping a second
description of what a group is. The column is still written: deciding
what it should contain once nothing reads it is the separate question of
whether to pack it at all, which also governs the finalizer's
copy-a-sibling's-prompt workaround, left in place here.

Signed-off-by: Saurabh Mishra <[email protected]>

@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.

Thanks @saumishr. This moves the advantage stage off the controller's event loop into a pool of CPU actors, and splits grpo/opd work across the pool by prompt group.

What works well:

  • One AdvantageComputer serves both the in-process path and the actor, so the two can't drift, and the stage can now be unit-tested without Ray.
  • RewardPartial / AdvantagePartial are the right shape for metrics that merge across shards.
  • The actor pool follows the same pattern as the token-capture finalizer pool.
  • The shardable allow-list fails safe: a new estimator is not sharded until someone checks it.
  • Thanks too for the fixes from your own self-review.
  • Thanks for the quick pyrefly fix.

Convergence. The main thing to check is convergence. On data that repeats prompts, num_advantage_workers changes the GRPO advantages (details). Unless #4371 lands in this PR, please post a short same-seed A/B of num_advantage_workers: 0 vs 8 on a dataset that repeats prompts (e.g. DAPO-Math-17k), overlaying reward and advantages/*. On data with unique prompts the two should match exactly.

Evidence (not blocking):

  • Please confirm the measured run's log showed more than 1 shard: sharding is skipped without any error when it can't split, and the screenshots were taken before the commit that limits sharding to grpo/opd.
  • Which dataset was it, and do its prompts repeat? See the SHARD_INVARIANT_ESTIMATORS comment.

Docs. Please add async_rl.num_advantage_workers to docs/guides/single-controller.md next to the other async_rl knobs.

Small cleanup. rollout_manager.py still imports assert_metadata_only from rollout_reassembler_actor, and the _FORBIDDEN_RPC_KEYS alias now only serves a test. Both can import from nemo_rl.utils.rpc_guard.

PR description. The "ran the unit and functional tests locally" box is checked, but your own comment says the tests haven't run anywhere yet; please uncheck it until they have. Also remove the template leftovers: the empty Issues section, the code-snippet placeholder, and "* ...".

Generated by Claude Code

Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread nemo_rl/algorithms/single_controller.py Resolved
Comment thread nemo_rl/utils/rpc_guard.py Resolved
Resolves one import-block conflict in
tests/unit/single_controller/test_checkpointing.py: main added a
ClusterConfig import next to the schema import this branch had extended
with GROUP_ID_TAG. Both are kept.

Signed-off-by: Saurabh Mishra <[email protected]>
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from copy-pr-bot Bot Oct 2, 2026
test_restored_permits_are_released_by_a_live_pump is the one restore test
with max_num_steps > 0, so it is the only one whose pump body reads the
group-id tag off the restored rows. Its rows carried only a weight_version.

The tag has to match each group's declared "group_id" rather than be
unique per row, because the pump cross-checks the ids it selects against
the training claims the restore created. Stamped the sibling restore
fixtures the same way so the next test to raise max_num_steps does not
rediscover this.

Signed-off-by: Saurabh Mishra <[email protected]>
main added an OPD metric fix that reports teacher_student_logprob_gap_mean
from a raw pooled gap instead of the advantage mean. Three of its four
edits land in untouched regions and merged cleanly; the fourth accumulates
the gap inside the advantage computation, which this branch moved out of
the controller and into AdvantageComputer.

Ported that accumulation to the new home: AdvantageOutcome carries
opd_gap_sum as this call's contribution, the computer fills it under the
same teacher_logprobs_required guard and before GRPO clipping as on main,
and _absorb_advantage_outcome folds it in. Summing partials across shards
gives the same total as the single in-process pass, matching how the other
OPD moments already cross the RPC boundary.

git aligned the hunk against this branch's shard-decline log, which is
unrelated code that happens to end in the same delimiter; that side is
kept as-is.

Signed-off-by: Saurabh Mishra <[email protected]>
Running the unit lanes locally rather than pushing surfaced 43 failures
from the main merge, in three groups.

_absorb_advantage_outcome folds opd_gap_sum in unconditionally, the way it
already does the other OPD moments, so the stubs that bypass __init__ need
the attribute to exist even for non-OPD tests. Added it to the two shared
builders instead of the individual tests.

main turned AdvEstimatorConfig into a BaseModel, so the OPD estimator stub
can no longer be constructed from a bare dict; it now reuses the config the
surrounding GRPOConfig already holds, matching the GRPO branch beside it.

test_opd_advantage_stage_pools_raw_gap_separately_under_tropd asserted on
_step_log_dict["masked_advantages"], which this branch reduced to an
AdvantagePartial. It now reads the post-clip column the stage wrote, which
is what that key used to hold, flattening the jagged payload to compare
against the dense mask. Its gap assertion is unchanged and is what
validates the ported accumulation.

Also stamped the group-id tag on the remaining train-pump fixtures and the
replay-buffer tag assertion, and declared opd_gap_sum in the RPC dataclass
inventory so that guard stays a deliberate choice.

Local run of the L0_Unit_Tests_Other selection: 4474 passed, 39 skipped.
The 14 remaining failures (native_checkpoint, mooncake backend_config,
trtllm wheel mirror, flops_counter, venv creation) fail identically on a
pristine main checkout in the same container, as they need GPUs, RDMA or
network that a login node does not have.

Signed-off-by: Saurabh Mishra <[email protected]>
@NVIDIA-NeMo NVIDIA-NeMo deleted a comment from copy-pr-bot Bot Oct 2, 2026
@saumishr

saumishr commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test e5d9f2e

terrykong
terrykong previously approved these changes Oct 3, 2026
Resolves the conflict with NVIDIA-NeMo#4347 (full per-step training data dump).

The dump's two load-bearing pieces -- the pre_seq_error_sample_mask clone
and the add_chunk call -- sat inside the in-process advantage body this
branch relocates into advantage_stage.py, so git aligned them against
unrelated code and left an empty "ours" side on all three hunks. Keeping
either side verbatim would have dropped one of the two features.

main's hooks that survive the relocation (imports, the TrainDataDump the
controller owns, finish_step on the optimizer step) are untouched. The two
that moved now live in AdvantageComputer.run, which is the only code that
still holds the untruncated tensors: the controller stopped fetching them
when the computation moved off it.

Because the stage can run in a pool, TrainDataDump is now a sharded writer.
Each shard owns train_data_step<N>.jsonl.part-<shard_id> and finish_step
merges them in shard order, assigning idx across the merged file -- no
single writer sees every row, so no writer can number them. The controller
publishes a step it never wrote, which the previous row-counter guard
rejected. Sharding also moves the JSON serialization, which is the
expensive half of the feature, off the controller.

The dump's timing survives the move as a float on AdvantageOutcome and is
replayed into the controller's timer, so the train_data_dump metric still
reports when the work happened in an actor.

Two of main's assertions encoded behaviour this branch changed on purpose:
the estimator now receives the prompt-group key rather than the dense
prompt matrix, and a pump fixture needed the group_id tag this branch
makes mandatory. prompt_ids_for_adv returns to AdvantageConfig as a
dump-only column.

Verified locally in the CI container before pushing: 1553 passed in the
single-controller blast radius, and 4495 passed in a full
L0_Unit_Tests_Other with only this node's five known environmental
failures (no GPU, no RDMA, no HF access).

Signed-off-by: Saurabh Mishra <[email protected]>
The advantage stage writes the dump wherever it runs, so with a pool the
controller merges part files it did not write. A pool that does not share
the controller's filesystem still runs and still reports, and its parts
are simply absent -- which would publish a short dump that looks complete.

Carry the per-call row count back on AdvantageOutcome and check the merged
total against it before the atomic publish.

Signed-off-by: Saurabh Mishra <[email protected]>
@saumishr

saumishr commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 67707d4

@terrykong

Copy link
Copy Markdown
Collaborator

Record of the CI failures on head 67707d4 (run 37150580820), so they aren't mistaken for problems in this PR.

Failing (4 jobs). None are caused by this PR:

  • L1_Functional_Tests_Megatron_Generation (H100)
  • L1_Functional_Tests_Megatron_Generation (GB200)
  • L1_Functional_Tests_GB200_Megatron_Omni
  • L1_Functional_Tests_GB200_Megatron_Omni_Single_Controller

CI quality check is red only because it rolls up those 4.

All 4 fail the same way. Every Megatron generation call raises:

File "nemo_rl/models/generation/megatron/megatron_generation.py", line 596, in generate_async
File ".../ray/actor.py", line 973, in options
ValueError: num_returns='streaming' can only be used with generator functions (functions that use 'yield'). The decorated function is not a generator function.

The cause is the Ray 2.58 bump on main (#4419), not this PR: Ray 2.58 added a check in .options() that this call trips. This PR doesn't touch megatron_generation.py. The same 4 jobs fail the same way on other PRs, and they pass when Ray is reverted.

Fix: #4469 (main) and #4468 (r0.8.0). Both were verified on Ray 2.58, where all 4 jobs pass.

Everything else passed (103 jobs), including the single-controller tests that run this PR's code with vLLM: SingleController_1/_2/_3 on both GPU types, and GB200_Vllm_Omni_Single_Controller.

One gap: the Megatron single-controller test fails during the first rollout, before the advantage stage runs. So this PR's code has not been tested with Megatron generation yet. That will be covered once the Ray fix is on main and this branch is rebased.

Heads-up for the rebase: main also had an unrelated L0_Unit_Tests_Other failure (test_opd_advantage_stage_pools_raw_gap_separately_under_tropd, missing _train_data_dump). It was fixed by #4464, which has already merged, so a rebase picks it up. It did not fail on this branch.

@terrykong
terrykong disabled auto-merge October 4, 2026 07:07
@terrykong
terrykong merged commit 486c345 into NVIDIA-NeMo:main Oct 4, 2026
162 of 169 checks passed
@terrykong

Copy link
Copy Markdown
Collaborator

force merged this PR given the tests failed should be solved by #4468 (since it's broken on main) and this PR is fairly high priority

mk-0 added a commit to mk-0/RL that referenced this pull request Oct 14, 2026
…quet-logging

Main moved the advantage stage into AdvantageComputer and a sharded actor
pool (NVIDIA-NeMo#4326). Trajectory records are now submitted once per chunk after
all shards have written their advantages, from the merged batch meta.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Marat Kitov <[email protected]>
pjin-nvidia added a commit that referenced this pull request Oct 30, 2026
…ics-20260930

Conflicts:
- grpo.py: keep _apply_async_sample_masks beside the #4160 participation
  helpers, and capture dataset_loss_multiplier before calling it (the
  helper clones loss_multiplier, so the reference stays the dataset weight).
- single_controller.py: take main's _advantage_stage, whose body #4326
  moved into AdvantageComputer.run, and drop the unused helper import.
- test_grpo.py: keep both sides' imports and test classes.

Move the SingleController port with the code it changed:
- advantage_stage.py: apply _apply_async_sample_masks in
  AdvantageComputer.run, fold the logprob-error count into
  num_masked_seqs_total, and return the counts as
  AdvantageOutcome.sample_mask_metrics.
- single_controller.py: _absorb_advantage_outcome appends them to
  _step_log_dict["sample_mask_metrics"].
- test_advantage_stage.py: classify the new AdvantageOutcome field.
- test_utils.py: use the reward_partials/advantage_partials parameter
  names from #4326.

Signed-off-by: Peter Jin <[email protected]>
saumishr added a commit to saumishr/RL that referenced this pull request Nov 3, 2026
The controller's host-memory peak is set by cohort postprocessing, which is
fixed by the batch shape rather than by cluster size, so sharing a node with
GPU workers puts it a few hundred GB from the kernel OOM killer. Job 847389
died that way: the head was carrying the Ray head, the driver and four GPU
workers when the controller went from ~60 GB to at least 330 GB, and the
kernel took the step before the first refit.

ray.sub's DEDICATED_RAY_HEAD=1 already reserves a compute-free node and
advertises it as `ray_head`; nothing was claiming it. `_placement_node_ids`
in advantage_actor (NVIDIA-NeMo#4326) already keeps the advantage pool off that node on
the stated assumption that the controller claims it, so this closes a gap a
merged component already relies on.

The placement reads the live cluster rather than the env var so a mismatch
between launcher and allocation cannot silently pin nothing, and claims the
whole unit rather than a fraction, since the point is that nothing else lands
on that node. NRL_PIN_CONTROLLER_TO_HEAD=0 separates the two decisions, for a
run that wants the reserved head without the pin. docs/cluster.md's
DEDICATED_RAY_HEAD entry gains the corresponding note.

Signed-off-by: Saurabh Mishra <[email protected]>
saumishr added a commit to saumishr/RL that referenced this pull request Nov 13, 2026
The controller's host-memory peak is set by cohort postprocessing, which is
fixed by the batch shape rather than by cluster size, so sharing a node with
GPU workers puts it a few hundred GB from the kernel OOM killer. Job 847389
died that way: the head was carrying the Ray head, the driver and four GPU
workers when the controller went from ~60 GB to at least 330 GB, and the
kernel took the step before the first refit.

ray.sub's DEDICATED_RAY_HEAD=1 already reserves a compute-free node and
advertises it as `ray_head`; nothing was claiming it. `_placement_node_ids`
in advantage_actor (NVIDIA-NeMo#4326) already keeps the advantage pool off that node on
the stated assumption that the controller claims it, so this closes a gap a
merged component already relies on.

The placement reads the live cluster rather than the env var so a mismatch
between launcher and allocation cannot silently pin nothing, and claims the
whole unit rather than a fraction, since the point is that nothing else lands
on that node. NRL_PIN_CONTROLLER_TO_HEAD=0 separates the two decisions, for a
run that wants the reserved head without the pin. docs/cluster.md's
DEDICATED_RAY_HEAD entry gains the corresponding note.

Signed-off-by: Saurabh Mishra <[email protected]>
saumishr added a commit to saumishr/RL that referenced this pull request Nov 13, 2026
The controller's host-memory peak is set by cohort postprocessing, which is
fixed by the batch shape rather than by cluster size, so sharing a node with
GPU workers puts it a few hundred GB from the kernel OOM killer. Job 847389
died that way: the head was carrying the Ray head, the driver and four GPU
workers when the controller went from ~60 GB to at least 330 GB, and the
kernel took the step before the first refit.

ray.sub's DEDICATED_RAY_HEAD=1 already reserves a compute-free node and
advertises it as `ray_head`; nothing was claiming it. `_placement_node_ids`
in advantage_actor (NVIDIA-NeMo#4326) already keeps the advantage pool off that node on
the stated assumption that the controller claims it, so this closes a gap a
merged component already relies on.

The placement reads the live cluster rather than the env var so a mismatch
between launcher and allocation cannot silently pin nothing, and claims the
whole unit rather than a fraction, since the point is that nothing else lands
on that node. NRL_PIN_CONTROLLER_TO_HEAD=0 separates the two decisions, for a
run that wants the reserved head without the pin. docs/cluster.md's
DEDICATED_RAY_HEAD entry gains the corresponding note.

Signed-off-by: Saurabh Mishra <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:L2 Run doctests, unit tests, functional tests, and convergence tests Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GRPO baseline groups rows by prompt text instead of by group id (single controller)

2 participants