Knowledge-enhanced Session-based Recommendation with Temporal Transformer

Rongzhi Zhang, Yulong Gu, Xiaoyu Shen, Hui SuarXiv 2021

Abstract

Session-based recommendation (SBR) aims to predict a user's next action based on a sequence of interactions. Traditional models often overlook rich item metadata and the precise temporal dynamics between actions. This paper introduces KSTT (Knowledge-enhanced Session-based Recommendation with Temporal Transformer), a framework that integrates item attributes via a Knowledge Graph and captures exact time intervals using a Temporal Transformer. By replacing standard position embeddings with time-aware embeddings and leveraging semantic item relationships, KSTT achieves state-of-the-art performance on major benchmarks.

Introduction

Session-based recommendation systems are critical for platforms where user profiles are unavailable or sessions are short. While existing models capture sequential dependencies, they typically treat items as isolated entities and rely on coarse positional information. KSTT addresses these limitations by incorporating item metadata (e.g., brand, category) and modeling the specific time elapsed between user clicks, which often signals varying levels of intent.

Methods

The KSTT framework consists of two core components: a Knowledge-enhanced Item Encoder and a Temporal Transformer Session Encoder.

Architecture of the KSTT framework, showing the Knowledge-enhanced Item Encoder and the Temporal Transformer Session Encoder.

1. Knowledge-enhanced Item Encoder

Instead of simple embedding lookups, KSTT builds a Knowledge Graph (KG) where nodes represent items and their attributes (e.g., brand, category). It uses TransR for embedding learning and a Graph Neural Network (GNN) to aggregate contextual information from neighbors. This ensures that an item's representation is "aware" of its global context and semantic attributes, which is particularly useful for sparse data.

2. Temporal Transformer (Session Encoder)

The authors modify the standard Transformer architecture to handle time more effectively. They replace classic position embeddings with a Time Encoder that calculates the time interval between each click and the prediction point. Among various techniques—including Time2vec and Mercer time embedding—Time Bucket Embedding (TBE) proved most effective at capturing non-linear temporal patterns in user behavior.

Datasets

The model was evaluated on four widely used recommendation benchmarks:

  • Yoochoose (1/64 and 1/4 splits): E-commerce click-stream data from the RecSys Challenge 2015.
  • Diginetica: Transaction data containing product metadata from the CIKM Cup 2016.
  • Last-fm: A music dataset used for artist recommendation.

Key Insights and Ideas

  • Knowledge is Power: Ablation studies showed that the Knowledge Graph module (KGNN) provided a larger performance boost on datasets with richer attribute data (like Diginetica), proving the model successfully harvests metadata to improve predictions.
  • Time Intervals > Sequence Order: Replacing position embeddings with time-interval embeddings consistently improved results. This suggests that the velocity of user actions is a stronger signal of intent than just the numerical order of clicks.
  • Simplicity in Time Encoding: Interestingly, the simplest time encoding method—Time Bucket Embedding (TBE)—outperformed more complex mathematical functions. This suggests that coarse-grained "buckets" of time are more robust for recommendation tasks.

Key Results

KSTT outperformed all baselines, including popular models like SR-GNN and GC-SAN, across all four datasets on both Recall and Mean Reciprocal Rank (MRR) metrics.

Performance comparison of KSTT against various baselines on four benchmark datasets.

On the Yoochoose 1/64 dataset, KSTT achieved a Recall@20 of 72.25 and an MRR@20 of 31.05, representing a significant improvement over the baseline SR-GNN. The study confirmed that both the KGNN and the Temporal Transformer contribute independently to the performance, with their combination yielding the best results.

Limitations and Future Work

While KSTT sets new performance standards, the computational overhead of maintaining and updating a large-scale Knowledge Graph in real-time production environments remains a challenge. Additionally, the model's effectiveness is dependent on the quality of metadata; in "cold-start" scenarios with missing attributes, the KGNN's impact might diminish. Future directions include exploring more diverse time patterns and complex graph structures to further refine session representations.

Summary updated

BibTeX
@misc{zhang2021knowledge,
  author = {Rongzhi Zhang and Yulong Gu and Xiaoyu Shen and Hui Su},
  title = {{Knowledge-enhanced Session-based Recommendation with Temporal Transformer}},
  year = {2021},
  eprint = {2112.08745},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2112.08745},
}
Figure