๐ Performance and Stability
From smaller-model fine-tuning to multi-node training of large MoE models, ms-swift v5 combines efficient execution with stable training: asynchronous sampling reduces waits, multi-node training supports long sequences and expert LoRA, and training results remain consistent with v4. The results below come from completed runs. Research-workflow efficiency is reported in AutoResearch Benchmarks.
- Efficient GRPO: Building on v4's mature training capabilities, v5's asynchronous mode delivers over 100% higher token throughput than v4 server in the 35B-A3B GRPO benchmark, with a steady step time of 8.07 s and stable training throughout.
- Large-model training: 122B-A10B completes 50 GRPO updates on 32 devices, processing 9,600 generated sequences. Training reward rises from 0.057 to 0.932; loss and gradients remain stable throughout.
- Numerical consistency: across seven 4B and 35B SFT comparisons, median relative loss deviation is at most 1.5%, and endpoint deviation is at most 4%.
The 122B test uses PPU devices; the other tests use NVIDIA H20 96GB GPUs. Steady step time measures elapsed time between optimizer steps, excluding model loading and first-step warm-up. ยฑ denotes standard deviation.
GRPO: Synchronous and Asynchronous Throughput
Qwen3.5-35B-A3B uses disaggregated FSDP2 + vLLM: two GPUs for the TP2 sampler and two for training. The run uses GSM8K and LoRA r8 / ฮฑ32, generating 16 sequences per step with a limit of 2,048 tokens per generation.
| Mode | Steady step time (s/step) | tokens/s | MathAccuracy (training) |
|---|---|---|---|
| v5 ray sync | 10.597 ยฑ 2.979 | 319.37 | 0.9208 |
| v5 ray fully_async | 8.069 ยฑ 0.736 | 329.66 | 0.9542 |
Both synchronous and asynchronous runs complete 15 updates with positive gradient norms throughout. v5 offers efficient asynchronous execution for sampling-intensive tasks while maintaining training stability.
Asynchronous Execution Optimization
fully_async overlaps generation and training while limiting sample staleness to one policy version. Relative to v5 sync, asynchronous steady step time is 23.9% shorter and trainer idle ratio decreases from 31.6% to 3.3%, reducing time spent waiting for sampling.
122B MoE: Multi-node LoRA GRPO
Qwen3.5-122B-A10B completes 50 updates and saves the final adapter on four nodes with 32 PPU devices. Megatron training, vLLM sampling, and synchronous weight publication support long sequences, MoE expert LoRA, multi-node training, and checkpoint export.
Model and Resource Configuration
| Item | Configuration |
|---|---|
| Model | Qwen3.5-122B-A10B |
| Hardware | 4ร8 PPU devices, 96 GiB memory per device, high-speed inter-node links |
| Training | 16 devices, Megatron TP4 / EP8 / PP1 / CP1, DP4 |
| Sampling | 16 devices, 2 vLLM TP8 replicas, memory utilization 0.85 |
| LoRA | r8 / ฮฑ32 / dropout 0, all-linear, including attention, shared experts, and MoE experts; frozen vision tower |
| Data | DAPO-Math; 24 prompts ร 8 generations = 192 sequences per step |
| Length | Total length 9,216; generation limit 8,192; thinking enabled |
| Optimization | GRPO, lr 5e-5, bf16, activation recomputation, sequence parallelism |
The 50 steps process 1,200 prompt groups and 9,600 generated sequences, totaling approximately 44.68 million prompt + response tokens. Training MathAccuracy reward rises from 0.057 to 0.932, with a peak of 0.984. These results validate ms-swift v5's ability to provide stable, reliable RL training at very large scale.
Numerical and Execution Stability
Loss and gradients contain no NaN / Inf across all 50 updates, and sampling and reward evaluation complete normally. Mean workload_imbalance for long-sequence data parallelism decreases from 1.525 before redistribution to 1.00007 afterward, keeping multi-node token workloads nearly balanced. Numerical stability and workload balancing support continuous large-scale training.
Training Throughput and Model Saving
| Item | Measurement |
|---|---|
| Steady step time | 499.3 s/step |
| Steady throughput | 54.8 tokens/s/device |
| Full job duration | About 7 h 21 min, including startup and final saving |
| Final adapters | About 4.7 GB each |
The steady window covers steps 2โ49, excluding 12 checkpoint steps, for 36 steps in total; throughput is calculated across all 32 devices. Periodic checkpoints and final adapters are saved, covering the workflow from multi-node training to model export.
Multi-node Deployment Steps
- Prepare
grpo-122b.yamlusing the public GRPO examples, setting model and data paths and the LoRA, length, and parallelism settings above. - Initialize a four-node Ray cluster with 16 training and 16 sampling devices, using Megatron for training and vLLM for sampling.
- Run
RAY_ADDRESS=auto swift rl grpo-122b.yaml --mode rayfrom the driver and export the adapter after training.
SFT and Supervised Task Performance
v5 ray completes 30 training steps on 4B and 35B-A3B SFT and JEV-9B decision tasks, covering language-model fine-tuning and decision-model training.
| Task | v5 ray steady step time |
|---|---|
| 4B SFT, LoRA r8, DP2 | 4.480 ยฑ 0.500 s/step |
| 35B-A3B SFT, LoRA r8, DP2 | 6.56 ยฑ 0.57 s/step |
| JEV-9B decision | 4.25 ยฑ 0.43 s/step |
Training-result Consistency
SFT Numerical Consistency
v5 maintains training-result alignment with v4 alongside efficient execution. After 30 training steps on 4B and 35B models, all seven comparisons have median relative loss deviations at most 1.5% and endpoint deviations at most 4%.
| Model | Comparison | Median deviation | Maximum deviation | Endpoint deviation |
|---|---|---|---|---|
| 4B | v4 vs ray | 1.186% | 4.003% | 3.877% |
| 4B | v4 vs training service (ga16) | 0.959% | 3.167% | 3.014% |
| 4B | ray vs training service (ga16) | 0.516% | 1.825% | 0.898% |
| 4B | ray same-configuration rerun | 0.000% | 0.000% | 0.000% |
| 35B-A3B | v4 vs ray | 1.001% | 3.416% | 3.416% |
| 35B-A3B | v4 vs training service (ga16) | 0.736% | 3.782% | 2.308% |
| 35B-A3B | ray vs training service (ga16) | 1.424% | 3.344% | 1.071% |
The 30 loss values in the 4B ray same-configuration rerun are identical. Ray and training service comparisons use aligned effective batches to verify numerical consistency between local and service-based training.
GRPO Reward and Task Coverage
Training reward increases in v5 ray, training service, and router replay runs. Values below are mean training rewards over the first five and last five steps of each run.
| Model | Mode | Early โ late training reward |
|---|---|---|
| 4B | ray | 0.50 โ 0.96 |
| 4B | training service | 0.475 โ 0.875 |
| 35B-A3B | ray | 0.5625 โ 0.95 |
| 35B-A3B | training service | 0.5875 โ 0.9875 |
| 35B-A3B router replay | ray | 0.5875 โ 0.975 |
| 35B-A3B router replay | training service | 0.625 โ 1.0 |
All six runs complete 15 updates with finite gradient norms throughout. JEV-9B decision supervised loss also decreases to near zero over 30 training steps in ray and training service modes.
GRPO Usage Steps
- Choose an example from Online Reinforcement Learning and public examples/v5. Prepare the model and JSONL data;
solutionis used for reward computation. - Use disaggregated ray deployment, allocate training and sampling resources according to GPU count, and run synchronous GRPO.
- To enable asynchronous execution, add
--async_mode fully_async --max_staleness 1 --rollout_importance_sampling_mode token_truncateto the training arguments.
See CLI and Server and Client for complete parameter and deployment instructions.
๐ Quick Migration to ms-swift 5
New features and breaking changes of ms-swift 5 relative to v4 - how commands, arguments, data formats, plugins, and the Python API map across.
โ๏ธ Offline Distillation Explained
The distillation principle from one-hot labels to the teacher distribution, the trade-off between output distillation and logits distillation, the engineering constraints of each stage of the offline distillation data pipeline, and an analysis of a set of training regression curves.