Fine-tune with the API or CLI

更新时间:
复制 MD 格式

This document explains how to tune the Qwen model in Alibaba Cloud Model Studio using the API (HTTP) and the command line (shell). Model tuning includes three methods: supervised fine-tuning (SFT), continual pre-training (CPT), and Direct Preference Optimization (DPO).

Important

This topic is applicable only to the Chinese Mainland Edition (Beijing region).

Prerequisites

Note

Training jobs created using the API support only token-based billing. To use model training units (prepaid or postpaid), create the job in the console.

Upload a tuning file

Prepare a fine-tuning file

SFT training set

The SFT training set uses the ChatML (Chat Markup Language) format, which supports multi-turn conversation and various role settings.

OpenAI's name and weight parameters are not supported. All assistant outputs are trained.
# A single line of training data (JSON format) has the following structure:
{"messages": [
  {"role": "system", "content": "System input 1"}, 
  {"role": "user", "content": "User input 1"}, 
  {"role": "assistant", "content": "Expected model output 1"}, 
  {"role": "user", "content": "User input 2"}, 
  {"role": "assistant", "content": "Expected model output 2"}
  ...
]}

For an explanation of the system, user, and assistant roles, see Overview. For dataset examples, see SFT-ChatML-format-example.jsonl and SFT-ChatML-format-example.xlsx (XLS and XLSX formats support only single-turn conversations).

All assistant rows in a single training data entry support the "loss_weight" parameter, which is used to set the relative importance of that row during training. (The valid range is 0.0 to 1.0, and a larger value indicates higher importance.)

This is an invitation-only parameter. To use it, please contact your account manager.
 {"role": "assistant", "content": "Expected model output 1", "loss_weight": 1.0}, 
 {"role": "assistant", "content": "Expected model output 2", "loss_weight": 0.5}

SFT thinking model

The training data supports multi-turn conversation and various role settings, but only the final assistant output is used for training. A single line of training data has the following structure:

The \n characters before and after the <think> tag must be preserved.
# A single line of training data (JSON format) has the following structure:
{"messages": [
  {"role": "system", "content": "System input 1"}, 
  {"role": "user", "content": "User input 1"}, 
  {"role": "assistant", "content": "Model output 1"}, -- Intermediate assistant outputs should not include <think> tags.
   ...
  {"role": "user", "content": "User input 2"}, 
  {"role": "assistant", "content": "<think>\nExpected thinking content 2\n</think>\n\nExpected output 2"} -- Thinking content can only be included in the last assistant output.
]}

For an explanation of the system, user, and assistant roles, see Overview. For a dataset example, see SFT-deep-thinking-content-example.jsonl.

You can also configure the model in the training samples to not output the <think> tag. If you use this output method, we do not recommend enabling the thinking mode for calls after the model is trained.

{"role": "assistant", "content": "Expected model output 2"}  -- Instructs the model not to enable thinking mode.

The last assistant line of a single training data entry supports the "loss_weight" parameter to set the relative importance of that entry during training. (The valid range is 0.0 ~ 1.0, where a larger value indicates higher importance.)

This is an invitation-only parameter. To use it, please contact your account manager.
 {"role": "assistant", "content": "<think>\nExpected thinking content 2\n</think>\n\nExpected output 2", "loss_weight": 1.0}

SFT visual understanding (Qwen-VL)

The name and weight parameters of OpenAI are not supported, and all assistant outputs are trained.

For an explanation of the system, user, and assistant roles, see Overview. The following is an example of training data in the ChatML format:

To pass a system message, the corresponding content must be in the array format [{"text":"..."}], and not the string format "content":"string".
# A single line of training data (JSON format) has the following structure:
{"messages": [
  {"role": "system", "content": [{"text": "System input"}]},
  {"role": "user", "content": [{"text": "User input 1"}, {"image": "image_filename_1.jpg", "resized_width": 200, "resized_height": 200}]},
  {"role": "assistant", "content": [{"text": "Expected model output 1"}]},
  {"role": "user", "content": [{"text": "User input 2"}, {"video": "video_filename_1.mp4", "fps": 3.0, "resized_width": 200, "resized_height": 200, "video_start": 0.0, "video_end": 3.0}]},
  {"role": "assistant", "content": [{"text": "Expected model output 2"}]},
  {"role": "user", "content": [{"text": "User input 2"}, {"video": ["0.jpg", "1.jpg", "2.jpg", "3.jpg"], "sample_fps": 5.0, "resized_width": 200, "resized_height": 200}]},
  {"role": "assistant", "content": [{"text": "Expected model output 2"}]},
  ...
]}

