All Products
Search
Document Center

Platform For AI:Fine-rank configuration

Last Updated:Jun 24, 2026

Model configuration

In the fine rank stage, PAI-Rec obtains scores by calling an algorithm model service on Elastic Algorithm Service (EAS). EAS allows you to deploy various model types that PAI-Rec can call, including EasyRec, TorchEasyRec, TensorFlow, PMML, PS, and Alink.

The code for EasyRec is open-source. To use PAI-Rec for scoring, follow the EasyRec documentation to train a model, export the model, and deploy it as an EAS service by using the EasyRec Processor.

TorchEasyRec is the Torch version of EasyRec. To use it for scoring with PAI-Rec, follow the TorchEasyRec documentation to train a model, export the model, and deploy it as an EAS service by using the TorchEasyRec Processor.

Configuration example

{
    "AlgoConfs": [
        {
            "Name": "room3_mt_v2",
            "Type": "EAS",
            "EasConf": {
                "Processor": "EasyRec",
                "Timeout": 300,
                "ResponseFuncName": "easyrecMutValResponseFunc",
                "Url": "http:xxx.pai-eas.aliyuncs.com/api/predict/xxx",
                "EndpointType": "DIRECT",
                "Auth": ""
            }
        },
        {
            "Name": "room3_mt_v2_torch",
            "Type": "EAS",
            "EasConf": {
                "Processor": "EasyRec",
                "Timeout": 300,
                "ResponseFuncName": "torchrecMutValResponseFunc",
                "Url": "http:xxx.pai-eas.aliyuncs.com/api/predict/xxx",
                "EndpointType": "DIRECT",
                "Auth": ""
            }
        },
        {
            "Name": "tf",
            "Type": "EAS",
            "EasConf": {
                "Processor": "TensorFlow",
                "ResponseFuncName": "tfMutValResponseFunc",
                "Url": "http:xxx.pai-eas.aliyuncs.com/api/predict/xxx",
                "Auth": ""
            }
        },
        {
            "Name": "ps_smart",
            "Type": "EAS",
            "EasConf": {
                "Processor": "PMML",
                "ResponseFuncName": "pssmartResponseFunc",
                "Url": "http:xxx.pai-eas.aliyuncs.com/api/predict/xxx",
                "Auth": ""
            }
        },
        {
            "Name": "fm",
            "Type": "EAS",
            "EasConf": {
                "Processor": "ALINK_FM",
                "ResponseFuncName": "alinkFMResponseFunc",
                "Url": "http:xxx.pai-eas.aliyuncs.com/api/predict/xxx",
                "Auth": ""
            }
        }
    ]
}

Parameter

Type

Required

Description

Name

string

Yes

A custom name for the model information. This name is referenced in RankConf.

Type

string

Yes

The model deployment type.

EasConf

Parameter

Type

Required

Description

Processor

string

Yes

The model type. Valid values:

  • EasyRec

  • TensorFlow

  • ALINK_FM

  • PMML

  • TFServing

Timeout

int

No

The timeout period for model requests, in milliseconds.

ResponseFuncName

string

Yes

The function used to parse the response data. This function must correspond to the Processor type.

  • EasyRec

    • For the TensorFlow version, use easyrecMutValResponseFunc.

    • For the Torch version, use torchrecMutValResponseFunc.

  • TensorFlow: tfMutValResponseFunc

  • ALINK_FM: alinkFMResponseFunc

  • PMML: pssmartResponseFunc

  • TFServing: tfServingResponseFunc

Url

string

Yes

The endpoint URL of the model.

EndpointType

string

No

The endpoint type. Valid values: DOCKER and DIRECT.

If both the engine and the model are deployed on EAS, set this parameter to DIRECT to connect directly to the model for higher performance.

Auth

string

Yes

The token for model authentication.

The easyrecMutValResponseFunc, torchrecMutValResponseFunc, and tfMutValResponseFunc functions can return multiple target prediction values. You can configure operations in PAI-Rec to process these values. For example, you can sum all returned values to generate the final ranking score.

If the model is deployed on EAS, you can find the Url and Auth values in the PAI-EAS console.

In the PAI-EAS console, go to the Inference Service page. Find the target service and click the Invocation Information link. In the dialog box that appears, select the VPC Address Call tab to obtain the Url. The Auth value corresponds to the token field.

Algorithm configuration

The algorithm configuration corresponds to RankConf in the configuration overview. RankConf is a Map[string]object structure. The key is the scenario name, such as ${scene_name1} and ${scene_name2} in the example. You can select different models for each scenario by using the custom model names defined in AlgoConfs.

Configuration example

{
    "RankConf": {
        "${scene_name1}": {
            "RankAlgoList": [
                "fm"
            ],
            "RankScore": "${fm}"
        },
        "${scene_name2}": {
            "RankAlgoList": [
                "dbmtl_v1"
            ],
            "RankScore": "${dbmtl_v1_probs_ctr} * (${dbmtl_v1_probs_view} + ${dbmtl_v1_y_view_time} + 0.5 * ${dbmtl_v1_probs_on_wheat} + 0.5 * ${dbmtl_v1_y_on_wheat_time} + 0.25 * ${dbmtl_v1_y_gift} + 0.25 * ${dbmtl_v1_probs_add_friend} + 0.1)",
            "Processor": "EasyRec"
        }
    }
}

Parameter

Type

Required

Description

RankAlgoList

[]string

Yes

An array of model names defined in AlgoConfs. Specifies which models to use for scoring in this scenario.

RankScore

string

Yes

The model fusion expression.

Processor

string

No

Required and must be set to EasyRec if any model in RankAlgoList uses the EasyRec processor.

BatchCount

int

No

The number of items to send in a single batch request to the model. The default value is 100.

ContextFeatures

[]string

No

A list of context features to pass to the processor. This parameter applies only to EasyRec processors.

ItemFeatures

[]string

No

A list of item features to pass to the EasyRec processor, which overrides the cached item features in the processor. This parameter applies only to EasyRec processors. To pass all item features, set the value to ["*"]. To pass specific features, list their names, such as ["feature1", "feature2"]. This parameter can be used in conjunction with ContextFeatures.

RankScore is a model fusion expression for multiple target prediction values. For example, in dbmtl_v1_probs_ctr, dbmtl_v1 refers to the model configuration name, and probs_ctr refers to one of the objectives of the multi-objective model.

RankScore supports the following arithmetic operators: addition (+), subtraction (-), multiplication (*), division (/), exponentiation (^), and modulo (%). For example, ${dbmtl_v1_probs_ctr}%2 performs a modulo operation, and ${dbmtl_v1_probs_ctr}^2 performs an exponentiation operation.

Fusing scores from multiple models follows a similar pattern. For example, if you have two models named dbmtl_v1 and dbmtl_v2, set RankAlgoList to ["dbmtl_v1","dbmtl_v2"]. You can then set RankScore to an expression like ${dbmtl_v1_probs_ctr}+${dbmtl_v2_probs_y_gift}. Each part of the expression combines a model name with one of its target objectives. In this example, probs_ctr and y_gift are used for demonstration purposes.

BatchCount specifies the number of items PAI-Rec sends in a single batch request. For example, if a candidate set for ranking contains 1,000 items and you set BatchCount to 100, PAI-Rec sends 10 separate batch requests, each containing 100 items. Adjust this parameter based on the resources of your model inference service.