Skip to content

Model Library Overview

Torch-RecHub provides a rich set of recommendation models covering ranking, matching, multi-task learning, and generative recommendation. All models are implemented with PyTorch and are easy to use and extend.

Library Structure

Models are organized by stage/task:

  1. Ranking: fine-ranking models to predict CTR or preference scores.
  2. Matching: retrieval models to fetch candidate items from large catalogs.
  3. Multi-Task: models that jointly optimize related tasks.
  4. Generative: models that generate personalized recommendations.

Model Selection Guide

Ranking Models

ModelScenarioHighlights
WideDeepBasic rankingCombines linear (memorization) and deep (generalization)
DeepFMFeature interactions matterCaptures low- and high-order feature crosses
DCN/DCNv2Explicit feature crossingEfficient high-order crosses
DINDynamic user interestAttention-based interest modeling
DIENLong sequence interestModels evolving interests
BSTSequence-focusedTransformer for sequential features
AutoIntAuto feature interactionLearns interaction patterns automatically

Matching Models

ModelScenarioHighlights
DSSMText / semantic matchTwo-tower mapping to a shared vector space
YoutubeDNNLarge-scale retrievalSequence-based deep retrieval
MINDMulti-interestLearns multiple user interests
GRU4Rec/SASRecSequential recommendationModels recent behavior sequences
ComirecDR/ComirecSAControllable interestsControl number of interests

Multi-Task Models

ModelScenarioHighlights
SharedBottomTasks highly relatedShared bottom network
MMOETask conflict existsMulti-gate mixture-of-experts per task
PLEComplex multi-taskProgressive layered extraction to reduce negative transfer
ESMMSample selection biasFull-space modeling to mitigate bias
AITMTask dependencyAdaptive information transfer between tasks

Generative Recommendation

ModelScenarioHighlights
HSTULarge-scale sequencesHierarchical Sequential Transduction Units
HLLMLLM-enhanced recommendationCombines LLM semantic understanding

Documentation Navigation

Usage Examples

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

model = DeepFM(
    deep_features=deep_features,
    fm_features=fm_features,
    mlp_params={"dims": [256, 128], "dropout": 0.2}
)
trainer = CTRTrainer(model, optimizer_params={"lr": 0.001}, device="cuda:0")
trainer.fit(train_dataloader, val_dataloader)
python
# Matching example
from torch_rechub.models.matching import DSSM
from torch_rechub.trainers import MatchTrainer

model = DSSM(
    user_features=user_features,
    item_features=item_features,
    temperature=0.02,
    user_params={"dims": [256, 128, 64]},
    item_params={"dims": [256, 128, 64]}
)
trainer = MatchTrainer(model, mode=0, optimizer_params={"lr": 0.001}, device="cuda:0")
trainer.fit(train_dataloader)