Fine-tune models in the console

更新时间: 2026-12-02 18:51:34

This topic describes how to run model fine-tuning tasks in the console and helps you choose the right fine-tuning method and parameters. The console provides five training methods when creating a training task: SFT fine-tuning, DPO preference training, CPT continued pre-training, RL reinforcement learning, and OPD distillation training.

Model fine-tuning process

image

Step 1: Select a fine-tuning method

Go to the model fine-tuning page and click the "Create Training Task" button.

After entering the Create Training Task page, select a training method in the Training Method card within the Training Configuration area. The console provides five training methods:

Training MethodDescription
SFT fine-tuningSupervised fine-tuning that enhances the model's instruction-following capability, available in full-parameter and efficient training modes
DPO preference trainingIntroduces negative feedback to reduce hallucinations and make model outputs better align with human preferences
CPT continued pre-trainingUnsupervised continued pre-training on unlabeled data to strengthen or add specific model capabilities
RL reinforcement learningOptimizes policies through reward signals to improve the model's reasoning and decision-making capabilities. For more information, see reinforcement learning
OPD distillation trainingOn-policy distillation that aligns a student model with a teacher model on its own sampled trajectories, inheriting strong model capabilities at low cost. For more information, see OPD distillation training

When you select SFT fine-tuning, you can further choose Efficient Training or Full Parameter Training. The Training Task Summary panel on the right side of the page displays a real-time overview of the current task's model, priority, billing method, and other configuration.

In the Basic Information area, you can set the Task Name and Task Priority. Task priorities are divided into four levels: L0, L1, L2, and L3, ranked from highest to lowest, and affect the scheduling order of training tasks. A higher priority means the training task is scheduled and executed earlier.

How to choose among CPT, SFT, and DPO

CPT (Continual Pre-Training) aims to improve the model's performance in a specific industry through massive amounts of unlabeled training data.

In addition to CPT, SFT, and DPO, RL (reinforcement learning) suits scenarios that require continuously improving model performance through human feedback or automated scoring, as well as enhancing reasoning and decision-making capabilities. For more information, see reinforcement learning. OPD distillation training suits scenarios where you want to inherit the capabilities of a stronger teacher model at low cost. For more information, see OPD distillation training.

SFT (Supervised Fine-Tuning) aims to improve the model's performance in a specific business through targeted datasets and training.

DPO (Direct Preference Optimization) provides both positive and negative samples in the training dataset. By introducing negative feedback, it reduces hallucinations and optimizes bad cases in a targeted manner.

The three fine-tuning methods provided by Model Studio are not mutually exclusive, but progressive and complementary.

CPT(可选)→ SFT → DPO(可选)

  1. CPT (Continual Pre-Training) - adds knowledge (the "breadth" and "shallowness" of general model knowledge cannot meet the "depth" and "precision" requirements of professional domains)

    • Financial model: learn financial terminology
    • Medical model: learn drug indications and pathology
    • Legal model: learn statutes and case law
  2. SFT (Supervised fine-tuning) - learns to perform tasks

    • Customer service bot: learn customer service workflows
    • Code assistant: learn programming paradigms
    • Tool calling (Agent): learn to use MCP
  3. DPO (Direct preference optimization) - performs better

    • Safety and responsibility: reject harmful advice
    • Conciseness and effectiveness: answer crisply
    • Objectivity and neutrality: judge fairly and objectively

For the data file formats of each training method, see fine-tuning data upload rules.

For the data volume requirements of each training method, see fine-tuning data upload rules.

Alibaba Cloud Model Studio recommends using model fine-tuning in the order of CPT (optional) first, then SFT, and finally DPO:
  1. First, collect massive amounts (at least 10 million tokens) of unlabeled samples in a specific domain for CPT continued pre-training, training the model into an expert in a specific industry or domain.
  2. Before launching your application, use a sufficient number (1,000+) of positive samples for specific scenarios or businesses, that is, collect scenario/business inputs plus expected model outputs, for SFT training.
  3. After your application enters trial operation or goes live, collect enough (100+) user feedback (such as likes, dislikes, and feedback) or bad cases, turn this data into a DPO training set, and perform DPO training.
