{"id":21964412,"url":"https://github.com/sb-ai-lab/replay","last_synced_at":"2026-02-05T16:01:02.128Z","repository":{"id":37866716,"uuid":"483260394","full_name":"sb-ai-lab/RePlay","owner":"sb-ai-lab","description":"A Comprehensive Framework for Building End-to-End Recommendation Systems with State-of-the-Art Models","archived":false,"fork":false,"pushed_at":"2026-01-30T10:53:36.000Z","size":44369,"stargazers_count":385,"open_issues_count":10,"forks_count":35,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-01-31T12:10:03.974Z","etag":null,"topics":["algorithms","collaborative-filtering","deep-learning","distributed-computing","evaluation","machine-learning","matrix-factorization","pyspark","pytorch","recommendation-algorithms","recommender-system","recsys","transformers"],"latest_commit_sha":null,"homepage":"https://sb-ai-lab.github.io/RePlay/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sb-ai-lab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-04-19T13:34:50.000Z","updated_at":"2026-01-30T10:38:02.000Z","dependencies_parsed_at":"2023-10-04T13:20:50.345Z","dependency_job_id":"a8ed76f5-37df-4650-a670-17cc30c94bde","html_url":"https://github.com/sb-ai-lab/RePlay","commit_stats":{"total_commits":1801,"total_committers":35,"mean_commits":"51.457142857142856","dds":0.7568017767906718,"last_synced_commit":"e3756f6387bec3e21b3215aa3117aeb9686879fc"},"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/sb-ai-lab/RePlay","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sb-ai-lab%2FRePlay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sb-ai-lab%2FRePlay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sb-ai-lab%2FRePlay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sb-ai-lab%2FRePlay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sb-ai-lab","download_url":"https://codeload.github.com/sb-ai-lab/RePlay/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sb-ai-lab%2FRePlay/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29125101,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T14:05:12.718Z","status":"ssl_error","status_checked_at":"2026-02-05T14:03:53.078Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algorithms","collaborative-filtering","deep-learning","distributed-computing","evaluation","machine-learning","matrix-factorization","pyspark","pytorch","recommendation-algorithms","recommender-system","recsys","transformers"],"created_at":"2024-11-29T12:09:36.617Z","updated_at":"2026-02-05T16:01:02.108Z","avatar_url":"https://github.com/sb-ai-lab.png","language":"Python","readme":"\u003cimg src=\"docs/images/replay_logo_color.svg\" height=\"50\"/\u003e\n\u003cbr\u003e\n\n[![GitHub License](https://img.shields.io/github/license/sb-ai-lab/RePlay)](https://github.com/sb-ai-lab/RePlay/blob/main/LICENSE)\n[![PyPI - Version](https://img.shields.io/pypi/v/replay-rec)](https://pypi.org/project/replay-rec)\n[![Documentation](https://img.shields.io/badge/docs-latest-brightgreen.svg)](https://sb-ai-lab.github.io/RePlay/)\n[![PyPI - Downloads](https://img.shields.io/pypi/dm/replay-rec)](https://pypistats.org/packages/replay-rec)\n\u003cbr\u003e\n[![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/sb-ai-lab/replay/main.yml)](https://github.com/sb-ai-lab/RePlay/actions/workflows/main.yml?query=branch%3Amain)\n[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)\n[![Python Versions](https://img.shields.io/pypi/pyversions/replay-rec.svg?logo=python\u0026logoColor=white)](https://pypi.org/project/replay-rec)\n[![Join the community on GitHub Discussions](https://badgen.net/badge/join%20the%20discussion/on%20github/black?icon=github)](https://github.com/sb-ai-lab/RePlay/discussions)\n\n\nRePlay is an advanced framework designed to facilitate the development and evaluation of recommendation systems. It provides a robust set of tools covering the entire lifecycle of a recommendation system pipeline:\n\n## 🚀 Features:\n* **Data Preprocessing and Splitting:** Streamlines the data preparation process for recommendation systems, ensuring optimal data structure and format for efficient processing.\n* **Wide Range of Recommendation Models:** Enables building of recommendation models from State-of-the-Art to commonly-used baselines and evaluate their performance and quality.\n* **Hyperparameter Optimization:** Offers tools for fine-tuning model parameters to achieve the best possible performance, reducing the complexity of the optimization process.\n* **Comprehensive Evaluation Metrics:** Incorporates a wide range of evaluation metrics to assess the accuracy and effectiveness of recommendation models.\n* **Model Ensemble and Hybridization:** Supports combining predictions from multiple models and creating two-level (ensemble) models to enhance the quality of recommendations.\n* **Seamless Mode Transition:** Facilitates easy transition from offline experimentation to online production environments, ensuring scalability and flexibility.\n\n## 💻 Hardware and Environment Compatibility:\n1. **Diverse Hardware Support:** Compatible with various hardware configurations including CPU, GPU, Multi-GPU.\n2. **Cluster Computing Integration:** Integrating with PySpark for distributed computing, enabling scalability for large-scale recommendation systems.\n\n\u003ca name=\"toc\"\u003e\u003c/a\u003e\n# Table of Contents\n\n* [Quickstart](#quickstart)\n* [Installation](#installation)\n* [Resources](#examples)\n* [Contributing to RePlay](#contributing)\n\n\n\u003ca name=\"quickstart\"\u003e\u003c/a\u003e\n## 📈 Quickstart\n\n```bash\npip install replay-rec[all]\n```\n\nPyspark-based model and [fast](https://github.com/sb-ai-lab/RePlay/blob/main/examples/11_sasrec_dataframes_comparison.ipynb) polars-based data preprocessing:\n```python\nfrom polars import from_pandas\nfrom rs_datasets import MovieLens\n\nfrom replay.data import Dataset, FeatureHint, FeatureInfo, FeatureSchema, FeatureType\nfrom replay.data.dataset_utils import DatasetLabelEncoder\nfrom replay.metrics import HitRate, NDCG, Experiment\nfrom replay.models import ItemKNN\nfrom replay.utils.spark_utils import convert2spark\nfrom replay.utils.session_handler import State\nfrom replay.splitters import RatioSplitter\n\nspark = State().session\n\nml_1m = MovieLens(\"1m\")\nK = 10\n\n# convert data to polars\ninteractions = from_pandas(ml_1m.ratings)\n\n# data splitting\nsplitter = RatioSplitter(\n    test_size=0.3,\n    divide_column=\"user_id\",\n    query_column=\"user_id\",\n    item_column=\"item_id\",\n    timestamp_column=\"timestamp\",\n    drop_cold_items=True,\n    drop_cold_users=True,\n)\ntrain, test = splitter.split(interactions)\n\n# datasets creation\nfeature_schema = FeatureSchema(\n    [\n        FeatureInfo(\n            column=\"user_id\",\n            feature_type=FeatureType.CATEGORICAL,\n            feature_hint=FeatureHint.QUERY_ID,\n        ),\n        FeatureInfo(\n            column=\"item_id\",\n            feature_type=FeatureType.CATEGORICAL,\n            feature_hint=FeatureHint.ITEM_ID,\n        ),\n        FeatureInfo(\n            column=\"rating\",\n            feature_type=FeatureType.NUMERICAL,\n            feature_hint=FeatureHint.RATING,\n        ),\n        FeatureInfo(\n            column=\"timestamp\",\n            feature_type=FeatureType.NUMERICAL,\n            feature_hint=FeatureHint.TIMESTAMP,\n        ),\n    ]\n)\n\ntrain_dataset = Dataset(feature_schema=feature_schema, interactions=train)\ntest_dataset = Dataset(feature_schema=feature_schema, interactions=test)\n\n# data encoding\nencoder = DatasetLabelEncoder()\ntrain_dataset = encoder.fit_transform(train_dataset)\ntest_dataset = encoder.transform(test_dataset)\n\n# convert datasets to spark\ntrain_dataset.to_spark()\ntest_dataset.to_spark()\n\n# model training\nmodel = ItemKNN()\nmodel.fit(train_dataset)\n\n# model inference\nencoded_recs = model.predict(\n    dataset=train_dataset,\n    k=K,\n    queries=test_dataset.query_ids,\n    filter_seen_items=True,\n)\n\nrecs = encoder.query_and_item_id_encoder.inverse_transform(encoded_recs)\n\n# model evaluation\nmetrics = Experiment(\n    [NDCG(K), HitRate(K)],\n    test,\n    query_column=\"user_id\",\n    item_column=\"item_id\",\n    rating_column=\"rating\",\n)\nmetrics.add_result(\"ItemKNN\", recs)\nprint(metrics.results)\n```\n\n\u003ca name=\"installation\"\u003e\u003c/a\u003e\n## 🔧 Installation\n\nInstallation via `pip` package manager is recommended by default:\n\n```bash\npip install replay-rec\n```\n\nIn this case it will be installed the `core` package without `PySpark` and `PyTorch` dependencies.\nAlso `experimental` submodule will not be installed.\n\nTo install `experimental` submodule please specify the version with `rc0` suffix.\nFor example:\n\n```bash\npip install replay-rec==XX.YY.ZZrc0\n```\n\n### Extras\n\nIn addition to the core package, several extras are also provided, including:\n- `[spark]`: Install PySpark functionality\n- `[torch]`: Install PyTorch and Lightning functionality\n\nExample:\n```bash\n# Install core package with PySpark dependency\npip install replay-rec[spark]\n\n# Install package with experimental submodule and PySpark dependency\npip install replay-rec[spark]==XX.YY.ZZrc0\n```\n\nAdditionally, `replay-rec[torch]` may be installed with CPU-only version of `torch` by providing its respective index URL during installation:\n```bash\n# Install package with the CPU version of torch\npip install replay-rec[torch] --extra-index-url https://download.pytorch.org/whl/cpu\n```\n\n\nTo build RePlay from sources please use the [instruction](CONTRIBUTING.md#installing-from-the-source).\n\n\n### Optional features\nRePlay includes a set of optional features which require users to install optional dependencies manually. These features include:\n\n1) Hyperpearameter search via Optuna:\n```bash\npip install optuna\n```\n\n2) Model compilation via OpenVINO:\n```bash\npip install openvino onnx onnxscript\n```\n\n3) Vector database and hierarchical search support:\n```bash\npip install hnswlib fixed-install-nmslib\n```\n\n4) (Experimental) LightFM model support:\n```bash\npip install ligfhtfm\n```\n\u003e **_NOTE_** : LightFM is not officially supported for Python 3.12 due to discontinued maintenance of the library. If you wish to install it locally, you'll have to use a patched fork of LightFM, such as the [one used internally](https://github.com/daviddavo/lightfm).\n\n\n\u003ca name=\"examples\"\u003e\u003c/a\u003e\n## 📑  Resources\n\n### Usage examples\n1. [01_replay_basics.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/01_replay_basics.ipynb) - get started with RePlay.\n2. [02_models_comparison.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/02_models_comparison.ipynb) - reproducible models comparison on [MovieLens-1M dataset](https://grouplens.org/datasets/movielens/1m/).\n3. [03_features_preprocessing_and_lightFM.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/03_features_preprocessing_and_lightFM.ipynb) - LightFM example with pyspark for feature preprocessing.\n4. [04_splitters.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/04_splitters.ipynb) - An example of using RePlay data splitters.\n5. [05_feature_generators.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/05_feature_generators.ipynb) - Feature generation with RePlay.\n6. [06_item2item_recommendations.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/06_item2item_recommendations.ipynb) - Item to Item recommendations example.\n7. [07_filters.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/07_filters.ipynb) - An example of using filters.\n8. [08_recommending_for_categories.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/08_recommending_for_categories.ipynb) - An example of recommendation for product categories.\n9. [09_sasrec_example.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/09_sasrec_example.ipynb) - An example of using transformer-based SASRec model to generate recommendations.\n10. [10_bert4rec_example.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/10_bert4rec_example.ipynb) - An example of using transformer-based BERT4Rec model to generate recommendations.\n11. [11_sasrec_dataframes_comparison.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/11_sasrec_dataframes_comparison.ipynb) - speed comparison of using different frameworks (pandas, polars, pyspark) for data processing during SASRec training.\n12. [12_neural_ts_exp.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/12_neural_ts_exp.ipynb) - An example of using Neural Thompson Sampling bandit model (based on Wide\u0026Deep architecture).\n13. [13_personalized_bandit_comparison.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/13_personalized_bandit_comparison.ipynb) - A comparison of context-free and contextual bandit models.\n14. [14_hierarchical_recommender.ipynb](https://github.com/sb-ai-lab/RePlay/blob/main/examples/14_hierarchical_recommender.ipynb) - An example of using HierarchicalRecommender with user-disjoint LinUCB.\n\n### Videos and papers\n* **Video guides**:\n\t- [Replay for offline recommendations, AI Journey 2021](https://www.youtube.com/watch?v=ejQZKGAG0xs)\n\n* **Research papers**:\n    - [RePlay: a Recommendation Framework for Experimentation and Production Use](https://arxiv.org/abs/2409.07272) Alexey Vasilev, Anna Volodkevich, Denis Kulandin, Tatiana Bysheva, Anton Klenitskiy. In The 18th ACM Conference on Recommender Systems (RecSys '24)\n\t- [Turning Dross Into Gold Loss: is BERT4Rec really better than SASRec?](https://doi.org/10.1145/3604915.3610644) Anton Klenitskiy, Alexey Vasilev. In The 17th ACM Conference on Recommender Systems (RecSys '23)\n    - [The Long Tail of Context: Does it Exist and Matter?](https://arxiv.org/abs/2210.01023). Konstantin Bauman, Alexey Vasilev, Alexander Tuzhilin. In Workshop on Context-Aware Recommender Systems (CARS) (RecSys '22)\n    - [Multiobjective Evaluation of Reinforcement Learning Based Recommender Systems](https://doi.org/10.1145/3523227.3551485). Alexey Grishanov, Anastasia Ianina, Konstantin Vorontsov. In The 16th ACM Conference on Recommender Systems (RecSys '22)\n    - [Quality Metrics in Recommender Systems: Do We Calculate Metrics Consistently?](https://doi.org/10.1145/3460231.3478848) Yan-Martin Tamm, Rinchin Damdinov, Alexey Vasilev. In The 15th ACM Conference on Recommender Systems (RecSys '21)\n\n\u003ca name=\"contributing\"\u003e\u003c/a\u003e\n## 💡 Contributing to RePlay\n\nWe welcome community contributions. For details please check our [contributing guidelines](CONTRIBUTING.md).\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsb-ai-lab%2Freplay","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsb-ai-lab%2Freplay","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsb-ai-lab%2Freplay/lists"}