All Products
Search
Document Center

MaxCompute:Modify a model version

Last Updated:Mar 26, 2026

Manage model versions in MaxCompute by adding new versions, changing the default version, or removing obsolete ones. All three operations use ALTER MODEL DDL and require the ALTER permission on the model.

Prerequisites

Before you begin, make sure that:

  • A MaxCompute model object already exists in the project. See Create and delete a model.

  • You have the ALTER permission on the model.

Public models are hosted in public projects under the MaxCompute system account. You cannot modify version information of public models. For a list of public models, see MaxCompute models.

Supported platforms

Run the commands in this topic on any of the following platforms:

Add a model version

Add a new version to an existing MaxCompute model. Each version can have its own input column definitions and source-specific configuration.

Syntax

ALTER MODEL <model_name> ADD VERSION <version_name>
[INPUT(<input_col_name> <input_data_type>, ... )]
WITH OPTIONS(
    [MODEL_SOURCE_TYPE = '<model_source_type>']
    [,MODEL_TYPE = '<model_type>']
    [,LOCATION = '<location>']
    [,ROLEARN = '<rolearn>']
    [,TASKS = '<tasks>']
    [,PAI_EAS_MODEL_NAME = '<pai_eas_model_name>']
    [,PAI_EAS_SERVICE_NAME = '<pai_eas_service_name>']
    [,ENDPOINT = '<endpoint>']
    [,APIKEY = '<apikey>']
    [,PAI_EAS_SYNC_MODE = 'true']
    [,PAI_EAS_SYNC_REQUEST_TIMEOUT = '5000']
)
[COMMENT <model_comment>];

Parameters

General parameters

Parameter Required Description
model_name Yes Name of the existing model to modify. An error is returned if the model does not exist.
version_name Yes Name of the new model version. Case-insensitive; can contain letters (a-z, A-Z), digits, and underscores (_). Start with a letter. Maximum 256 bytes. Cannot be default_version.
input_col_name No (required for imported models) Input column name for the model version. Case-insensitive; can contain letters, digits, underscores, or Chinese characters. Start with a letter. Maximum 128 bytes. Different versions of the same model can have different column names and column counts.
input_data_type No (required for imported models) Data type of the input column. Supported types: BIGINT, DOUBLE, STRING, BINARY. For the full list, see Data type versions. Different versions of the same model can have different column types.
model_source_type No Model source type. If specified, must be the same across all versions of the model — an error is returned if versions have inconsistent values. Valid values: IMPORT (imported model), REMOTE (remote model).
model_type No Model type. If specified, must be the same across all versions of the model — an error is returned if versions have inconsistent values. For imported models: BOOSTED_TREE_REGRESSOR (XGBoost regression), BOOSTED_TREE_CLASSIFIER (XGBoost classification). For remote models: LLM (large language model), MLLM (multimodal large language model).
comment No Comment for the new model version. Maximum 1,024 bytes.

Imported model parameters

Use these parameters when MODEL_SOURCE_TYPE = 'IMPORT'.

Parameter Required Description
location Yes OSS path of the model file. Only OSS internal network endpoints are supported. Example: LOCATION = 'oss://oss-cn-shanghai-internal.aliyuncs.com/test-mode-bucket/'
rolearn Yes RAM role ARN for authenticating access to the model file in OSS. Example: ROLEARN = 'acs:ram::139******728:role/aliyunodpsdefaultrole'. To grant the MaxCompute access account the required OSS permissions, use one-click authorization (grants the AliyunODPSDefaultRole permission by default) or create a custom role.

Remote model parameters

Use these parameters when MODEL_SOURCE_TYPE = 'REMOTE'.

