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

Enhancing Transformers without Self-supervised Learning: A Loss Landscape Perspective in Sequential Recommendation

Vivian Lai, Huiyuan Chen, Chin-Chia Michael Yeh, Minghua Xu, Yiwei Cai, Hao Yang · DOI

TL;DR

This paper proposes SAMRec, a novel approach to improve Transformer-based sequential recommender systems by focusing on the geometry of their loss landscapes. By adapting Sharpness-Aware Minimization (SAM), SAMRec encourages models to converge to flatter minima, leading to better generalization and data efficiency without relying on complex self-supervised learning techniques or manual data augmentations.

What Problem Does This Paper Address?

Sequential recommendation systems aim to predict a user's next action based on their historical interactions. Transformer architectures have shown great promise in this area due to their ability to capture long-range dependencies. However, these models often struggle with data sparsity, leading to poor generalization. Existing solutions, like self-supervised learning (SSL) methods (e.g., S³Rec, CL4SRec), have shown success but introduce their own challenges: they can be sensitive to initialization, require manual data augmentation, and often necessitate large batch sizes for effective training. This paper questions whether these benefits can be achieved without the overhead of SSL.

Methods

The core idea is to leverage the understanding that flatter loss landscapes correlate with better model generalization. The authors observe that standard Transformer models like SASRec tend to converge to sharp local minima, making them sensitive to small parameter changes and thus prone to poor generalization.

To address this, they propose SAMRec, which adapts the Sharpness-Aware Minimization (SAM) technique. SAM works by finding model parameters that not only minimize the loss but also ensure that the loss remains low in a neighborhood around those parameters. This is achieved through a min-max optimization objective:

$$ \min_{\Theta} \max_{||\Delta||_2 \leq \rho} L_{BCE}(\Theta + \Delta) $$

Here, $\Theta$ represents the model parameters, $L_{BCE}$ is the standard Binary Cross-Entropy loss for sequential recommendation, and $\rho$ is a radius defining the neighborhood. The inner maximization finds the worst-case perturbation $\Delta$ within the ball of radius $\rho$, and the outer minimization seeks parameters $\Theta$ that are robust to such perturbations.

The paper uses a first-order Taylor expansion to approximate the optimal perturbation $\Delta$, leading to a two-step gradient update: first, an ascent step to find $\Delta$, and then a descent step to update $\Theta$. This approach effectively smooths the loss landscape, guiding the model towards flatter regions.

Datasets

The experiments were conducted on four public benchmark datasets:

  • Amazon-Beauty
  • Amazon-Sports
  • Amazon-Toys
  • Yelp

The standard data splitting procedure was followed, using the last interacted item for testing, the second-to-last for validation, and earlier items for training.

Key Insights and Ideas

  • Sharpness Matters: The paper provides empirical evidence that Transformer-based sequential recommenders like SASRec converge to sharp local minima, which directly impacts their generalization performance.
  • SSL Implicitly Smooths: Self-supervised learning methods (S³Rec, CL4SRec) implicitly smooth the loss landscape, contributing to their improved performance over models like SASRec.
  • Explicit Smoothing is Sufficient: SAMRec demonstrates that explicitly smoothing the loss landscape using SAM-like principles can achieve comparable or better performance than SSL methods, without the associated complexities.
  • Data Efficiency Gains: SAMRec shows improved performance even when trained on significantly less data, highlighting its enhanced data efficiency.
  • Generalizability of SAM: The success of SAMRec suggests that SAM can be a powerful tool for improving various Transformer-based models in sequential recommendation, not just the specific architecture used in the experiments.

Key Results

  • SAMRec consistently outperforms the baseline SASRec across all datasets, with improvements in HR@10 and NDCG@10 ranging from 11.04% to 15.48%.
  • SAMRec achieves performance comparable to state-of-the-art self-supervised methods like S³Rec and CL4SRec, but without requiring pre-training or manual data augmentations.
  • When trained with reduced data (60%, 80%), SAMRec shows significantly less performance degradation compared to SASRec and CL4SRec, demonstrating superior data efficiency.
  • Integrating SAMRec's smoothing mechanism with S³Rec and CL4SRec further improved their performance, indicating the broad applicability of the loss landscape smoothing approach.

Limitations and Future Work

  • Computational Overhead: SAMRec's update rule involves two sequential gradient computations, which can double the computational cost compared to standard methods. The paper notes that periodically computing the inner gradient ascent (as suggested by Liu et al. [25]) can mitigate this.
  • Hyperparameter Tuning: SAMRec introduces a new hyperparameter, the radius $\rho$, which needs to be tuned. The paper suggests that SAMRec remains stable for $\rho$ in the range of [0.1, 1.0].
  • Adaptive Radius: The authors suggest exploring a scheduler for $\rho$ to make it adaptive to the gradient ascent optimization, potentially improving performance and reducing training time.
  • Broader Applicability: Future work could involve integrating SAMRec with other Transformer-based models within libraries like HuggingFace Transformers.

Summary updated

BibTeX
@inproceedings{lai2023enhancing,
  author = {Vivian Lai and Huiyuan Chen and Chin-Chia Michael Yeh and Minghua Xu and Yiwei Cai and Hao Yang},
  title = {{Enhancing Transformers without Self-supervised Learning: A Loss Landscape Perspective in Sequential Recommendation}},
  booktitle = {RecSys},
  year = {2023},
  doi = {10.1145/3604915.3608831},
}
Figure