Skip to Content
MS-SWIFT ร— TWINKLE
๐Ÿš€ Get Started
DOCUMENTATION5.0.0.dev

๐Ÿ“Š 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.

ModeSteady step time (s/step)tokens/sMathAccuracy (training)
v5 ray sync10.597 ยฑ 2.979319.370.9208
v5 ray fully_async8.069 ยฑ 0.736329.660.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

ItemConfiguration
ModelQwen3.5-122B-A10B
Hardware4ร—8 PPU devices, 96 GiB memory per device, high-speed inter-node links
Training16 devices, Megatron TP4 / EP8 / PP1 / CP1, DP4
Sampling16 devices, 2 vLLM TP8 replicas, memory utilization 0.85
LoRAr8 / ฮฑ32 / dropout 0, all-linear, including attention, shared experts, and MoE experts; frozen vision tower
DataDAPO-Math; 24 prompts ร— 8 generations = 192 sequences per step
LengthTotal length 9,216; generation limit 8,192; thinking enabled
OptimizationGRPO, 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

Gradient norms and surrogate loss over 50 updates of 122B LoRA GRPO

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

Per-step time and mean response length in 122B LoRA GRPO
ItemMeasurement
Steady step time499.3 s/step
Steady throughput54.8 tokens/s/device
Full job durationAbout 7 h 21 min, including startup and final saving
Final adaptersAbout 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

  1. Prepare grpo-122b.yaml using the public GRPO examples, setting model and data paths and the LoRA, length, and parallelism settings above.
  2. Initialize a four-node Ray cluster with 16 training and 16 sampling devices, using Megatron for training and vLLM for sampling.
  3. Run RAY_ADDRESS=auto swift rl grpo-122b.yaml --mode ray from 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.

Taskv5 ray steady step time
4B SFT, LoRA r8, DP24.480 ยฑ 0.500 s/step
35B-A3B SFT, LoRA r8, DP26.56 ยฑ 0.57 s/step
JEV-9B decision4.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%.

ModelComparisonMedian deviationMaximum deviationEndpoint deviation
4Bv4 vs ray1.186%4.003%3.877%
4Bv4 vs training service (ga16)0.959%3.167%3.014%
4Bray vs training service (ga16)0.516%1.825%0.898%
4Bray same-configuration rerun0.000%0.000%0.000%
35B-A3Bv4 vs ray1.001%3.416%3.416%
35B-A3Bv4 vs training service (ga16)0.736%3.782%2.308%
35B-A3Bray 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.

ModelModeEarly โ†’ late training reward
4Bray0.50 โ†’ 0.96
4Btraining service0.475 โ†’ 0.875
35B-A3Bray0.5625 โ†’ 0.95
35B-A3Btraining service0.5875 โ†’ 0.9875
35B-A3B router replayray0.5875 โ†’ 0.975
35B-A3B router replaytraining service0.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

  1. Choose an example from Online Reinforcement Learning and public examples/v5. Prepare the model and JSONL data; solution is used for reward computation.
  2. Use disaggregated ray deployment, allocate training and sampling resources according to GPU count, and run synchronous GRPO.
  3. To enable asynchronous execution, add --async_mode fully_async --max_staleness 1 --rollout_importance_sampling_mode token_truncate to the training arguments.

See CLI and Server and Client for complete parameter and deployment instructions.