Skip to content

feat: GDPO vs GRPO multi-reward example and collapse demo - #2681

Merged
terrykong merged 6 commits into
NVIDIA-NeMo:mainfrom
anjalibshah:gdpo-examples-and-skill-upstream
Jul 21, 2026
Merged

terrykong merged 6 commits into
NVIDIA-NeMo:mainfrom
anjalibshah:gdpo-examples-and-skill-upstream

Conversation

@anjalibshah

@anjalibshah anjalibshah commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Documentation and tooling for multi-reward RL with GDPO (arXiv:2601.05242); no runtime-code changes.

  • examples/configs/grpo_math_1B_multireward.yaml — a matched GRPO control, identical to gdpo_math_1B.yaml except adv_estimator.name (grpo vs gdpo), for an apples-to-apples comparison on the same multi-reward env.
  • examples/run_gdpo_grpo_advantage_demo.py — a CPU-only demonstration of advantage collapse: GRPO assigns identical advantages to same-total/different-composition responses, while GDPO separates them. Doubles as a regression test via assertions.
  • skills/nemo-rl-gdpo-experiment/ — an agent skill (SKILL.md + skill-card + evals + references) for setting up multi-reward GDPO and the GDPO-vs-GRPO comparison workflow. (skill removed during review — guidance folded into docs/guides/grpo.md)

Note

The skill's BENCHMARK.md and signature are produced by NVSkills CI (a maintainer comment of /nvskills-ci), not included in this PR. (no longer applicable — the skill was removed)

@anjalibshah
anjalibshah requested review from a team as code owners June 3, 2026 23:15
@copy-pr-bot

copy-pr-bot Bot commented Jun 3, 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.

@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

Hi, @anjalibshah thanks a lot for the pr.

All looks good to me.

The only caveat is about the skills, looks like experiment-specific content isn't appropriate as part of nemo-rl repo skill:

┌─────────────────────────┬────────────────────────────────────────────────────────────────────┐
│     Existing skill      │                    Recurring general workflow?                     │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ launch-nemo-rl          │ Yes — every K8s launch reuses the same steps                       │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ nemo-rl-auto-research   │ Yes — every autonomous research campaign uses the same lifecycle   │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ nemo-rl-brev-etiquette  │ Yes — every Brev session hits the same disk/env constraints        │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ nemo-rl-docs            │ Yes — every docs contribution uses the same conventions            │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ nemo-rl-session-memory  │ Yes — every long-running session uses the same persistence pattern │
└─────────────────────────┴────────────────────────────────────────────────────────────────────┘

All existing skills are for general, recurring workflows including setup, k8s, documentation etc, while none of it is specific for an experiment recipe.

So what do you think to make it a doc instead or fold the content into docs/guides/grpo.md (already has a GDPO subsection)?

@ZhiyuLi-Nvidia ZhiyuLi-Nvidia added CI:docs Run doctest CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) labels Jul 15, 2026
@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

/ok to test 90f71f4

@anjalibshah

Copy link
Copy Markdown
Contributor Author

Hi, @anjalibshah thanks a lot for the pr.

All looks good to me.

The only caveat is about the skills, looks like experiment-specific content isn't appropriate as part of nemo-rl repo skill:

┌─────────────────────────┬────────────────────────────────────────────────────────────────────┐
│     Existing skill      │                    Recurring general workflow?                     │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ launch-nemo-rl          │ Yes — every K8s launch reuses the same steps                       │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ nemo-rl-auto-research   │ Yes — every autonomous research campaign uses the same lifecycle   │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ nemo-rl-brev-etiquette  │ Yes — every Brev session hits the same disk/env constraints        │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ nemo-rl-docs            │ Yes — every docs contribution uses the same conventions            │
├─────────────────────────┼────────────────────────────────────────────────────────────────────┤
│ nemo-rl-session-memory  │ Yes — every long-running session uses the same persistence pattern │
└─────────────────────────┴────────────────────────────────────────────────────────────────────┘

All existing skills are for general, recurring workflows including setup, k8s, documentation etc, while none of it is specific for an experiment recipe.

So what do you think to make it a doc instead or fold the content into docs/guides/grpo.md (already has a GDPO subsection)?

Thanks Zhiyu — agree, and good catch on the convention. You're right that the existing skills are all general infra/process, so I'll fold the content into docs/guides/grpo.md file in the GDPO subsection. And I'll remove skills/nemo-rl-gdpo-experiment/ entirely

@anjalibshah
anjalibshah requested a review from a team as a code owner July 15, 2026 23:54
@github-actions github-actions Bot added the Documentation Improvements or additions to documentation label Jul 15, 2026
@anjalibshah

Copy link
Copy Markdown
Contributor Author

Done in 11a3268. Removed skills/nemo-rl-gdpo-experiment/ entirely and folded the additive pieces into the existing GDPO section of docs/guides/grpo.md.

@ZhiyuLi-Nvidia

Copy link
Copy Markdown
Contributor

Found DCO failure in unit tests.

Could you finally git commit / amend -s to sign the commits?

