fix(grpo): grpo_sync dict unpack of seq_logprob error (#2559 follow-up) - #2607
Closed
qiaochuz-nv wants to merge 2 commits into
Closed
fix(grpo): grpo_sync dict unpack of seq_logprob error (#2559 follow-up)#2607qiaochuz-nv wants to merge 2 commits into
qiaochuz-nv wants to merge 2 commits into
Conversation
…ng (#2559 follow-up) PR #2559 changed compute_and_apply_seq_logprob_error_masking to return a dict, and updated the two grpo.py call sites at lines 1935 and 3064. However, PR #2439 (data plane transfer queue integration) merged the same day added a NEW call site at grpo_sync.py:772-781 that #2559 did not see and therefore did not migrate. HEAD origin/main now raises ValueError: too many values to unpack (expected 3) at GRPO sync step=1 the moment data_plane.enabled=true is set. Fix replaces the 3-tuple unpack with the same dict-key access pattern used in grpo.py, preserving the existing local variable names (max_seq_mult_prob_error, num_masked_seqs, masked_correct_pct) so the downstream metrics emission at lines 1014-1016 is unchanged. Verified end-to-end on EOS H100 with nemo-rl-nightly-20260528.sqsh: - BEFORE: ValueError: too many values to unpack (expected 3) at step=1 - AFTER: 2/2 train steps PASS, train/loss valid, gen_kl_error < 0.02 Signed-off-by: Qiaochu Zhu <qiaochuz@nvidia.com>
Adds CPU-runnable unit coverage for the 3 dict-access lines at grpo_sync.py:773-781 introduced by the #2559 follow-up fix. Signed-off-by: Qiaochu Zhu <qiaochuz@nvidia.com>
@qiaochuz-nv, 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 336c80a |
@qiaochuz-nv, 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 799db61 |
Contributor
|
Thank you @qiaochuz-nv, looks like there's existing PR to fix |
Contributor
Author
|
close directly thanks @ZhiyuLi-Nvidia |
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.
Summary
PR #2559 changed
compute_and_apply_seq_logprob_error_maskinginnemo_rl/algorithms/grpo.py:1294from a 3-tuple return to a dictreturn, and migrated the two existing call sites in grpo.py
(lines 1935 and 3064) to consume the dict via key access. However,
the same day, PR #2439 (data plane transfer queue integration) merged
a NEW call site at
nemo_rl/algorithms/grpo_sync.py:772-781. PR #2559never touched grpo_sync.py, so this new call site retained its
3-tuple unpack and now raises
ValueError: too many values to unpack (expected 3)at GRPO sync step=1 the momentdata_plane.enabled=trueis set on
origin/main.This PR replaces the 3-tuple unpack in grpo_sync.py with the same
dict-key access pattern used in grpo.py, preserving the existing local
variable names (
max_seq_mult_prob_error,num_masked_seqs,masked_correct_pct) so the downstream metrics emission atgrpo_sync.py:1014-1016 is unchanged.
Root cause
Two PRs landed on
origin/mainwithin hours of each other on2026-05-28:
64be007eb"feat(grpo): add sequence-level logprob error metrics" (feat(grpo): add sequence-level logprob error metrics #2559)— refactored
compute_and_apply_seq_logprob_error_maskingto return adict with 8 keys (added
mean_*,min_*,*_after_maskvariants ontop of the original 3 fields). Updated the 2 call sites it knew
about:
grpo.py:1935andgrpo.py:3064.4454fa64e"feat: data plane transfer queue integration" (feat: data plane transfer queue integration #2439)— added a NEW call site at
grpo_sync.py:772-781that destructuresthe legacy 3-tuple. This file was never touched by feat(grpo): add sequence-level logprob error metrics #2559.
Because the two diffs do not overlap textually (different files,
different functions), neither PR's CI run saw the mismatch — each PR
passed in isolation. The bug only surfaces post-merge when both diffs
are present and
data_plane.enabled=trueexercisesgrpo_sync.py.Why the existing test did not catch this
The repo's
test_grpo_data_plane_transfer_queue_daily_pr.shtestcase(introduced by #2439) does exercise this exact code path. It started
failing immediately on
origin/mainonce #2559 merged. This PR isthe fix surfaced by that testcase.
Test command (functional / e2e)
Container:
/lustre/fsw/coreai_dlalgo_ci/qiaochuz/containers/nemo-rl-nightly-20260528.sqshCluster: EOS,
coreai_dlalgo_qa, partition=batch, 1 node, 2× H100Command (drives both BEFORE and AFTER runs through the daily-PR
testcase plumbing —
_runtime_cherry_pick.shensures/opt/nemo-rlmatches
origin/mainHEAD64be007ebpost-#2559):Before fix — run output
SLURM job 5342797 (EOS,
coreai_dlalgo_qa-qiaochuz, 2× H100,nemo-rl-nightly-20260528.sqsh,
/opt/nemo-rlHEAD =5494d14d5post-#2559):
After fix — run output
SLURM job 5342817 (same cluster + container; patched
grpo_sync.pyfile-overlay'd into
/opt/nemo-rl/nemo_rl/algorithms/grpo_sync.pybefore launching
run_grpo.py):Detected by
test_grpo_data_plane_transfer_queue_daily_pr.shnemo_llm/test_suite/rl/testcases/algorithms/test_grpo_data_plane_transfer_queue_daily_pr.shTest plan
grpo_sync.py:1014-1016unchangedgrpo.py:1935-1962migration done by feat(grpo): add sequence-level logprob error metrics #2559covering the 3 new dict-access lines