Ms Swift
Use PEFT or Full-parameter to CPT/SFT/DPO/GRPO 600+ LLMs (Qwen3.6, DeepSeek-V4, GLM-5.1, InternLM3, Llama4, ...) and 300+ MLLMs (Qwen3-VL, Qwen3-Omni, InternVL3.5, Ovis2.5, GLM4.5v, Gemma4, Llava, Phi4, ...) (AAAI 2025).
Last verified:
What is Ms Swift?
Ms Swift is an official framework provided by the ModelScope community for fine-tuning and deploying large language models and multi-modal large models. It supports training (pre-training, fine-tuning, human alignment), inference, evaluation, quantization, and deployment of 600+ large models and 300+ multi-modal large models including Qwen3, Qwen3-MoE, Qwen2.5, InternLM3, GLM4.5, Mistral, DeepSeek-R1, Qwen3-VL, Qwen3-Omni, Llama4, Llava, InternVL3.5, and more.
Key features include support for lightweight training methods (LoRA, QLoRA, Llama-Pro, LongLoRA, GaLore, Q-GaLore, LoRA+, LISA, DoRA, FourierFt, ReFT, UnSloth, Liger), RLHF training methods (DPO, GRPO, RM, PPO, GKD, KTO, CPO, SimPO, ORPO), distributed training (DDP, DeepSpeed ZeRO2/ZeRO3, FSDP, Megatron), model quantization (GPTQ, AWQ, BNB), inference acceleration (vLLM, SGLang, LMDeploy), Web UI based on Gradio, 150+ pre-built datasets, and custom dataset support. The framework is designed for AI researchers, machine learning engineers, data scientists, and developers working with large language models who need efficient fine-tuning and deployment capabilities.
Ms Swift supports multiple hardware platforms including CPU, RTX series GPUs, T4/V100, A10/A100/H100, Ascend NPU, and MPS. It provides interface-based training, inference, evaluation, quantization, and deployment through command-line tools, Python API, and Web UI. The framework has been accepted by AAAI 2025 and has over 10.6k stars on GitHub.
Ms Swift pricing
Pricing model: Freemium
SWIFT is completely free and open-source under Apache License 2.0. The framework is free to install via pip (pip install ms-swift -U) or from source. There are no paid tiers, subscription plans, or licensing fees. All features including training, inference, evaluation, quantization, and deployment are available at no cost. Users only need to provide their own hardware (GPU/CPU) and may incur costs for cloud GPU instances if not using local hardware.
Ms Swift pros
- Supports 600+ large language models and 300+ multi-modal models
- Comprehensive training pipeline from pre-training to deployment
- Lightweight fine-tuning methods like LoRA, QLoRA, DoRA, UnSloth
- Distributed training with DDP, DeepSpeed ZeRO2/ZeRO3, FSDP, Megatron
- RLHF training support including DPO, GRPO, PPO, KTO, CPO, SimPO, ORPO
- Inference acceleration with vLLM, SGLang, LMDeploy backends
- Model quantization support with GPTQ, AWQ, BNB, FP8
- Web UI interface based on Gradio for zero-threshold usage
- 150+ built-in pre-training, fine-tuning, and alignment datasets
- Custom model and dataset extension capabilities
- Supports CPU, NVIDIA GPUs, Ascend NPU, and MPS hardware
- OpenAI API compatible interface for inference and deployment
- Model evaluation with EvalScope backend on 100+ datasets
- Megatron parallelism for accelerating large model training
- Apache 2.0 license for open and free usage
Ms Swift cons
- Requires Python 3.9 or higher (recommended 3.10/3.11)
- CUDA 12 recommended for GPU training (adds complexity)
- Many optional dependencies need separate installation
- Steep learning curve for beginners without ML background
- Documentation primarily in Chinese with limited English coverage
- Large model training requires significant GPU memory (22GB+ minimum)
- Complex configuration with many command-line parameters
- DeepSpeed and flash_attn can be difficult to install on some systems
Frequently asked questions about Ms Swift
What is SWIFT/ms-swift?
SWIFT (Scalable lightWeight Infrastructure for Fine-Tuning) is an official framework provided by the ModelScope community for fine-tuning and deploying large language models and multi-modal large models. It supports training (pre-training, fine-tuning, human alignment), inference, evaluation, quantization, and deployment of 600+ large models and 300+ multi-modal models.
How do I install SWIFT?
You can install SWIFT using pip with 'pip install ms-swift -U' or from source by cloning the repository and running 'pip install -e .' after navigating to the ms-swift directory. The recommended environment includes Python 3.10/3.11, CUDA 12, PyTorch 2.7.1, and transformers 4.56.2.
What models does SWIFT support?
SWIFT supports 600+ pure text large models including Qwen3, Qwen3-MoE, Qwen2.5, InternLM3, GLM4.5, Mistral, DeepSeek-R1, TeleChat2, Baichuan2, Gemma2, and Llama4. It also supports 300+ multi-modal models including Qwen3-VL, Qwen3-Omni, Llava, InternVL3.5, MiniCPM-V-4, Ovis2.5, GLM4.5-V, DeepSeek-VL2, Phi3.5-Vision, and GOT-OCR2.
What training methods are supported?
SWIFT supports pre-training, instruction supervised fine-tuning (SFT), DPO training, GRPO training, reward model training, PPO training, GKD training, KTO training, CPO training, SimPO training, ORPO training, classification model training, embedding model training, and reranker model training. Both full-parameter and LoRA/QLoRA fine-tuning are available.
Can I use SWIFT with my own dataset?
Yes, SWIFT supports custom datasets. You can organize your dataset in the required format and specify it using the --dataset parameter with the dataset path. The documentation provides guides for custom dataset formats, and there are 150+ built-in datasets for pre-training, fine-tuning, and human alignment.
How do I perform inference with a trained model?
After training, use the 'swift infer' command with the --adapters parameter pointing to the checkpoint folder. For example: 'swift infer --adapters output/vx-xxx/checkpoint-xxx --stream true --temperature 0 --max_new_tokens 2048'. You can also use vLLM for acceleration with --merge_lora true and --infer_backend vllm.
What hardware does SWIFT support?
SWIFT is compatible with CPU, RTX series GPUs, T4/V100, A10/A100/H100, Ascend NPU, MPS, and other hardware. For GPU training, CUDA 12 is recommended. The framework supports distributed training across multiple GPUs and multi-node setups.
What is Megatron-SWIFT?
Megatron-SWIFT incorporates Megatron's parallel technology to accelerate training of multimodal large models. It supports CPT/SFT/GRPO/DPO/KTO/RM for models like Qwen3-VL, Qwen3-Omni, InternVL3.5, GLM4.5v, Kimi-VL, and achieves significant speedup on MoE models compared to standard ms-swift.
How do I use the Web UI?
The Web UI is a zero-threshold training and deployment interface based on Gradio. Run 'SWIFT_UI_LANG=en swift web-ui' to start it (set to Chinese for Chinese interface). The Web UI provides an easier alternative to command-line for training and deployment tasks.
What inference acceleration backends are available?
SWIFT supports PyTorch (native), vLLM, SGLang, and LMDeploy as inference acceleration backends. Specify the backend using --infer_backend vllm/lmdeploy/sglang/pt. vLLM and SGLang can significantly speed up inference, deployment, and evaluation modules.