Abstract
Sequential recommendation systems traditionally face a trade-off between ID-based models, which excel at capturing collaborative filtering (CF) signals but suffer from cold-start issues, and text-based models, which generalize well but often ignore latent behavioral patterns. We introduce LLM2Rec, a novel framework that transforms Large Language Models (LLMs) into high-performance embedding models for recommendation. By employing a two-stage training process—Collaborative Supervised Fine-tuning (CSFT) and Item-level Embedding Modeling (IEM)—LLM2Rec successfully bridges the gap between semantic textual understanding and behavioral patterns. Our framework achieves state-of-the-art results across diverse datasets, demonstrating superior performance in both in-domain and out-of-domain scenarios.
Introduction
In the landscape of recommender systems, two primary paradigms exist: ID-based models and text-based models. ID-based models assign unique identifiers to items, making them highly effective at picking up CF signals—the subtle patterns of user behavior (e.g., "users who liked X also liked Y"). However, these models are "content-blind" and fail in cold-start or cross-domain settings. Conversely, text-based models leverage LLMs to generate embeddings from item descriptions. While they generalize well to new domains, they are often "behavior-blind," failing to capture the latent correlations found in interaction data.
LLM2Rec addresses this challenge by building a unified embedding model that captures both rich semantics and behavioral patterns without the prohibitive compute costs of previous hybrid methods.
Methodology
The LLM2Rec framework utilizes a two-stage training approach to transition generative LLMs into discriminative embedding models.
Stage 1: Collaborative Supervised Fine-tuning (CSFT)
In this stage, the LLM is treated as a recommender. Given a user's history of item titles, the model is trained to predict the next item title autoregressively. This process "unlocks" the LLM's ability to perceive CF signals, teaching it that items like "Mario Party" and "Animal Crossing" are behaviorally related despite differing textual descriptions.
Stage 2: Item-level Embedding Modeling (IEM)
This stage refines the LLM into a dedicated embedding tool through two key modifications:
- Encoder Reformation: The causal mask is removed to enable bidirectional attention, allowing the model to look at the entire item title simultaneously. Masked Next Token Prediction (MNTP) is used to adapt the model to this new architecture.
- Item-level Contrastive Learning (ICL): To enhance the distinctiveness of embeddings, contrastive learning is applied. By creating slightly different "views" of an item title (via dropout), the model learns to cluster similar representations while pushing dissimilar items apart in the embedding space.
Key Insights: The Behavioral Shift
Evolution of item embeddings through the LLM2Rec training stages. Source, p. 2
A core finding of this work is the visualization of the embedding space's evolution. As shown in the figure above, standard LLM embeddings for related items are initially scattered. After CSFT, these items cluster tightly based on user behavior. The final IEM stage ensures these clusters remain while making individual items more distinguishable, reaching the "sweet spot" for high-accuracy recommendation.
Further analysis revealed that CSFT is the primary driver of performance, indicating that teaching the model user behavior is more critical than architectural fine-tuning. Additionally, bidirectional attention consistently outperformed causal (GPT-style) approaches for embedding tasks.
Experimental Results
LLM2Rec was pre-trained on six diverse Amazon 2023 categories and evaluated against strong baselines including BGE, GTE, and recommendation-specific models like EasyRec.
- Superior Performance: LLM2Rec consistently outperformed all baselines. In-domain tests on Games and Arts datasets showed an average relative improvement of 15%.
- Generalization Power: The model excelled in out-of-domain (OOD) scenarios, including the Goodreads dataset. This proves the model learns a "universal" representation of items that transcends specific platforms or categories.
- Efficiency: Utilizing smaller backbones like Qwen2-0.5B, LLM2Rec achieved results superior to much larger general-purpose models while maintaining practical inference times for real-world deployment.
Conclusion and Future Work
LLM2Rec demonstrates that LLMs can be effectively repurposed as recommendation engines by aligning their semantic power with collaborative signals. Future research will focus on addressing data noise in e-commerce datasets and exploring the scaling laws of this framework with models exceeding 7B parameters. The ultimate goal remains a plug-and-play universal embedding layer for any recommendation task.
Summary updated