Abstract
Reinforcement Learning (RL)-Based Recommender Systems (RSs) have gained rising attention for their potential to enhance long-term user engagement. However, research in this field faces challenges, including the lack of user-friendly frameworks, inconsistent evaluation metrics, and difficulties in reproducing existing studies. To tackle these issues, we introduce EasyRL4Rec, an easy-to-use code library designed specifically for RL-based RSs. This library provides lightweight and diverse RL environments based on five public datasets and includes core modules with rich options, simplifying model development. It provides unified evaluation standards focusing on long-term outcomes and offers tailored designs for state modeling and action representation for recommendation scenarios. Furthermore, we share our findings from insightful experiments with current methods. EasyRL4Rec seeks to facilitate the model development and experimental process in the domain of RL-based RSs.
Introduction
Traditional recommender systems typically rely on supervised learning to predict immediate user actions, such as clicks or ratings. However, this "myopic" approach often leads to issues like filter bubbles and feedback loops, where the system fails to account for long-term user satisfaction. Reinforcement Learning (RL) presents a natural solution by treating recommendation as a multi-step decision-making process aimed at maximizing cumulative rewards.
Despite its potential, RL-based RS research faces three major hurdles:
- Framework Scarcity: Most general RL libraries are not optimized for the discrete and sparse nature of recommendation data.
- Evaluation Inconsistency: The lack of standardized metrics makes head-to-head comparisons between different studies nearly impossible.
- The Reproducibility Crisis: A significant portion of existing RL-based RS research is not open-source, hindering the ability of new researchers to build upon prior work.
System Architecture
EasyRL4Rec is built upon a modular architecture designed to bridge the gap between the OpenAI Gymnasium API and the Tianshou RL library. The framework is organized into three primary layers: Executor, Core Modules, and Data.
The core modules include:
- Environment: This module converts static datasets into interactive environments. It utilizes a Matrix Factorization (MF) model to simulate feedback for unobserved user-item pairs, allowing the agent to learn in a more continuous space.
- Policy: Supports a wide array of algorithms, including Batch RL, Off-policy (e.g., DQN, TD3), and On-policy (e.g., PPO, A2C) methods. It includes a conversion mechanism to map continuous-action policies to discrete item sets.
- StateTracker: Since user "state" is implicit in recommendation, this module encodes interaction history using models such as GRU, SASRec, or Caser.
- Collector: Manages the interaction between the Policy and the Environment, handling the trajectory buffer used for training.
Additionally, the library introduces a "Quit Mechanism" to simulate real-world user behavior, where an interaction session terminates if the agent provides consistently poor recommendations.
Experimental Setup and Datasets
To ensure robust evaluation, EasyRL4Rec includes five preprocessed public datasets across various domains:
- Coat & YahooR3: Small-scale product and music recommendations.
- MovieLens (1M): A classic benchmark for movie recommendation.
- KuaiRec: A large-scale "fully observed" video dataset, essential for accurate RL evaluation.
- KuaiRand: A video dataset featuring randomly exposed items to mitigate inherent selection bias.
Key Insights and Results
Our experiments revealed several critical findings for the development of RL-based RS:
- Discrete vs. Continuous Actions: Contrary to trends in robotics, discrete action-based methods (like DQN) often outperform continuous ones in recommendation tasks. Continuous actions frequently suffer from mapping errors when translated back to discrete item IDs.
- The Preference Overestimation Paradox: User models trained with insufficient negative samples tend to predict unrealistically high rewards. Increasing negative sampling during user model training is vital for stable performance.
- On-Policy Advantage: On-policy methods like A2C generally handle the exploration-exploitation tradeoff better than off-policy methods, resulting in higher cumulative rewards and longer interaction lengths.
In benchmarks on the KuaiRec dataset, the on-policy A2C algorithm achieved a Cumulative Reward ($R_{cumu}$) of 25.24, significantly outperforming the off-policy DQN (12.65). Furthermore, for offline learning scenarios, the CRR (Critic Regularized Regression) algorithm proved to be the most robust across all tested datasets.
Conclusion
EasyRL4Rec addresses the critical need for a standardized, user-friendly framework in the RL-based recommendation space. By providing modular components and unified evaluation protocols, it simplifies the development process and enhances reproducibility. Future work will focus on integrating state-of-the-art RL models, expanding dataset diversity, and implementing automated hyperparameter tuning to further lower the barrier to entry for researchers.
Summary updated