Supported parameters

Parameter

Type

Required

Description

Image file

image

str

Yes

Specifies the path to the image file.

resized_width

int

No

Specifies the target width of the resized image in pixels.

resized_height

int

No

Specifies the target height of the resized image in pixels.

Video file - File path mode (Supported only by Qwen-VL models version qwen3.5 and later)

Example: AlibabaCloud_VL_Video.zip

video

str 

Yes

Video file path pattern: {"video": "video_filename1.mp4"}

resized_width

int

No

Specifies the target width of the resized video in pixels.

resized_height

int

No

Specifies the target height of the resized video in pixels.

fps

float

No

The input frequency for training. If you set fps=30, the actual video frame rate used for training is 30 fps.

video_start

float

No

Specifies the start time of the video clip in seconds.

video_end

float

No

Specifies the end time of the video clip in seconds.

Video file - Image frame list mode (Supported only by Qwen-VL models version qwen3.5 and later)

video

List[str]

Yes

Image frame list format: {"video": ["0.jpg", "1.jpg", "2.jpg", ...], "sample_fps": 2.0}

sample_fps

float

No

Specifies the frame rate of the image frames.

resized_width

int

No

Specifies the target width of the resized image frames in pixels.

resized_height

int

No

Specifies the target height of the resized image frames in pixels.

Note

If you are training a thinking model, you must also follow the data format requirements for the SFT thinking model.

ZIP package requirements
  1. The package format must be ZIP. The maximum size is 2 GB. Folder and file names within the ZIP package must only contain ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), and hyphens (-).

  2. The training text data file must be named data.jsonl and located in the root directory of the ZIP package. Ensure that when you open the ZIP file, you can immediately see data.jsonl file.

  3. The width and height of a single image must not exceed 1024 px, and the file size must not exceed 10 MB. Supported formats are .bmp.jpeg /.jpg.png.tif /.tiff, and .webp.

  4. Image file names must be unique within the entire package, even if they are in different folders.

  5. ZIP package directory structure:

    Single-level directory (Recommended)

    The image files and the data.jsonl file are located in the root directory of the ZIP package.

    Trainingdata_vl.zip
       |--- data.jsonl # Note: Do not place this file inside another folder.
       |--- image1.png
       |--- video1.mp4
    Multi-level directory
    1. The data.jsonl file must be in the root directory of the ZIP package.

    2. In data.jsonl, specify only the image or video file name. Do not specify the file path. For example:

      Correct example: image1.jpg. Incorrect example: jpg_folder/image1.jpg.

    3. Image and video file names must be unique within the entire ZIP package.

    Trainingdata_vl.zip
        |--- data.jsonl # Note: Do not place this file inside another folder.
        |--- jpg_folder
        |   └── image1.jpg
        |--- mp4_folder
            └── video.mp4

DPO dataset

The DPO dataset uses the ChatML format. A single training example has the following structure:

For an explanation of the system, user, and assistant roles, see Overview. For a dataset example, see DPO-ChatML-format-example.jsonl.

# A single line of training data (JSON format) has the following structure:
{"messages": [
  {"role": "system", "content": "System input"},
  {"role": "user", "content": "User input 1"},
  {"role": "assistant", "content": "Model output 1"},
  {"role": "user", "content": "User input 2"},
  {"role": "assistant", "content": "Model output 2"},
  {"role": "user", "content": "User input 3"}
 ],
 "chosen":
   {"role": "assistant", "content": "Preferred model output 3"},
 "rejected":
   {"role": "assistant", "content": "Rejected model output 3"}}

The model takes all content within messages as input, and DPO trains the model on the positive and negative feedback for User Input 3.

Wrap content for in-depth thoughts in the <think> tag:

{"role": "assistant", "content": "<think>Expected model thinking content</think>Expected model output"}

The "chosen" module of a single training data entry supports the "loss_weight" parameter, which is used to set the relative importance of that entry during training. (The valid range is 0.0 to 1.0, where a larger value indicates higher importance.)

