Contrastive State Augmentations for Reinforcement Learning-Based Recommender Systems

Zhaochun Ren, Na Huang, Yidan Wang, Pengjie Ren, Jun Ma, Jiahuan Lei, Xinlei Shi, Hengliang Luo, Joemon M. Jose, Xin Xin

Abstract

Reinforcement learning (RL) has emerged as a powerful paradigm for recommender systems, enabling the optimization of long-term user engagement rather than immediate clicks. However, training RL agents offline using historical logs introduces significant challenges, specifically the "unseen state" problem and the lack of explicit negative feedback. This paper introduces the Contrastive State Augmentations (CSA) framework, which utilizes four novel state augmentation strategies combined with a contrastive learning objective. By artificially expanding the state space and regularizing the representation layer, CSA improves the generalization of RL agents to out-of-distribution user behaviors and enhances the robustness of state representations derived from sparse, implicit feedback.

1. Introduction

Modern recommender systems are increasingly moving away from static supervised learning models toward Reinforcement Learning (RL) frameworks. While supervised models excel at predicting the next likely interaction, RL agents are designed to maximize cumulative rewards, such as total purchase value or long-term retention. Despite this potential, deploying RL in production usually requires training on offline historical data due to the risks and costs associated with online exploration.

Offline training, however, is fraught with difficulties. The historical data represents only a tiny fraction of the possible interaction trajectories, leading to a "generalization gap" where the model encounters unfamiliar user states during deployment. Furthermore, most recommendation datasets rely on implicit feedback (clicks and views), providing no clear signal on what a user dislikes. The CSA framework addresses these hurdles by leveraging contrastive learning and data augmentation to smooth the value function and provide discriminative signals in the absence of explicit negative feedback.

2. The CSA Framework

The CSA framework is designed to be model-agnostic, capable of integrating with common sequential architectures such as GRU4Rec or SASRec. The architecture consists of a shared base encoder that transforms a user's interaction history into a state vector. This vector then branches into two distinct heads:

  1. Supervised Learning Head: Performs next-item prediction to maintain recommendation accuracy.
  2. Reinforcement Learning Head: Utilizes Double Q-learning to estimate the long-term value of potential actions.

2.1 State Augmentation Strategies

To simulate "local exploration" within a static dataset, CSA introduces four perturbation techniques to the state vectors:

  • Zero-mean Gaussian Noise: Adds random jitter to the state vector to ensure the model is robust to small variations in user representation.
  • Uniform Noise: Introduces noise within a defined range to perturb the state space.
  • Item Masking: Randomly replaces an item in the user’s history with a [mask] token, forcing the model to infer intent from incomplete sequences.
  • Dimension Dropout: Randomly zeros out specific dimensions of the state vector, preventing the model from over-relying on specific features.

2.2 Contrastive Learning Objective

Central to the framework is the Contrastive Loss ($L_c$). Inspired by self-supervised learning in computer vision, this objective "pulls" the representations of an original state and its augmented versions closer together in the vector space. Simultaneously, it "pushes" these representations away from states sampled from different user sessions. This process forces the encoder to identify the core semantic features of a user's intent, effectively treating different user sessions as negative samples for one another.

3. Experimental Evaluation

The researchers evaluated CSA against several baselines, including standard supervised models and the State-of-the-art RL-supervised hybrid, SQN (Supervised Q-Learning Network). Testing was conducted across four diverse environments:

  • RC15: A session-based dataset from the RecSys Challenge 2015.
  • RetailRocket: Real-world e-commerce interaction data.
  • Meituan: A large-scale dataset from a major e-commerce platform.
  • KuaiRec: A high-density video-sharing dataset used for online simulation.

3.1 Key Results

CSA consistently outperformed the baselines in offline metrics. On the RC15 dataset, the Item Masking variant (CSA-M) improved the Hit Ratio (HR@5) from 0.4313 (SQN) to 0.4525. In online simulations using the KuaiRec environment, the RL-based CSA methods demonstrated significantly higher cumulative rewards over multiple recommendation rounds compared to purely supervised approaches.

Analysis of the augmentation strategies revealed that Gaussian noise (CSA-N) and Item Masking (CSA-M) were the most effective. CSA-N typically performed better in the early stages of a recommendation session, while CSA-M proved more robust for longer interaction sequences.

4. Discussion and Insights

The success of CSA can be attributed to two primary factors:

  1. Q-Function Smoothing: By requiring the model to predict similar Q-values for a state and its perturbed versions, CSA prevents the erratic value estimations that typically occur when an offline model encounters an out-of-distribution state.
  2. Artificial Exploration: In a static log, an agent cannot try new actions. State augmentation acts as a proxy for this exploration, allowing the agent to "visit" and learn from regions of the state space adjacent to the logged data.

5. Conclusion and Future Work

The Contrastive State Augmentations framework provides a robust solution to the inherent limitations of offline RL for recommendations. By combining state perturbations with contrastive learning, the model learns more resilient user representations and smoother value functions.

Future research may explore action augmentation, where item embeddings themselves are perturbed, or the integration of more complex reward functions that account for user dwell time and content diversity. Additionally, addressing hyperparameter sensitivity remains a priority, as the magnitude of noise must be carefully tuned to avoid "model collapse" where the agent loses the ability to distinguish between distinct user intents.

Summary updated

BibTeX
@inproceedings{ren2023contrastive,
  author = {Zhaochun Ren and Na Huang and Yidan Wang and Pengjie Ren and Jun Ma and Jiahuan Lei and Xinlei Shi and Hengliang Luo and Joemon M. Jose and Xin Xin},
  title = {{Contrastive State Augmentations for Reinforcement Learning-Based Recommender Systems}},
  booktitle = {International ACM SIGIR Conference on Research and Development in Information Retrieval},
  year = {2023},
  doi = {10.1145/3539618.3591656},
}
Figure