Attention-Based Transactional Context Embedding for Next-Item Recommendation

Shoujin Wang, Liang Hu, Longbing Cao, Xiaoshui Huang, Defu Lian, Wei Liu

Introduction

Next-item recommendation in Transaction-Based Recommender Systems (TBRSs) is a critical task for e-commerce and retail. Traditional models often struggle with three primary issues: recency bias (over-weighting the last item), rigid order assumptions (assuming the sequence of adding items to a cart is fixed), and noise in long transactions (irrelevant items obscuring the user's true intent). This paper, originally presented at AAAI-18, introduces the Attention-based Transaction Embedding Model (ATEM) to address these challenges by treating a transaction as a flexible context where items possess varying degrees of relevance.

The ATEM Architecture

ATEM is designed as a shallow "wide-in-wide-out" neural network that prioritizes efficiency and interpretability. Unlike complex Recurrent Neural Networks (RNNs) that assume a strict temporal dependency, ATEM utilizes an attention mechanism to dynamically weight the importance of each item in a user's current "basket."

The ATEM architecture featuring an attention layer to weight contextual items.

The model consists of three primary components:

  1. Item Embedding Layer: Sparse one-hot encoded item identifiers are mapped into dense, lower-dimensional vectors.
  2. Attention Layer: This core innovation learns an "attention weight" for each item in the context. By using a shared context vector to query the basket, the model identifies which items are most informative for predicting the next target item.
  3. Noise Contrastive Estimation (NCE): To ensure scalability across massive item catalogs, ATEM employs NCE. This transforms the multi-class recommendation problem into a binary classification task, distinguishing the actual next item from a set of randomly sampled "noise" items.

Key Insights: Relevance Over Recency

A fundamental insight of ATEM is that the most recent item is not always the most predictive. For instance, in a grocery session, the first item (e.g., milk) might be highly relevant to a later item (e.g., cereal), even if intermediate items (like a magazine) are unrelated. By treating the context as a set rather than a sequence, ATEM remains robust even when the order of items is shuffled—a scenario where traditional sequence-based models often fail.

Experimental Results

The model was evaluated on two large-scale real-world datasets: IJCAI-15 (Tmall e-commerce) and Tafang (grocery shopping). ATEM was compared against several state-of-the-art baselines, including Markov Chain models (FPMC), metric embedding (PRME), and deep RNN-based models (GRU4Rec).

Performance comparison (REC@10 and MRR) on the IJCAI-15 dataset across varying context lengths.

As shown in the experimental results, ATEM consistently outperforms its competitors. On the IJCAI-15 dataset, ATEM achieved a Recall@10 of 0.3542, significantly higher than GRU4Rec’s 0.2283. Furthermore, the model demonstrated superior Mean Reciprocal Rank (MRR), indicating its ability to place the correct next item higher in the recommendation list. Notably, as the context length increases, the performance gap between ATEM and other models widens, highlighting the effectiveness of the attention mechanism in filtering out transactional noise.

Conclusion

ATEM provides a powerful yet computationally efficient alternative to deep sequential models for next-item recommendation. By focusing on attentive relevance rather than simple recency or order, it achieves higher accuracy and provides more novel recommendations. Future work may involve integrating item metadata to address cold-start problems and exploring inter-transaction dynamics to model long-term user behavior.

Summary updated

BibTeX
@inproceedings{wang2018attention,
  author = {Shoujin Wang and Liang Hu and Longbing Cao and Xiaoshui Huang and Defu Lian and Wei Liu},
  title = {{Attention-Based Transactional Context Embedding for Next-Item Recommendation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2018},
  doi = {10.1609/aaai.v32i1.11851},
}
Figure