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

Vahid Azizi, Fatemeh Koochaki
6/9/2025
cs.IRcs.AIcs.CL

Official code: VahidAz/LlamaRec-LKG-RAG (1 star, MIT, last commit 2025-06-21).

Abstract

Recent advances in Large Language Models (LLMs) have driven their adoption in recommender systems through Retrieval-Augmented Generation (RAG) frameworks. However, existing RAG approaches predominantly rely on flat, similarity-based retrieval that fails to leverage the rich relational structure inherent in user-item interactions. We introduce LlamaRec-LKG-RAG, a novel single-pass, end-to-end trainable framework that integrates personalized knowledge graph context into LLM-based recommendation ranking. Our approach extends the LlamaRec architecture by incorporating a lightweight user preference module that dynamically identifies salient relation paths within a heterogeneous knowledge graph constructed from user behavior and item metadata. These personalized subgraphs are seamlessly integrated into prompts for a fine-tuned Llama-2 model, enabling efficient and interpretable recommendations through a unified inference step. Comprehensive experiments on ML-100K and Amazon Beauty datasets demonstrate consistent and significant improvements over LlamaRec across key ranking metrics (MRR, NDCG, Recall). LlamaRec-LKG-RAG demonstrates the critical value of structured reasoning in LLM-based recommendations and establishes a foundation for scalable, knowledge-aware personalization in next-generation recommender systems. Code is available at~\href{https://github.com/VahidAz/LlamaRec-LKG-RAG}{repository}.

View on arXivView PDF

Code Implementations(1)

MIT

Open-sourced code for LlamaRec-LKG-RAG

10Python, Jupyter NotebookJun 20, 20251 years agoMIT

Similar Papers

Cite this paper

@article{azizi2025llamareclkgrag,
  title  = {LlamaRec-LKG-RAG: A Single-Pass, Learnable Knowledge Graph-RAG Framework for LLM-Based Ranking},
  author = {Vahid Azizi and Fatemeh Koochaki},
  year   = {2025},
  eprint = {2506.07449},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2506.07449v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2506.07449.svg)](https://codeofpaper.com/paper/2506.07449)

Discussion