This is an invitation-only parameter. To use it, please contact your account manager.
 "chosen":
   {"role": "assistant", "content": "Preferred model output 3", "loss_weight": 1.0},

CPT training set

The CPT training set uses the plain text format. A single training example has the following structure:

{"text":"Text content"}

For a dataset example, see CPT-text-generation-training-set-example.jsonl.

You can also download a data template from the Model Studio console.

image

Upload a fine-tuning file to Model Studio

DashScope API

For Windows CMD, replace ${DASHSCOPE_API_KEY} with %DASHSCOPE_API_KEY%. For PowerShell, replace it with $env:DASHSCOPE_API_KEY.
curl --request POST \
'https://dashscope.aliyuncs.com/api/v1/files' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY} \
--form 'files=@"/path/to/your/file.jsonl"' \
--form 'purpose="fine-tune"' \
--form 'descriptions="a sample fine-tune data file for qwen"'
Note

Usage limits:

  • The maximum size of a single file is 300 MB.

  • The total storage for all non-deleted files is limited to 5 GB.

  • The total number of non-deleted files is limited to 100.

  • There is no time limit on file storage.

For more details, see Model Fine-tuning File Management Service.

Sample response:

{
  "request_id":"xx",
  "data":{
    "uploaded_files":[{
      "file_id":"976bd01a-f30b-4414-86fd-50c54486e3ef",
      "name":"qwen-fine-tune-sample.jsonl"}],
   "failed_uploads":[]}
 }

Model fine-tuning

Create a fine-tuning job

HTTP

For Windows CMD, replace ${DASHSCOPE_API_KEY} with %DASHSCOPE_API_KEY%. For PowerShell, replace it with $env:DASHSCOPE_API_KEY.
curl --location "https://dashscope.aliyuncs.com/api/v1/fine-tunes" \
--header "Authorization: Bearer ${DASHSCOPE_API_KEY}" \
--header 'Content-Type: application/json' \
--data '{
    "model":"qwen3-8b",
    "training_file_ids":[
        "<your_training_file_id_1>",
        "<your_training_file_id_2>"
    ],
    "hyper_parameters":
    {
        "n_epochs": 3,
        "batch_size": 16,
        "max_length": 8192,
        "learning_rate": "1.6e-5",
        "lr_scheduler_type": "linear",
        "split": 0.9,
        "warmup_ratio": 0.05,
        "eval_steps": 50,
        "data_augmentation": true,
        "augmentation_ratio": "0.1,0.05,0.15",
        "augmentation_types": "dialogue_CN,general_purpose_CN,NLP",
        "save_strategy": "epoch",
        "save_total_limit": 10
    },
    "training_type":"sft"
}'

Input parameters

Parameter

Required

Type

Location

Description

training_file_ids

Yes

Array

Body

A list of file IDs for the training set.

validation_file_ids

No

Array

Body

A list of file IDs for the validation set.

model

Yes

String

Body

The ID of the base model to fine-tune, or the ID of a model from a previous fine-tuning job.

hyper_parameters

No

Map

Body

Hyperparameters for the fine-tuning job. Supported parameters and their default values vary by model. Go to the console and select the same model and training method to view the default values.

The following parameters affect the training cost and are required: n_epochs (number of epochs), batch_size (batch size), and max_length (sequence length).

training_type

No

String

Body

The fine-tuning method. Valid values are:

cpt

sft

efficient_sft

dpo_full

dpo_lora

job_name

No

String

Body

The name of the fine-tuning job.

model_name

No

String

Body

The name of the fine-tuned model. This is not the model ID, which is generated by the system.

Sample response