ZhiyuLi-Nvidia
ZhiyuLi-Nvidia previously approved these changes Jul 16, 2026
@anjalibshah

Copy link
Copy Markdown
Contributor Author

Found DCO failure in unit tests.

Could you finally git commit / amend -s to sign the commits?

Yes, waiting for #2680 to merge, then I'll rebase #2681 (the grpo.md docs) so its subsection stacks under #2680's reward_weights one

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

Team review (5 agents; the demo was independently re-run by three of them and passes on the PR head). The content is technically sound: the demo's estimator API usage is correct, the new config deep-merges cleanly (verified via load_config and the config-walker unit test), and both "Practical notes" claims are true against source (scale_rewards rescales each rewardN; GDPO's final normalization is unconditional). Inline comments cover a CI-blocking format issue and a few doc-wording accuracy points.

A few non-inline notes:

  • #2680 coordination: this PR's three new grpo.md subsections and #2680's #### Per-reward weights section insert at the same anchor (right after this line), so they will conflict textually on merge. Your plan to merge #2680 first and then rebase this PR so its subsections stack under the reward_weights one looks right — just noting the conflict is real. There's no hard dependency otherwise; this PR is safe against current main.
  • PR title/description: after 11a3268 removed skills/nemo-rl-gdpo-experiment/, the description's skill bullet and the NVSkills-CI note (and the "and experiment skill" part of the title) no longer match the diff — worth a quick refresh so reviewers see the actual scope (docs + control config + demo).
  • DCO: the head commit 11a3268 is missing a Signed-off-by trailer (the first two commits have it) — that's the DCO failure already flagged; sounds like it's covered by your planned rebase.

Generated by Claude Code

Comment thread docs/guides/grpo.md Resolved
Comment thread docs/guides/grpo.md Resolved
Comment thread docs/guides/grpo.md Resolved
anjalibshah and others added 5 commits July 21, 2026 10:49
…t skill

Add a matched GRPO control config for the multi-reward math env, a CPU-only
advantage-collapse demo (GRPO collapses same-total responses to one advantage;
GDPO separates them), and the nemo-rl-gdpo-experiment skill (SKILL.md + evals)
documenting multi-reward GDPO setup and the GDPO-vs-GRPO comparison workflow.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Anjali Shah <[email protected]>
Add the author-provided model card (owner, license, use case, risks, references,
output spec, eval task composition) required before NVSkills CI benchmarking and
signing. Evaluation results are left pending; they are populated by NVSkills CI.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Signed-off-by: Anjali Shah <[email protected]>
…-experiment skill

Per review on NVIDIA-NeMo#2681: experiment-specific content doesn't fit the repo's skill
convention (existing skills are general infra/process workflows). Remove the
skills/nemo-rl-gdpo-experiment/ directory and fold the genuinely additive
pieces into the existing GDPO section of docs/guides/grpo.md:
- matched GDPO-vs-GRPO comparison workflow (points at the examples/ control
  config and CPU collapse demo, both unchanged)
- what to measure (per-reward convergence, per-prompt advantage spread)
- practical notes: reward_scaling applies per component; final batch
  normalization always runs regardless of normalize_rewards

Deliberately excludes reward_weights guidance to avoid overlap with NVIDIA-NeMo#2680,
which documents that option. Env-authoring contract is left in
docs/guides/environments.md where it already lives.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: Anjali Shah <[email protected]>
Addresses review on NVIDIA-NeMo#2681 (bridge-emission block was uncovered by any test). Move
the reward/<name> column construction from run_async_nemo_gym_rollout into a pure
helper next to extract_reward_components, and unit-test it in test_nemo_gym.py:
keys are exactly what get_gdpo_reward_component_keys selects, missing components
fill 0.0, ordering is deterministic (sorted), and no-components -> no columns.
This directly guards the producer->consumer contract that the reward1/reward2 bug
slipped through.

Signed-off-by: Anjali Shah <[email protected]>
…o.md wording

Per review on NVIDIA-NeMo#2681:
- Remove examples/run_gdpo_grpo_advantage_demo.py (untested, bit-rots; breaks on
  main after the reward/<name> rename) and cite the GDPO paper's collapse example.
- Remove examples/configs/grpo_math_1B_multireward.yaml (untested config); show the
  GRPO control as a CLI override on gdpo_math_1B.yaml instead.
