NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Explanation Guided Contrastive Learning for Sequential Recommendation

Lei Wang, Ee-Peng Lim, Zhiwei Liu, Tianxiang Zhao · DOI

Abstract

Sequential recommendation systems aim to predict a user's next interaction based on their historical behavior. However, these systems often struggle with data sparsity. While Contrastive Learning (CL) has emerged as a powerful technique to address this by generating augmented views of user sequences, standard random augmentation methods often introduce noise by inadvertently masking critical items. This paper introduces EC4SRec, a novel framework that utilizes model explanations to guide data augmentation. By identifying and preserving "important" items in positive views and removing them in negative ones, EC4SRec creates more robust and accurate user representations, significantly outperforming existing state-of-the-art methods.

Introduction

In the realm of sequential recommendation, the goal is to capture the evolving preferences of users over time. A significant hurdle in this field is the sparsity of interaction data, particularly for new or infrequent users. Contrastive Learning (CL) has recently been applied to mitigate this, typically by creating two different "views" of the same user sequence (e.g., through random masking, cropping, or reordering) and training the model to recognize them as similar.

However, the reliance on randomness in standard CL is a double-edged sword. If a random mask hides the most influential item in a sequence—the "signal"—the resulting view may no longer represent the user's true intent, leading to "false positives" in training. Conversely, a negative sample from a different user might accidentally share the same core intent, creating "false negatives." These noisy signals degrade the model's ability to learn precise user representations.

The EC4SRec Framework

The authors propose Explanation Guided Augmentations (EGA) to move from random noise to "informed" perturbations. The EC4SRec framework consists of four primary components:

1. Importance Scoring

Instead of treating all items in a history equally, the model uses explanation methods (such as Saliency Maps or Occlusion) to assign an importance score to every item. These scores quantify how much each specific interaction contributes to the prediction of the next item. This turns "explainability" from a post-hoc diagnostic tool into an active part of the training loop.

2. Guided Positive Views (ecrop+, emask+, erord+)

Using the importance scores, the model generates positive views by specifically preserving high-importance items. Augmentation operations like masking or cropping are restricted to "unimportant" items. This ensures that the semantic "essence" of the user’s intent remains intact across different views.

3. Guided Negative Views (ecrop-, emask-)

To sharpen the model's decision boundaries, EC4SRec creates "hard" negative samples. This is achieved by intentionally removing or masking the most important items from a sequence. By breaking the primary signal, the model is forced to learn exactly what makes a specific sequence unique compared to others.

4. Model-Agnostic Integration

EC4SRec is designed as a flexible wrapper. It can be applied to various "backbone" architectures, including RNN-based (GRU4Rec), CNN-based (Caser), or Transformer-based (SASRec) models. The training objective combines standard recommendation loss with both self-supervised and supervised contrastive losses.

Experimental Evaluation

The researchers evaluated EC4SRec across several diverse datasets:

  • Synthetic Dataset: A controlled environment where "important" items were known as ground truth, allowing for a direct comparison between explanation-guided and random masking.
  • Amazon (Beauty, Clothing, Sports): Three sparse, real-world retail datasets.
  • MovieLens 1M (ML-1M): A large-scale benchmark for movie recommendations.

Key Results

  • Superior Performance: EC4SRec consistently outperformed top-tier baselines. On average, it achieved a 12.4% improvement over CL4SRec and a 4.9% improvement over DuoRec across all tested datasets.
  • Validation via Synthetic Data: In tests where the ground-truth important items were known, explanation-guided masking resulted in a 40% higher NDCG@3 compared to random masking, proving that informed augmentations are significantly more effective at capturing user intent.
  • Architecture Robustness: The framework showed consistent gains (ranging from 4.2% to 23.0%) across different encoder backbones, demonstrating that the strategy is fundamentally sound regardless of the underlying neural network.

Insights and Discussion

The core insight of this research is that not all items in a user's history are created equal. In a sequence of interactions, often only a few key items define the current intent (e.g., a user buying a specific accessory after purchasing a primary electronic device). By using the model's own internal "reasoning" to identify these items, EC4SRec creates a feedback loop that continuously improves the quality of the training data.

Furthermore, the use of "hard negatives"—sequences where the primary signal has been removed—is crucial. It prevents the model from relying on shortcuts and forces it to develop a deeper understanding of the relationship between specific items and the user's ultimate goal.

Limitations and Future Work

While highly effective, the authors acknowledge certain challenges:

  • Computational Overhead: Calculating importance scores for every sequence is more resource-intensive than random augmentation. Future research may focus on more efficient indexing or hashing techniques to reduce this overhead.
  • Sequence Length: Designing effective augmentations for extremely long sequences remains a complex task that requires further refinement of the importance functions.
  • Refining Explanations: The current study primarily uses Occlusion and Saliency; exploring more sophisticated explanation methods could further improve the quality of the generated views.

Conclusion

EC4SRec represents a significant step forward in sequential recommendation by bridging the gap between model explainability and data augmentation. By ensuring that contrastive learning focuses on the most informative parts of a user's history, the framework provides a more robust solution to the perennial problem of data sparsity in recommendation systems.

Summary updated

BibTeX
@inproceedings{wang2022explanation,
  author = {Lei Wang and Ee-Peng Lim and Zhiwei Liu and Tianxiang Zhao},
  title = {{Explanation Guided Contrastive Learning for Sequential Recommendation}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2022},
  doi = {10.1145/3511808.3557317},
}
Figure