{
    "request_id": "635f7047-003e-4be3-b1db-6f98e239f57b",
    "output":
    {
        "job_id": "ft-202511272033-8ae7",
        "job_name": "ft-202511272033-8ae7",
        "status": "PENDING",
        "finetuned_output": "qwen3-8b-ft-202511272033-8ae7",
        "model": "qwen3-8b",
        "base_model": "qwen3-8b",
        "training_file_ids":
        [
            "9e9ffdfa-c3bf-436e-9613-6f053c66aa6e"
        ],
        "validation_file_ids":
        [],
        "hyper_parameters":
        {
            "n_epochs": 3,
            "batch_size": 16,
            "max_length": 8192,
            "learning_rate": "1.6e-5",
            "lr_scheduler_type": "linear",
            "split": 0.9,
            "warmup_ratio": 0.05,
            "eval_steps": 50,
            "data_augmentation": true,
            "augmentation_ratio": "0.1,0.05,0.15",
            "augmentation_types": "dialogue_CN,general_purpose_CN,NLP",
            "save_strategy": "epoch",
            "save_total_limit": 10
        },
        "training_type": "sft",
        "create_time": "2025-11-27 20:33:15",
        "workspace_id": "llm-8v53etv3hwb8orx1",
        "user_identity": "1654290265984853",
        "modifier": "1654290265984853",
        "creator": "1654290265984853",
        "group": "llm",
        "max_output_cnt": 10
    }
}

Supported base model IDs (model) and training types (training_type)

If the model for fine-tuning does not support the sft method, the fine-tuning job will fail.

Model service

Model code

Full-parameter CPT (cpt)

Full-parameter SFT (sft)

Efficient SFT (sft_efficient)

Full-parameter DPO (dpo_full)

Efficient DPO (dpo_lora)

Qwen3.6-Flash-2026-04-16

qwen3.6-flash-2026-04-16

×

Supported

×

×

×

Qwen3.5-27B

qwen3.5-27b

×

Supported

Supported

×

×

Qwen3.5-9B

qwen3.5-9b

×

Supported

Supported

×

×

Qwen3.5-Flash-2026-02-23

qwen3.5-flash-2026-02-23

×

Supported

×

×

×

Qwen3-32B

qwen3-32b

Supported

Supported

Supported

Supported

Supported

Qwen3-30B-A3B-Instruct-2507

qwen3-30b-a3b-instruct-2507

Supported

Supported

Supported

×

×

Qwen3-14B

qwen3-14b

×

Supported

Supported

Supported

Supported

Qwen3-8B

qwen3-8b

×

Supported

Supported

Supported

Supported

Qwen3-1.7B

qwen3-1.7b

Supported

Supported

Supported

Supported

Supported

Qwen3-0.6B

qwen3-0.6b

Supported

Supported

Supported

Supported

Supported

Qwen2.5-72B-Instruct

qwen2.5-72b-instruct

Supported

Supported

Supported

Supported

Supported

Qwen2.5-32B-Instruct

qwen2.5-32b-instruct

Supported

Supported

Supported

Supported

Supported

Qwen2.5-14B-Instruct

qwen2.5-14b-instruct

Supported

Supported

Supported

Supported

Supported

Qwen2.5-7B-Instruct

qwen2.5-7b-instruct

Supported

Supported

Supported

Supported

Supported

Qwen-Plus-Character-2025-11-06

qwen-plus-character-2025-11-06

×

Supported

Supported

Supported

Supported

hyper_parameters: Supported settings

Supported parameters and their default values vary by model. Go to the Console, select the same model and training method to view the actual default values.

Parameter

Recommended setting

Type

Description

n_epochs

(Number of epochs) [Required]

Data size < 10,000: 3~5

Data size > 10,000: 1~2

Integer

The number of times the model iterates through the training data. Adjust based on your experience with model fine-tuning.

More epochs lead to longer training times and higher costs.

learning_rate

(Learning rate)

Use the recommended default value.

Float

Controls the intensity of model weight adjustments.

  • A high learning rate causes drastic changes in model parameters, which may lead to poor or worse performance.

  • A low learning rate results in minimal changes to the model's performance.

freeze_vit

(Freeze visual backbone)

Adjust as needed

Boolean

Freezes the parameters of the visual backbone so its weights are not updated during training. This applies only to Qwen-VL models.

Warning

Billing based on token usage is available only when freeze_vit is set to true.

batch_size

(Batch size) [Required]

Use the recommended default value.

Integer

The number of data entries fed into the model for training at one time. A small value can significantly extend training time. Default values vary by model; check the console.

eval_steps

(Evaluation steps)

Adjust as needed

Integer

The step interval for model validation during training, used for periodic evaluation of training accuracy and loss.

This parameter affects the display frequency of Validation Loss and Validation Token Accuracy during model fine-tuning.

logging_steps

(Logging steps)

Adjust as needed

Integer

The step interval for logging fine-tuning progress.

lr_scheduler_type