Select Model

If this is your first time fine-tuning a model, select the Official Model you want.

If you need to retrain a model because its training results are unsatisfactory, select My Models > the model you want to retrain.

After selecting a model, some models display the Training Modality options (such as text generation and visual understanding). Select the modality that matches your business scenario. If the model supports it, the thinking mode options (such as Instruct and Thinking) are also displayed; select as needed.

Search for decision in the model drop-down list to select a decision model (preview) for decision model fine-tuning. For more information, see decision model fine-tuning best practices.

Full parameter training vs. efficient training

  • Full parameter training learns by updating all model parameters.
  • Efficient training uses Low-Rank Adaptation (LoRA), updating only the decomposed low-rank parameters through matrix factorization.

Since the costs of the two training methods are the same, Alibaba Cloud Model Studio recommends that you prefer full parameter training if the model supports it, because full parameter training delivers better results than efficient training and is more cost-effective.

Step 2: Hyperparameter configuration

Training parameter description:

Not all models support adjusting all parameters. The console display takes precedence.

In addition to batch size, the parameter configuration panel includes the following training parameters (default values are subject to the console display):

  • learning_rate (learning rate): default 3e-4 for efficient training, default 1e-5 for full parameter training and CPT
  • n_epochs (Rounds): default value 3, range [1, 200]
  • eval_steps (evaluation steps): default value 50
  • lora_alpha (LoRA scaling factor): default value 16
  • lora_dropout: default value 0.1, range [0, 0.2]
  • lora_rank (LoRA rank): default value 8
  • lr_scheduler_type (learning rate scheduler type): default value linear
  • max_length (maximum length): the value range varies by model and training method (for example, [500, 32768], [500, 65536], and [500, 131072])
  • warmup_ratio (warmup ratio): default value 0.05, range [0, 1]
  • weight_decay (weight decay): default value 0.01, range [0, 0.2]

Parameter Name

Recommended Settings

Hyperparameter Effect

Batch size (batch_size)

Use the default value

Batch size, which represents the data step at which the model updates its parameters during model training. It can be understood as how much data the model reviews before updating its parameters once. The generally recommended batch size is 16/32, meaning the model updates its parameters after reviewing every 16 or 32 records. The specific value range varies by model and training method, and the console display takes precedence.

Learning rate (learning_rate)

Efficient Training: 1e-4 Levels

Full Parameter Training: 1e-5 Levels

CPT continued pre-training: 1e-5 Levels

Controls the strength of the model's weight correction.

If the learning rate is set too high, the model parameters change drastically, and the fine-tuned model may not necessarily perform better, or may even perform worse;

If the learning rate is too low, the fine-tuned model's performance will not change much.

Rounds (n_epochs)

Data volume < 10,000, 3~5 Times

Data volume > 10,000, 1~2 Times

The specific value should be determined based on experiment results

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

More training rounds mean longer training time and higher training costs. Value range [1, 200].

Evaluation steps (eval_steps)

Use the default value

The validation interval, in steps, for the model during the training phase. It is used to periodically evaluate the model's training accuracy and training loss.

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

Learning rate scheduler type (lr_scheduler_type)

It is recommended to select "linear" or "Inverse_sqrt".

The strategy for dynamically adjusting the learning rate during model training.

For details on each strategy, see Introduction to learning rate schedulers.

Sequence length (max_length)

Set to the maximum value supported by the model

The maximum token length supported for a single piece of training data. If the token length of a single data entry exceeds the set value:

For SFT, the data entry is directly discarded and not used for training;

For DPO, tokens beyond the configured length are automatically truncated, and the truncated data is still used for training.

