TL;DR
Traditional sequential recommenders treat user preferences as deterministic vectors, failing to capture the inherent uncertainty of human behavior and struggling with rare "cold-start" items. This paper introduces STOSA (STOchastic Self-Attention), a framework that embeds items as Gaussian distributions and replaces standard dot-product attention with Wasserstein distance. By satisfying the triangle inequality, STOSA naturally captures collaborative transitivity and handles uncertainty, leading to significant performance gains—especially for cold-start items and top-1 recommendations.
What Problem Does This Paper Address?
Sequential Recommendation (SR) aims to predict a user's next favorite item by analyzing their chronological history. State-of-the-art models typically leverage Transformer architectures (like SASRec) with dot-product self-attention. However, the authors identify three critical flaws in these standard approaches:
- Dynamic Uncertainty: Real-world user behavior is volatile. A user browsing sci-fi books might suddenly look at a biography. Deterministic vector embeddings treat user interests as fixed points, failing to capture this inherent behavioral variance.
- Lack of Collaborative Transitivity: Dot-product attention does not satisfy the triangle inequality. If the data shows strong transitions from item $A \rightarrow B$ and $B \rightarrow C$, dot-product models cannot automatically deduce that $A$ and $C$ are related. This severely hurts "cold-start" items that suffer from data sparsity.
- Flawed Ranking Loss: Standard Bayesian Personalized Ranking (BPR) loss optimizes relative pairwise preferences but lacks explicit constraints to ensure positive and negative items are cleanly separated in the latent metric space.
Methods
The authors propose STOSA to inject geometry and probability back into sequential recommendation through three core components:
- Stochastic Embeddings: Instead of fixed vectors, items are represented as multi-dimensional elliptical Gaussian distributions $\mathcal{N}(\mu, \Sigma)$. The mean vector ($\mu$) represents the base interest, while the diagonal covariance matrix ($\Sigma$) explicitly models the context's uncertainty or variability.
- Wasserstein Self-Attention: To aggregate sequence history while preserving distribution properties, the authors replace dot-product attention with the negative 2-Wasserstein distance. Because Wasserstein distance is a true metric satisfying the triangle inequality, it naturally enables inductive collaborative transitivity across item transitions.
- Regularized BPR Loss: They introduce a novel hinge-loss regularization term ($\ell_{pvn}$) to the standard BPR loss. This term explicitly forces the distance between a positive item and a sampled negative item to be larger than the distance between the user's historical sequence and the positive item.
Datasets
STOSA was evaluated on five real-world benchmark datasets from the Amazon review repository, spanning different levels of sparsity:
- Home (Home and Kitchen)
- Beauty
- Toys
- Tools (Tools and Home Improvement)
- Office (Office Products)
All datasets were filtered using the standard 5-core setting (users and items must have at least 5 interactions) and evaluated using a leave-one-out strategy.
Key Insights and Ideas
- Embracing Volatility: By analyzing performance across different sequence lengths, the authors found that STOSA achieved its most substantial improvements on users with the longest interaction histories. More interactions introduce more behavioral diversity; stochastic embeddings successfully capture this variance where deterministic vectors fail.
- Geometry Alleviates Sparsity: Switching from dot-product similarity to a true distance metric allows the model to perform transitive reasoning ($A \sim B$ and $B \sim C \implies A \sim C$). This geometric constraint acts as a powerful regularizer, allowing the model to recommend cold-start items by routing relationships through well-established "popular" item hubs.
- Distance-Constrained Ranking: Simply ranking items relatively isn't enough. Forcing an explicit distance gap between positive and negative items prevents the latent space from collapsing and ensures robust decision boundaries.
Key Results
STOSA consistently outperformed strong baselines (including SASRec, BERT4Rec, and the distribution-based DT4SR) across all datasets and metrics:
- Top-1 Recommendation Leap: The model showed massive relative improvements in Recall@1, ranging from +13.59% on the Office dataset to a staggering +35.11% on the Beauty dataset.
- Cold-Start Mastery: When breaking down performance by item popularity, STOSA achieved its highest performance gains on rare items (those with 3 or fewer training interactions).
- Loss Regularization Impact: Sensitivity analysis on the regularization weight $\lambda$ showed that explicitly penalizing the positive-to-negative item distance yields a clear, tunable performance curve, significantly beating the baseline ($\lambda=0$) configuration.
Limitations and Future Work
- Negative Sampling Quality: The negative items used in the regularized BPR loss are randomly sampled from un-interacted items. These are not guaranteed to be "hard negatives" (items the user actively dislikes or considered but skipped). The authors note that integrating advanced negative sampling strategies is a crucial next step.
- Computational Overhead: Although the authors demonstrate that Wasserstein self-attention can be formulated efficiently using batch matrix multiplications, maintaining separate mean and covariance representations inherently increases memory consumption and embedding lookup complexity relative to vanilla vector models.
Summary updated