include vs excludeNVIDIA-NeMo/RL #4160 ยท follow-up #4968 ยท permalinks pinned to head 1429122e
grpo.masked_reward_policy: include (default) or exclude. All four trainers apply it the same way.exclude_infra), and the include-vs-exclude training comparison was never posted.The loss mask never changes; a masked row never trains. The new key decides only which rows vote, meaning which rows count toward the group baseline, the standard deviation, batch normalization and dynamic-sampling admission. Under include, every row with a nonzero dataset weight votes (_include_valid_mask). Under exclude, only rows with a nonzero loss weight vote. Voting is yes or no: a row with loss weight 0.5 still gets one full vote (_binary_participation).
The same three rows train in both columns. Only the baseline moves. Under include the two masked zeros pull the average down, so the correct answers r1 and r2 get a bigger push (+0.60 instead of +0.33). That is the trade-off. A row that was cut off really did fail, so counting it is fair. A row the environment flagged because its own grader broke is not a real measurement, yet under include it still moves its siblings. #4968 is the follow-up for that case.
The three loop trainers call one shared helper, _advantage_valid_mask. SingleController makes the same two-way choice in its own six lines, because that stage also runs PPO. Every path then passes the result to the estimator as valid_mask. That is where they become one: GRPO, GDPO and Reinforce++ all read it (GRPO, GDPO, Reinforce++).
| Trainer | Picks the voters at | What the default (include) changed |
|---|---|---|
| Legacy sync GRPO | grpo.py L4150 | GRPO/GDPO group averages: nothing. Reinforce++ batch normalization now counts masked rewards. |
| Async GRPO | grpo.py L5994 | Same as legacy. |
| TransferQueue | grpo_sync.py L1058 | Same as legacy, and rows flagged with mask_sample no longer train (they used to train at full weight). |
| SingleController | advantage_stage.py L424 | Masked, cut-off and sequence-error rows now vote. Before, only rows that train voted. |
Two kinds of rows never vote, on any trainer, under either setting: prompts too long to fit the sequence limit (the dataset gives them loss_multiplier = 0 before any rollout), and SingleController's empty placeholder rows.
Why PPO is left out. In advantage_stage.py, the check not cfg.is_ppo only avoids reading a field PPO's config does not have. PPO's GAE estimator has no group baseline. It whitens advantages over the tokens that train (L575) and never reads valid_mask. So the setting has nothing to change for PPO.
exclude when your environment flags rows because its own grader or tooling failed. Those rewards are noise, and under include they shift every sibling's advantage. Keep include (the default) when masked rows are real failures, such as answers cut off at the length limit. No controlled training run comparing the two has been published yet. To run one, use the paired include / exclude configs.