For how characters and tokens are counted for billing, see Model invocation billing. The value range varies by model and training method (for example, [500, 32768], [500, 65536], [500, 131072]), subject to what is displayed in the console.

Learning rate warmup ratio (warmup_ratio)

Use the default value

The proportion of the total training process occupied by learning rate warmup. Learning rate warmup means that the learning rate linearly increases from a small value to the set learning rate after training starts.

This parameter mainly limits the magnitude of changes in model parameters during the initial stage of training, helping the model train more stably.

An excessively large ratio has the same effect as an overly low learning rate, resulting in little change in the fine-tuned model's performance.

An excessively small ratio has the same effect as an overly high learning rate, which may not improve, or may even degrade, the fine-tuned model's performance. Value range: [0, 1].

This parameter is invalid only for the "Constant" learning rate scheduling strategy.

Weight decay (weight_decay)

Use the default value

The L2 regularization strength. L2 regularization helps preserve the model's general capabilities to some extent. An excessively large value results in an unnoticeable fine-tuning effect. Value range: [0, 0.2].

Whether to freeze the VIT (freeze_vit)

Use the default value

Used to freeze the parameters of the visual backbone network so that its weights are not updated during training.

Only when freeze_vit is set to "true" can the model be billed by token usage.

Efficient training parameters

LoRA alpha (lora_alpha)

Use the default value

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

A larger Alpha value gives more weight to the LoRA correction terms, making the model rely more on the specific information of the fine-tuning task;

while a smaller Alpha value makes the model more inclined to retain the knowledge of the original pre-trained model.

LoRA dropout (lora_dropout)

Use the default value

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

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

An excessively large value results in an unnoticeable fine-tuning effect. Value range: [0, 0.2].

LoRA rank (lora_rank)

Set to the maximum value supported by the model

The rank size of the low-rank matrices in LoRA training. A larger rank slightly improves the fine-tuning effect but slows down training somewhat.

NoteThe supported parameters vary by training method:

  • SFT (efficient training): supports all the preceding parameters.
  • DPO (efficient training): supports all parameters except "Whether to freeze the VIT" (freeze_vit).
  • CPT (continued pre-training): does not support lora_alpha/lora_dropout/lora_rank; all other parameters (including freeze_vit) are supported.

Introduction to learning rate scheduling strategies

Learning rate scheduling strategy (lr_scheduler_type) is located in the Hyperparameter Configuration section and becomes visible after you click Show. It includes a total of 8 strategies:

  • Linear: The learning rate decreases linearly. Suitable for tasks with a short training process.

    plot_linear
  • Polynomial: The learning rate gradually decreases according to a predefined polynomial function as the number of training iterations or epochs increases, allowing finer control over the rate at which the learning rate decreases. Suitable for relatively complex tasks. However, the built-in polynomial coefficient is 1, so the curve and effect are the same as Linear, and this strategy is not recommended.

  • Cosine: The learning rate changes along a cosine function curve. Suitable for tasks that require fine adjustments and a long training process.

    plot_cosine
  • Cosine_with_restarts: The learning rate periodically decreases to a minimum value following the shape of a cosine function, "restarts" to a preset value at the end of each cycle, and then begins the next cycle. Suitable for cases where the model needs to jump out of a local optimum and try to find a better global solution. In actual runs, the learning rate does not "restart" to the preset value at the bottom of the function curve, and this strategy is not recommended.

  • Constant: The learning rate remains unchanged, and the learning rate warmup ratio parameter has no effect. Suitable for initial exploration of model performance.

    plot_constant
  • Constant_with_warmup: The learning rate remains unchanged, but the learning rate warmup ratio parameter takes effect. Suitable for initial exploration of model performance.

    plot_constant_with_warmup
  • Inverse_sqrt: The learning rate gradually decreases, and the amount of decrease is positively correlated with the reciprocal of the square root of the number of iterations. Suitable for SFT fine-tuning, as it balances learning efficiency and model convergence well.

    plot_inverse_sqrt
  • reduce_lr_on_plateau: Automatically reduces the learning rate when the monitored metric (validation loss or validation accuracy) shows no significant improvement over several consecutive epochs. When it is difficult for the model to further improve its performance, this strategy can help the model continue to optimize and improve.

    plot_reduce_lr_on_plateau

