arXiv(opens in a new tab)Computer ScienceAug 2018Cited by 17 papers on PaperVantageClassic Paper

Manuscript Offprint

arXiv:1808.09781

Self-Attentive Sequential Recommendation

Wang-Cheng Kang, Julian McAuley

Abstract

Sequential dynamics are a key feature of many modern recommender systems, which seek to capture the ‘context’ of users’ activities on the basis of actions they have performed recently. To capture such patterns, two approaches have proliferated: Markov Chains (MCs) and Recurrent Neural Networks (RNNs). Markov Chains assume that a user’s next action can be predicted on the basis of just their last (or last few) actions, while RNNs in principle allow for longer-term semantics to be uncovered. Generally speaking, MC-based methods perform best in extremely sparse datasets, where model parsimony is critical, while RNNs perform better in denser datasets where higher model complexity is affordable. The goal of our work is to balance these two goals, by proposing a self-attention based sequential model (SASRec) that allows us to capture long-term semantics (like an RNN), but, using an attention mechanism, makes its predictions based on relatively few actions (like an MC). At each time step, SASRec seeks to identify which items are ‘relevant’ from a user’s action history, and use them to predict the next item. Extensive empirical studies show that our method outperforms various state-of-the-art sequential models (including MC/CNN/RNN-based approaches) on both sparse and dense datasets. Moreover, the model is an order of magnitude more efficient than comparable CNN/RNN-based models. Visualizations on attention weights also show how our model adaptively handles datasets with various density, and uncovers meaningful patterns in activity sequences.

I Introduction

The goal of sequential recommender systems is to combine personalized models of user behavior (based on historical activities) with some notion of ‘context’ on the basis of users’ recent actions. Capturing useful patterns from sequential dynamics is challenging, primarily because the dimension of the input space grows exponentially with the number of past actions used as context. Research in sequential recommendation is therefore largely concerned with how to capture these high-order dynamics succinctly.

Markov Chains (MCs) are a classic example, which assume that the next action is conditioned on only the previous action (or previous few), and have been successfully adopted to characterize short-range item transitions for recommendation [1]. Another line of work uses Recurrent Neural Networks (RNNs) to summarize all previous actions via a hidden state, which is used to predict the next action [2].

Both approaches, while strong in specific cases, are somewhat limited to certain types of data. MC-based methods, by making strong simplifying assumptions, perform well in high-sparsity settings, but may fail to capture the intricate dynamics of more complex scenarios. Conversely RNNs, while expressive, require large amounts of data (an in particular dense data) before they can outperform simpler baselines.

Recently, a new sequential model Transfomer achieved state-of-the-art performance and efficiency for machine translation tasks [3]. Unlike existing sequential models that use convolutional or recurrent modules, Transformer is purely based on a proposed attention mechanism called ‘self-attention,’ which is highly efficient and capable of uncovering syntactic and semantic patterns between words in a sentence.

Inspired by this method, we seek to apply self-attention mechanisms to sequential recommendation problems. Our hope is that this idea can address both of the problems outlined above, being on the one hand able to draw context from all actions in the past (like RNNs) but on the other hand being able to frame predictions in terms of just a small number of actions (like MCs). Specifically, we build a Self-Attention based Sequential Recommendation model (SASRec), which adaptively assigns weights to previous items at each time step (Figure 1).

Figure

Fig. 1: A simplified diagram showing the training process of SASRec. At each time step, the model considers all previous items, and uses attention to ‘focus on’ items relevant to the next action.

The proposed model significantly outperforms state-of-the-art MC/CNN/RNN-based sequential recommendation methods on several benchmark datasets. In particular, we examine performance as a function of dataset sparsity, where model performance aligns closely with the patterns described above. Due to the self-attention mechanism, SASRec tends to consider long-range dependencies on dense datasets, while focusing on more recent activities on sparse datasets. This proves crucial for adaptively handling datasets with varying density.

Furthermore, the core component (i.e., the self-attention block) of SASRec is suitable for parallel acceleration, resulting in a model that is an order of magnitude faster than CNN/RNN-based alternatives. In addition, we analyze the complexity and scalability of SASRec, conduct a comprehensive ablation study to show the effect of key components, and visualize the attention weights to qualitatively reveal the model’s behavior.

References (48)

  • Factorizing personalized markov chains for next-basket recommendation
  • Session-based recommendations with recurrent neural networks
  • Attention is all you need
  • Collaborative filtering for implicit feedback datasets
  • BPR: bayesian personalized ranking from implicit feedback
  • Springer US, 2011
  • Advances in collaborative filtering
  • Fism: factored item similarity models for top-n recommender systems
  • Deep learning based recommender system: A survey and new perspectives
  • What your images reveal: Exploiting visual contents for point-of-interest recommendation
  • Visually-aware fashion recommendation and design with generative image models
  • Collaborative deep learning for recommender systems
  • Convolutional matrix factorization for document context-aware recommendation
  • Neural collaborative filtering
  • Autorec: Autoencoders meet collaborative filtering
  • Collaborative filtering with temporal dynamics
  • Recurrent recommender networks
  • Temporal collaborative filtering with bayesian probabilistic tensor factorization
  • Translation-based recommendation
  • Vista: A visually, socially, and temporally-aware model for artistic recommendation
  • Fusing similarity models with markov chains for sparse sequential recommendation
  • Personalized top-n sequential recommendation via convolutional sequence embedding
  • Neural survival recommender
  • Context-aware sequential recommendation
  • Latent cross: Making use of context in recurrent recommender systems
  • Recurrent neural networks with top-k gains for session-based recommendations
  • Show, attend and tell: Neural image caption generation with visual attention
  • Neural machine translation by jointly learning to align and translate
  • Attentive collaborative filtering: Multimedia recommendation with item- and component-level attention
  • Attentional factorization machines: Learning the weight of feature interactions via attention networks
  • Attention-based transactional context embedding for next-item recommendation
  • Google's Neural Machine Translation System: Bridging the Gap between Human and Machine Translation
  • Deep recurrent models with fast-forward connections for neural machine translation
  • Visualizing and understanding convolutional networks
  • Deep residual learning for image recognition
  • Layer normalization
  • Batch normalization: Accelerating deep network training by reducing internal covariate shift
  • Dropout: a simple way to prevent neural networks from overfitting
  • An empirical analysis of dropout in piecewise linear networks
  • Matrix factorization techniques for recommender systems
  • Adam: A method for stochastic optimization
  • A time-restricted self-attention layer for asr
  • Learning hierarchical representation model for next basket recommendation
  • An empirical evaluation of generic convolutional and recurrent networks for sequence modeling
  • Gradient flow in recurrent nets: the difficulty of learning long-term dependencies
  • Image-based recommendations on styles and substitutes
  • Personalized ranking metric embedding for next new poi recommendation
  • Factorization meets the neighborhood: a multifaceted collaborative filtering model