(Learning rate scheduler)

Recommended: linear or Inverse_sqrt

String

The strategy for dynamically adjusting the learning rate during training.

For details on each strategy, see Fine-tune a model in the console.

max_length

(Sequence length) [Required]

8192

Integer

The maximum token length supported for a single training data entry. If a data entry exceeds this value, it will be discarded and not used for training.

For the relationship between characters and tokens, see How to convert between tokens and characters.

max_split_val_dataset_sample

(Max validation set samples)

Use the recommended default value.

Integer

If "validation_file_ids" is not set, the automatically split validation set will have a maximum of 1,000 samples.

This parameter is ignored if "validation_file_ids" is set.

split

(Training set ratio)

Use the recommended default value.

Float

If "validation_file_ids" is not set, 80% of the training file is automatically used as the training set and 20% as the validation set.

This parameter is ignored if "validation_file_ids" is set.

warmup_ratio

(Warm-up ratio)

Use the recommended default value.

Float

The proportion of the total training process dedicated to learning rate warm-up, where the learning rate linearly increases from a small value to the set value.

This parameter helps stabilize training by limiting parameter changes in the initial phase.

A high ratio has the same effect as a low learning rate, leading to minimal changes. A low ratio has the same effect as a high learning rate, potentially degrading performance.

A ratio that is too small has the same effect as a learning rate that is too high, which can cause the performance of the tuned model to not improve or even to degrade.

This parameter has no effect on the "Constant" learning rate scheduler.

weight_decay

(Weight decay)

Use the recommended default value.

Float

The strength of L2 regularization, which helps maintain the model's generalizability. An overly large value can diminish the effect of fine-tuning.

Efficient fine-tuning (efficient_sft or dpo_lora) parameters

Note

When you efficiently fine-tune a model for a second time, the lora_rank, lora_alpha, and lora_dropout parameters must remain consistent.

lora_rank

(LoRA rank)

64

Integer

The rank of the low-rank matrices in LoRA training. A higher rank improves fine-tuning effectiveness but slightly slows down training.

lora_alpha

(LoRA alpha)

Use the recommended default value.

Integer

The scaling factor that controls the combination of original model weights and the LoRA low-rank correction term.

A larger alpha gives more weight to the LoRA correction, making the model rely more on task-specific information.

A smaller alpha makes the model retain more knowledge from the original pre-trained model.

lora_dropout

(LoRA dropout)

Use the recommended default value.

Float

The dropout rate for the values in the low-rank matrices during LoRA training.

Using the recommended value enhances the model's generalization capabilities.

An overly large value can diminish the fine-tuning effect.

Data augmentation (supports efficient_sft and sft) parameters

data_augmentation

(Enable mixed training)

Mix based on the model's use case.

Boolean

When enabled, your training data is mixed with general-purpose datasets (multi-domain/industry/scenario):

- Effect: Improves training results and prevents catastrophic forgetting.

- Billing: Mixed data is included in the total training tokens and billed at the standard rate.

augmentation_types

(Preset data types)

Mix based on the model's use case.

Example: "augmentation_types": "dialogue_CN,general_purpose_CN,NLP"

Must be used with augmentation_ratio.

String

Dataset code

Dataset name

Supported models

dialogue_cn

Chinese-Dialogue

Qwen2 series

math_cn

Chinese-Math

general_coding_cn

Chinese-Code

general_purpose_cn

Chinese-General

nlp

NLP-Understanding

dialogue_en

English-Dialogue

math_en

English-Math

general_coding_en

English-Code

general_purpose_en

English-General

mix_v2

General-V2

Qwen3 series

vl_mix

General

Qwen3 VL series

augmentation_ratio

(Mixing ratio)

Mix based on the model's use case.

String

  • Format: Must correspond to augmentation_types.

  • Example: "0.1,0.05,0.15" (The values correspond to the three datasets listed in augmentation_types, respectively.)

  • Description: Randomly sample and mix 10%/5%/15% of the training data.

  • Range: 0.0 ~ 2.0

Model Parameter Snapshot Publishing (for efficient_sft or sft only) Parameters

save_strategy

(Snapshot save strategy)

You can set this to epoch or steps.

  • When set to steps, you can adjust the save interval by setting the save_steps parameter.

String

