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

๐Ÿค– Supported Models and Datasets

๐Ÿค– Models

ms-swift supports the training, inference, and deployment of text-only LLMs, multimodal LLMs, and task-dedicated models. Model families include Qwen, DeepSeek, Llama, InternLM, GLM, and others. Multimodal models can process text, images, video, or audio, and the exact inputs depend on the capability of the model itself.

To train with another model, change --model. The model can be a ModelScope / Hugging Face model ID or a local model directory:

CUDA_VISIBLE_DEVICES=0 swift sft \
    --model Qwen/Qwen3.5-4B \
    --dataset 'swift/self-cognition#600' \
    --max_length 2048 \
    --output_dir output/sft

๐Ÿค– Models / tasks and templates

  • model: the ID or local path of the model weights.
  • model_type: the model family identifier of ms-swift. It decides how the model is loaded and adapted. It is usually recognized automatically from the model ID. A local custom directory or an ambiguous model can be specified explicitly.
  • template: the chat encoding template. It decides how roles, delimiters, tool calls, and multimodal inputs are encoded. It also defaults to automatic recognition.
  • task_type: the task type, such as causal_lm, seq_cls, embedding, reranker, generative_reranker, or decision.

When an explicit choice is needed, append --model_type qwen3_5 --template qwen3_5 to the command above. The model name, the model_type in the Transformers config, and the registered name of ms-swift should not be mixed up. For the model in this page, the ms-swift registered name and the template name are both qwen3_5. Task-dedicated models must be used with the matching task and input format. Changing only the name does not make them usable as plain chat models.

๐Ÿค– Download sources

By default, models and datasets are downloaded from ModelScope. There are two ways to use Hugging Face: add an hf:// prefix to the ID (for example --model hf://Qwen/Qwen3.5-4B), which affects only that ID, or specify --use_hf true on the same training command, and model IDs and dataset IDs are then resolved against Hugging Face:

CUDA_VISIBLE_DEVICES=0 swift sft \
    --model Qwen/Qwen3.5-4B \
    --dataset <Hugging Face dataset ID> \
    --use_hf true

Caching and downloads are managed by the corresponding hub. The ModelScope cache can be set with MODELSCOPE_CACHE. When local weights already exist, pass the model directory directly. IDs in --model and --adapters accept the ms:// / hf:// prefix to specify the hub explicitly, which takes precedence over --use_hf. IDs without a prefix are resolved according to --use_hf.

๐Ÿ“š Datasets

ms-swift ships with pretraining, instruction fine-tuning, preference alignment, multimodal, and task-dedicated datasets. For the built-in IDs and preprocessing definitions see the dataset registry.

--dataset can take a built-in dataset, a hub dataset, or a local file, and supports mixing several datasets:

--dataset 'swift/self-cognition#600'
--dataset train.jsonl extra.jsonl

#600 means sampling 600 rows, not the number of training steps. --val_dataset specifies the validation data. When there is no separate validation set, --split_dataset_ratio can split one out of the training data.

๐Ÿ“š Example data

DataPurposeInput and target
swift/self-cognitionInstruction fine-tuning of the model name and authorFull user / assistant conversation
AI-MO/NuminaMath-TIRMath online learningThe problem as the prompt, and solution left for the math reward
Local JSONLCustom taskMessages, labels, or reward reference fields provided according to the task

--model_name and --model_author only take effect when the relevant data preprocessing reads these fields. They do not automatically modify the answers in all data.

Model list

260 model families and 998 models in total, 305 of which support Megatron training.

The table below lists the models supported by ms-swift:

  • Model ID: the ModelScope model id (linked)
  • Model Type: the model type
  • Default Template: the default chat template
  • Task Type: the training task that the model family is bound to (--task_type). causal_lm is a general generative model, which can switch to a seq_cls, embedding, reranker, or generative_reranker task head as needed. seq_cls is a reward model family. seq_cls / embedding is a bare encoder backbone (it cannot generate). Any other value is a task-dedicated model (including multimodal embedding / reranker) that can only be used for that task
  • Requires: extra dependencies for using this model (if you hit a transformers version mismatch during training, check the transformers_version field in the model config.json)
  • Support Megatron: whether Megatron training is supported
  • Tags: the tags of the model (values are explained in Tags at the end of this page)
  • HF Model ID: the HuggingFace model id (linked)
Task type
Showing 998 of 998 models259 model series305 support Megatron

Tags

tags come from a controlled vocabulary (the single source of truth: swift/dev/utils/tags.py). Registering a model or dataset with a tag outside the vocabulary raises an error directly, so the table below is the complete set of tags currently allowed:

agent, audio, awq, bench, bert, caption, caption-grounding, character-dialogue, chat, classification, clef, coding, common, cot, decision, distill, docqa, dpo, em, embedding, en, financial, general, gpt4, grounding, grpo, hfrl, human-annotated, jev, kev, kto, law, laya, long, long-sequence, math, medical, multi-agent, multi-domain, multi-modal, multi-round, multi-task, multilabel, multilingual, ner, nl2sql, novel, o1, ocr, ocr-vqa, omni, omnijev, orpo, pairwise, play-ground, poetry, poison-management, pretrain, qa, quality, r1, rerank, reranker, rl, rlhf, rlvr, role-play, science, self-cognition, sft, similarity, sql, startlux, text-generation, thinking, tts, video, vision, vqa, youtube, zh, zhihu, ๐Ÿ”ฅ

๐Ÿ“š Custom formats

There are three ways to bring in a custom dataset. Control over the preprocessing function increases step by step, and so does the difficulty of bringing it in:

  1. Pass a file path directly, for example --dataset train.jsonl. Standard messages, sharegpt, query/response, Alpaca, and other formats are recognized by column name by the format converter and turned into standard rows. --columns can rename columns.
  2. Use an external dataset_info.json, and define the dataset ID, path, and column mapping through --custom_dataset_info.
  3. Register a custom dataset loader or preprocessing logic, import it through --external_plugins, and select it by registered name.

A standard supervised fine-tuning sample:

{"messages": [{"role": "user", "content": "Who are you?"}, {"role": "assistant", "content": "I am swift-robot, developed by swift."}]}

An online learning sample takes the conversation before generation as the prompt and keeps the fields the reward needs. The trailing assistant reply is removed automatically, so SFT-format data can be reused directly:

{"messages": [{"role": "user", "content": "What is 1 + 1?"}], "solution": "2"}

Preprocessing, encoding, and sampling are different steps. In SFT the assistant content is the training target. In online learning the reply is generated by the sampler, and fields such as solution are for the reward function. Do not put the reference answer into the prompt generated online.

For the full format, column mapping, and registration examples see Custom datasets. For template arguments see Template.

๐Ÿ“– Usage tips

  • The model must have the input modalities and output head that the task needs. A model supporting vision does not mean that text-only training needs a placeholder image inserted.
  • Fix the model, the template, and the data preprocessing first, then change the sampler or the parallel strategy. They are different configuration dimensions.
  • Multimodal media paths must be reachable by the process that actually reads the data. A file visible on the client machine is not necessarily reachable by a remote worker.
  • When comparing experiments, keep the data split, the number of samples, and the effective batch the same. For how speed and curves are compared see Performance testing and benchmarks.