NeighCF: Neighborhood-aware Collaborative Filtering for LLM-based Sequential Recommendation

Authors:

Abstract
Recently, Large Language Models (LLMs) have shown strong promise in recommendation tasks by leveraging semantic reasoning and external knowledge. As inputs to LLMs, prompts play a crucial role in guiding LLMs to generate outputs that align with task-specific requirements. However, existing prompting strategies primarily rely on a user’s individual history, overlooking collaborative signals that capture broader behavioral patterns. While recent works attempt to incorporate neighbors’ histories, they face two key challenges: (i) fixed-size neighbor selection, which either underutilizes sparse contexts or overloads dense ones with redundancy; and (ii) computationally expensive global neighbor retrieval, which is impractical for large-scale systems. Specifically, NeighCF (i) employs a cluster-aware retrieval strategy that restricts neighbor search to candidate-relevant subspaces, reducing the cost of global retrieval while maintaining high recall; and (ii) introduces an adaptive neighbor selection mechanism based on a learnable threshold that dynamically adjusts the number of neighbors according to interaction density and candidate relevance. The resulting neighbor representations are integrated into prompts for LLM-based reasoning. Extensive experiments on various datasets demonstrate that NeighCF consistently outperforms both single-user prompting baselines and state-of-the-art collaborative prompting approaches. These results validate the effectiveness and efficiency of our framework, highlighting collaborative reasoning in LLM-based sequential recommendation.