Contrastive Learning for Representation Degeneration Problem in Sequential Recommendation

Ruihong Qiu, Zi Huang, Hongzhi Yin, Zijian Wang · DOI

Abstract

Recent advancements of sequential deep learning models such as Transformer and BERT have significantly facilitated the sequential recommendation. However, according to our study, the distribution of item embeddings generated by these models tends to degenerate into an anisotropic shape, which may result in high semantic similarities among embeddings. In this paper, both empirical and theoretical investigations of this representation degeneration problem are first provided, based on which a novel recommender model DuoRec is proposed to improve the item embeddings distribution. Specifically, in light of the uniformity property of contrastive learning, a contrastive regularization is designed for DuoRec to reshape the distribution of sequence representations. Given the convention that the recommendation task is performed by measuring the similarity between sequence representations and item embeddings in the same space via dot product, the regularization can be implicitly applied to the item embedding distribution. Existing contrastive learning methods mainly rely on data level augmentation for user-item interaction sequences through item cropping, masking, or reordering and can hardly provide semantically consistent augmentation samples. In DuoRec, a model-level augmentation is proposed based on Dropout to enable better semantic preserving. Furthermore, a novel sampling strategy is developed, where sequences having the same target item are chosen hard positive samples. Extensive experiments conducted on five datasets demonstrate the superior performance of the proposed DuoRec model compared with baseline methods. Visualization results of the learned representations validate that DuoRec can largely alleviate the representation degeneration problem.

Introduction

Sequential recommendation aims to predict a user's next interaction based on their historical behavior. While modern architectures like SASRec (based on Transformers) have set new benchmarks, they suffer from a hidden flaw known as representation degeneration. This phenomenon occurs when learned item embeddings collapse into a narrow, anisotropic cone in the latent space. Consequently, embeddings exhibit excessively high cosine similarity, making it difficult for the model to distinguish between items, especially rare ones. This loss of semantic nuance leads to sub-optimal recommendations.

The Representation Degeneration Problem

The authors provide theoretical evidence that rare items suffer from a gradient bias. Because they are frequently treated as negative samples during training, their gradients are pushed toward the "context vector" of the sequence, effectively crowding them into a narrow region of the embedding space. Geometrically, this results in a distribution where most vectors point in nearly the same direction, reducing the effective rank of the embedding matrix.

The DuoRec Framework

To address these issues, the authors introduce DuoRec, which integrates contrastive learning into the standard recommendation objective. DuoRec is built on three pillars:

  1. Contrastive Regularization: By optimizing for both alignment (similar sequences should be close) and uniformity (representations should be spread evenly), DuoRec reshapes the sequence representation space. Because recommendation is calculated via dot products between sequences and items, this uniformity implicitly regularizes the item embedding space as well.
  2. Model-level Augmentation (Dropout): Traditional data-level augmentations (cropping, masking) can disrupt the semantic meaning of a sequence. DuoRec instead uses Dropout-based augmentation, passing the same sequence through the model twice with different random Dropout masks to create two semantically consistent "views."
  3. Supervised Positive Sampling: DuoRec identifies "hard positives"—distinct sequences that lead to the same target item. Pulling these representations together helps the model learn deeper semantic connections between different user paths.

Experimental Evaluation

DuoRec was evaluated against several baselines (including SASRec, CL4SRec, and UCL) across five benchmark datasets: Amazon Beauty, Clothing, and Sports; MovieLens-1M (ML-1M); and Yelp. All datasets were preprocessed to remove infrequent users and items.

Results and Analysis

DuoRec achieved state-of-the-art (SOTA) performance across all datasets. Notably, on the Yelp dataset, DuoRec improved NDCG@5 by 150% and HR@5 by 104% compared to the best previous baseline, CL4SRec.

Performance comparison of DuoRec against various baselines on the Beauty and Yelp datasets, showing significant improvements in HR@K and NDCG@K.

Visualization using Singular Value Decomposition (SVD) confirms that DuoRec successfully mitigates representation degeneration. As shown in the figure below, SASRec's embeddings are tightly clustered, while DuoRec's are distributed more uniformly around the origin. The singular value plot further illustrates that DuoRec maintains a more balanced distribution of information across dimensions compared to the sharp decay seen in SASRec.

Visualization of representation degeneration. (a) and (b) show the embedding distributions of SASRec and DuoRec, respectively. (c) shows the normalized singular values, highlighting DuoRec's improved uniformity.

Conclusion

DuoRec effectively addresses the representation degeneration problem in sequential recommendation through contrastive learning and model-level augmentation. While the model shows significant gains, the authors note that the Dropout ratio requires careful tuning on dense datasets. Future work may explore more sophisticated definitions of semantic similarity between sequences beyond shared target items.

Summary updated

BibTeX
@inproceedings{qiu2021contrastive,
  author = {Ruihong Qiu and Zi Huang and Hongzhi Yin and Zijian Wang},
  title = {{Contrastive Learning for Representation Degeneration Problem in Sequential Recommendation}},
  booktitle = {WSDM},
  year = {2021},
  doi = {10.1145/3488560.3498433},
}
Figure