Repository navigation
fix(sc): apply reward scaling before advantage estimation - #3787
tianyi-zhang-02 wants to merge 1 commit into
Conversation
fbed880 to
93c2551
Compare
…ity PRs NVIDIA-NeMo#3786 and NVIDIA-NeMo#3787 each rewrote this comment to name the knob they removed, so they conflicted on nothing but the prose -- the tuple entries merged fine. Stating the rule once, without naming a knob, lets the two auto-merge in either order. Signed-off-by: Tianyi Zhang <[email protected]> Signed-off-by: Tianyi Zhang <[email protected]>
…ity PRs NVIDIA-NeMo#3786 and NVIDIA-NeMo#3787 each rewrote this comment to name the knob they removed, so they conflicted on nothing but the prose -- the tuple entries merged fine. Stating the rule once, without naming a knob, lets the two auto-merge in either order. Signed-off-by: Tianyi Zhang <[email protected]> Signed-off-by: Tianyi Zhang <[email protected]>
|
Heads-up on merge order, with the resolution written out. Four of my open PRs edit the same twelve-line block — the
I checked every pair by actually merging them. #3786 × #3787 is clean now — they only ever conflicted on the comment wording and on both adding a test before the same anchor, and both are fixed. The remaining four pairs are a genuine textual conflict on that block, and no restructuring avoids it: extracting or reordering the list conflicts just as hard. So rather than force a stack, here is the resolution. Whichever order they land in, this is the merged form: # An enabled one here describes shaping this run does not do. An entry
# leaves this list when the SC path starts implementing it -- rejecting a
# knob is only right while nobody honours it.
#
# DistillationConfig defines none of them: there is no reward to shape or
# filter on, so the list cannot even be evaluated on that path.
unsupported = (
[]
if is_distillation_run(master_config)
else [
name
for name, enabled in (
("use_dynamic_sampling", algo_cfg.use_dynamic_sampling),
("reward_scaling", algo_cfg.reward_scaling.enabled),
("reward_shaping", algo_cfg.reward_shaping.enabled),
)
if enabled
]
)I built that merge locally and ran the SC and config suites against it — 1084 passed. Happy to rebase whichever ones are left once the first lands; just say which order you want. |
The guard used to wrap that list in a conditional, which put this PR on the same twelve lines as NVIDIA-NeMo#3786 and NVIDIA-NeMo#3787 -- each of those removes an entry from it. Four pairwise conflicts on nothing but placement. Returns early instead. DistillationConfig defines none of the knobs the list names, so the check does not apply and the comprehension could not be evaluated anyway; everything after it is PPO-specific and returns early on this path already. The colocated requirement is the one thing that does apply, so it moves into a helper and the guard calls it directly rather than falling through. The list itself is now untouched by this PR, so all four conflicts go away and none of the three needs to land before the others. Signed-off-by: Tianyi Zhang <[email protected]> Signed-off-by: Tianyi Zhang <[email protected]>
The guard used to wrap that list in a conditional, which put this PR on the same twelve lines as NVIDIA-NeMo#3786 and NVIDIA-NeMo#3787 -- each of those removes an entry from it. Four pairwise conflicts on nothing but placement. Returns early instead. DistillationConfig defines none of the knobs the list names, so the check does not apply and the comprehension could not be evaluated anyway; everything after it is PPO-specific and returns early on this path already. The colocated requirement is the one thing that does apply, so it moves into a helper and the guard calls it directly rather than falling through. The list itself is now untouched by this PR, so all four conflicts go away and none of the three needs to land before the others. Signed-off-by: Tianyi Zhang <[email protected]> Signed-off-by: Tianyi Zhang <[email protected]>
The guard used to wrap that list in a conditional, which put this PR on the same twelve lines as NVIDIA-NeMo#3786 and NVIDIA-NeMo#3787 -- each of those removes an entry from it. Four pairwise conflicts on nothing but placement. Returns early instead. DistillationConfig defines none of the knobs the list names, so the check does not apply and the comprehension could not be evaluated anyway; everything after it is PPO-specific and returns early on this path already. The colocated requirement is the one thing that does apply, so it moves into a helper and the guard calls it directly rather than falling through. The list itself is now untouched by this PR, so all four conflicts go away and none of the three needs to land before the others. Signed-off-by: Tianyi Zhang <[email protected]> Signed-off-by: Tianyi Zhang <[email protected]>
The guard used to wrap that list in a conditional, which put this PR on the same twelve lines as NVIDIA-NeMo#3786 and NVIDIA-NeMo#3787 -- each of those removes an entry from it. Four pairwise conflicts on nothing but placement. Returns early instead. DistillationConfig defines none of the knobs the list names, so the check does not apply and the comprehension could not be evaluated anyway; everything after it is PPO-specific and returns early on this path already. The colocated requirement is the one thing that does apply, so it moves into a helper and the guard calls it directly rather than falling through. The list itself is now untouched by this PR, so all four conflicts go away and none of the three needs to land before the others. Signed-off-by: Tianyi Zhang <[email protected]> Signed-off-by: Tianyi Zhang <[email protected]>
9e3cfc4 to
6535295
Compare
Scale rewards before advantage estimation on the Single Controller path, using the same helper and configuration semantics as legacy GRPO. Preserve current-main filtering and clipping behavior, and keep non-GRPO algorithms unchanged when the setting is absent. Signed-off-by: Tianyi Zhang <[email protected]>
5cd3e7a to
90d294e
Compare
What does this PR do?
Makes Single Controller apply the existing
grpo.reward_scalingsetting before advantage estimation, using the sharedscale_rewardshelper.This PR is intentionally limited to reward scaling. Current main already provides advantage clipping, overlong filtering, and environment sample masking. Reward shaping and message-level penalties remain out of scope because Single Controller does not yet carry the response-length/message fields they need.
The shipped default remains a no-op, and algorithms without a reward-scaling block remain unchanged.
Validation
Current head
90d294e9df9376dec52d71d94488d814a8d20b72, rebased onto upstreammainat90a2a212d503455d8590be5c8de3cb989d3425b0.tests/unit/single_controller/test_single_controller_actor.py: 61 passedgit diff --check: passedAn earlier pre-refresh head completed a real 2×H100 SC run with Qwen3-0.6B, Megatron policy/reference, vLLM, and TQ. With scaling enabled, rewards were mapped from
0..1to-1..1; training completed with loss0.1040and grad norm2.6518. The current head was shrunk against main and rerun through the full SC actor suite; the 2-GPU functional run was not repeated after that refresh.