Skip to content

Model catalog ​

Look at a single example from your logs. What is known at prediction time, and what are you trying to predict? For a movie recommender, the choice might look like this.

QuestionData you needWhere to start
Which few hundred movies should enter the candidate set?Movies a user has watched and a catalog of candidate moviesRetrieval models. DSSM computes separate vectors for users and movies and retrieves candidates by similarity.
Which candidate movie should appear first?User, movie, context and click label for each impressionRanking models. DeepFM gives each impression a score that can be used to order the candidates.
Will the user click? If they do, will they pay?Click and conversion labels for the same impressionMulti-task models. SharedBottom produces one prediction per target. ESMM also models the relationship between a click and a subsequent conversion.
Which movie is the user likely to watch next?Each user’s viewing history in chronological orderGenerative recommendation models. HSTU scores movies from the history. TIGER generates the semantic ID of the next movie one token at a time.

Choosing a model ​

DeepFM is a useful first ranking model. Once you have chronological user histories, try DIN to see how the candidate movie affects the weight of each past interaction. For retrieval, start with DSSM to go from training to vector search. Try MIND if you want a user’s interests in, say, thrillers and animation to retrieve different candidates.

For multi-task learning, check which labels are available for each impression. A click label alone is enough for single-task ranking. With conversion labels as well, you can compare the AUC of both tasks on the same validation set. For next-item prediction, interaction sequences suffice for HSTU. HLLM additionally needs movie text embeddings, while TIGER needs a semantic ID for each movie.

Usage examples ​

Ranking and retrieval use similar training calls. The main difference is how you prepare a batch. These snippets are independent. The ranking quick start and retrieval tutorial define their features and data loaders.

python
# Ranking 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)

# Retrieval 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)

Model papers ​

DeepFFM is the baseline described in the FAT-DeepFFM paper.

Contributing a model ​

To contribute a model, follow the coding and documentation conventions in the contribution guide.