RecRanker: Instruction Tuning Large Language Model as Ranker for Top-k Recommendation

Sichun Luo, Bowei He, Haohan Zhao, Wei Shao, Yanlin Qi, Yinya Huang, Aojun Zhou, Yuxuan Yao, Zongpeng Li, Yuanzhang Xiao, Mingjie Zhan, Linqi Song

TL;DR

RecRanker is a new framework that transforms Large Language Models (LLMs) into high-performance recommendation rankers through specialized instruction tuning. By using "adaptive sampling" to curate high-quality training data and ensembling multiple ranking strategies (pointwise, pairwise, and listwise), RecRanker significantly outperforms both traditional recommendation models and even powerhouse models like GPT-4 in top-k recommendation tasks.

What Problem Does This Paper Address?

While LLMs have shown flashes of brilliance in recommendation tasks, they aren't naturally "aligned" with the specific goals of a recommender system. Most existing approaches use LLMs as zero-shot rankers or tune them on low-quality, randomly sampled data. This leads to three major headaches:

  1. Data Quality: Randomly sampling user interactions often misses the "representative" users who provide the best signals for learning.
  2. Signal Silos: LLMs usually only look at text, ignoring the powerful collaborative filtering signals (like "users who liked X also liked Y") that traditional models excel at.
  3. Inconsistency: An LLM might give different ranking results depending on whether you ask it to rate items one by one (pointwise) or rank a whole list (listwise). It also suffers from position bias, often favoring items just because they appear first in a prompt.

RecRanker aims to bridge the gap between the reasoning power of LLMs and the specialized accuracy of traditional recommender systems.

Methods

The authors propose a multi-stage pipeline to turn a base LLM (like LLaMA-2) into a RecRanker.

1. Adaptive User Sampling

Instead of picking users at random, RecRanker uses three strategies to build a diverse, high-quality training set:

  • Importance-aware sampling: Prioritizes users with more interactions (more data = more reliable preferences).
  • Clustering-based sampling: Groups users by interest to ensure the model sees a broad spectrum of behaviors.
  • Repetition penalty: Prevents the model from over-fitting to a few "power users."

2. Prompt Engineering & Enhancement

To make the prompts more robust, the authors introduced:

  • Position Shifting: Randomly shuffling the order of items in the prompt to force the LLM to focus on content rather than position.
  • Auxiliary Signals: They literally tell the LLM what other models think. By including hints like "another recommendation model indicates item X is preferred," the LLM can synergize its linguistic reasoning with traditional collaborative filtering data.
Fig. 2. (i). The overall training pipeline of RecRanker. (ii). Adaptive user sampling module, where we propose importance-aware sampling, clustering-based, and penalty for repetitive sampling to sample users. For each sampled user, corresponding candidate items are randomly selected from the items the user liked, disliked, and had no interaction with. (iii). Prompt construction, where we incorporate position shifting and prompt enhancement strategies to enhance the model performance.

3. Hybrid Ranking Ensemble

This is the "secret sauce." During inference, RecRanker doesn't just pick one way to rank. It calculates scores using three different methods:

  • Pointwise: Rating each item individually.
  • Pairwise: Comparing items in pairs.
  • Listwise: Ranking the entire set at once.

It then combines these into a Hybrid Score. This leverages the concept of "self-consistency"—if multiple ranking perspectives agree that an item is good, it’s likely a winner.

Datasets

The framework was evaluated on three widely-used benchmarks:

  • MovieLens 100K (ML-100K)
  • MovieLens 1M (ML-1M)
  • BookCrossing (using a 10-core setting to ensure data quality).

The authors used standard metrics: Hit Ratio (HR) and Normalized Discounted Cumulative Gain (NDCG) at $k=3$ and $k=5$.

Key Insights and Ideas

  • LLMs are "Coachable": The most striking finding is that LLMs perform better when they are given "hints" from traditional models. They aren't just replacing old models; they are acting as a sophisticated "judge" that weighs traditional signals against textual context.
  • Simplicity Wins in Pointwise Tasks: The authors noted that LLMs are surprisingly good at pointwise tasks (rating 1-5), likely because it's a simpler cognitive load than comparing ten items at once.
  • Ensembling for Stability: The hybrid approach consistently beat any single ranking method. This suggests that LLM "hallucinations" or inconsistencies in one ranking format can be smoothed out by looking at the task from other angles.

Key Results

RecRanker demonstrated significant superiority over "backbone" models (like LightGCN and SASRec):

  • Massive Gains: On the BookCrossing dataset, RecRanker improved the NDCG@3 of a Matrix Factorization (MF) backbone by a staggering 85.09%.
  • Beating the Giants: In head-to-head tests on listwise ranking, the instruction-tuned RecRanker outperformed GPT-3.5-turbo and even GPT-4. Specifically, RecRanker "won" or "tied" against GPT-4 in 64% of the test cases.
  • Scaling Matters: Moving from a 7B to a 13B parameter LLaMA-2 model provided a consistent performance boost across all ranking tasks.
Comparison of RecRanker against GPT models.

Limitations and Future Work

Despite the impressive accuracy, the "elephant in the room" is efficiency.

  • Latency: Training took ~4.6 hours on 16 A800 GPUs, and inference takes about 0.059 seconds per item. While that sounds fast, it's orders of magnitude slower than traditional models, making it difficult to deploy for real-time recommendations to millions of users.
  • Future Directions: The authors suggest model distillation (training a smaller, faster model to mimic the big LLM) and quantization as necessary next steps to make LLM-based ranking commercially viable.

For those interested in the implementation, the source code is available on GitHub.

Summary updated

BibTeX
@article{luo2023recranker,
  author = {Sichun Luo and Bowei He and Haohan Zhao and Wei Shao and Yanlin Qi and Yinya Huang and Aojun Zhou and Yuxuan Yao and Zongpeng Li and Yuanzhang Xiao and Mingjie Zhan and Linqi Song},
  title = {{RecRanker: Instruction Tuning Large Language Model as Ranker for Top-k Recommendation}},
  journal = {ACM Trans. Information Systems},
  year = {2023},
  doi = {10.1145/3705728},
}
Figure