Sets the save interval and maximum number of model parameter snapshots (checkpoints) to save during fine-tuning.

save_steps

(Save steps)

If you need to manually modify the value, you should set it to an integer multiple of the eval_steps parameter.

Integer

Sets the step interval for saving model parameter snapshots (checkpoints).

save_total_limit

(Snapshot save limit)

10

Integer

Limits the maximum number of model parameter snapshots (checkpoints) that can be saved for publishing.

Query job details

To query the job status, use the job_id returned when you create the job.

HTTP

curl 'https://dashscope.aliyuncs.com/api/v1/fine-tunes/<job_id>' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY} \
--header 'Content-Type: application/json'

Request parameters

Parameter

Type

Location

Required

Description

job_id

String

Path

Yes

The ID of the fine-tuning job to query.

Successful response

{
    "request_id": "d100cddb-ac85-4c82-bd5c-9b5421c5e94d",
    "output":
    {
        "job_id": "ft-202511272033-8ae7",
        "job_name": "ft-202511272033-8ae7",
        "status": "RUNNING",
        "finetuned_output": "qwen3-8b-ft-202511272033-8ae7",
        "model": "qwen3-8b",
        "base_model": "qwen3-8b",
        "training_file_ids":
        [
            "9e9ffdfa-c3bf-436e-9613-6f053c66aa6e"
        ],
        "validation_file_ids":
        [],
        "hyper_parameters":
        {
            "n_epochs": 3,
            "batch_size": 16,
            "max_length": 8192,
            "learning_rate": "1.6e-5",
            "lr_scheduler_type": "linear",
            "split": 0.9,
            "warmup_ratio": 0.05,
            "eval_steps": 50,
            "data_augmentation": true,
            "augmentation_ratio": "0.1,0.05,0.15",
            "augmentation_types": "dialogue_CN,general_purpose_CN,NLP",
            "save_strategy": "epoch",
            "save_total_limit": 10
        },
        "training_type": "sft",
        "create_time": "2025-11-27 20:33:15",
        "workspace_id": "llm-8v53etv3hwb8orx1",
        "user_identity": "1654290265984853",
        "modifier": "1654290265984853",
        "creator": "1654290265984853",
        "group": "llm",
        "max_output_cnt": 10
    }
}

Job status

Description

PENDING

The job is waiting to start.

QUEUING

The fine-tuning job is in the queue. Only one fine-tuning job can run at a time.

RUNNING

The job is running.

CANCELING

The job is being canceled.

SUCCEEDED

The job succeeded.

FAILED

The job failed.

CANCELED

The job has been canceled.

Note

After a fine-tuning job succeeds, the finetuned_output field contains the resulting model ID. You can use this ID for model deployment.

Fine-tuning job logs

HTTP

curl 'https://dashscope.aliyuncs.com/api/v1/fine-tunes/<job_id>/logs?offset=0&line=1000' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY} \
--header 'Content-Type: application/json' 
Use the offset and line parameters to retrieve a specific range of log lines. The offset parameter sets the starting position for the log output, and the line parameter sets the maximum number of lines to return.

Sample response:

{
    "request_id":"1100d073-4673-47df-aed8-c35b3108e968",
    "output":{
        "total":57,
        "logs":[
            "{Log entry 1}",
            "{Log entry 2}",
            ...
            ...
            ...
        ]
    }
}

Query and publish model checkpoints

Only SFT fine-tuning (efficient_sft and sft) supports saving and publishing model checkpoints from intermediate states.

List checkpoints for a fine-tuning job

curl 'https://dashscope.aliyuncs.com/api/v1/fine-tunes/<job_id>/checkpoints' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY} \
--header 'Content-Type: application/json'

Request parameters

Parameter

Type

Parameter location

Required

Description

job_id

String

Path

Yes

The ID of the fine-tuning job.

Successful response example

Note

checkpoint refers to the Checkpoint ID, which is used to specify the snapshot to publish in the Model Publishing (Optional) API. model_name refers to the model ID and can be used for model deployment. (finetuned_output outputs the model_name of the last checkpoint.)

{
    "request_id": "c11939b5-efa6-4639-97ae-ed4597984647",
    "output":
    [
        {
            "create_time": "2025-11-11T16:25:42",
            "full_name": "ft-202511272033-8ae7-checkpoint-20",
            "job_id": "ft-202511272033-8ae7",
            "checkpoint": "checkpoint-20",
            "model_name": "qwen3-8b-instruct-ft-202511272033-8ae7",
            "status": "SUCCEEDED"
        }
    ]
}

