-
Notifications
You must be signed in to change notification settings - Fork 550
feat: async colocated GRPO with Megatron inference #2884
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
d6d5d93
feat: async colocated GRPO with Megatron inference
tdene b469e9b
Drop unnecessary synchronize
tdene deeac40
Defer colocated wake past checkpoint saves
tdene e33e49c
Allow inference_optimized during training
tdene 67d8e1f
Add functional test
tdene b1e36e5
Handle nightly tests
tdene 48d05e5
Remove the NEED_REFIT carve-out
tdene 7b3a56a
Handle rebase conflicts
tdene 3fd09e2
Address PR team review
tdene b3b51bb
Fix CI
tdene 8772e04
Address reviewer comment
tdene ab0c137
Fix CI
tdene a53fc02
Fix CI
tdene 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
50 changes: 50 additions & 0 deletions
50
examples/configs/recipes/llm/grpo-nanov3-30BA3B-4n4g-megatron_async_colocated.yaml
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,50 @@ | ||
| defaults: ../../grpo_math_1B.yaml | ||
| # Async colocated GRPO with Megatron (Nemotron-3-Nano-30B-A3B): training and | ||
| # generation share GPUs/workers; the engine sleeps across training steps and | ||
| # serves the shared weights (resharding into a dedicated inference layout when | ||
| # one is configured). Off-policy data via the replay buffer. | ||
| grpo: | ||
| num_prompts_per_step: 2 | ||
| num_generations_per_prompt: 8 | ||
| async_grpo: | ||
| enabled: true | ||
| max_trajectory_age_steps: 4 # weight versions a rollout may span | ||
| in_flight_weight_updates: true | ||
| # For AREAL-style KV invalidation, add recompute_kv_cache_after_weight_updates: true. | ||
| loss_fn: | ||
| use_importance_sampling_correction: true # required for off-policy replay data | ||
| checkpointing: | ||
| enabled: false | ||
| checkpoint_dir: results/grpo-nanov3-30BA3B-4n4g-megatron_async_colocated | ||
| save_period: 100 | ||
| policy: | ||
| model_name: nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-Base-BF16 | ||
| tokenizer: | ||
| name: nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16 | ||
| train_global_batch_size: 16 | ||
| train_micro_batch_size: 1 | ||
| logprob_batch_size: 1 | ||
| max_total_sequence_length: 2048 | ||
| megatron_cfg: | ||
| enabled: true | ||
| bias_activation_fusion: false | ||
| tensor_model_parallel_size: 2 | ||
| expert_model_parallel_size: 8 | ||
| sequence_parallel: true | ||
| dtensor_cfg: | ||
| enabled: false | ||
| sequence_packing: | ||
| enabled: false | ||
| generation: | ||
| backend: megatron | ||
| logger: | ||
| log_dir: logs/grpo-nanov3-30BA3B-4n4g-megatron_async_colocated | ||
| wandb_enabled: true | ||
| tensorboard_enabled: true | ||
| wandb: | ||
| project: nemo-rl | ||
| name: grpo-nanov3-30BA3B-4n4g-megatron_async_colocated | ||
| cluster: | ||
| gpus_per_node: 4 | ||
| num_nodes: 4 | ||
| segment_size: 2 | ||
41 changes: 41 additions & 0 deletions
41
examples/configs/recipes/llm/grpo-nanov3-30BA3B-4n4g-megatron_sync_colocated.yaml
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,41 @@ | ||
| defaults: ../../grpo_math_1B.yaml | ||
| grpo: | ||
| num_prompts_per_step: 2 | ||
| num_generations_per_prompt: 8 | ||
| loss_fn: | ||
| use_importance_sampling_correction: true # matches the async sibling so the pair isolates the loop | ||
| checkpointing: | ||
| enabled: false | ||
| checkpoint_dir: results/grpo-nanov3-30BA3B-4n4g-megatron_sync_colocated | ||
| save_period: 100 | ||
| policy: | ||
| model_name: nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-Base-BF16 | ||
| tokenizer: | ||
| name: nvidia/NVIDIA-Nemotron-3-Nano-30B-A3B-BF16 | ||
| train_global_batch_size: 16 | ||
| train_micro_batch_size: 1 | ||
| logprob_batch_size: 1 | ||
| max_total_sequence_length: 2048 | ||
| megatron_cfg: | ||
| enabled: true | ||
| bias_activation_fusion: false | ||
| tensor_model_parallel_size: 2 | ||
| expert_model_parallel_size: 8 | ||
| sequence_parallel: true | ||
| dtensor_cfg: | ||
| enabled: false | ||
| sequence_packing: | ||
| enabled: false | ||
| generation: | ||
| backend: megatron | ||
| logger: | ||
| log_dir: logs/grpo-nanov3-30BA3B-4n4g-megatron_sync_colocated | ||
| wandb_enabled: true | ||
| tensorboard_enabled: true | ||
| wandb: | ||
| project: nemo-rl | ||
| name: grpo-nanov3-30BA3B-4n4g-megatron_sync_colocated | ||
| cluster: | ||
| gpus_per_node: 4 | ||
| num_nodes: 4 | ||
| segment_size: 2 |
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.