ms-swift
Swift: Scalable lightWeight Infrastructure for Fine-Tuning
What it is and what it does
ms-swift is a comprehensive framework for training and deploying large language models and multimodal models, built by the ModelScope community. It handles the full pipeline from pre-training and fine-tuning through inference, evaluation, quantization, and deployment. The framework supports a wide range of model architectures (including Qwen, InternLM, GLM, Mistral, DeepSeek, and Llama for text; and Qwen-VL, Kimi-K3, Llava, and others for multimodal) and training tasks including supervised fine-tuning, reinforcement learning algorithms (GRPO family), preference learning (DPO, KTO, SimPO), and embedding/reranker training.
The framework emphasizes efficiency and scalability through support for parameter-efficient methods (LoRA, QLoRA, DoRA, Adapter), distributed training strategies (DDP, DeepSpeed ZeRO, FSDP, Megatron), memory optimization techniques (GaLore, Flash-Attention, sequence parallelism), and quantization-aware training on BNB, AWQ, GPTQ models. It includes inference acceleration via vLLM, SGLang, and LMDeploy, provides a web UI for training and evaluation, and integrates EvalScope for model evaluation across 100+ datasets.
Use it for:
- Fine-tune a 7B language model on custom instruction data using LoRA with only 9GB of GPU memory via quantized training.
- Train a multimodal model on mixed text, image, and video data with independent control over vision encoder, aligner, and LLM components.
- Deploy a trained model with OpenAI-compatible inference endpoints using vLLM or SGLang acceleration.
- Run distributed training of a mixture-of-experts model across multiple GPUs using Megatron parallelism strategies.
- Evaluate a fine-tuned model against 100+ standard benchmarks using the integrated EvalScope backend.
- Quantize a trained model to AWQ, GPTQ, or FP8 format for reduced memory and faster inference.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
ms-swift is a framework for training, evaluating, quantizing, and deploying large language models and multimodal models at scale, supporting 600+ text models and 400+ multimodal models with distributed training and inference acceleration.
Yes. ms-swift is actively maintained, permissively licensed, and offers a production-ready framework for LLM and multimodal model training and deployment. The low install friction, broad hardware support, and comprehensive feature set (distributed training, quantization, inference acceleration, evaluation) make it valuable for teams working with modern large models. No known security vulnerabilities. Install if you need end-to-end LLM training and deployment infrastructure; skip if you only need inference or a simpler fine-tuning wrapper.
Install
ms-swift on PyPI
pip
pip install ms-swiftuv
uv add ms-swiftpoetry
poetry add ms-swiftInstalling ms-swift
Before you install
Low install friction with a pure-Python wheel. Active maintenance with a recent release and 15170 repository stars. Supports Python 3.8 through 3.12. The 39 runtime dependencies are substantial but typical for a comprehensive ML framework.
License in practice
Apache License 2.0 (permissive) allows commercial use, modification, and distribution with minimal restrictions, making it suitable for both open-source and proprietary projects.
Quickstart
pip install ms-swift
from swift import Swift
# Framework provides training, inference, and quantization APIs
# See documentation for model-specific training examples
Requires Python 3.8 or later. GPU support depends on installed CUDA/ROCm libraries and hardware compatibility (A10, A100, H100, RTX, T4, V100, AMD MI300, or Ascend NPU).
Verify before relying
- Exact model count claims (600+ text, 400+ multimodal) and whether Day-0 support means immediate availability or planned support
- Whether 150+ built-in datasets are pre-downloaded or require separate acquisition
- Memory reduction percentages for sequence parallelism techniques (Ulysses, Ring-Attention)
- Training speed improvement claim of 100%+ for multimodal packing and how it is measured
Package facts
| License | Apache License 2.0 (permissive) |
| Python support | supports the current Python release (>=3.8.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 39 — accelerate, addict, aiohttp, attrdict, binpacking, charset-normalizer, cpm-kernels, dacite, datasets, einops, fastapi, gradio, importlib-metadata, json-repair, matplotlib, modelscope, nltk, numpy, openai, oss2, pandas, peft, pillow, PyYAML, requests, rouge, safetensors, scipy, sentencepiece, simplejson |
| Maintenance | actively maintained — 0 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 130,605/month — #11,635 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: ms_swift-4.5.0-py3-none-any.whl
Keywords: transformers, LLM, lora, megatron, grpo, sft
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
modelscopeModelScope provides unified Python interfaces…
permissive · top 5,000 on PyPI
llamafactoryLLaMA Factory provides a unified framework for…
permissive · top 15,000 on PyPI
unslothUnsloth accelerates training and fine-tuning of…
permissive · top 5,000 on PyPI
peftPEFT implements parameter-efficient fine-tuning…
permissive · top 5,000 on PyPI
trlTRL provides trainer classes for post-training…
permissive · top 5,000 on PyPI
tinker_cookbookTinker Cookbook provides recipes and…
permissive · top 15,000 on PyPI
verlverl is a reinforcement learning training…
permissive · top 15,000 on PyPI
unsloth-zooUnsloth Zoo provides utilities for fine-tuning…
copyleft · top 5,000 on PyPI
swebenchSWE-bench is a benchmark framework for…
permissive · top 1,000 on PyPI
mlx-vlmMLX-VLM runs vision language models and omni…
permissive · top 5,000 on PyPI