Denoising Self-attentive Sequential Recommendation

Huiyuan Chen, Yusan Lin, Menghai Pan, Lan Wang, Chin-Chia Michael Yeh, Xiaoting Li, Yan Zheng, Fei Wang, Hao Yang · DOI

Abstract

Transformer-based sequential recommenders are very powerful for capturing both short-term and long-term sequential item dependencies. This is mainly attributed to their unique self-attention networks to exploit pairwise item-item interactions within the sequence. However, real-world item sequences are often noisy, which is particularly true for implicit feedback. For example, a large portion of clicks do not align well with user preferences, and many products end up with negative reviews or being returned. As such, the current user action only depends on a subset of items, not on the entire sequences. Many existing Transformer-based models use full attention distributions, which inevitably assign certain credits to irrelevant items. This may lead to sub-optimal performance if Transformers are not regularized properly.

1. Introduction

Sequential recommendation systems aim to predict a user's future behavior by analyzing their historical interactions. While Transformer architectures like SASRec and BERT4Rec have set new benchmarks in this field, they are inherently limited by their "full attention" mechanism. In a standard Transformer, every item in a sequence is allowed to interact with every other item. In the context of real-world e-commerce or content streaming, this assumption is often flawed.

User histories are frequently cluttered with "noise"—accidental clicks, one-off purchases for others, or interactions that resulted in dissatisfaction. When a model assigns attention weights to these irrelevant interactions, it introduces bias and reduces the accuracy of the final recommendation. Furthermore, the self-attention mechanism lacks Lipschitz continuity, meaning small perturbations in the input sequence can lead to significant, unstable changes in the output. To address these issues, we present Rec-denoiser, a framework designed to prune irrelevant interactions and stabilize model predictions through regularization.

2. Methodology

Rec-denoiser introduces two core components that can be integrated into existing Transformer-based recommendation models: Learnable Differentiable Masks and Jacobian Regularization.

2.1 Learnable Differentiable Masks

To move beyond the limitations of full attention, Rec-denoiser implements a trainable binary mask for each self-attention layer. The goal is to learn a sparse attention distribution where irrelevant items are assigned a weight of exactly zero.

Because binary masks (0 or 1) are discrete and non-differentiable, they cannot be optimized using standard gradient descent. Rec-denoiser overcomes this by utilizing the Augment-REINFORCE-merge (ARM) estimator. This approach treats the mask as a stochastic variable, allowing the model to learn the optimal pruning strategy in an end-to-end fashion. Unlike fixed-pattern sparse Transformers (e.g., sliding windows), this method is entirely data-driven, learning which specific items to ignore based on the unique context of a user's history.

2.2 Jacobian Regularization

To address the sensitivity of self-attention to input noise, the framework applies Jacobian regularization to the Transformer blocks. By penalizing the Frobenius norm of the Jacobian matrix, the model is forced to adhere to a Lipschitz constraint. This mathematical "smoothing" ensures that the model's output remains stable even when the input sequence contains noisy or unexpected interactions, significantly improving the model's generalization capabilities.

3. Experimental Evaluation

3.1 Datasets and Setup

The framework was evaluated across five diverse datasets: MovieLens, Steam, and three Amazon categories (Beauty, Games, and Movies&TV). These datasets represent varying levels of sparsity and user behavior patterns. The evaluation followed standard protocols, using the last item in each sequence for testing and the penultimate item for validation.

3.2 Performance and Robustness

Rec-denoiser demonstrated substantial improvements over state-of-the-art baselines, including SASRec, BERT4Rec, TiSASRec, and SSE-PT. Key findings include:

  • Accuracy Gains: The model achieved relative improvements in Hit@10 and NDCG@10 metrics ranging from 5.05% to 19.55%.
  • Noise Resistance: When subjected to synthetic noise (randomly replaced items in training sequences), Rec-denoiser's performance remained significantly more stable than standard Transformer models.
  • Interpretability: By forcing irrelevant weights to zero, the resulting attention maps are cleaner and more interpretable, clearly highlighting the historical items that truly drive a recommendation.

4. Conclusion and Future Work

Rec-denoiser demonstrates that sparsity is not just a tool for computational efficiency, but a powerful mechanism for denoising sequential data. By combining differentiable masking with Jacobian regularization, the framework provides a robust solution to the inherent noise in implicit feedback.

While the ARM estimator introduces some computational overhead—typically requiring two forward passes during training—the performance gains and increased interpretability offer a compelling trade-off. Future research may explore the integration of Rec-denoiser with linearized self-attention to mitigate these computational costs, or apply the framework to other domains like Natural Language Processing where input noise remains a challenge.

Summary updated

BibTeX
@inproceedings{chen2022denoising,
  author = {Huiyuan Chen and Yusan Lin and Menghai Pan and Lan Wang and Chin-Chia Michael Yeh and Xiaoting Li and Yan Zheng and Fei Wang and Hao Yang},
  title = {{Denoising Self-attentive Sequential Recommendation}},
  booktitle = {RecSys},
  year = {2022},
  doi = {10.1145/3523227.3546788},
}
Figure