Skip to content

Model Library Overview

Torch-RecHub provides a rich recommendation model library that covers ranking, matching, multi-task learning, and generative recommendation. All models are implemented in PyTorch and are easy to use and extend.

Model Library Structure

The model library is organized by recommendation stage and task type:

  1. Ranking Models: Used during fine ranking to predict click-through rates or user preference scores for items
  2. Matching Models: Used during candidate generation to retrieve candidates from a large item collection
  3. Multi-Task Models: Jointly optimize multiple related tasks to improve generalization
  4. Generative Recommendation: Uses generative models to produce personalized recommendations

Model Selection Guide

Choosing a Ranking Model

ModelSuitable ScenarioCharacteristics
WideDeepBasic ranking tasksCombines linear and deep models to balance memorization and generalization
DeepFMScenarios where feature interactions matterCaptures both low-order and high-order feature interactions
DCN/DCNv2Explicit feature-crossing scenariosExplicitly learns high-order feature crosses with high computational efficiency
DINScenarios with dynamically changing user interestsUses attention to capture user interests
DIENLong-sequence interest modelingModels the dynamic evolution of user interests
BSTScenarios where sequence features matterUses a Transformer to model sequence features
AutoIntAutomatic feature-interaction learningAutomatically learns feature-interaction patterns

Choosing a Matching Model

ModelSuitable ScenarioCharacteristics
DSSMText-matching scenariosUses a two-tower architecture to map users and items into the same vector space
YoutubeDNNLarge-scale recommendationDeep matching based on user behavior sequences
MINDMulti-interest recommendationLearns multiple interest representations for each user
GRU4Rec/SASRecSequential recommendationModels a user's recent behavior sequence
ComirecDR/ComirecSAControllable multi-interest recommendationAllows control over the number of generated interests

Choosing a Multi-Task Model

ModelSuitable ScenarioCharacteristics
SharedBottomScenarios with strongly related tasksAll tasks share the bottom network
MMOEScenarios with substantial task conflictUses a multi-gate mixture of experts so each task learns a different expert combination
PLEComplex multi-task scenariosUses progressive layered extraction to alleviate negative transfer
ESMMScenarios with sample-selection biasUses entire-space modeling to address sample-selection bias
AITMScenarios with dependencies between tasksUses adaptive information transfer to learn task dependencies

Choosing a Generative Recommendation Model

ModelSuitable ScenarioCharacteristics
HSTUNext-item sequential recommendationHierarchical sequential transduction units with positional and temporal biases
HLLMSequential recommendation with precomputed LLM item embeddingsFreezes the item semantic table and trains a user-sequence Transformer
RQ-VAEItem semantic-ID quantizationCompresses continuous item embeddings into multi-level codebook IDs
TIGERSemantic-ID generative retrievalUses T5 to generate a valid semantic ID for the next item

Model Documentation

Ranking Models

Detailed descriptions of ranking-model principles, usage, and parameters.

View Ranking Model Documentation

Matching Models

Detailed descriptions of matching-model principles, usage, and parameters.

View Matching Model Documentation

Multi-Task Models

Detailed descriptions of multi-task-model principles, usage, and parameters.

View Multi-Task Model Documentation

Generative Recommendation Models

Detailed descriptions of generative recommendation-model principles, usage, and parameters.

View Generative Recommendation Model Documentation

Usage Example

python
# Ranking-model example
from torch_rechub.models.ranking import DeepFM
from torch_rechub.trainers import CTRTrainer

# Create the model
model = DeepFM(deep_features=deep_features, fm_features=fm_features, mlp_params={"dims": [256, 128], "dropout": 0.2})

# Create the trainer
trainer = CTRTrainer(model, optimizer_params={"lr": 0.001}, device="cpu")

# Train the model
trainer.fit(train_dataloader, val_dataloader)

# Matching-model example
from torch_rechub.models.matching import DSSM
from torch_rechub.trainers import MatchTrainer

# Create the model
model = DSSM(user_features=user_features, item_features=item_features, temperature=1.0,
             user_params={"dims": [256, 128, 64]}, item_params={"dims": [256, 128, 64]})

# Create the trainer
trainer = MatchTrainer(model, mode=0, device="cpu")

# Train the model
trainer.fit(train_dataloader)

Contributing a New Model

If you would like to contribute a new model, see the Contributing Guide and follow the project's coding standards and documentation requirements.