Overview
PAI-Rec offers recall algorithms that range from simple statistics to deep learning. This topic describes all supported recall algorithms and explains DSSM vector recall in the TorchEasyRec environment.
Recall algorithm categories:
-
Deep learning recall: DSSM vector recall
-
Collaborative filtering recall: ETrec, Swing, and SimRank
-
Statistical recall: Global hot items and grouped hot items
DSSM vector recall (TorchEasyRec version)
2.1 How it works
DSSM is a two-tower deep learning model that encodes users and items into fixed-dimension vectors and retrieves candidates by vector similarity.
User Features Item Features
| |
┌─────┴──────┐ ┌─────┴─────┐
│ User Tower │ │ Item Tower│
│ (DNN) │ │ (DNN) │
└─────┬──────┘ └─────┬─────┘
user_embedding item_embedding
└──── dot product ────┘
Match Score
2.2 Core advantages
|
Advantage |
Description |
|
Decoupled two-tower architecture |
Item vectors are pre-computed offline; user vectors are computed in real time. |
|
Semantic generalization |
Learns semantic relationships between users and items via deep neural networks. |
|
Efficient retrieval |
Retrieves from millions of items in milliseconds. Supports local vector retrieval with FAISS. |
|
Rich feature support |
Supports user profiles, item attributes, and behavior sequences. |
2.3 Key parameters
|
Parameter |
Description |
Typical value |
|
|
Model name. |
dssm |
|
|
Model type. |
dssm / mind (multi-interest) |
|
|
Negative sampling strategy. |
1,024 negative samples |
|
|
Training duration in days. |
30 days |
|
|
Embedding dimension policy. |
EMB_SQRT4_STEP4 (See the formula below for details.) |
|
|
Enables online mode. |
true/false |
2.4 Embedding dimension policy
The embed_dim_policy parameter determines embedding dimensions for discrete features. In the following formulas, N is the feature cardinality.
|
Policy name |
Formula |
Description |
|
|
|
Fourth root with a step size of 8 |
|
|
|
Fourth root with a step size of 4 (default) |
|
|
|
Natural logarithm with a step size of 8 |
|
|
|
Natural logarithm with a step size of 4 |
Calculation Example (Assume feature cardinality N = 10,000):
-
EMB_SQRT4_STEP4: round(10000^0.25 / 4) × 4 = round(10 / 4) × 4 = 8 -
EMB_LN_STEP4: round(ln(10000) / 4) × 4 = round(9.21 / 4) × 4 = 8
2.5 DSSM features in TorchEasyRec
TorchEasyRec DSSM supports the following capabilities:
|
Feature |
Description |
|
Training framework |
TorchEasyRec (PyTorch backend) |
|
Training platform |
PAI-DLC (GPU training) |
|
Vector index |
FAISS (IVF type) |
|
Online service |
EasyRec Processor (Torch version) |
|
Feature engineering |
FG feature encoding for offline and online consistency |
|
Model hot update |
Automatic loading via the steady_mode setting. |
Negative Sampling Configuration:
{
"negative_sampler": {
"sampler_type": "negative_sampler",
"num_sample": 1024
}
}
Negative sampling improves discriminative capability by dynamically sampling negative examples during training.
2.6 TorchEasyRec service architecture
TorchEasyRec service components:
-
FG encoding: Ensures offline-online feature consistency.
-
User Tower: A Torch ScriptModule for real-time user vector inference.
-
FAISS index: Efficient CPU-based retrieval, deployable on PAI-EAS CPU instances.
-
TorchEasyRec Processor: The
easyrec-torch-{version}processor. Available versions are listed in the version list.
Deployment Configuration Example:
{
"processor": "easyrec-torch-1.12",
"model_config": {
"fg_mode": "normal",
"faiss_neigh_num": 500,
"faiss_nprobe": 1000,
"steady_mode": true,
"period": 2880
}
}
Hot-item recall
3.1 Global hot-item recall
Principle: Returns the most popular items across the entire site based on user behavior statistics.
Formula:
Use cases:
-
Cold start for new users with no behavior history.
-
A fallback recall strategy.
-
Distributing popular content.
Key Configurations:
|
Parameter |
Description |
|
Behavior weight |
Assigns different weights to user behaviors such as impressions, clicks, and conversions. |
|
Time decay |
Gives higher weight to recent behaviors. |
|
Deduplication strategy |
Removes duplicate items by item, author, or category. |
3.2 User-grouped hot-item recall
Principle: Groups users by attributes such as gender, age group, and location, then identifies the most popular items within each group.
Use cases:
-
On the Guess You Like homepage.
-
Scenarios where different user groups have distinct preferences.
Advantages:
-
More personalized than global hot-item recall.
-
Simple to implement and does not require user behavior history.
3.3 Item-grouped hot-item recall
Principle: Groups items by attributes such as category and tag, then identifies the most popular items within each group.
Use cases:
-
In the Related Recommendation scenario on a detail page, this supplements results when other algorithms such as ETrec I2I return insufficient related items.
-
Recommending popular items from the same category as the current item.
Collaborative filtering recall
4.1 ETrec U2I recall
Reference: Collaborative Filtering (etrec)
This item-based collaborative filtering (Item-based CF) algorithm calculates item co-occurrence similarity from user-item interactions and recommends items similar to those in a user's history.
Key Features:
-
Supports real-time behavior triggers (U2I Trigger).
-
Applies time decay to prioritize recent behaviors.
-
Combines multiple behavior types by weighting clicks, favorites, and cart additions.
Key Configurations:
|
Parameter |
Description |
Typical value |
|
|
Behavior time window. |
15 days |
|
|
Time decay coefficient. |
0.2 |
|
|
Number of triggers to select. |
10 |
|
|
Number of items to recall. |
500 |
|
|
Recall engine. |
FeatureStore / Hologres |
4.2 ETrec I2I recall
Principle: An item-based collaborative filtering algorithm that calculates similarity between items based on co-occurrence or embeddings.
Use cases:
-
Related Recommendation (e.g., "Frequently Bought Together").
-
Recommending similar items on a detail page.
Similarity Calculation:
-
Co-occurrence-based: Based on how many times the same user interacts with two items.
-
Vector-based: Based on the cosine similarity of item embeddings.
4.3 Swing U2I recall
Reference: Swing Algorithm Tool
Principle: An improved collaborative filtering algorithm that leverages the Swing structure in a user-item bipartite graph to measure similarity.
Core Idea:
-
Two items are considered similar if many common users interact with them.
-
Penalizes highly active users by reducing their weight.
Advantages:
-
Reduces the over-recommendation of popular items.
-
Helps discover associations for long-tail items.
4.4 SimRank U2I recall
Reference: SimRank++ Similarity Calculation Algorithm
⚠️ Note: SimRank is resource-intensive due to multiple iterations and full-graph random walks. Use MaxCompute subscription resources to reduce costs.
Principle: A graph-based similarity algorithm that measures node similarity through random walks on a user-item bipartite graph.
Core Idea:
-
Two users are similar if they interact with many similar items.
-
Two items are similar if similar users interact with them.
Use cases:
-
Sparse user behavior data.
-
Indirect relationship discovery.
Characteristics:
-
Iterative with potentially slow convergence.
-
Captures multi-hop relationships.
Guess you like vs. related recommendation
5.1 Why differentiate scenarios?
Different scenarios call for different recall strategies because user intents and goals vary:
|
Dimension |
Guess You Like |
Related Recommendation |
|
Page location |
Homepage/Recommendation feed |
Detail page/Content page |
|
User intent |
Discovering interests, browsing, consumption |
In-depth exploration and decision support |
|
Trigger condition |
User profile + historical behavior |
Currently viewed item |
|
Recommendation goal |
Personalized exploration |
Similar/complementary recommendations |
|
Diversity requirement |
High (cross-category) |
Medium (related items in the same category) |
5.2 Guess you like
Applicable algorithms:
-
DSSM vector recall: The core algorithm for deep personalization.
-
ETrec U2I: Collaborative filtering based on user behavior history.
-
Swing U2I: For discovering long-tail interests.
-
SimRank U2I: For discovering indirect relationships.
-
User-grouped hot items: A fallback for cold-start users.
Configuration Characteristics:
-
Emphasis on user personalization
-
Fusion of multiple recall channels
-
Controlling recommendation diversity
5.3 Related recommendation
Applicable algorithms:
-
ETrec I2I: Collaborative filtering based on item similarity.
-
Item-grouped hot items: For recommending popular items from the same category.
-
DSSM vector recall: For matching items based on semantic similarity.
Configuration Characteristics:
-
Triggered by the currently viewed item
-
Emphasizes content relevance
-
Prioritizes items in the same category or topic
5.4 Algorithm-scenario mapping
|
Algorithm |
Guess You Like |
Related Recommendation |
|
DSSM vector recall |
✅ Core |
✅ Auxiliary |
|
ETrec U2I |
✅ Core |
❌ |
|
ETrec I2I |
❌ |
✅ Core |
|
Swing U2I |
✅ |
❌ |
|
SimRank U2I |
✅ |
❌ |
|
Global hot items |
✅ Fallback |
✅ Fallback |
|
User-grouped hot items |
✅ |
❌ |
|
Item-grouped hot items |
❌ |
✅ |
Algorithm selection
6.1 Selection by business stage
|
Stage |
Recommended algorithm |
|
Cold-start stage |
Hot-item recall + Grouped hot-item recall |
|
Growth stage |
Collaborative filtering (ETrec/Swing) |
|
Mature stage |
DSSM vector recall + Multi-channel fusion |
6.2 Multi-channel recall fusion
In production, you typically combine multiple recall channels for better coverage.
Fusion strategies:
-
Weighted fusion: Assigns different weights to each recall channel.
-
Deduplication fusion: Deduplicates by item ID and retains the highest score.
-
Quota fusion: Assigns a fixed slot count to each recall channel.
Summary
PAI-Rec provides a comprehensive recall algorithm suite that covers different business needs:
|
Algorithm type |
Representative algorithm |
Core capability |
Applicable scenario |
|
Deep learning |
DSSM (TorchEasyRec) |
Semantic matching, efficient retrieval |
Large-scale personalization |
|
Collaborative filtering |
ETrec/Swing/SimRank |
Behavioral association, long-tail discovery |
Medium-scale scenarios |
|
Statistical recall |
Hot items/Grouped hot items |
Simple, efficient, cold-start solution |
Fallback/New users |
Core Advantages of TorchEasyRec DSSM:
-
PyTorch-based training supporting complex model architectures.
-
FAISS vector index for efficient retrieval, including on CPU instances.
-
EasyRec Processor (Torch) for unified online serving.
-
FG feature encoding ensures offline-online feature consistency.
-
steady_mode supports model hot updates.
Vector Index Comparison: EasyRec (TensorFlow) vs. TorchEasyRec:
|
Framework |
Vector index solution |
Description |
|
EasyRec (TensorFlow) |
Hologres Proxima |
Does not support FAISS. Item vectors are stored in the Hologres vector engine instead. |
|
TorchEasyRec |
FAISS |
Supports FAISS indexing. The index file is stored with the model in OSS and loaded into memory when the service starts. |
Best Practices:
-
Use DSSM vector recall (TorchEasyRec) as the core deep learning recall method.
-
Use collaborative filtering as a supplement to discover behavioral associations.
-
Use hot-item recall as a fallback to ensure coverage.
-
Select the appropriate algorithm combination based on the scenario (Guess You Like or Related Recommendation).