XRec: Large Language Models for Explainable Recommendation

Qiyao Ma, Xubin Ren, Chao Huang

Abstract

Recommender systems help users navigate information overload by providing personalized recommendations aligned with their preferences. Collaborative Filtering (CF) is a widely adopted approach, but while advanced techniques like graph neural networks (GNNs) and self-supervised learning (SSL) have enhanced CF models for better user representations, they often lack the ability to provide explanations for the recommended items. Explainable recommendations aim to address this gap by offering transparency and insights into the recommendation decision-making process, enhancing users’ understanding. This work leverages the language capabilities of Large Language Models (LLMs) to push the boundaries of explainable recommender systems. We introduce a model-agnostic framework called XRec, which enables LLMs to provide comprehensive explanations for user behaviors in recommender systems. By integrating collaborative signals and designing a lightweight collaborative adaptor, the framework empowers LLMs to understand complex patterns in user-item interactions and gain a deeper understanding of user preferences. Our extensive experiments demonstrate the effectiveness of XRec, showcasing its ability to generate comprehensive and meaningful explanations that outperform baseline approaches in explainable recommender systems.

Introduction

Modern recommender systems, particularly those utilizing Graph Neural Networks (GNNs) and Collaborative Filtering (CF), excel at predicting user preferences but often function as "black boxes." They lack the transparency required to explain why a specific item is recommended. While Large Language Models (LLMs) possess the linguistic prowess to generate explanations, they face two primary challenges in this context: the semantic gap, where LLMs struggle to interpret non-textual collaborative signals, and information dilution, where critical user/item embeddings can be lost within long textual prompts as the context grows.

XRec addresses these challenges by treating graph-based collaborative relationships as distinct tokens and injecting them directly into the LLM's internal architecture, ensuring that personalized context remains central to the generation process.

Methodology

The XRec framework integrates collaborative signals into a frozen LLM through three primary components:

  1. Collaborative Relation Tokenizer: Utilizing LightGCN, the system processes user-item interaction graphs to generate embeddings that capture high-order collaborative relationships (e.g., "Users who liked X also liked Y").
  2. Collaborative Information Adapter: A Mixture of Experts (MoE) module aligns these graph embeddings with the LLM’s word-embedding space. Multiple linear "experts" capture diverse semantic dimensions of user behavior, which are then combined via a learnable gating mechanism.
  3. Layer-wise Injection: To combat information dilution, XRec injects the adapted embeddings into the Query (Q), Key (K), and Value (V) projections of every layer in the LLM (specifically LLaMA2-7B). This ensures the collaborative signal persists throughout the model's reasoning process.
The XRec architecture integrates graph-based collaborative signals into a frozen LLM via a lightweight MoE adapter and layer-wise injection.

By keeping the LLM frozen and only training the lightweight adapter and GNN tokenizer, XRec maintains computational efficiency while leveraging the model's pre-trained knowledge.

Experimental Results

XRec was evaluated on three large-scale datasets: Amazon-books, Yelp, and Google-reviews. Ground-truth explanations were distilled from raw user reviews using LLMs to ensure high-quality training data focused on user intent rather than subjective noise.

The framework demonstrated superior performance against state-of-the-art baselines like PETER and PEPLER. Notably, XRec achieved a Unique Sentence Ratio (USR) near 1.0, indicating highly personalized explanations rather than generic templates. Ablation studies highlight the importance of both profile generation and collaborative signal injection in achieving high semantic alignment, as measured by GPTScore and BERTScore.

Ablation study results on Amazon-books and Google-reviews datasets, demonstrating the impact of profile and injection components on performance metrics.

XRec also exhibited significant robustness in "cold-start" scenarios, where it outperformed traditional models by effectively mapping graph structures to natural language for users not seen during training.

Conclusion and Future Work

XRec successfully bridges the gap between collaborative filtering and natural language generation, providing a model-agnostic framework for explainable recommendations. While currently limited to text and graph data, future iterations aim to incorporate multimodal inputs, such as images and video, to further enrich the generated explanations with visual preferences.

Summary updated

BibTeX
@inproceedings{ma2024xrec,
  author = {Qiyao Ma and Xubin Ren and Chao Huang},
  title = {{XRec: Large Language Models for Explainable Recommendation}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2024},
  url = {https://openreview.net/forum?id=r9hwWpEMJk},
}
Figure