-
Notifications
You must be signed in to change notification settings - Fork 546
feat(models): add Qwen3.8-27B Megatron support #3678
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
2a7a9ce
feat(models): add Qwen3.8-27B Megatron support
zpqiu fc3263d
test(models): strengthen Qwen3.8 nightly coverage
zpqiu 53265de
test(models): shorten Qwen3.8 nightly timeout
zpqiu c7b6d54
test(models): exercise Qwen3.8 TP2 PP2 CP2
zpqiu a0a7ffb
docs(models): align Qwen3.8 guide with Qwen3.5
zpqiu 42e0163
test(models): exercise Qwen3.8 TP4 PP2 CP2
zpqiu 92c12e0
test: reduce Qwen3.8 nightly timeout
zpqiu 5148ac8
docs: add Qwen3.8 functional validation curves
zpqiu 93c344c
chore: minimize Qwen3.8 recipe
zpqiu fdc6805
test: update nightly GPU-hour limit
zpqiu b1f12ed
Update docs/guides/models/qwen/qwen3-8.md
zpqiu 01dda13
Merge branch 'main' into feat/qwen3.8-27b-mcore
zpqiu 38a9f71
Merge branch 'main' into feat/qwen3.8-27b-mcore
sharonyu-115 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
Binary file added
BIN
+341 KB
docs/assets/qwen3-8/grpo-qwen3.8-27b-2n8g-megatron-tp4pp2cp2-100steps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # Qwen3.8 | ||
|
|
||
| This page describes the initial NeMo RL support for the dense | ||
| `Qwen/Qwen3.8-27B` model. | ||
|
|
||
| ## Support Status | ||
|
|
||
| `Qwen/Qwen3.8-27B` is **Functionally Ready** for text-only GRPO on the Megatron | ||
| (MBridge) training backend, with vLLM inference. The shipped recipe is a short | ||
| functional smoke test. It validates model loading, rollout generation, weight | ||
| refit, log-probability computation, and an optimizer step; it is not a long-run | ||
| convergence recipe. | ||
|
|
||
| ## What's Supported | ||
|
|
||
| | Model | Modality | Training backend | Parallelism | Inference | | ||
| | --- | --- | --- | --- | --- | | ||
| | `Qwen/Qwen3.8-27B` | LLM (dense) | Megatron | TP + PP + CP | vLLM | | ||
|
|
||
| The model follows the same dense hybrid-attention integration path as the | ||
| supported Qwen3.5 dense models. Context parallelism requires sequence packing, | ||
| which is enabled in the example recipe below. | ||
|
|
||
| > [!NOTE] | ||
| > AutoModel dependencies now include the Qwen3.5-family dense adapter via | ||
| > [NeMo RL PR #3498](https://github.com/NVIDIA-NeMo/RL/pull/3498). | ||
| > Qwen3.8 AutoModel validation and an example recipe remain tracked in | ||
| > [issue #3675](https://github.com/NVIDIA-NeMo/RL/issues/3675). | ||
|
|
||
| ## Example Recipes | ||
|
|
||
| The recipe below is an example starting point. Recipe YAML files under | ||
| `examples/configs/recipes/` are the source of truth; check the YAML file for the | ||
| authoritative settings. | ||
|
|
||
| | Model | Modality | Algorithm | Backend | Scale | Recipe | | ||
| |---|---|---|---|---|---| | ||
| | Qwen3.8-27B | LLM | GRPO | Megatron | 2n8g | [`grpo-qwen3.8-27b-2n8g-megatron-tp4pp2cp2.yaml`](../../../../examples/configs/recipes/llm/grpo-qwen3.8-27b-2n8g-megatron-tp4pp2cp2.yaml) | | ||
|
|
||
| ## Choose a Recipe | ||
|
|
||
| ### 27B GRPO (Megatron) | ||
|
|
||
| Use the Megatron recipe to validate the setup, launch mechanics, logging, and | ||
| checkpointing. | ||
|
|
||
| ```sh | ||
| uv run examples/run_grpo.py \ | ||
| --config examples/configs/recipes/llm/grpo-qwen3.8-27b-2n8g-megatron-tp4pp2cp2.yaml | ||
| ``` | ||
|
|
||
| This is a functional validation recipe rather than a long-run convergence | ||
| recipe; validate longer training separately for the target workload. | ||
|
|
||
| #### 100-Step Functional Validation Results | ||
|
|
||
| The reference curves below were produced by running the example recipe for more | ||
| than 100 steps. | ||
|
|
||
| The recipe's OpenMathInstruct-2 dataset is relatively easy for Qwen3.8-27B, and | ||
| the maximum sequence length is limited to 4,096 tokens. Consequently, the | ||
| reward curve does not show a pronounced upward trend. These curves are provided | ||
| only as a functional validation reference for training beyond 100 steps, not as | ||
| evidence of long-run convergence. | ||
|
|
||
|  |
19 changes: 19 additions & 0 deletions
19
examples/configs/recipes/llm/grpo-qwen3.8-27b-2n8g-megatron-tp4pp2cp2.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,19 @@ | ||
| defaults: grpo-qwen3.5-9b-1n8g-megatron.yaml | ||
| grpo: | ||
| num_generations_per_prompt: 8 | ||
| checkpointing: | ||
| checkpoint_dir: results/grpo-qwen3.8-27b-2n8g-megatron-tp4pp2cp2 | ||
| policy: | ||
| model_name: Qwen/Qwen3.8-27B | ||
| train_global_batch_size: 256 | ||
| sequence_packing: | ||
| enabled: true | ||
| make_sequence_length_divisible_by: 16 | ||
| megatron_cfg: | ||
| pipeline_model_parallel_size: 2 | ||
| context_parallel_size: 2 | ||
| logger: | ||
| wandb: | ||
| name: grpo-qwen3.8-27b-2n8g-megatron-tp4pp2cp2 | ||
| cluster: | ||
| num_nodes: 2 | ||
43 changes: 43 additions & 0 deletions
43
tests/test_suites/llm/grpo-qwen3.8-27b-2n8g-megatron-tp4pp2cp2.sh
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,43 @@ | ||
| #!/bin/bash | ||
| SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd) | ||
| source $SCRIPT_DIR/common.env | ||
|
|
||
| # ===== BEGIN CONFIG ===== | ||
| NUM_NODES=2 | ||
| GPUS_PER_NODE=8 | ||
| STEPS_PER_RUN=10 | ||
| MAX_STEPS=10 | ||
| NUM_RUNS=$(( (MAX_STEPS + STEPS_PER_RUN - 1) / STEPS_PER_RUN )) # Round up | ||
| NUM_MINUTES=60 | ||
| # ===== END CONFIG ===== | ||
|
|
||
| exit_if_max_steps_reached | ||
|
|
||
| # Run the experiment | ||
| cd $PROJECT_ROOT | ||
| uv run examples/run_grpo.py \ | ||
|
sharonyu-115 marked this conversation as resolved.
|
||
| --config $CONFIG_PATH \ | ||
| grpo.max_num_steps=$MAX_STEPS \ | ||
| logger.log_dir=$LOG_DIR \ | ||
| logger.wandb_enabled=True \ | ||
| logger.wandb.project=nemo-rl \ | ||
| logger.wandb.name=$EXP_NAME \ | ||
| logger.monitor_gpus=True \ | ||
| logger.tensorboard_enabled=True \ | ||
| checkpointing.enabled=True \ | ||
| checkpointing.checkpoint_dir=$CKPT_DIR \ | ||
| $@ \ | ||
| 2>&1 | tee $RUN_LOG | ||
|
|
||
| # Convert tensorboard logs to json | ||
| uv run tests/json_dump_tb_logs.py $LOG_DIR --output_path $JSON_METRICS | ||
|
|
||
| # Only run metrics if the target step is reached | ||
| if [[ $(jq 'to_entries | .[] | select(.key == "train/loss") | .value | keys | map(tonumber) | max' $JSON_METRICS) -ge $MAX_STEPS ]]; then | ||
| uv run tests/check_metrics.py $JSON_METRICS \ | ||
| 'mean(data["train/gen_kl_error"]) < 0.002' \ | ||
|
sharonyu-115 marked this conversation as resolved.
|
||
| 'max(data["train/reward"]) > 0.5' | ||
|
|
||
| # Clean up checkpoint directory after successful run to save space. | ||
| rm -rf "$CKPT_DIR" | ||
| fi | ||
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.
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.