-
Notifications
You must be signed in to change notification settings - Fork 94
[Feature] Add DAPO preset and Soft Overlong support #362
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
base: main
Are you sure you want to change the base?
Changes from all commits
a2a332a
af2cb5e
e0c3fb9
98b3b99
935a40f
d8b3673
0851942
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -908,6 +908,12 @@ def add_algo_arguments(parser): | |
|
|
||
| parser.add_argument("--eps-clip", type=float, default=0.2, help="PPO clip range") | ||
| parser.add_argument("--eps-clip-high", type=float, default=None, help="PPO clip upper range") | ||
| parser.add_argument( | ||
| "--soft-overlong-cache", | ||
| type=int, | ||
| default=None, | ||
| help="DAPO Soft Overlong penalty window; 0 disables it.", | ||
| ) | ||
| parser.add_argument( | ||
| "--eps-clip-c", | ||
| type=float, | ||
|
|
@@ -954,6 +960,7 @@ def add_algo_arguments(parser): | |
| "grpo", | ||
| "gspo", | ||
| "cispo", | ||
| "dapo", | ||
| "reinforce_plus_plus", | ||
| "reinforce_plus_plus_baseline", | ||
| "ppo", | ||
|
|
@@ -1889,9 +1896,29 @@ def vime_validate_args(args): | |
| assert args.use_dynamic_batch_size, "--balance-by-flops requires --use-dynamic-batch-size" | ||
| args.balance_data = True | ||
|
|
||
| if args.advantage_estimator == "dapo": | ||
| args.advantage_estimator = "grpo" | ||
| if args.eps_clip_high is None: | ||
| args.eps_clip_high = 0.28 | ||
| args.calculate_per_token_loss = True | ||
| if args.dynamic_sampling_filter_path is None: | ||
| args.dynamic_sampling_filter_path = ( | ||
| "vime.rollout.filter_hub.dynamic_sampling_filters.check_reward_nonzero_std" | ||
| ) | ||
| if args.soft_overlong_cache is None: | ||
| if args.rollout_max_response_len is None: | ||
| raise ValueError("DAPO requires --rollout-max-response-len or --soft-overlong-cache 0.") | ||
| args.soft_overlong_cache = max(1, int(args.rollout_max_response_len) // 4) | ||
|
Comment on lines
+1908
to
+1911
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If if args.soft_overlong_cache is None:
if args.rollout_max_response_len is None:
raise ValueError("DAPO requires --rollout-max-response-len to be set to enable Soft Overlong.")
args.soft_overlong_cache = max(1, int(args.rollout_max_response_len) // 4) |
||
|
|
||
| if args.eps_clip_high is None: | ||
| args.eps_clip_high = args.eps_clip | ||
|
|
||
| soft_overlong_cache = getattr(args, "soft_overlong_cache", None) | ||
| if soft_overlong_cache and ( | ||
| args.rollout_max_response_len is None or not 0 < soft_overlong_cache <= args.rollout_max_response_len | ||
| ): | ||
| raise ValueError("--soft-overlong-cache must be between 0 and --rollout-max-response-len.") | ||
|
|
||
| if args.advantage_estimator == "cispo" and args.eps_clip < 1.0: | ||
| logger.warning( | ||
| "CISPO is canonically single-sided, but --eps-clip=%s keeps the lower clip bound %s active. " | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think most of the ability of dapo is already support in vime, and for the soft overlong cache, I would say we recommend just use the --custom-reward-post-process-path instead of merging it, I'm still ok with merging this amount of code if it is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Let's leave this as the solution for now.