Parameter Required Description
tasks Yes Task type. Valid values: text-generation, chat, sentence-embedding.
pai_eas_model_name Yes Name of the model deployed in PAI EAS. View the model name and service name in the PAI EAS console.
pai_eas_service_name Yes Name of the PAI EAS model service. If the EAS service belongs to a service group, use the GroupName.ServiceName format (for example, group.service_name). Otherwise, specify only the EAS service name.
endpoint Yes Endpoint of the PAI EAS service. Example: http://1**************70.cn-shanghai.pai-eas.aliyuncs.com. Only public endpoints are currently supported. Before calling the AI function, add the endpoint to the allowed external network addresses for MaxCompute. See Edit external network addresses through project management.
apikey Yes Token of the PAI EAS service. View the token on the invocation information page in the PAI EAS console.
pai_eas_sync_mode Yes Request processing mode. Only true is supported (synchronous mode).
pai_eas_sync_request_timeout No Timeout for synchronous requests, in milliseconds. Default: 5000. Range: 5000–1800000.

Examples

Example 1: Add version v2 to the remote model PAI_EAS_Qwen25_Omni_3B. The input is a string-type image URL, enabling the model to perform image-to-text tasks. For a complete end-to-end example, see Use a MaxCompute remote model to automatically generate E-commerce product descriptions.

ALTER MODEL PAI_EAS_Qwen25_Omni_3B ADD VERSION v2
INPUT(url STRING, promt STRING)
WITH OPTIONS(
    TASKS = 'text-generation',
    PAI_EAS_MODEL_NAME = 'Qwen2.5-Omni-3B',
    PAI_EAS_SERVICE_NAME = 'test_remote_model',
    ENDPOINT = 'http://11261230********.cn-shanghai.pai-eas.aliyuncs.com',
    APIKEY = '<apikey>',
    PAI_EAS_SYNC_MODE = 'true'
)
COMMENT "PAI EAS remote model string-url input";

Example 2: Add version V2 to the imported model test_xgboost_classifier.

ALTER MODEL test_xgboost_classifier ADD VERSION V2
INPUT (f1 int, f2 int, f3 int)
WITH OPTIONS(
    LOCATION = 'oss://oss-cn-shanghai.aliyuncs.com/model-bucket-test/xgboost_classifier_v2/',
    ROLEARN = 'acs:ram::11261230********:role/aliyunodpsdefaultrole'
)
COMMENT 'Import XGBoost model v2';

Set the default model version

Change which version MaxCompute treats as the default for a model.

Syntax

ALTER MODEL <model_name> SET DEFAULT_VERSION <version_name>;

Parameters

Parameter Required Description
model_name Yes Name of an existing model. An error is returned if the model does not exist.
version_name Yes Name of an existing model version to set as the default. An error is returned if the version does not exist.

Example

The following example checks the current default version of PAI_EAS_Qwen25_Omni_3B (v1), changes it to v2, and verifies the change.

-- Check the current default version. Default version is v1, with BINARY input.
DESC MODEL PAI_EAS_Qwen25_Omni_3B;
+------------------------------------------------------------------------------------+
|                  Model Information                                                 |
+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$*********                             |
| Project:                  ****_demo                                                |
| Model Name:               pai_eas_qwen25_omni_3b                                   |
| Model Type:               MLLM                                                     |
| Source Type:              REMOTE                                                   |
| Default Version:          v1                                                       |
| CreateTime:               2025-10-09 18:32:48                                      |
| LastModifiedTime:         2025-10-10 16:38:41                                      |
| Comment:                  PAI EAS remote model binary input                        |
+------------------------------------------------------------------------------------+
|                Version Information                                                 |
+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$*********                             |
| Project:                  ****_demo                                                |
| Model Name:               pai_eas_qwen25_omni_3b                                   |
| Model Type:               MLLM                                                     |
| Source Type:              REMOTE                                                   |
| Version Name:             v1                                                       |
| Path:                                                                              |
| CreateTime:               2025-10-09 18:32:48                                      |
| LastModifiedTime:         2025-10-09 18:32:48                                      |
| APIKEY:                   ZjA5NGRjN2VjOTZiM********TZmZTQ1MThkMGE4ZmUyNj********== |
| ENDPOINT:                 http://11261230********.cn-shanghai.pai-eas.aliyuncs.com |
| PAI_EAS_MODEL_NAME:       Qwen2.5-Omni-3B                                          |
| PAI_EAS_SERVICE_NAME:     test_remote_model                                        |
| PAI_EAS_SYNC_MODE:        true                                                     |
| REMOTE_SERVICE_TYPE:      PAI-EAS                                                  |
+------------------------------------------------------------------------------------+
| Input           | Type       | Comment                                             |
+------------------------------------------------------------------------------------+
| data            | binary     |                                                     |
| promt           | string     |                                                     |
+------------------------------------------------------------------------------------+
-- Change the default version to v2.
ALTER MODEL PAI_EAS_Qwen25_Omni_3B SET DEFAULT_VERSION v2;
-- OK