- grpo.md: note per-component rewards are not logged out of the box; use reward/<name>
  naming (post-NVIDIA-NeMo#2597) in "What to measure" and "Practical notes"; name the checkpoint
  dir / logger deltas in the comparison so it doesn't overstate "only the estimator".

Signed-off-by: Anjali Shah <[email protected]>
@anjalibshah
anjalibshah requested review from a team as code owners July 21, 2026 18:54
@terrykong terrykong changed the title feat: GDPO vs GRPO multi-reward example, collapse demo, and experiment skill feat: GDPO vs GRPO multi-reward example and collapse demo Jul 21, 2026
@anjalibshah
anjalibshah force-pushed the gdpo-examples-and-skill-upstream branch from 3596242 to 30b6243 Compare July 21, 2026 19:58
@terrykong terrykong removed the CI:docs Run doctest label Jul 21, 2026
@terrykong

Copy link
Copy Markdown
Collaborator

/ok to test 30b6243

copy-pr-bot Bot pushed a commit that referenced this pull request Jul 21, 2026
…gym nightly

Addresses review on #2681: point the GDPO nightly at the multi-reward gym path so it
exercises the *new* reward/<name> bridge end to end, instead of the native rollout path
(already covered on main). Qwen2.5-1.5B on 1x8 H100, DTensor backend.

- examples/nemo_gym/gdpo_example_tool_call_multireward.yaml: GDPO-gym base wired to the
  example_tool_call_multireward env (config_paths, shipped data, reward_weights).
- examples/configs/recipes/llm/gdpo-qwen2.5-1.5b-1n8g-gym-multireward.yaml + .sh: nightly
  recipe/launcher (gym entrypoint, DTensor for the 1.5B model, hermes tool parser).
- Remove the native gdpo-...-fsdp2-reward-weights recipe/.sh and swap the nightly.txt
  entry. reward_weights math stays covered by unit tests; the bridge emission is now
  covered by test_build_reward_component_columns.

Signed-off-by: Anjali Shah <[email protected]>
terrykong
terrykong previously approved these changes Jul 21, 2026

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

lgtm. thanks @anjalibshah . merge subject to nightly test running

@anjalibshah

Copy link
Copy Markdown
Contributor Author

lgtm. thanks @anjalibshah . merge subject to nightly test running

Thanks @terrykong!

@terrykong

Copy link
Copy Markdown
Collaborator

from @anjalibshah :

Metric Checks
┏━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━┓
┃ Status    ┃ Check                                                                                ┃ Value       ┃ Message    ┃
┡━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━┩
│ PASS     │ max(data["train/reward"]) > 0.0                                                                   │ 2.0        │        │
│ PASS     │ mean(data["train/example_tool_call_multireward_simple_agent/correctness/mean"]) >= 0.0                                       │ 0.96875      │        │
│ PASS     │ mean(data["train/example_tool_call_multireward_simple_agent/schema_valid/mean"]) >= 0.0                                       │ 0.971875     │        │
│ PASS     │ mean(data["train/example_tool_call_multireward_simple_agent/format/mean"]) >= 0.0                                          │ 0.0        │        │
└───────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┴───────────────────┴─────

@anjalibshah
anjalibshah force-pushed the gdpo-examples-and-skill-upstream branch from 28454c0 to d0e9f39 Compare July 21, 2026 21:13
@terrykong

Copy link
Copy Markdown
Collaborator

/ok to test d0e9f39

copy-pr-bot Bot pushed a commit that referenced this pull request Jul 21, 2026
…gym nightly

Addresses review on #2681: point the GDPO nightly at the multi-reward gym path so it
exercises the *new* reward/<name> bridge end to end, instead of the native rollout path
(already covered on main). Qwen2.5-1.5B on 1x8 H100, DTensor backend.

- examples/nemo_gym/gdpo_example_tool_call_multireward.yaml: GDPO-gym base wired to the
  example_tool_call_multireward env (config_paths, shipped data, reward_weights).
- examples/configs/recipes/llm/gdpo-qwen2.5-1.5b-1n8g-gym-multireward.yaml + .sh: nightly
  recipe/launcher (gym entrypoint, DTensor for the 1.5B model, hermes tool parser).
- Remove the native gdpo-...-fsdp2-reward-weights recipe/.sh and swap the nightly.txt
  entry. reward_weights math stays covered by unit tests; the bridge emission is now
  covered by test_build_reward_component_columns.

Signed-off-by: Anjali Shah <[email protected]>
terrykong
terrykong previously approved these changes Jul 21, 2026
…gym nightly

Addresses review on NVIDIA-NeMo#2681: point the GDPO nightly at the multi-reward gym path so it
exercises the *new* reward/<name> bridge end to end, instead of the native rollout path
(already covered on main). Qwen2.5-1.5B on 1x8 H100, DTensor backend.

- examples/nemo_gym/gdpo_example_tool_call_multireward.yaml: GDPO-gym base wired to the
  example_tool_call_multireward env (config_paths, shipped data, reward_weights).
- examples/configs/recipes/llm/gdpo-qwen2.5-1.5b-1n8g-gym-multireward.yaml + .sh: nightly
  recipe/launcher (gym entrypoint, DTensor for the 1.5B model, hermes tool parser).
- Remove the native gdpo-...-fsdp2-reward-weights recipe/.sh and swap the nightly.txt
  entry. reward_weights math stays covered by unit tests; the bridge emission is now
  covered by test_build_reward_component_columns.

Signed-off-by: Anjali Shah <[email protected]>
@terrykong

Copy link
Copy Markdown
Collaborator

/ok to test 2278596

@terrykong
terrykong merged commit fd93fd4 into NVIDIA-NeMo:main Jul 21, 2026
78 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI:Lfast Runs a fast test suite and re-use nightly `main` container (but sync dependencies to PRs version) Documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants