LlamaRec: Two-Stage Recommendation using Large Language Models for Ranking

Zhenrui Yue, Sara Rabhi, Gabriel de Souza Pereira Moreira, Dong Wang, Even Oldridge
10/25/2023
cs.IRcs.AIcs.CL

No official code found. Best implementation: Yueeeeeeee/LlamaRec (173 stars, last commit 2024-04-25).

Abstract

Recently, large language models (LLMs) have exhibited significant progress in language understanding and generation. By leveraging textual features, customized LLMs are also applied for recommendation and demonstrate improvements across diverse recommendation scenarios. Yet the majority of existing methods perform training-free recommendation that heavily relies on pretrained knowledge (e.g., movie recommendation). In addition, inference on LLMs is slow due to autoregressive generation, rendering existing methods less effective for real-time recommendation. As such, we propose a two-stage framework using large language models for ranking-based recommendation (LlamaRec). In particular, we use small-scale sequential recommenders to retrieve candidates based on the user interaction history. Then, both history and retrieved items are fed to the LLM in text via a carefully designed prompt template. Instead of generating next-item titles, we adopt a verbalizer-based approach that transforms output logits into probability distributions over the candidate items. Therefore, the proposed LlamaRec can efficiently rank items without generating long text. To validate the effectiveness of the proposed framework, we compare against state-of-the-art baseline methods on benchmark datasets. Our experimental results demonstrate the performance of LlamaRec, which consistently achieves superior performance in both recommendation performance and efficiency.

View on arXivView PDF

Code Implementations(1)

Yueeeeeeee/LlamaRecCommunity100%

[PGAI@CIKM 2023] PyTorch Implementation of LlamaRec: Two-Stage Recommendation using Large Language Models for Ranking

17331PythonOct 23, 20232 years ago

Similar Papers

Cite this paper

@article{yue2023llamarec,
  title  = {LlamaRec: Two-Stage Recommendation using Large Language Models for Ranking},
  author = {Zhenrui Yue and Sara Rabhi and Gabriel de Souza Pereira Moreira and Dong Wang and Even Oldridge},
  year   = {2023},
  eprint = {2311.02089},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2311.02089v1}
}

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/2311.02089.svg)](https://codeofpaper.com/paper/2311.02089)

Discussion