-
Notifications
You must be signed in to change notification settings - Fork 276
feat: support GDPO (New) #2069
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
8
commits into
main
Choose a base branch
from
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.
Open
feat: support GDPO (New) #2069
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
91bd7c6
move from my personal brannch to here
yuki-97 dfd53e1
remove redudant repeat_batch key
nbasyl 9b7bc11
lint
yuki-97 e1a3452
update math env
yuki-97 841341d
pyrefly
yuki-97 77af8bf
address comments
yuki-97 e23fa7e
add assert
yuki-97 198c991
add unit test for gdpo estimator and multi-reward env
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
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
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.