sb-ai-lab/RePlay

A Comprehensive Framework for Building End-to-End Recommendation Systems with State-of-the-Art Models

RePlay is a framework for building and testing recommendation systems — the kind of software that suggests products, movies, or content to users. It covers the whole workflow, from cleaning raw data to deploying a model in production.

Key capabilities (all from the README):

  • Data prep: tools to split data into training and test sets, and to format it correctly.
  • Many models: includes both state-of-the-art and baseline recommendation algorithms.
  • Tuning: helps find the best hyperparameters (settings) for a model.
  • Evaluation: provides standard metrics (like HitRate and NDCG) to measure how good recommendations are.
  • Ensembling: combines predictions from multiple models to improve quality.
  • Flexible deployment: works on CPU, GPU, or multiple GPUs, and can scale with PySpark for large datasets.

How it works in practice (from the quickstart example):

  1. Load interaction data (e.g., user ratings).
  2. Split it into train and test sets.
  3. Define a schema describing the data columns (user ID, item ID, rating, timestamp).
  4. Encode the data (convert IDs to numbers).
  5. Train a model (e.g., ItemKNN) on the training set.
  6. Generate recommendations for test users.
  7. Evaluate with metrics like NDCG and HitRate.

Installation:

  • Basic: pip install replay-rec (core only, no PySpark or PyTorch).
  • Extras: [spark] for PySpark, [torch] for PyTorch/Lightning. Example: pip install replay-rec[spark].
  • Optional features require manual install: Optuna for hyperparameter search, OpenVINO for model compilation, hnswlib for vector search, and LightFM (experimental, not officially supported on Python 3.12).

Resources: The README links to 16 example notebooks (covering basics, model comparisons, feature preprocessing, splitters, item-to-item recommendations, transformer-based models like SASRec and BERT4Rec, bandit models, and more) plus videos and research papers.

In short, RePlay is a one-stop toolkit for anyone building recommendation systems, from research to production.

Related

  • Project
  • Project
  • Project
  • Project
  • Project