# Personalized Top-N Sequential Recommendation via Convolutional Sequence Embedding

Convolutional filters over recent items capture sequential patterns for top-N recommendation

Tang, Jiaxi, Wang, Ke · arXiv · 2018-9-19

- **Problem** Top-N recommenders that rank by lasting tastes miss the order of a user's recent items. Markov chains do not capture union-level influence or skip behaviours between earlier and later actions.
- **Method** Caser stacks the embeddings of the last L items into a matrix and treats it as an image. Horizontal and vertical convolutional filters then find sequential patterns, and the result is combined with a user embedding to score all items.
- **Results** On Gowalla, Caser reaches Prec@1 of 0.1961, against 0.1736 for Fossil, the best baseline on that metric. That is a 13.0% improvement.

## Why order matters in top-N recommendation

Most top-N recommenders rank items by a user's lasting tastes and pay little attention to how recent each interaction is. Top-N sequential recommendation treats each user's history as an ordered series of items and asks for a short list of items the user is likely to engage with soon. The order carries information: the index of an item in the sequence records its position relative to the others, not its clock timestamp.

A concrete case is an accessory bought after a phone, a link that a model tracking only lasting tastes would not see. Short-term, dynamic behaviour sits beside stable tastes, so a model has to represent both.

## Gaps in Markov-chain recommenders

An L-order Markov chain predicts the next action from the L previous actions. A first-order chain is an item-to-item transition matrix estimated by maximum likelihood; FPMC factorizes it into two low-rank latent matrices, and Fossil extends the idea to high-order chains through a weighted sum over earlier items' latent representations.

Fossil's weighted sum still combines earlier items one at a time, so it models point-level influence. Union-level influence is the joint effect of several earlier actions taken in order. Buying milk and butter in one basket, for example, raises the odds of a later flour purchase more than either item alone.

A skip pattern lets an earlier action affect a later target across intermediate steps that carry no weight. An L-order Markov chain assumes that all of the last L steps affect the immediate next step, so it has no explicit way to express skips.

To check both effects against real data, sequential association rules were mined from MovieLens and Gowalla, with rules mapping the last L items to a later item. With minimum support count 5 and minimum confidence 50%, a sizable number of rules have skip steps of 1 or 2, and most rules have L = 2 or L = 3. The confidence of rules rises for larger L.

## Why convolution instead of recurrence

Recurrent networks are the obvious alternative for sequences, and GRU4Rec applies one to session-based recommendation. The authors argue that a recurrent chain ties each step to the adjacent one, while in recommendation not every pair of adjacent actions is linked. Caser instead keeps convolution filters from CNN models, which were built for image recognition and sentence classification, and applies them to local groups of items wherever they occur.

## Recent items as an image

The embeddings of the L most recent items are stacked in time order into a matrix E with L rows and d latent columns, where d is the latent dimension. Treating E as an image in the time and latent spaces lets filters search for sequential patterns as local features. Unlike a photograph, this image is not given; the item embeddings are learned together with the filters.

For each user, a window of size L + T slides over the sequence, and each window yields one training triple made of the user, the previous L items and the next T items. The item embedding Q\_i in R^d is a latent vector for item i, and a user embedding P\_u in R^d is looked up alongside the stacked matrix E(u,t) in R^{L x d}.

## Horizontal and vertical filters

A horizontal filter has height h between 1 and L and full width d, so it spans h consecutive items across all latent dimensions and slides down the rows of E. Each position gives an inner product followed by the activation phi\_c, written as c^k\_i = phi\_c(E\_{i:i+h-1} ⊙ F^k), and the vector of responses for a filter goes through max pooling.

Max pooling keeps only the largest response of each filter, so the signal is picked up wherever it sits in the window; n filters give an output o in R^n.

In the illustration, a height-2 filter responds to the airport and hotel embeddings while skipping the fast food and restaurant embeddings, and predicts the Great Wall. This is how horizontal filters of several heights can capture union-level patterns of several sizes.

A vertical filter has size L x 1 and slides across the d columns, so each latent dimension gets one value that is a weighted sum of the L rows of E. The result equals the sum over l of the weights in the filter times the l-th row E\_l, which makes the vertical filter an aggregator of the L previous items. No max pooling follows the vertical layer, since each latent dimension should keep its own aggregate, and the filter size stays fixed at L x 1.

