ms-swift
Fine-tuning and deployment framework from the ModelScope community for training, evaluating, quantizing and serving text and multimodal large models.
At a Glance
About ms-swift
ms-swift (SWIFT, Scalable lightWeight Infrastructure for Fine-Tuning) is an open-source framework from the ModelScope community for fine-tuning and deploying large language models and multimodal models. According to its README, it covers pre-training, fine-tuning, human alignment, inference, evaluation, quantization and deployment for 600+ text-only and 400+ multimodal models. The latest release listed is v4.6.0.
What It Is
ms-swift is a Python training and deployment toolkit driven mainly by a command-line interface (swift sft, swift rlhf, swift infer, swift deploy, swift eval, swift export), with a Gradio-based Web-UI and a Python API as alternatives. Users pick a model and a dataset (built-in or custom), choose a tuning method such as full-parameter, LoRA or QLoRA, and run training. Models and datasets are downloaded from ModelScope by default, with HuggingFace as an option.
Training and Reinforcement Learning
Supported tasks include pre-training, supervised fine-tuning, DPO, KTO, CPO, SimPO, ORPO, reward models, GKD distillation, embedding, reranker and sequence classification training. A family of GRPO-style reinforcement learning algorithms is built in, including GRPO, DAPO, GSPO, SAPO, CISPO, CHORD, RLOO and Reinforce++, with vLLM-accelerated rollouts and plugin-based reward functions and multi-turn schedulers. Megatron-SWIFT adds TP/PP/CP/EP parallelism for large-scale and MoE training.
Inference, Evaluation and Export
Inference and deployment can use Transformers, vLLM, SGLang or LMDeploy, exposing OpenAI-compatible interfaces. Evaluation uses EvalScope as backend. Models can be quantized with GPTQ, AWQ, BNB or FP8, merged from LoRA adapters, and pushed to ModelScope.
Hardware Support
Documentation covers NVIDIA GPUs, AMD GPUs, Ascend NPU, MetaX, Moore Threads MUSA, Apple MPS and CPU. The README states a 7B model can be trained with quantized training in about 9GB.
Community Discussions
Be the first to start a conversation about ms-swift
Share your experience with ms-swift, ask questions, or help others learn from your insights.
Pricing
Open Source (Apache-2.0)
ms-swift framework is licensed under the Apache License 2.0; free to use, modify and distribute. Models and datasets follow their own original licenses.
- Licensed under Apache License 2.0
- Fine-tuning, pre-training, human alignment, inference, evaluation, quantization and deployment
- 600+ text-only LLMs and 400+ multimodal LLMs supported
- Megatron parallelism and GRPO-family reinforcement learning algorithms
- Models and datasets are subject to their own original licenses
Capabilities
Key Features
- Pre-training, SFT, and human alignment (DPO, KTO, CPO, SimPO, ORPO, RM)
- GRPO family reinforcement learning (GRPO, DAPO, GSPO, SAPO, CISPO, CHORD, RLOO, Reinforce++)
- LoRA, QLoRA, DoRA and other lightweight tuning methods
- Megatron-SWIFT parallelism (TP/PP/CP/EP) for MoE and large-scale training
- Embedding, reranker and sequence classification training
- Multimodal training with packing and mixed modality data
- Agent templates for tool-calling training
- Inference and deployment via Transformers, vLLM, SGLang, LMDeploy
- Evaluation through EvalScope
- Quantization export (GPTQ, AWQ, BNB, FP8)
- Web-UI for training, inference, evaluation and quantization
- Support for NVIDIA, AMD, Ascend NPU, MetaX, MUSA, Apple MPS and CPU
