Repository navigation
Conversation
Forest training was GRPO-only. A PPO run now runs GAE on every physical row with that row's own critic values; the logical owner still decides validity, so a filtered segment masks all of its owner's rows. - ppo.adv_estimator.normalize_over: kept_rows (default) or all_rows, which also whitens over rows masked from the loss. Execution padding never counts. - The critic takes every Forest row as one optimizer step. - Forest row padding covers the critic's DP and microbatch sizes too. - The complete-group check now runs on the PPO path as well. - Forest requires ppo.value_training_mode=whole_batch: its row padding covers the whole step, while split mode shards each chunk on its own. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
…tics Execution padding and failed owners' borrowed inputs run through the model, so with expert-bias updates enabled their tokens count toward the router's expert loads. Forest keeps counting them by default, as ordinary training does. token_capture.exclude_padding_from_router_stats opts into masking them. The finalizer publishes router_excluded_rows for Forest rows; the policy and a PPO critic then fetch it, and the Megatron microbatch builder gives those rows no router-visible tokens in the existing padding mask, packed or not. The critic also masks sequence-packing padding. Both workers check the mask only with the option on, and raise an error naming it when the model cannot honour it, such as an expert-bias MoE with HybridBlock chunkwise context parallelism. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
Forest pads every published group to the policy and critic row multiple. With one rollout per group, most rows a step trains on are then padding: a DP of 4 turns ~154 real rows into ~512. token_capture.forest_padding_scope: step pads each training batch once instead. Pad rows copy real rows under new sample IDs with no loss, borrowed-input tags, and router exclusion flags; token_capture.forest_pad_source picks row0 or cyclic copies. ppo.adv_estimator.whiten_execution_padding lets those copies join all_rows whitening. Defaults are unchanged. A rollout snapshot taken during a step accepts that step's padding copies (<sample_id>_padN) of replayed rows, and restore deletes them before checking the replay inventory. Full trainer checkpoints run after the step clears its padding and stay strict. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
SingleController PPO rejects a rollout-failure drop budget because the critic expected a full step. A Forest critic trains on the step's actual rows, so a short step fits and Forest PPO now accepts the budget. Streaming PPO selects chunks in multiples of whole prompt groups so the rows split evenly across the policy and critic data-parallel ranks. Forest groups vary in row count and execution padding already aligns each chunk to both models, so that alignment only held back ready groups, rejected some num_prompts_per_step values, and made the sampler raise once a dropped rollout shrank the step. Forest streaming PPO now selects any group count, as streaming GRPO does. With forest_padding_scope=step, each chunk is padded. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
Unit tests, as PPO counterparts of the Forest GRPO tests: - Full-batch PPO trains every segment row per epoch and the critic takes the step's rows (gbs = rows); streaming PPO steps the policy once and trains the critic on all chunks after the refit. - Invalid logical batches and all-invalid owners never train either model; a partial step trains the critic on the surviving rows. - Whole-owner overlong filtering; the GAE advantage stage is never sharded. - Forest PPO startup rejections, policy/critic padding validation order, checkpoint restore with a critic, the critic row multiple pinned in data-plane checkpoints, and value-loss equivalence across packing bins and segments. Functional tests, both in L1_Functional_Tests_SingleController_3: - ppo_async_gym_single_controller_context_compaction.sh: PPO (GAE, Megatron critic) on the context-compaction Forest rows, two steps with checkpoints, then a resume to step 4. Its config, examples/nemo_gym/ppo_qwen3_0_6b_single_controller.yaml, composes the PPO SingleController exemplar with the Gym GRPO config. - grpo_async_gym_single_controller_context_compaction_resume.sh: the same checkpoint/resume for Forest GRPO. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
whiten_execution_padding only changes whitening under Forest step padding, normalize_over=all_rows only with normalize_advantages=true, and the legacy PPO entrypoint reads neither. Reject each of these at startup. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
…on note PPO advantages are per physical row, each row a GAE episode, and Forest PPO needs whole_batch critic training. Restore the truncation and unsupported-features paragraph, which also applies to PPO overlong filtering. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
…ler exemplars Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
…sets The critic's method also sets its router padding-mask flag, so call it configure_forest_router_padding; setup calls the policy's check and the critic's setup by their own names. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
…loss With every microbatch size 1 the run never padded. A critic microbatch of 2 and step-scope padding pad steps with an odd row count, in the checkpointed run and the resumed one. The critic-loss check gets an upper bound. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
Full-batch and streaming PPO: the padding copies reach the policy and the critic, the critic gbs counts them, and the step deletes them. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
Main moved rollout checkpointing into nemo_rl/algorithms/rollout_checkpointing (#5011). Step padding handling of the replay inventory check now lives in rollout_checkpointing.inventory.validate_replay_inventory, called from the restorer ("clear") and the snapshotter ("allow"). Forest's estimator check keeps main's new seq_logprob_error_in_loss rejection. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
The stage zeroed advantages outside the mask by multiplying with it, so a dataset loss weight of 0.5 scaled the stored advantage again on top of GAE and the loss. Zero the tokens outside the mask without rescaling the rest. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
The inventory exception for forest_padding_scope=step also applied to full trainer checkpoints, so an extra _pad row passed the save check and restore deleted it. A full checkpoint never owns a streamed step's rows, so gate the exception on a rollout snapshot on save and from_rollout_snapshot on restore. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
raw_reward reads neither normalize_over nor whiten_execution_padding, so setting them promised a whitening change that never happened. Fail at config validation instead. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
The PPO exemplar and three guide summaries said every logical rollout keeps one advantage, which only holds for GRPO. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Remove token_capture.forest_padding_scope and its step mode: the controller's once-per-batch padding, the rollout snapshot's tolerance for step padding copies, the config, docs and tests. Forest groups keep padding themselves to the policy and critic row multiple. Signed-off-by: bg51717 <[email protected]>
Remove token_capture.exclude_padding_from_router_stats: the router_excluded_rows field the finalizer publishes, the policy and critic masks built from it, the critic's extra train fields, the config, docs and tests. Both models keep the Forest router check, which rejects routing that execution padding could perturb. Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
…never shipped Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Both PPO estimators now return zero advantages where the mask is zero, so the advantage stage no longer clears them a second time. Signed-off-by: bg51717 <[email protected]>
Trains Forest PPO on Nemotron-3 Nano 30B-A3B with expert-bias updates on the policy and the critic, so the router padding mask that keeps Forest's artificial rows out of expert-load counts is exercised. Signed-off-by: bg51717 <[email protected]>
…embler Since padding moved to the controller, the reassembler builds no padding rows; the per-batch padding copies set the column themselves. Signed-off-by: bg51717 <[email protected]>
Per-group padding reported finalize/execution_padding_rows; per-batch padding reported nothing. The step now logs forest_padding_rows, summed over the step's chunks. Tests cover two padded streaming chunks and the GRPO path. Signed-off-by: bg51717 <[email protected]>
The old message (saved=4, current=1) read like a config mismatch; per-group padded checkpoints cannot resume under any config. Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
Member
Author
|
/ok to test 269be6e |
…ding Signed-off-by: bg51717 <[email protected]> # Conflicts: # nemo_rl/algorithms/single_controller.py # nemo_rl/algorithms/single_controller_utils/setup.py # nemo_rl/data_plane/schema.py
…est_utils pad_forest_step_rows only needs the data-plane client, the checkpoint barrier and the row multiple, so it becomes a module-level function in the new nemo_rl/algorithms/forest_utils package, next to logical_advantage.py moved from single_controller_utils. Signed-off-by: bg51717 <[email protected]>
…se helper validate_forest_checkpoint_metadata derives the current row multiple from forest_training, since restore always passed 1 under Forest; the replay inventory folds its one-expression padding helper in and requires step_padding. The guide no longer says padding IDs are fixed before publication. Signed-off-by: bg51717 <[email protected]>
The step padder moved to forest_utils.utils.pad_forest_step_rows; its router exclusion of the pad copies moves with it. Signed-off-by: bg51717 <[email protected]>
…critic fake Signed-off-by: bg51717 <[email protected]>
Signed-off-by: bg51717 <[email protected]>
…all check Signed-off-by: bg51717 <[email protected]>
Member
Author
|
/ok to test af85133 |
1 task done
…tats Signed-off-by: bg51717 <[email protected]> # Conflicts: # nemo_rl/algorithms/forest_utils/utils.py # nemo_rl/algorithms/single_controller.py # tests/unit/experience/test_cc_cpu_pipeline.py # tests/unit/experience/test_selected_forest_boundaries.py # tests/unit/single_controller/test_logical_advantage.py # tests/unit/single_controller/test_setup.py
…tats Signed-off-by: bg51717 <[email protected]> # Conflicts: # tests/unit/experience/test_selected_forest_boundaries.py
Main renamed token_capture.forest_training to token_capture.forest.enabled. The router-statistics setup and its test still used the old name. Signed-off-by: bg51717 <[email protected]>
Member
Author
|
/ok to test 0522291 |
yuki-97
reviewed
Dec 3, 2026
yuki-97
left a comment
Contributor
There was a problem hiding this comment.
Thanks for resolving the previous comments: the option is gone and exclusion is always on under Forest, the step-padding copies are marked, and the MoE nightly with its before/after comparison is in the description.
Scope: the whole PR at 0522291, including the nemo_rl/ changes the first review did not cover.
Checked in the original review:
- Mask shape and polarity match the pinned Megatron-LM, and expert-load counts accumulate only with grad enabled, so fetching the column for train steps is enough.
- Every Forest row carries the flag, and it stays with its row through sorting, packing and DP sharding.
- The non-Forest path is unchanged, and the three helpers moved to
common.pyare identical to the originals. - The new unit tests ran and passed in CI at the head; the nightly does not run in CI.
Remaining comments
- Remove the unreachable prepacked-input check in
data.pyand its mention in the PR description. - Remove the unused
moe_aux_loss_coeffsetting from both the policy and critic recipe blocks.
Nits
- Use the Forest router-padding flag directly on the critic. Every Forest critic training batch fetches the column.
- Mark step-padding copies unconditionally. Every Forest batch carries the exclusion column.
- Combine the two router checks and give the policy and critic setup methods the same name.
- Drop the leading underscores from the three helpers now imported from
common.py. - Reuse
_unwrapped_chunksin_model_self_packs_for_cp. - Rename
_router_excluded_fieldsto_forest_train_fieldsto make clear that both workers fetch these fields.
nemo-rl-review: kind=expert harness=codex/0.173.0 model=gpt-6.2-astra effort=medium review-pr-team=v3 reviewed=0522291
Signed-off-by: fujial <[email protected]>
Contributor
|
Addressed all eight outstanding review threads in da4ead9.
|
Contributor
|
/ok to test da4ead9 |
This branch has not been deployed
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 and why
Stacked on #5379.
Forest training (#5047) adds rows that carry no loss: padding rows that fill a batch up to the row multiple, and rows of failed rollouts that borrow another row's input. On an MoE model these rows still reach the router, so their tokens count toward expert load and shift the next expert-bias updates.
Under Forest training these rows are now always left out of expert-load counts:
router_excluded_rowscolumn, and the per-batch padding copies from feat(forest): pad Forest rows once per training batch #5379 set it too.nemo_rl/models/megatron/common.py, so the critic can use them.ppo-nanov3-30BA3B-3n4g-megatron-gym-single-controller-forest: Forest PPO on Nemotron-3 Nano 30B-A3B with expert-bias updates on the policy and the critic. Every other Forest test trains dense Qwen3-0.6B, where no mask is built.Issues
Follow-up to #5047.
Convergence / perf / functionality proof
Forest PPO on Nemotron-3 Nano 30B-A3B (the new nightly's recipe, 2 steps), on GB200 3 nodes x 4 GPUs, once on #5379 and once on this PR. A temporary log printed, for each expert-bias update, the tokens the router counted (summed over ranks, divided by top-k 6) and the real tokens of each rank's rows:
token_mult_prob_error1.073 (1.074), the same step time.Needs upstream changes
None