Unlike the single per-user weighting in Fossil, n-tilde global vertical filters produce n-tilde weighted sums, shared by all users, in the output o-tilde in R^{d x n-tilde}.

## From convolutional outputs to scores and training

The horizontal output o and the vertical output o-tilde are concatenated and passed through one fully connected layer, z = phi\_a(W\[o; o-tilde\] + b), where W has size d x (n + d n-tilde). The vector z is the convolutional sequence embedding, and it captures the sequential features of the L previous items.

Concatenating z with the user embedding P\_u and projecting to \|I\| output nodes gives the scores y(u,t) = W'\[z; P\_u\] + b', where W' has size \|I\| x 2d. The user embedding sits in the last hidden layer, so that it can generalize other models and so that parameters can be pre-trained from them; the authors cite earlier work for the claim that such pre-training is critical.

Each score is passed through a sigmoid to give the probability that the user interacts with an item. To capture skip behaviours, the next T items form a target set D rather than a single item. The loss is the sum of -log sigma of the target scores plus -log(1 - sigma) of the sampled negatives, which is the binary cross-entropy loss; three negatives are sampled for each target item.

Parameters are learned by minimizing this loss on the training set, while L, T, d and the other hyperparameters are tuned on the validation set by grid search. Adam is used with batch size 100, the L2 norm is applied to all parameters, and dropout with a 50% drop ratio is applied to the fully connected layers. Training took around 1 hour on MovieLens and 2 hours on Gowalla on a 4-core i7 CPU with 32GB RAM.

At run time, the trained network takes the user embedding and the embeddings of the user's last L items, and returns the N items with the highest output values. T is fixed during training, while N is chosen after the model has been trained. Scoring all users costs O(\|U\|\|I\| d), with the convolution cost left out.

## Which earlier models Caser contains

Dropping the convolutional layers and the bias terms leaves a model like matrix factorization, with user embeddings as user factors and output weights as item factors. Copying the previous item's embedding into z, with no bias terms, gives an FPMC-like structure; the difference is the loss, since FPMC uses BPR, which allows one target and one negative per step.

Keeping one vertical filter and copying its output into z gives a Fossil-like weighted sum over the L previous items; Fossil uses a similarity model rather than LFM and a per-user weighting, where Caser uses global filters.

These are reductions of the architecture; the experiments compare the full Caser model with the baselines as separate methods.

## Data sets, sequential intensity and evaluation protocol

Four public data sets are used: MovieLens, Gowalla, Foursquare and Tmall, the last being user-purchase data from the largest B2C platform in China. Numeric ratings become implicit feedback of 1, and users and items with fewer than n feedbacks are removed, with n equal to 5, 15, 10 and 10 respectively. Cold-start recommendation is treated as a separate problem and is not studied here.

Sequential Intensity is the number of sequential association rules found, with support count 5, confidence 50% and Markov order from 1 to 5, divided by the number of users. Its values are 0.3265 for MovieLens, 0.0748 for Gowalla, 0.0378 for Foursquare and 0.0104 for Tmall. Amazon data was excluded because its sequential intensity values, 0.0026 and 0.0019 for its categories, are much lower.

For each user's sequence, the first 70% of actions form the training set, the next 10% the validation set, and the last 20% the test set. Precision@N divides the hits in the top N list by N, and Recall@N divides the hits by the size of the test set; both are averaged over users, with N in {1, 5, 10}. AP weights the precision at each hit position in the ranked list, and MAP is the average of AP over users.

## Comparison with baselines

Caser is compared with POP, BPR, FMC, FPMC, Fossil and GRU4Rec, and each method is tuned by grid search on the validation set. The grid covered latent dimension d from 5 to 100, Markov order L from 1 to 9 for Fossil, Caser and GRU4Rec, and target number T from 1 to 3 for Caser.

On Gowalla, Caser reaches Prec@1 of 0.1961, against 0.1736 for Fossil, the best baseline on that metric, a 13.0% improvement. On Foursquare, MAP is 0.0909 against 0.0823 for Fossil, which is 10.4% higher. On Tmall, MAP is 0.0310 against 0.0256 for Fossil, which is 21.1% higher.

On Gowalla, Foursquare and Tmall, Caser has the highest value in every metric row. Caser's MAP on MovieLens is 0.1507, which is 4.7% above GRU4Rec's 0.1440.

