SkillAgentSearch skills...

RecBole

A unified, comprehensive and efficient recommendation library

Install / Use

/learn @RUCAIBox/RecBole

README

RecBole Logo


RecBole (伯乐)

“世有伯乐,然后有千里马。千里马常有,而伯乐不常有。”——韩愈《马说》

PyPi Latest Release Conda Latest Release License arXiv

HomePage | Docs | Datasets | Paper | Blogs | Models | 中文版

RecBole is developed based on Python and PyTorch for reproducing and developing recommendation algorithms in a unified, comprehensive and efficient framework for research purpose. Our library includes 94 recommendation algorithms, covering four major categories:

  • General Recommendation
  • Sequential Recommendation
  • Context-aware Recommendation
  • Knowledge-based Recommendation

We design a unified and flexible data file format, and provide the support for 44 benchmark recommendation datasets. A user can apply the provided script to process the original data copy, or simply download the processed datasets by our team.

<p align="center"> <img src="asset/framework.png" alt="RecBole v0.1 architecture" width="600"> <br> <b>Figure</b>: RecBole Overall Architecture </p>

In order to support the study of recent advances in recommender systems, we construct an extended recommendation library RecBole2.0 consisting of 8 packages for up-to-date topics and architectures (e.g., debiased, fairness and GNNs).

Feature

  • General and extensible data structure. We design general and extensible data structures to unify the formatting and usage of various recommendation datasets.

  • Comprehensive benchmark models and datasets. We implement 94 commonly used recommendation algorithms, and provide the formatted copies of 44 recommendation datasets.

  • Efficient GPU-accelerated execution. We optimize the efficiency of our library with a number of improved techniques oriented to the GPU environment.

  • Extensive and standard evaluation protocols. We support a series of widely adopted evaluation protocols or settings for testing and comparing recommendation algorithms.

RecBole News

new 02/23/2025: We release RecBole v1.2.1.

new 11/01/2023: We release RecBole v1.2.0.

11/06/2022: We release the optimal hyperparameters of the model and their tuning ranges.

10/05/2022: We release RecBole v1.1.1.

06/28/2022: We release RecBole2.0 with 8 packages consisting of 65 newly implement models.

02/25/2022: We release RecBole v1.0.1.

09/17/2021: We release RecBole v1.0.0.

03/22/2021: We release RecBole v0.2.1.

01/15/2021: We release RecBole v0.2.0.

12/10/2020: 我们发布了RecBole小白入门系列中文博客(持续更新中)

12/06/2020: We release RecBole v0.1.2.

11/29/2020: We constructed preliminary experiments to test the time and memory cost on three different-sized datasets and provided the test result for reference.

11/03/2020: We release the first version of RecBole v0.1.1.

Latest Update for SIGIR 2023 Submission

To better meet the user requirements and contribute to the research community, we present a significant update of RecBole in the latest version, making it more user-friendly and easy-to-use as a comprehensive benchmark library for recommendation. We summarize these updates in "Towards a More User-Friendly and Easy-to-Use Benchmark Library for Recommender Systems" and submit the paper to SIGIR 2023. The main contribution in this update is introduced below.

Our extensions are made in three major aspects, namely the models/datasets, the framework, and the configurations. Furthermore, we provide more comprehensive documentation and well-organized FAQ for the usage of our library, which largely improves the user experience. More specifically, the highlights of this update are summarized as:

  1. We introduce more operations and settings to help benchmarking the recommendation domain.

  2. We improve the user friendliness of our library by providing more detailed documentation and well-organized frequently asked questions.

  3. We point out several development guidelines for the open-source library developers.

These extensions make it much easier to reproduce the benchmark results and stay up-to-date with the recent advances on recommender systems. The datailed comparison between this update and previous versions is listed below.

| Aspect | RecBole 1.0 | RecBole 2.0 | This update | | :-----------------------: | :--------------------------------: | :----------------------------: | :----------------------------------------------: | | Recommendation tasks | 4 categories | 3 topics and 5 packages | 4 categories | | Models and datasets | 73 models and 28 datasets | 65 models and 8 new datasets | 94 models and 43 datasets | | Data structure | Implemented Dataset and Dataloader | Task-oriented | Compatible data module inherited from PyTorch | | Continuous features | Field embedding | Field embedding | Field embedding and discretization | | GPU-accelerated execution | Single-GPU utilization | Single-GPU utilization | Multi-GPU and mixed precision training | | Hyper-parameter tuning | Serial gradient search | Serial gradient search | Three search methods in both serial and parallel | | Significance test | - | - | Available interface | | Benchmark results | - | Partially public (GNN and CDR) | Benchmark configurations on 94 models | | Friendly usage | Documentation | Documentation | Improved documentation and FAQ page |

Installation

RecBole works with the following operating systems:

  • Linux
  • Windows 10
  • macOS X

RecBole requires Python version 3.7 or later.

RecBole requires torch version 1.7.0 or later. If you want to use RecBole with GPU, please ensure that CUDA or cudatoolkit version is 9.2 or later. This requires NVIDIA driver version >= 396.26 (for Linux) or >= 397.44 (for Windows10).

Install from conda

conda install -c aibox recbole

Install from pip

pip install recbole

Install from source

git clone https://github.com/RUCAIBox/RecBole.git && cd RecBole
pip install -e . --verbose

Quick-Start

With the source code, you can use the provided script for initial usage of our library:

python run_recbole.py

This script will run the BPR model on the ml-100k dataset.

Typically, this example takes less than one minute. We will obtain some output like:

INFO ml-100k
The number of users: 944
Average actions of users: 106.04453870625663
The number of items: 1683
Average actions of items: 59.45303210463734
The number of inters: 100000
The sparsity of the dataset: 93.70575143257098%
INFO Evaluation Settings:
Group by user_id
Ordering: {'strategy': 'shuffle'}
Splitting: {'strategy': 'by_ratio', 'ratios': [0.8, 0.1, 0.1]}
Negative Sampling: {'strategy': 'full', 'distribution': 'uniform'}
INFO BPRMF(
    (user_embedding): Embedding(944, 64)
    (item_embedding): Embedding(1683, 64)
    (loss): BPRLoss()
)
Trainable parameters: 168128
INFO epoch 0 training [time: 0.27s, train loss: 27.7231]
INFO epoch 0 evaluating [time: 0.12s, valid_score: 0.021900]
INFO valid result:
recall@10: 0.0073  mrr@10: 0.0219  ndcg@10: 0.0093  hit@10: 0.0795  precision@10: 0.0088
...
INFO epoch 63 training [time: 0.19s, train loss: 4.7660]
INFO epoch 63 evaluating [time: 0.08s, valid_score: 0.394500]
INFO valid result:
recall@10: 0.2156  mrr@10: 0.3945  ndcg@10: 0.2332  hit@10: 0.7593  precision@10: 0.1591
INFO Finished training, best eval result in epoch 52
INFO Loading model structure and parameters from saved/***.pth
INFO best valid result:
recall@10: 0.2169  mrr@10: 0.4005  ndcg@10: 0.235  hit@10: 0.7582  precision@10: 0.1598
INFO test result:
recall@10: 0.2368  mrr@10: 0.4519  ndcg@10: 0.2768  hit@10: 0.7614  precision@10: 0.1901

If you want to change the parameters, such as learning_rate, embedding_size, just set the additional command parameters as you need:

Related Skills

View on GitHub
GitHub Stars4.4k
CategoryEducation
Updated1d ago
Forks736

Languages

Python

Security Score

100/100

Audited on Apr 7, 2026

No findings