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

๐Ÿงฐ Feature Scaffolds

Each swift command corresponds to one kind of feature. Pick the feature first, then pick a model by the task types it supports, and finally pick a dataset. The result is a command that runs directly. <model> and <dataset> in the commands are to be filled in. <adapter_dir> in the merge command is the training output directory. The other arguments come from the corresponding example scripts.

For the task types of a model see the Task Type column of the model table in Models and datasets. It decides which commands the model can be used with:

Task TypeMeaningAvailable commands
causal_lmGeneral generative modelswift pt, all task types of swift sft, all algorithms of swift rl, plus inference, merge, deploy, export, and eval
seq_clsReward model family (single-logit scoring head)swift rl --rl_type rm, inference, and deploy
embeddingTask-dedicated embedding modelswift sft --task_type embedding, inference, and deploy
seq_cls / embeddingBare encoder backbone (BERT / ModernBERT, etc.; it cannot generate)swift sft --task_type seq_cls (--num_labels must be given as well) or --task_type embedding, inference, and deploy
rerankerTask-dedicated reranker modelswift sft --task_type reranker, inference, and deploy
decisionTask-dedicated decision scoring modelswift sft --task_type decision, inference, and deploy

When a general generative model is given --task_type seq_cls, --num_labels must be given as well. When embedding, reranker, or generative_reranker is specified, the data must use the input format of that task. See Custom datasets.

๐Ÿงฐ Assembling commands

swift commandbash
Model
Dataset
Command
Run mode
Example: pretrain
CUDA_VISIBLE_DEVICES=0 \
swift pt \
    --model Qwen/Qwen3.5-4B \
    --dataset 'AI-ModelScope/ruozhiba#2000' \
    --tuner full \
    --max_length 1024 \
    --output_dir output/pt

Datasets filtered by tag๏ผšpretrain

The templates keep only the arguments that decide the feature. For the full training arguments, multi-GPU and multi-node configuration, and the code form with the complete training loop, see the example directory of each feature.