Hypergraph Enhanced Knowledge Tree Prompt Learning for Next-Basket Recommendation

Zi-Feng Mai, Jianyang Zhai, Naiqing Li, Chang-Dong Wang, Zhongjie Zeng, Ya Li, Jiaquan Chen

Abstract

Next-Basket Recommendation (NBR) aims to predict a user's future purchase set based on historical transaction sequences. Current approaches often struggle with Out-of-Vocabulary (OOV) item IDs in Pretrained Language Models (PLMs) and fail to capture complex, higher-order relationships between items within a basket. We present HEKP4NBR, a framework that bridges the gap between structured knowledge and language modeling. By utilizing Knowledge Tree Prompts (KTP) to provide semantic descriptions of items and a Hypergraph Convolutional module to model multi-item dependencies, HEKP4NBR achieves state-of-the-art performance, outperforming existing baselines by up to 38% in F1 score.

Introduction

Next-Basket Recommendation (NBR) is a critical task in e-commerce, requiring the prediction of a set of items bought simultaneously. Unlike sequential recommendation, NBR must account for non-linear relationships within baskets. This paper identifies three primary challenges: the OOV problem where PLMs cannot interpret raw item IDs, the inability of standard graphs to model higher-order (triadic or greater) dependencies, and the inherent sparsity of user-item interaction data.

Methodology: The HEKP4NBR Framework

HEKP4NBR addresses these challenges through a unified architecture that combines prompt learning with graph neural networks.

The HEKP4NBR architecture, illustrating the integration of Knowledge Tree Prompts with Hypergraph Convolutional modules.

Knowledge-Aware Prompt Learning

To leverage the reasoning power of PLMs, the recommendation task is reformulated as a "mask prediction" language task. A Masked User Prompt (MUP) describes the user's history in natural language. To resolve the OOV issue, the Knowledge Tree Prompt (KTP) extracts relevant attributes from a Knowledge Graph (KG) and converts them into descriptive sentences (e.g., "The category of Item X is Pharmacy"). This provides the PLM with the necessary semantic context to understand niche or coded item identifiers.

Multi-item Relation Encoder

Standard bipartite graphs are limited to binary relationships. HEKP4NBR employs a Hypergraph Convolutional module where hyperedges can connect multiple items, capturing complex dependencies like drug combinations in medical prescriptions. A Mixture-of-Experts (MoE) approach is used to determine item similarity across various latent aspects before constructing the hypergraph.

Frequency-Based Gating

To account for the high rate of repurchases in NBR, a gating mechanism incorporates item interaction frequency, allowing the model to balance novel recommendations with established user habits.

Experimental Evaluation

The model was evaluated on two distinct real-world datasets: Poultry (dense B2B wholesale data) and Pharmacy (sparse B2C medical data).

Performance Comparison

HEKP4NBR demonstrated significant improvements over traditional sequential models (GRU4Rec, SASRec) and PLM-based models (P5).

Performance comparison of HEKP4NBR against state-of-the-art baselines on Poultry and Pharmacy datasets.

On the Pharmacy dataset, HEKP4NBR achieved a 38.57% improvement in F1@5 and a 30.70% improvement in NDCG@5 over the strongest baseline. The model also showed superior convergence properties, reaching stability in approximately 100 epochs compared to 300 for the P5 baseline.

Ablation Study and Insights

Ablation tests confirmed the necessity of each component. Removing the Knowledge Tree Prompt (KTP) resulted in a performance drop of approximately 20% on the Poultry dataset, highlighting the importance of semantic grounding for item IDs. Furthermore, the hypergraph module proved particularly effective in the Pharmacy domain, where multi-drug interactions are prevalent.

Conclusion

HEKP4NBR successfully integrates the semantic depth of PLMs with the structural precision of Knowledge Graphs and Hypergraphs. While constrained by PLM token limits and the need for high-quality KGs, the framework sets a new benchmark for NBR by effectively "explaining" items to language models and capturing higher-order behavioral patterns. Future work will focus on automated KG construction and parameter-efficient fine-tuning for larger LLMs.

Summary updated

BibTeX
@inproceedings{mai2023hypergraph,
  author = {Zi-Feng Mai and Jianyang Zhai and Naiqing Li and Chang-Dong Wang and Zhongjie Zeng and Ya Li and Jiaquan Chen},
  title = {{Hypergraph Enhanced Knowledge Tree Prompt Learning for Next-Basket Recommendation}},
  booktitle = {DASFAA},
  year = {2023},
}
Figure