Meta-optimized Contrastive Learning for Sequential Recommendation

Xiuyuan Qin, Huanhuan Yuan, Pengpeng Zhao, Junhua Fang, Fuzhen Zhuang, Guanfeng Liu, Victor Sheng · DOI

TL;DR

Contrastive learning (CL) is highly effective at tackling data sparsity in sequential recommendation, but traditional methods rely on rigid, hand-crafted augmentations and massive batch sizes to avoid representation collapse. This paper introduces MCLRec, a framework that pairs stochastic data augmentation with learnable model augmenters optimized via meta-learning. This approach adaptively generates highly informative contrastive views, allowing the model to significantly outperform state-of-the-art methods even with small training batch sizes.

What Problem Does This Paper Address?

Sequential Recommendation (SR) systems aim to predict a user's next item interaction by modeling their historical behavior sequence. However, real-world interaction data is notoriously sparse and noisy, making it difficult for deep learning models to accurately capture user preferences.

Recently, Contrastive Learning (CL) has emerged as a powerful self-supervised solution. By maximizing the similarity between different "augmented views" of the same sequence (positive pairs) and pushing apart different sequences (negative pairs), CL helps models learn more robust embeddings.

However, existing CL recommendation frameworks suffer from two major bottlenecks:

  1. Inflexible Augmentations: They rely on hand-crafted data manipulations (like randomly cropping or masking items) or static model perturbations (like dropout). These unlearnable operations require domain expertise and fail to adapt to different datasets.
  2. The Large Batch Size Requirement: To prevent "embedding collapse"—where the encoder lazily maps all sequences to identical representations—current models require massive batch sizes or memory banks to ensure a sufficient supply of diverse negative samples. This drastically increases computational overhead.

Methods

The authors propose Meta-optimized Contrastive Learning for Sequential Recommendation (MCLRec) to make contrastive views both learnable and resource-efficient.

The architecture consists of three core components:

  1. Hybrid Augmentation Module: Given an interaction sequence, standard stochastic data augmentation (e.g., masking or cropping) first creates two data-augmented views. These views are passed through a sequence encoder (SASRec). Crucially, MCLRec then introduces two learnable Multi-Layer Perceptrons (MLPs) acting as model augmenters to transform these representations into two additional model-augmented views.
  2. Meta-Learning Training Strategy: Directly updating both the encoder and the augmenters via joint learning can lead to suboptimal solutions due to conflicting objectives. Instead, MCLRec uses a two-stage meta-learning strategy. In the first stage, the encoder is updated using a joint loss of the primary recommendation task and contrastive tasks. In the second stage, the encoder's parameters are frozen, and the model augmenters are updated based on how well their generated views improve the encoder's discriminative performance.
  3. Contrastive Regularization: To prevent the learnable augmenters from "cheating" (i.e., outputting identical, collapsed views to minimize loss), the authors introduce a regularization term that enforces a strict similarity margin between positive and negative pairs.
MCLRec Framework vs. General Contrastive Learning

Datasets

The framework was evaluated on three standard, real-world benchmark datasets:

  • Amazon-Beauty: E-commerce user interactions with beauty products.
  • Amazon-Sports: E-commerce user interactions with sporting goods.
  • Yelp: User reviews and business interactions.

Following standard literature protocols, users and items with fewer than five interactions were filtered out.

Key Insights and Ideas

  • Learnable Beats Random: Static, hand-crafted data augmentations hit a performance ceiling because they cannot adapt to a dataset's unique structural properties. Learnable model augmenters can dynamically discover which latent features are truly informative for contrastive alignment.
  • Quality Over Quantity: Traditional CL models require huge batch sizes (e.g., 256+) to encounter meaningful negative samples. By meta-optimizing the augmenters to generate highly discriminative views natively, MCLRec running at a batch size of 64 successfully outperforms baseline models running at a batch size of 256.
  • Regularization is Mandatory for Learnable CL: Without the contrastive regularization term, learnable augmenters quickly suffer from feature collapse. Forcing a margin ensures that positive pairs stay close while negative pairs remain distinctly separated in the latent space.
T-SNE visualization showing the effect of contrastive regularization

Key Results

  • State-of-the-Art Performance: MCLRec consistently outperformed all baselines (including advanced CL models like DuoRec, CoSeRec, and SRMA). It achieved a relative performance improvement of 3.94% to 8.41% in Hit Ratio (HR@20) and 2.47% to 5.69% in NDCG@20 across the datasets.
  • Robustness to Noise: When 15% random noise (negative items) was injected into the test sequences, MCLRec still outperformed competing models—even when those competitors were evaluated on completely clean data.
  • Sparsity Mitigation: The framework showed its most significant performance gains on users with low interaction frequencies (short sequence lengths), proving its capability to alleviate severe data sparsity.
Comparison of Meta-Optimization vs Joint Learning

Limitations and Future Work

  • Simple Augmenter Architecture: The authors utilized basic 3-layer MLPs for the model augmenters due to their universal approximation properties and low computational cost. They note that exploring more sophisticated architectures, such as self-attention mechanisms, could yield even better views.
  • Scope of Recommendation Paradigms: MCLRec was designed and validated strictly within the bounds of sequential recommendation. Extending this meta-optimized contrastive framework to graph-based collaborative filtering or multi-behavior recommendation remains an open avenue for future research.

Summary updated

BibTeX
@misc{qin2023meta,
  author = {Xiuyuan Qin and Huanhuan Yuan and Pengpeng Zhao and Junhua Fang and Fuzhen Zhuang and Guanfeng Liu and Victor Sheng},
  title = {{Meta-optimized Contrastive Learning for Sequential Recommendation}},
  year = {2023},
  eprint = {2304.07763},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2304.07763},
}
Figure