-- Verify: default version is now v2, with STRING input.
DESC MODEL PAI_EAS_Qwen25_Omni_3B;
+------------------------------------------------------------------------------------+
|                  Model Information                                                 |
+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$*********                                         |
| Project:                  muze_demo                                                |
| Model Name:               pai_eas_qwen25_omni_3b                                   |
| Model Type:               MLLM                                                     |
| Source Type:              REMOTE                                                   |
| Default Version:          v2                                                       |
| CreateTime:               2025-10-09 18:32:48                                      |
| LastModifiedTime:         2025-10-10 16:55:07                                      |
| Comment:                  PAI EAS remote model binary input                        |
+------------------------------------------------------------------------------------+
|                Version Information                                                 |
+------------------------------------------------------------------------------------+
| Owner:                    ALIYUN$*********                             |
| Project:                  *******_demo                                                |
| Model Name:               pai_eas_qwen25_omni_3b                                   |
| Model Type:               MLLM                                                     |
| Source Type:              REMOTE                                                   |
| Version Name:             v2                                                       |
| Path:                                                                              |
| CreateTime:               2025-10-10 16:53:51                                      |
| LastModifiedTime:         2025-10-10 16:53:51                                      |
| apikey:                   ZjA5NGRjN2Vj*********mU0OTZmZTQ1MTh***********jBhMmEzYw== |
| endpoint:                 http://11261230********.cn-shanghai.pai-eas.aliyuncs.com |
| pai_eas_model_name:       Qwen2.5-Omni-3B                                          |
| pai_eas_service_name:     test_remote_model                                        |
| pai_eas_sync_mode:        true                                                     |
| remote_service_type:      PAI-EAS                                                  |
+------------------------------------------------------------------------------------+
| Input           | Type       | Comment                                             |
+------------------------------------------------------------------------------------+
| url             | string     |                                                     |
| promt           | string     |                                                     |
+------------------------------------------------------------------------------------+

Delete a model version

Remove a specific version from an existing MaxCompute model.

Note

You cannot delete the default version of a model. To delete the current default version, you must first set another version as the default using ALTER MODEL <model_name> SET DEFAULT_VERSION <version_name>, then delete the old version.

Syntax

ALTER MODEL <model_name> DROP VERSION <version_name>;

Parameters

Parameter Required Description
model_name Yes Name of an existing model. An error is returned if the model does not exist.
version_name Yes Name of the model version to delete. An error is returned if the version does not exist.

Example

-- Attempting to delete v2 while it is the default version returns an error.
ALTER MODEL PAI_EAS_Qwen25_Omni_3B DROP VERSION v2;
-- Error: ODPS-0110061: Failed to run ddltask - The default version of the model cannot be dropped

-- First set another version as the default, then delete v2.
ALTER MODEL PAI_EAS_Qwen25_Omni_3B SET DEFAULT_VERSION v1;
-- OK

ALTER MODEL PAI_EAS_Qwen25_Omni_3B DROP VERSION v2;
-- OK

What's next