The authors attribute GRU4Rec's MovieLens result to that data set having more sequential signal, and they suggest that GRU4Rec gets biased on the three sparser sets. They also note that GRU4Rec is session-based rather than personalized, which enlarges its generalization error to some extent. Among the baselines, sequential methods usually beat the non-sequential BPR, and FPMC and Fossil outperform FMC on all data sets.

## Contribution of each component

Three components are switched on or off: the horizontal output o, the vertical output o-tilde, and the personalization term P\_u, with a disabled component set to zero. Caser-vh sets P\_u to zeros and Caser-pv sets o to zeros, while p denotes personalization only, which is similar to BPR and uses LFM alone.

On MovieLens, MAP is 0.0935 for Caser-p, 0.1304 for Caser-h, 0.1403 for Caser-v and 0.1448 for Caser-vh. On Gowalla, Caser-p has MAP 0.0777, the lowest value in that column. Adding either convolutional layer to personalization raises MAP on both data sets.

The full Caser-pvh has the highest MAP on both data sets, 0.1507 on MovieLens and 0.0928 on Gowalla. On MovieLens Caser-pv reaches 0.1494, close to the full model. The authors read the gap to Caser-p as evidence that treating the task as conventional top-N recommendation loses useful information. The table gives a single MAP value for each variant, and the text says the other two data sets show similar results.

## Markov order and target number

L and T were varied one at a time, with the other hyperparameters held at their optimal values. Caser-1, Caser-2 and Caser-3 use T = 1, 2 and 3, which isolates the effect of skip behaviours.

On the dense MovieLens, Caser makes better use of a larger L, and Caser-3 performs best there. The authors read this as a benefit of skip steps.

On the three sparser data sets, the models do not consistently gain from a larger L. The authors explain that a higher-order chain on sparse data adds both information and noise. Caser-2 slightly outperforms the other compared models on those three data sets in most cases.

## Latent dimensionality

On MovieLens a larger d does not always raise MAP, and models overfit at larger d. On the three sparser data sets each model needs more latent dimensions to reach its best MAP. Caser beats the strongest baseline with a comparatively small number of latent dimensions.

## What the learned filters capture

The vertical filters were inspected on MovieLens with L = 9. The four filters differ from one another, but across positions their weights rise from past items to recent items. The authors read this as Caser placing more emphasis on recent actions.

For a user with five previous movies, the top three recommendations are Mad Max, Star War and Star Trek, and Star Trek is the true next movie. Masking items by setting their embeddings to zero, masking S1 and S2 together moves the true item from rank 3 to rank 2. Masking S3 alone gives rank 32, S4 alone gives rank 117 and S5 alone gives rank 77.

Masking S3, S4 and S5 together gives rank 513, and the authors read this as the model using {S3, S4, S5} as a union-level feature. This is a single user with one trained model.

## Limitations

On the three sparser data sets, larger Markov orders did not consistently improve MAP. On MovieLens, Caser does not lead every metric, since GRU4Rec is higher on Prec@1 and Recall@1.

Four data sets are used, and the Amazon data was excluded because of its low sequential intensity. Cold-start users and items were removed before the experiments.

Training times are reported for one 4-core i7 CPU with 32GB RAM, and the authors say GPU use could reduce them, but no GPU timing is given. The hyperparameter search covered only the grid described in the experiment setup.

The filter case studies rest on one user and one trained model on MovieLens.

## Paper info