NoteThe learning rate lower-bound gradient and minimum values in the figure are for illustration only; the actual learning rate lower-bound gradient and minimum values are subject to actual usage.

Step 3: Select Training Data

For dataset building tips, see Dataset building tips. To upload a fine-tuning dataset, go to the Data Management page.

For more information about the upload format specifications, packaging rules, and size and quantity limits for fine-tuning data, see Fine-tuning data upload rules.

In the Data Configuration section, you can configure the following:

  • Training set: Two methods are supported: Dataset Selection and Mount Dataset. Dataset selection is used to select an uploaded fine-tuning dataset as the training data; dataset mounting is used to directly mount data files in OSS.

    NoteIf you use Mount Dataset to load a dataset, you must first authorize the Model Studio service to access your data. To do this: go to the Model fine-tuning page, click Create Training Task, then click Mount Dataset under Data Configuration, and follow the prompts to complete the authorization. If you can see your file list on that page, the authorization has succeeded.

  • Mixed Training: After it is enabled, you can additionally add mixed training datasets. Mixed training data is used to maintain the model's general capabilities during fine-tuning, preventing the model from losing its original general conversation capabilities due to overfitting to specific task data. If you have data from multiple business scenarios, enabling mixed training is recommended.

  • Validation set: Two methods are supported: Automatic Splitting and Select a dataset. When automatic splitting is selected, the platform randomly extracts 10% of the data from the training dataset as the validation set. You can also choose to upload a separate validation dataset. The validation set is used to evaluate model performance during training, showing validation loss (Validation Loss) and validation token accuracy (Validation Token Accuracy).

Step 4: Training Resource Configuration

In the Training Resource Configuration section, select the billing method for the training task. The console supports the following three billing methods:

  • Pay by Token: Uses the platform's idle shared resources and is billed based on the number of tokens actually consumed during training. Training speed depends on resource availability, and queueing may occur.
  • Training units (upfront): Training units are purchased in advance and deducted by unit, with guaranteed resources and no queueing. Suitable for scenarios with steady training demands. You must first purchase training units through Resource Pool (upfront).
  • Training units (pay-as-you-go): Uses training unit resources and is deducted on a pay-as-you-go basis according to actual usage. Suitable for flexible scenarios where you have training demands but do not want to purchase in advance.

NoteFor detailed billing information and pricing, see Model fine-tuning overview - Billing Details.

Step 5: Training Output

The following settings apply to SFT, DPO, and CPT training.

NoteOn the Model Studio platform, after model fine-tuning is complete you can export a parameter snapshot. Only after export can you deploy the model on Model Studio based on this version of the parameter snapshot.

The exported parameter snapshots are saved in cloud storage and currently cannot be accessed or downloaded.

In the Training Output area, you can configure:

  • Model Name: Set the name of the output model. After training completes, the last checkpoint produced is automatically published to My Models under this name.
  • Maximum number of exports: Use the Up to drop-down list to set the number of models finally exported by the training job. Each model save adds extra task duration.
  • Checkpoint save interval: Set how often checkpoints are saved. Select Calculated by epoch or Calculated by step.
  • Model Encryption (Security Upgrade): When enabled, the platform enables OSS server-side encryption for model files, using fully managed OSS keys for encryption and decryption (SSE-OSS), with AES256 as the encryption algorithm.

Step 6: Train the model

Click Start Training > Confirm the Model Fine-tuning Billing Notice > The model starts training.

If you encounter insufficient permissions, see: What should I do if I get a permission error during model fine-tuning?

During model training, click the "Logs" button to view the logs generated in real time during model training. You can also go to the Metrics tab to view Training Loss, Validation Loss, and Validation Token Accuracy.

