-
Notifications
You must be signed in to change notification settings - Fork 271
feat: support GDPO #1986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
nbasyl
wants to merge
9
commits into
NVIDIA-NeMo:main
Choose a base branch
from
nbasyl:gdpo
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+719
−41
Open
feat: support GDPO #1986
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f614e4a
squash (remove dependency update)
yuki-97 295e315
update dataset to new structure
yuki-97 578698e
register env and remove run_gdpo_gsm8k.py
yuki-97 16b0d53
align compute_advantage interface and move the initialization forward
6e1fd96
fix a small bug forgot to import re
e6a28ad
revert dependency
yuki-97 0428ef1
update math_gdpo_data_processor and system_prompt
yuki-97 665219d
add assert and revert some missing comments
yuki-97 b7597c6
revert async change and enable fast test
yuki-97 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| # GDPO: inherits from grpo_math_1B.yaml and overrides only what differs. | ||
| defaults: grpo_math_1B.yaml | ||
|
|
||
| grpo: | ||
| adv_estimator: | ||
| name: "gdpo" | ||
| normalize_rewards: true | ||
| use_leave_one_out_baseline: false | ||
|
|
||
| checkpointing: | ||
| checkpoint_dir: "results/gdpo" | ||
|
|
||
| policy: | ||
| model_name: "Qwen/Qwen2.5-1.5B-Instruct" | ||
| logprob_batch_size: 4 | ||
| max_total_sequence_length: 1024 | ||
| megatron_cfg: | ||
| optimizer: | ||
| weight_decay: 0.0 | ||
| scheduler: | ||
| lr_decay_style: "cosine" | ||
| lr_warmup_iters: 10 | ||
|
|
||
| # GDPO uses a single flat data config (GSM8K + math_gdpo_data_processor); replace parent's train/validation/default. | ||
| data: | ||
| _override_: true | ||
|
|
||
| max_input_seq_length: ${policy.max_total_sequence_length} | ||
| shuffle: true | ||
| num_workers: 1 | ||
|
|
||
| use_multiple_dataloader: false | ||
|
|
||
| train: | ||
| dataset_name: "gsm8k" | ||
| split: train | ||
| validation: | ||
| dataset_name: "gsm8k" | ||
| split: test | ||
|
|
||
| default: | ||
| prompt_file: null | ||
| system_prompt_file: "examples/prompts/gsm8k.txt" | ||
| processor: "math_gdpo_data_processor" | ||
| env_name: "math_multi_reward" | ||
|
|
||
| env: | ||
| math_multi_reward: | ||
| num_workers: 8 | ||
| math_verify_impl: "hf_math_verify" | ||
|
|
||
| logger: | ||
| wandb_enabled: true | ||
| wandb: | ||
| project: "gdpo-dev" | ||
| name: "gdpo-dev-logger" | ||
| swanlab: | ||
| project: "gdpo-dev" | ||
| name: "gdpo-dev-logger" | ||
| mlflow: | ||
| experiment_name: "gdpo-dev" | ||
| run_name: "gdpo-dev-logger" |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| You are a helpful AI assistant. | ||
|
|
||
| For every request, you should carefully think through the math problem step by step, then provide the final answer in integer format. | ||
|
|
||
| Steps for Each Request: | ||
| 1. Think: Provide detailed, step-by-step reasoning, calculations, or derivations. | ||
| 2. Produce Final Answer: After step-by-step reasoning, output the final answer in integer format. | ||
|
|
||
| Output Format: | ||
| <think>Your thoughts and reasoning</think> | ||
| <answer>Final answer in integer format</answer> | ||
|
|
||
| Important Notes: | ||
| 1. You must include your reasoning steps inside <think>. | ||
| 2. You must always output the Final Answer within <answer> after the reasoning steps is done. | ||
| 3. You should consistently work through the solution step by step before giving the final answer. | ||
| 4. The final answer can only be an integer. |
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.