Status

Description

PENDING

A checkpoint is pending publication and must be published using the Model Publishing API before you can perform Model Deployment & Invocation.

PROCESSING

Checkpoint publishing is in progress.

SUCCEEDED

The checkpoint has been published successfully. You can now use it for model deployment and invocation.

FAILED

Checkpoint publishing failed.

Model publishing (optional)

Note

In Model Studio, you can export a checkpoint after a fine-tuning job completes. Only exported checkpoints can be deployed.

Exported checkpoints are stored in cloud storage. You cannot access or download them at this time.

curl --request GET 'https://dashscope.aliyuncs.com/api/v1/fine-tunes/<job_id>/export/<checkpoint_id>?model_name=<model_name>' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY} \
--header 'Content-Type: application/json'

Request parameters

Parameter

Type

Parameter location

Required

Description

job_id

String

Path

Yes

The ID of the fine-tuning job.

checkpoint_id

String

Path

Yes

The ID of the checkpoint to publish.

model_name

String

Path

Yes

The custom model ID to assign to the published model.

Successful response example

{
    "request_id": "ed3faa41-6be3-4271-9b83-941b23680537",
    "output": true
}

Publishing tasks are performed asynchronously. Use the Query Snapshot List API to monitor the snapshot publishing status.

More fine-tuning operations

List fine-tuning jobs

curl 'https://dashscope.aliyuncs.com/api/v1/fine-tunes' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY} \
--header 'Content-Type: application/json' 

Cancel fine-tuning job

Cancels a fine-tuning job that is in progress.
curl --request POST 'https://dashscope.aliyuncs.com/api/v1/fine-tunes/<job_id>/cancel' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY} \
--header 'Content-Type: application/json' 

Delete fine-tuning job

You cannot delete a fine-tuning job that is in progress.
curl --request DELETE 'https://dashscope.aliyuncs.com/api/v1/fine-tunes/<job_id>' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY} \
--header 'Content-Type: application/json' 

API reference

This topic provides a reference for DashScope command line calls. For details on API calls, see API details.

Model deployment and invocation

Model deployment

For more information about model deployment methods, see Deploy a model by using the API.

Model token usage

curl "https://dashscope.aliyuncs.com/api/v1/deployments" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{        
    "model_name": "qwen3-8b-ft-202511132025-0260",
    "plan": "lora",
    "capacity": 1,
    "name": "qwen3-8b-ft"
}'

Model unit usage

curl "https://dashscope.aliyuncs.com/api/v1/deployments" \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "name": "my_qwen_plus",  
    "model_name": "qwen-plus-2025-12-01",
    "plan": "mu",
    "deploy_spec": "MU1",
    "enable_thinking": true,
    "capacity": 4,
    "max_context_length": 10000,
    "rpm_limit": 500,
    "tpm_limit": 1000
}'

Model deployment status

When the deployment status is RUNNING, you can invoke the model.

curl 'https://dashscope.aliyuncs.com/api/v1/deployments/<Replace with the model instance ID returned after the deployment job succeeds>' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY}  \
--header 'Content-Type: application/json' 

For more operations related to model deployment, such as scaling and taking a model offline, see Model deployment - API details.

Model invocation

When the deployment status is RUNNING, you can invoke the fine-tuned model just like any other model.

You can also go to the model deployment console to get the Model Code.

For more information about usage and parameter settings, see the DashScope API Reference.

curl 'https://dashscope.aliyuncs.com/api/v1/services/aigc/text-generation/generation' \
--header 'Authorization: Bearer '${DASHSCOPE_API_KEY}  \
--header 'Content-Type: application/json' \
--data '{
    "model": "<Replace with the model instance ID returned after the deployment job succeeds>",
    "input":{
        "messages":[
            {
                "role": "user",
                "content": "Who are you?"
            }
        ]
    },
    "parameters": {
        "result_format": "message"
    }
}'

Model evaluation

You can evaluate models in Alibaba Cloud Model Studio only in the console. Go to the Model Evaluation page to assess the training performance of your model.

For more information, see Model evaluation.