Harnessing Large Language Models for Text-Rich Sequential Recommendation

Zhi Zheng, Wenshuo Chao, Zhaopeng Qiu, Hengshu Zhu, Hui Xiong

Introduction

Sequential recommendation systems are designed to predict a user's future interactions by analyzing their historical behavior. However, as items become increasingly "text-rich"—incorporating detailed product descriptions or news headlines—traditional Large Language Models (LLMs) encounter significant bottlenecks. These include context window limitations, the $O(n^2)$ computational complexity of the Transformer architecture, and the "lost in the middle" phenomenon where models struggle to extract relevant signals from dense, long-form text.

To address these challenges, this paper introduces LLM-TRSR, a framework that leverages LLM-based summarization to compress extensive user histories into concise preference profiles. By mimicking classical neural architectures in the prompting stage, LLM-TRSR maintains high recommendation accuracy while significantly reducing computational overhead.

The LLM-TRSR Framework

The LLM-TRSR architecture operates in two distinct stages: summarization and recommendation.

Overview of the LLM-TRSR framework, illustrating the two-stage process of summarization and recommendation.

Summarization Paradigms

The first stage utilizes a frozen, high-capacity LLM (such as Llama-30b-instruct) to distill raw user history into a "Preference Summary." The framework introduces two novel prompting strategies inspired by traditional neural networks:

  • Hierarchical Summarization (CNN-inspired): User history is partitioned into blocks. Each block is summarized independently, and these intermediate summaries are then aggregated into a final global profile. This approach is particularly effective for capturing broad, topical interests.
  • Recurrent Summarization (RNN-inspired): The model processes history sequentially, using the summary of the previous block as context for the next. This iterative update mechanism is superior for tracking evolving user preferences over time.

Fine-Tuning for Recommendation

In the second stage, the generated summary is combined with a small number of recent interactions to form a recommendation prompt. This prompt is processed by a smaller LLM (e.g., Llama-2-7b) that has been fine-tuned using Low-Rank Adaptation (LoRA). This allows the model to specialize in the binary task of predicting user engagement ("Yes" or "No") without the prohibitive cost of full-parameter retraining.

Experimental Evaluation

The framework was evaluated on two text-heavy datasets: Amazon-M2 (e-commerce) and MIND (news). The study focused on users with 10 to 25 interactions to test the models' ability to handle rich textual context.

Key Findings

LLM-TRSR consistently outperformed state-of-the-art baselines, including SASRec and TALLRec. A critical insight from the ablation studies was the identification of the "Goldilocks" history length.

Impact of the number of historical items included in the prompt on Recall@3 and MRR@3.

As shown in the performance metrics, including exactly three recent items alongside the preference summary yielded optimal results. Including fewer items failed to provide sufficient immediate context, while including more introduced noise that obscured the long-term summary's signal. Furthermore, the choice of summarization strategy proved domain-dependent: Recurrent summarization excelled in the "journey-based" shopping domain of Amazon, while Hierarchical summarization was more effective for the topical nature of news in MIND.

Conclusion

LLM-TRSR demonstrates that structuring LLM prompts through architectural mimicry (CNN/RNN) effectively bypasses the physical limits of context windows. By separating the high-cost summarization of long-term history from the task-specific recommendation logic, the framework enables efficient, high-performance sequential recommendation on text-rich datasets. Future work will explore extending this methodology to multi-modal data and further optimizing prompt token efficiency.

Summary updated

BibTeX
@inproceedings{zheng2024harnessing,
  author = {Zhi Zheng and Wenshuo Chao and Zhaopeng Qiu and Hengshu Zhu and Hui Xiong},
  title = {{Harnessing Large Language Models for Text-Rich Sequential Recommendation}},
  booktitle = {The Web Conference},
  year = {2024},
}
Figure