LlamaRec-LKG-RAG: A Single-Pass, Learnable Knowledge Graph-RAG Framework for LLM-Based Ranking

| Source: arXiv AI

Tags: recommender systems, knowledge graphs, RAG, LlamaRec, Llama-2, personalization

LlamaRec-LKG-RAG adds a learnable knowledge graph layer to LlamaRec, extracting personalized relation paths from user-item graphs and injecting them into Llama-2 prompts — improving MRR, NDCG, and Recall over the base LlamaRec on ML-100K and Amazon Beauty in a single end-to-end trainable pass.

Details

Existing RAG-based recommender systems rely on flat similarity retrieval, losing the relational structure between users, items, and their attributes. LlamaRec-LKG-RAG addresses this by adding a lightweight user preference module that traverses a heterogeneous knowledge graph built from user behavior and item metadata, identifying the most salient relation paths for each individual user. These personalized subgraphs are injected directly into prompts for a fine-tuned Llama-2 model. The architecture is end-to-end trainable in a single inference pass — unlike two-stage systems that train retrieval and generation separately, which creates optimization misalignment. Experiments on ML-100K and Amazon Beauty show consistent improvements across key ranking metrics (MRR, NDCG, Recall) over the LlamaRec baseline. The contribution is incremental: knowledge graph augmentation for LLM-based recommendations is a well-studied area, and ML-100K is a relatively small benchmark by modern standards. The single-pass end-to-end training distinguishes the approach from prior work. For teams building recommendation systems with rich knowledge graph data, the architecture is worth examining, and code is publicly available.