After training completes, check the trend of the difference between Training Loss and Validation Loss.

  1. If Training Loss gradually decreases while Validation Loss gradually increases, the model has overfit the training data. Training may have failed and the results may be poor. Apply the following recommended methods (in order of recommendation) to optimize and retrain to improve the results:

    1. Use data augmentation to increase training data diversity and volume.
    2. Collect more training data to increase training data diversity and volume.
    3. Adjust hyperparameters, including: reduce "epochs", lower the "learning rate", decrease the "batch size", increase the "weight decay", raise the "LoRA dropout", and increase the "warmup ratio".
  2. If Training Loss shows little change or gradually increases (uncommon), the model has underfit the training data. Training failed. Apply the following recommended methods (in order of recommendation) to optimize and continue training:

    1. Check data quality and ensure thorough data cleaning.
    2. Adjust hyperparameters, including: increase "epochs", raise the "learning rate", increase the "batch size", decrease the "weight decay", lower the "LoRA dropout", and reduce the "warmup ratio".
  3. If neither of the above occurs, continue with the subsequent steps.

Task list and operations

On the Model Fine-tuning page, you can view all training jobs. The list displays the following columns: job name/ID, priority (L0-L3), base model, training method, training status, billing method, output, job duration, and creation time. The top-right corner of the page provides the following buttons:

  • Training Cost Records: View cost details of training jobs.
  • Resource Pool Management (Prepaid): Manage prepaid training unit resource pools.
  • Create Training Task: Create a new training job.
  • Reset: Clear filter conditions.

The list supports filtering by priority (after selecting a priority, only jobs of that level are displayed). Each row's operation column provides Details, Stop, Logs, and Delete buttons, with availability depending on the job status.

Step 7: Publish the model for deployment

Only SFT fine-tuning supports publishing model snapshots of intermediate training states

After model training completes, based on the configuration in Step 5: Training output, the last checkpoint produced is automatically published to the My Models page under the set model name.

To publish checkpoints from other intermediate training stages, go to the Outputs tab on the training job details page to view the list of all saved checkpoints, select the target checkpoint, and click Publish Model.

The Outputs tab contains the following information: Checkpoint ID, training save info, model publish status, model name, remaining retention time, creation time, and actions.

NoteCheckpoints are retained on the platform for 30 days. After expiration, they are automatically deleted and cannot be recovered, and the checkpoint can no longer be published. Publish the model snapshots you need promptly.

Published models can be viewed on the My Models page and deployed.

Step 8: Deploy the model

Go to the My Models page to quickly find information such as supported deployment modes and model ID. After deployment, you can evaluate the fine-tuned model. For model deployment details, see Model deployment.

Step 9: Evaluate the model

ImportantIf you have multiple business scenarios or have added mixed training data, when evaluating the model, we recommend splitting the evaluation set by scenario and evaluating each scenario separately to check whether the fine-tuned performance in each scenario meets your requirements.

Use the Alibaba Cloud Model Studio Model Evaluation feature to evaluate the training results of your custom model. For related information, see Help Center: Model evaluation overview.

FAQ

When should I use model fine-tuning?

  • Although text generation model fine-tuning can achieve excellent results in specific business scenarios, it has the following limitations:

    • Time-consuming, including: building a large-scale (at least 50 million token) CPT dataset, constructing an effective (1,000+) SFT dataset, collecting enough (100+) bad cases to build an effective DPO dataset, and the slow iteration speed of model optimization.
    • High cost. A fine-tuned model can only be used after deployment, and model deployment billing is high.
  • Alibaba Cloud Model Studio recommends that, before using text generation model fine-tuning, you first try using Prompt Engineering (Prompt Engineering) or Function Calling (Function Calling) to customize your application. Model fine-tuning is also usually the "last resort" for improving model performance. Because:

    1. In many tasks, the model may initially perform poorly, but applying the correct prompt techniques can improve the results, and model fine-tuning is not necessarily required.
    2. Iteratively optimizing prompts and plugins is more agile and lower-cost than fine-tuning iterations, because fine-tuning iterations may require re-collecting data, cleaning and optimizing data, collecting bad cases, and conducting customer surveys.
    3. Even if model fine-tuning is ultimately required, the initial prompt engineering and plugin iteration work will not be wasted. This preliminary work can be fully reused when building the fine-tuning dataset (as input for building the dataset).