- **Authors**: Tang, Jiaxi, Wang, Ke
- **Venue**: arXiv · Preprint
- **First published**: 2018-9-19
- **Added**: 2026-11-12
- **Updated**: 2018-9-19
- **Version**: v1
- **arXiv**: 1809.07426
- **Category**: cs.IR · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1809.07426v1) · [PDF ↗](https://arxiv.org/pdf/1809.07426v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Tang, Jiaxi, Wang, Ke (2018). Personalized Top-N Sequential Recommendation via Convolutional Sequence Embedding. arXiv:1809.07426v1. https://arxiv.org/abs/1809.07426v1

**BibTeX**

```
@misc{jiaxi2018personalized,
  title = {{Personalized Top-N Sequential Recommendation via Convolutional Sequence Embedding}},
  author = {Tang, Jiaxi and Wang, Ke},
  year = {2018},
  eprint = {1809.07426},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1809.07426v1}
}
```

## Other paper commentary

- [Deep Learning based Recommender System: A Survey and New Perspectives](https://refivu.com/en/papers/a0b4c642-cc6f-408f-8e70-b8aaebc9c4da-deep-learning-based-recommender-system-a-survey-and.md)
- [Beyond Part Models: Person Retrieval with Refined Part Pooling (and a Strong Convolutional Baseline)](https://refivu.com/en/papers/0d7a16fd-c14e-49e6-938f-2cdeb51ea5a4-beyond-part-models-person-retrieval-with-refined-part.md)
- [A Contextual-Bandit Approach to Personalized News Article Recommendation](https://refivu.com/en/papers/8024ed96-4fed-4baf-950b-7340e29feb0a-a-contextual-bandit-approach-to-personalized-news-article.md)
- [Empirical Analysis of Predictive Algorithms for Collaborative Filtering](https://refivu.com/en/papers/bc628fe8-827d-4576-8126-05c09f333880-empirical-analysis-of-predictive-algorithms-for.md)
- [BPR: Bayesian Personalized Ranking from Implicit Feedback](https://refivu.com/en/papers/e3d177de-9c9b-45b7-bcb5-9ef28bee1dbb-bpr-bayesian-personalized-ranking-from-implicit-feedback.md)
- [Machine Learning in Automated Text Categorization](https://refivu.com/en/papers/f3ed4c42-7556-47e0-bc36-a9acdd9bf6d0-machine-learning-in-automated-text-categorization.md)
- [TSM: Temporal Shift Module for Efficient Video Understanding](https://refivu.com/en/papers/e7e3764b-d00b-4555-9a23-62f113a3fdfe-tsm-temporal-shift-module-for-efficient-video-understanding.md)
- [Deep metric learning using Triplet network](https://refivu.com/en/papers/f6dd7198-0b7a-4f6a-a88a-eb7bbe1ff7ee-deep-metric-learning-using-triplet-network.md)
- [Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting](https://refivu.com/en/papers/d52df827-0d8c-42c3-97e1-3063d2cc1256-autoformer-decomposition-transformers-with-auto-correlation.md)
- [DeepSurv: Personalized Treatment Recommender System Using A Cox Proportional Hazards Deep Neural Network](https://refivu.com/en/papers/e56bf111-97b6-4d99-b702-a3e324f609b2-deepsurv-personalized-treatment-recommender-system-using-a.md)
- [Targeted Backdoor Attacks on Deep Learning Systems Using Data Poisoning](https://refivu.com/en/papers/4dc3fc3a-5207-430d-b5ed-3cc95d077c11-targeted-backdoor-attacks-on-deep-learning-systems-using.md)
- [M3-Embedding: Multi-Linguality, Multi-Functionality, Multi-Granularity Text Embeddings Through Self-Knowledge Distillation](https://refivu.com/en/papers/c3b40084-e91f-4769-ab5c-b3256a5b92f7-m3-embedding-multi-linguality-multi-functionality-multi.md)

## Terms in this paper

- [dropout](https://refivu.com/en/terms/db73f75bbdd3-dropout)
- [max pooling](https://refivu.com/en/terms/5fb6ec0ed2d6-max-pooling)
- [Mean Average Precision (MAP)](https://refivu.com/en/terms/aea689215183-mean-average-precision-map)
- [matrix factorization](https://refivu.com/en/terms/95ca022eb18f-matrix-factorization)
- [GRU4Rec](https://refivu.com/en/terms/5fc0256a0e06-gru4rec)
- [Markov chain](https://refivu.com/en/terms/d4f97a999643-markov-chain)
- [Gowalla](https://refivu.com/en/terms/bd8561340a90-gowalla)
- [POP](https://refivu.com/en/terms/580a834957ec-pop)
- [Adaptive Moment Estimation (Adam)](https://refivu.com/en/terms/efcb57380c07-adaptive-moment-estimation-adam)
- [Caser](https://refivu.com/en/terms/a83ef094027f-caser)
- [FourSquare](https://refivu.com/en/terms/290c6d024588-foursquare)
- [FPMC](https://refivu.com/en/terms/11097d9d28c8-fpmc)
- [MovieLens](https://refivu.com/en/terms/22ceb9ae94bf-movielens)
- [Recall@N](https://refivu.com/en/terms/4525d66dd34d-recall-n)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/7c1f4e3a-96df-4fe9-a8b5-6c36b294a565-personalized-top-n-sequential-recommendation-via)
