1. Model Introduction
Qwen3 is the latest generation of Alibaba’s Qwen language model series, available in dense and MoE variants with both Instruct and reasoning-enhanced Thinking editions. Key highlights:- Stronger general intelligence: significant improvements in instruction following, logical reasoning, mathematics, science, coding, and tool usage over Qwen2.5.
- Extended context length: trained for 256 K-token contexts, useful for long-document reasoning and agentic workflows.
- Flexible deployment options: dense sizes from 0.6 B up to 32 B; this page covers the dense recipes (MoE recipes live in qwen3-moe).
- Stronger agent interaction: improved tool-use and search-based agent performance.
2. Supported Variants
3. Environment Setup
3.1 Download model + datasets
3.2 HF → Megatron torch_dist conversion
WORLD_SIZE; for larger sizes drive it with torchrun --nproc-per-node 8. The FSDP launcher (scripts/run_qwen3_0_6b_fsdp.py) loads the HF checkpoint directly and skips this step.
4. Launch
4.1 Quick start
--model-name (Qwen3-32B, and the Qwen3.5 / Qwen3.6 sizes), and it selects the matching qwen3-XB.py model config. To run on a slice of a node, add --num-gpus-per-node 4 --cuda-visible-devices 4,5,6,7.
Checkpoints are read from --model-dir (default /root/models), datasets from --data-dir (default /root/datasets), and --save/--load point under --output-dir (default /root/shared_data).
The Qwen3-4B-Instruct-2507 config (scripts/models/qwen3-4B-Instruct-2507.py) just calls qwen3-4B with rotary_base=5000000 (MODEL_ARGS_ROTARY_BASE still works as an environment override) — load it when converting / launching the Instruct-2507 checkpoint.
5. Recipe Configuration
5.1 Parallelism
scripts/run_qwen3_dense.py holds one recipe per --model-name:
Qwen3-4B also runs on a 4-GPU slice with --num-gpus-per-node 4; the parallelism is unchanged.
--sequence-parallel is on whenever TP > 1.
5.2 Algorithm
GRPO baseline across all dense recipes:--rm-type deepscaler against dapo-math-17k. The SFT recipe (python scripts/run_qwen3_sft.py --model-name Qwen3-4B-Base) trains on /root/datasets/openhermes2_5.parquet.
5.3 Rollout & SGLang
Qwen3-32B additionally pins --sglang-cuda-graph-bs 1 2 4 8 $(seq 16 8 256). The FSDP variant uses --attn-implementation flash_attention_3, SGLang attention backend fa3, and adds --update-weight-buffer-size 536870912 --gradient-checkpointing.
5.4 Optimizer
Qwen3-32B enables CPU Adam:
5.5 Notable quirks
- BF16 train + FP8 inference: download
Qwen/Qwen3-4B-FP8and pass--extra-args "--hf-checkpoint /root/models/Qwen3-4B-FP8"to swap rollout to FP8 while keeping BF16 training. See Low Precision RL. - FSDP backend:
python3 scripts/run_qwen3_0_6b_fsdp.pyruns a Qwen3-0.6B recipe with--train-backend fsdp(downloads model + datasets itself); no Megatrontorch_distconversion needed. - AMD ROCm:
python scripts/amd/run_qwen3_4b.pymirrors the recipe, with the GPU count per node resolved from--hardware(MI350X/MI355X).
6. Pairs Well With
- Low Precision RL
- Backends Beyond Megatron — for the FSDP variant.

