XRec: LLM-based Explainable Recommendation
- XRec is a model-agnostic explainable recommendation framework that integrates collaborative filtering with LLM-generated natural language explanations.
- It employs a graph-based tokenizer (LightGCN) and a lightweight Mixture-of-Experts adapter to align user-item embeddings with LLM semantic space.
- Evaluations on datasets like Amazon-books and Yelp show improved explanation quality and stability, outperforming several baseline methods.
Searching arXiv for XRec and related explainable recommendation papers. arXiv_search query: "XRec explainable recommendation LLMs" XRec is a model-agnostic framework for explainable recommendation that leverages the language capabilities of LLMs to provide comprehensive explanations for user behaviors in recommender systems by integrating collaborative signals through a lightweight collaborative adaptor (Ma et al., 2024). In its reported formulation, XRec combines a graph-based “tokenizer” based on LightGCN, a lightweight Mixture-of-Experts (MoE) adapter that aligns collaborative embeddings with the LLM’s semantic space, and an instruction-tuned LLM, specifically LLaMA2-7B, for natural-language explanation generation (Ma et al., 2024). The framework targets a longstanding limitation of collaborative filtering (CF): although graph neural networks (GNNs) and self-supervised learning (SSL) improve user representations, they often do not explain why an item was recommended.
1. Problem formulation and design rationale
Explainable recommendation seeks to offer transparency and insights into recommendation decision-making, thereby enhancing users’ understanding of recommended items (Ma et al., 2024). XRec addresses this objective in settings where standard CF methods can model user–item interactions effectively but do not natively produce explanations.
The central design premise is to endow an LLM with behavior-aware collaborative information rather than relying only on textual profiles. In XRec, the collaborative side is derived from an interaction matrix
where if user interacted with item (Ma et al., 2024). LightGCN operates over this interaction structure and produces user embeddings and item embeddings (Ma et al., 2024). These embeddings are then adapted to the LLM by a dedicated collaborative module rather than being used only for ranking.
This arrangement makes XRec modular. The graph encoder supplies high-order collaborative signals, the adapter performs alignment into the LLM token space, and the LLM converts the resulting conditioned representation into free-form explanatory text (Ma et al., 2024). A plausible implication is that the framework separates collaborative representation learning from linguistic realization while still coupling them tightly at inference time.
2. Architecture and collaborative signal injection
XRec comprises three named components: a Collaborative Relation Tokenizer, a Collaborative Information Adapter, and an LLM with Injection Head (Ma et al., 2024). The tokenizer is the GNN backbone, implemented with LightGCN, and produces and . The adapter receives their concatenation,
and transforms it with an MoE into adapted vectors aligned with the LLM (Ma et al., 2024).
One formulation of the adapter is
with 0 experts 1 and a gating network (Ma et al., 2024). In the reproducibility study, this adapter is described as the core mechanism that “instruction-tunes” the LLM to reflect both semantic content and collaborative relations (Mishra et al., 6 Oct 2025).
The LLM interface uses special tokens 2USER_EMBED3 and 4ITEM_EMBED5. Their embeddings are replaced by adapted user and item vectors, and the same collaborative signal is also injected into every Transformer layer through the key, query, and value projections: 6 This means that collaborative information is not confined to the prompt prefix; it affects the internal attention computation layer by layer (Ma et al., 2024).
The later reproducibility study further isolates the role of this mechanism. Removing the adapted-embedding injection caused the LLM to revert to free-form or conversational generations such as “Sure! Here’s why…,” whereas retaining injection preserved more regular explanation structures such as “The user would enjoy…” or “The user would buy…” (Mishra et al., 6 Oct 2025). This suggests that the adapter acts not only as a content conditioner but also as a stabilizing structural prior.
3. Joint optimization and explanation generation
XRec jointly optimizes collaborative filtering and language modeling. Its total objective is
7
with 8 in practice (Ma et al., 2024).
The CF term is a Bayesian Personalized Ranking objective with embedding regularization: 9 where 0 (Ma et al., 2024). The explanation-generation term is a negative log-likelihood over explanation tokens: 1 Thus, XRec does not treat ranking and explanation as entirely separate pipelines; it trains them together (Ma et al., 2024).
The prompt template is structured as
2
(Ma et al., 2024). During tokenization, the two special embedding tokens are mapped to the adapted user and item vectors, and the LLM continues generation from 3EXPLAIN_POS4 (Ma et al., 2024).
The intended effect is that collaborative signals bias the LLM toward aspects consistent with inferred user preferences and salient item attributes. The paper gives the example: “This brewery was recommended because you enjoy cozy atmospheres and a broad selection of craft beers, as shown in your past visits.” (Ma et al., 2024) That example is illustrative of the framework’s target behavior: grounding the explanation in both latent interaction history and item semantics.
4. Experimental protocol and reported performance
XRec is evaluated on three datasets with train/validation/test splits and early stopping on Recall@20 (Ma et al., 2024).
| Dataset | Users / Items | Interactions |
|---|---|---|
| Amazon-books | 15,349 / 15,247 | 360,839 |
| Yelp | 15,942 / 14,085 | 393,680 |
| Google-reviews | 22,582 / 16,557 | 411,840 |
The reported baselines are Att2Seq, NRT, PETER, and PEPLER in its continuous-prompt variant (Ma et al., 2024). Evaluation covers explanation quality and stability through GPTScore, BERTScore precision/recall/5, BARTScore, BLEURT, and USR, with stability measured by the standard deviation of each score across examples (Ma et al., 2024).
On Amazon-books, XRec reports GPTScore 6, compared with 7 for the next-best PEPLER, along with BERTScore-8 and USR 9 (Ma et al., 2024). The paper states that similar gains are observed on Yelp and Google-reviews (Ma et al., 2024). These results support the paper’s claim that collaborative conditioning improves the semantic alignment and diversity of generated explanations.
Subsequent systems position XRec as a baseline or precursor. Curr-RLCER evaluates against XRec among other explainable recommendation systems and frames its contribution around coherence between predicted ratings and explanations (Pan et al., 7 Apr 2026). REXHA, working on Amazon-books, Yelp, and Google-reviews, targets profile deviation and retrieval overhead in existing LLM-based explainable recommendation models (Sun et al., 12 Jul 2025). RGCF-XRec extends the line to explainable sequential recommendation in a single step, reporting improvements in both recommendation metrics and explanation metrics on Amazon Sports, Toys, and Beauty (Anwaar et al., 5 Feb 2026).
5. Ablations, robustness, and known limitations
The ablation study reported for XRec shows that removing user or item profiles or disabling injection degrades GPTScore by 3–5 points and increases instability (Ma et al., 2024). The full model, labeled “Ours,” achieves the best combination of explainability and low standard deviation (Ma et al., 2024). This identifies the textual side and the collaborative-injection side as complementary rather than interchangeable components.
The robustness analysis reports that performance remains stable across users with very few to very many interactions, and that in a zero-shot setting with completely unseen users, XRec still outperforms baselines (Ma et al., 2024). A plausible implication is that the collaborative adapter is not only exploiting dense interaction histories but also transferring structural biases that remain useful under sparsity.
The paper also states two explicit limitations. First, only textual and graph-based data are used; visual modalities such as images and videos are not incorporated (Ma et al., 2024). Second, the LLM parameters are frozen and only the adapter is trained (Ma et al., 2024). The future directions named by the authors are correspondingly to integrate multimodal signals into the collaborative adapter, jointly fine-tune portions of the LLM, and explore online adaptation for evolving user preferences (Ma et al., 2024).
6. Reproducibility, extensions, and position within the field
A dedicated reproducibility study rebuilt XRec using the released codebase and replaced GPT-3.5-turbo with Llama 3 for evaluation (Mishra et al., 6 Oct 2025). That study concludes that XRec effectively generates personalized explanations and that its stability is improved by incorporating collaborative information, but it also reports that XRec did not consistently outperform all baseline models in every metric (Mishra et al., 6 Oct 2025). This is an important qualification: the original paper presents strong aggregate gains, whereas the reproduction indicates that evaluator choice, backbone choice, and variance materially affect absolute outcomes.
The same study performs targeted ablations of the MoE adapter. It reports that removing or fixing the embeddings degrades scores by up to approximately 10 points in LlamaScore and raises standard deviations by 25–40%, while collaborative embeddings anchor explanation structure and reduce variability (Mishra et al., 6 Oct 2025). In that account, the MoE is not merely an alignment device; it materially shapes explanation form.
Later work extends or reorients the XRec design space. RGCF-XRec introduces reasoning-guided collaborative filtering knowledge into a LLM for explainable sequential recommendation in a single step, adds four-dimensional Chain-of-Thought scoring, and uses a lightweight LLaMA 3.2-3B backbone with LoRA and projection MLPs (Anwaar et al., 5 Feb 2026). REXHA moves toward retrieval-augmented explanation generation with hierarchical aggregation of all user and item reviews and a GPU-accelerated Faiss retrieval index, explicitly addressing profile deviation and retrieval latency (Sun et al., 12 Jul 2025). Curr-RLCER shifts emphasis to coherence between generated explanations and predicted ratings through a three-stage curriculum reinforcement learning pipeline and a coherence-driven reward (Pan et al., 7 Apr 2026).
Taken together, these developments place XRec at an identifiable transition point in explainable recommendation research: from earlier joint text-generation baselines such as Att2Seq, NRT, PETER, and PEPLER toward LLM-based systems that explicitly fuse collaborative structure with generation (Ma et al., 2024). The later literature suggests two broad trajectories outward from XRec’s original formulation: richer conditioning mechanisms, including reasoning traces and retrieval, and stronger alignment objectives, especially around stability, coherence, and cold-start generalization (Anwaar et al., 5 Feb 2026).