Coarse ranking configuration
Configure coarse ranking to reduce the number of recalled items before fine ranking.
After recall and filtering (such as exposure and status filtering), you need to reduce the number of items before they enter the ranking stage for performance reasons. Sometimes you can reduce the number of items by simply adjusting the count, for example by using AdjustCountFilter and PriorityAdjustCountFilter to manually adjust the quantity.
PAI-Rec also supports calling a model to obtain coarse-ranking scores and using those scores to reduce the number of items. Using a model for coarse ranking enables more personalized and finer-grained recall.
Coarse ranking is roughly divided into three stages, and each stage is optional depending on your actual scenario.
Feature loading: this is the same as the feature loading configuration before ranking. For more information, see Configure features.
Model calling: the configuration is consistent with the ranking configuration used in fine ranking. For more information, see Algorithm configuration.
A series of Action operations: you can configure multiple operations here. For example, after the coarse-ranking model is called, the items must be sorted first, and then the items with high scores are retained. Action operations include sort and filter. After the operations are configured, they are executed in the configured order.
When you configure coarse ranking, consider cold-start recalled items. If you use a unified coarse-ranking model, cold-start items may receive low scores because they lack features. Therefore, you need a separate coarse-ranking configuration for cold-start recalled items. Currently, coarse ranking is divided into two types: main-path configuration and cold-start recall configuration. If no cold-start recall exists, you only need to configure the main path. If a cold-start path exists, we recommend that you use a pipeline to configure the cold-start path. For more information, see Custom pipeline flow.
GeneralRankConfs
The coarse-ranking configuration on the main path corresponds to GeneralRankConfs in the overall configuration. GeneralRankConfs is a Map[string]object structure, where the key is the scenario. You can use different coarse-ranking strategies for different scenarios.
Configuration example:
{
"GeneralRankConfs": {
"${scene_name}": {
"FeatureLoadConfs": [
{
"FeatureDaoConf": {
"AdapterType": "hologres",
"HologresName": "",
"FeatureKey": "user:uid",
"UserFeatureKeyName": "userid",
"HologresTableName": "",
"UserSelectFields": "*",
"FeatureStore": "user"
},
"Features": []
}
],
"RankConf": {
"RankAlgoList": ["sv_rocket_launching"],
"RankScore": "${sv_rocket_launching}",
"ContextFeatures": ["none"],
"BatchCount": 100,
"Processor": "EasyRec"
},
"ActionConfs": [
{
"ActionType": "sort",
"ActionName": "ItemRankScore"
},
{
"ActionType": "filter",
"ActionName": "GeneralCountFilter"
}
]
}
},
"FilterConfs": [
{
"Name": "GeneralCountFilter",
"FilterType": "AdjustCountFilter",
"ShuffleItem": false,
"RetainNum": 500
}
]
}
FeatureLoadConfs and RankConf in the configuration are the same as the feature loading and algorithm configurations used in fine ranking. These two configurations are also optional.
ActionConfs is a set of operations. ActionType specifies the operation type. Currently, sort and filter are supported. ActionName specifies the operation name, which must match a name in the corresponding type configuration. For example, ItemRankScore sorts items by score and is predefined in the engine. GeneralCountFilter must be configured in FilterConfs.
The overall meaning of the preceding ActionConfs configuration is as follows: first, run ItemRankScore to sort items so that items with higher scores rank higher; then, adjust the number of items. Because ShuffleItem is set to false, no position shuffling is performed, and only 500 items are retained.
ColdStartGeneralRankConfs
The cold-start coarse-ranking configuration is listed separately. Compared with GeneralRankConfs, it has one additional field, RecallNames, which specifies the recalls that require cold-start coarse-ranking settings.
Configuration example:
{
"ColdStartGeneralRankConfs": {
"${scene_name}": {
"RecallNames": [
"ColdStartRecall",
"ColdStartVideoVectorRecall",
"VideoColdStartRecall1",
"VideoColdStartRecall2",
"VideoColdStartRecall3",
"VideoColdStartRecall4",
"LinUcbRecall",
"LinUcbRecall_default",
"LinUcbRecall_highQuality",
"LinUcbRecall_default2"
],
"ActionConfs": [
{
"ActionType": "filter",
"ActionName": "PriorityAdjustCountFilterV4"
}
]
}
}
}