What should I do if I get a permission error during model fine-tuning?

Contact your platform or workspace administrator to verify and grant the following permissions:

  1. Your account must have the page permissions for Model Fine-tuning - Operation, Model Deployment - Operation, and Model Evaluation - Operation in the workspace where you run fine-tuning jobs.

    For related information, see: Account permission management. Console link: Model Studio - Account Management.

  2. The workspace where you run fine-tuning jobs must have the permission to perform Model Training (fine-tuning) on the specific model.

    For related information, see: Grant sub-workspaces model invocation, training, and deployment permissions. Console link: Model Studio - Workspace Management.

    On the Model List page in Workspace Management, confirm that the Model Training column of the target model (e.g., Qwen3-8B) shows Authorized.

What should I do if the evaluation results are poor after model fine-tuning?

  1. If you use manual evaluation, check whether the evaluation dimensions match your business or scenario.
  2. Collect the test cases with poor evaluation results, analyze the causes of the poor results, adjust the training dataset based on the analysis, and continue iterating on the fine-tuned model.
  3. Generate DPO cases from the poorly evaluated cases and run DPO training on the model.

How are model fine-tuning, model deployment, and model evaluation billed?

Model fine-tuning is billed by the number of tokens actually consumed during training. A trained model incurs only deployment fees after deployment, not invocation fees. Model evaluation is free of charge. For detailed data, see Model training and deployment billing.

Can I download a model fine-tuned on Alibaba Cloud Model Studio for local deployment?

Models fine-tuned on the Alibaba Cloud Model Studio platform do not support export. They can only be tested and invoked after deployment on Alibaba Cloud Model Studio.

What should I do if model fine-tuning fails with a message about insufficient training data?

When model fine-tuning fails due to insufficient training data, you can try adjusting the Sequence Length (max_length) parameter to resolve it.

Explanation

Sequence length determines the maximum token length supported for a single training data entry. In SFT (supervised fine-tuning) training, data exceeding the sequence length is discarded directly. If the sequence length is set too large, a large amount of training data may be discarded for being too long, leaving insufficient data actually participating in training and causing training failure.

Solution
  1. When creating a training job, click Expand Configuration in the Hyperparameter Configuration area and find the max_length (sequence length) parameter.
  2. Reduce the sequence length to a smaller value (such as 8192) so that more training data meets the length requirement and participates in model training.
  3. Resubmit the training job.

NoteOn the model fine-tuning job list, click Logs on the right of the failed training job to view the specific failure reason.

What should I do if the fine-tuned model still responds with the base model identity during testing?

Explanation

Identity settings take effect through the system prompt. If the system prompt used during fine-tuning is not passed in when calling, the model may still respond with the base model identity.

Solution

You can verify the identity setting effect of the fine-tuned model in the following ways:

  • Method 1: Pass in the system prompt through an API call

    When calling the API, fill in the identity setting content in the system field of the request, and the model will answer according to the fine-tuned settings.

  • Method 2: Test in the Experience Center of the console
    1. In the left-side navigation pane, choose Experience Center > Text Model.
    2. Click the model name and select your deployed fine-tuned model.
    3. Click Model Debugging in the upper-right corner and fill in the identity setting content in the System Prompt input box of the configuration panel that opens.
    4. Send a test question in the dialog box and confirm that the model answers with the fine-tuned identity.
上一篇: Fine-tuning data upload rules 下一篇: Fine-tune with the API
阿里云首页 大模型服务平台百炼 相关技术圈