Abstract
Sequential recommendation aims to predict users' next interaction with items based on their past engagement sequence. Recently, the advent of Large Language Models (LLMs) has sparked interest in leveraging them for sequential recommendation, viewing it as language modeling. Previous studies represent items within LLMs' input prompts as either ID indices or textual metadata. However, these approaches often fail to either encapsulate comprehensive world knowledge or exhibit sufficient behavioral understanding. To combine the complementary strengths of conventional recommenders in capturing behavioral patterns of users and LLMs in encoding world knowledge about items, we introduce Large Language-Recommendation Assistant (LLaRA). Specifically, it uses a novel hybrid prompting method that integrates ID-based item embeddings learned by traditional recommendation models with textual item features. Treating the "sequential behaviors of users" as a distinct modality beyond texts, we employ a projector to align the traditional recommender's ID embeddings with the LLM's input space. Moreover, rather than directly exposing the hybrid prompt to LLMs, a curriculum learning strategy is adopted to gradually ramp up training complexity. Initially, we warm up the LLM using text-only prompts, which better suit its inherent language modeling ability. Subsequently, we progressively transition to the hybrid prompts, training the model to seamlessly incorporate the behavioral knowledge from the traditional sequential recommender into the LLM. Empirical results validate the effectiveness of our proposed framework.
The Modality Gap in Sequential Recommendation
Sequential recommendation has traditionally relied on ID-based models (e.g., SASRec, GRU4Rec). These models excel at capturing mathematical patterns in user behavior but are inherently limited by their lack of semantic understanding; to such a model, a movie is merely an abstract index like ID: 14. Conversely, recent attempts to adapt Large Language Models (LLMs) for recommendation typically represent items using textual metadata such as titles and descriptions. While LLMs possess vast world knowledge (e.g., understanding the genre and themes of Titanic), they often struggle to internalize complex behavioral sequences or "cold" ID tokens that do not appear in their natural language pre-training data.
The authors identify this as a "modality gap." The challenge lies in imbuing an LLM with the behavioral precision of a traditional recommender without degrading its innate reasoning and linguistic capabilities. LLaRA addresses this by treating user behavioral patterns as a distinct modality, similar to how images or audio are integrated into multi-modal LLMs.
The LLaRA Framework: Hybrid Prompting and Curriculum Learning
LLaRA introduces two primary innovations to bridge the gap between world knowledge and user behavior:
1. Hybrid Item Representation
Instead of forcing a choice between IDs and text, LLaRA utilizes both. Each item in a user's history is represented by a Hybrid Item Representation:
- Textual Tokens: The item's title, processed by the LLM’s standard tokenizer, leveraging the model's pre-existing world knowledge.
- Behavioral Tokens: Embeddings extracted from a pre-trained traditional sequential recommender (SR). These embeddings (SR-EMB) capture collaborative filtering signals and behavioral patterns.
- Alignment Projector: To bridge the gap between the Sequential Recommender Space and the LLM Space, a trainable projector (typically a multi-layer perceptron) maps the behavioral embeddings into the same mathematical space as the LLM's word embeddings.
2. Curriculum Prompt Tuning
Introducing a new modality like behavioral embeddings can be disruptive to a frozen or semi-frozen LLM. To mitigate this, LLaRA employs a Curriculum Prompt Tuning strategy that gradually increases the complexity of the training task:
- Phase 1 (Easier Task): The model is "warmed up" using text-only prompts. This helps the LLM adapt to the specific format of the recommendation task (e.g., selecting from a candidate list) using its natural language strengths.
- Phase 2 (Harder Task): The model progressively transitions to hybrid prompts. A scheduler increases the probability of including behavioral tokens over time, allowing the model to learn how to integrate precise behavioral signals with its semantic understanding.
The framework utilizes Llama2-7B as the backbone, fine-tuned using LoRA (Low-Rank Adaptation) to ensure computational efficiency while maintaining the model's general reasoning capabilities.
Empirical Evaluation and Key Results
LLaRA was evaluated on three diverse real-world datasets: MovieLens (100K), Steam (video games), and LastFM (music). The recommendation task was framed as an instruction-following problem where the model must predict the next item from a candidate set of 20.
Key Findings:
- State-of-the-Art Performance: LLaRA consistently outperformed both traditional models (SASRec, Caser) and existing LLM-based methods (TALLRec, MoRec). On MovieLens, LLaRA achieved a HitRatio@1 of 0.4737, a significant improvement over SASRec's 0.3444.
- Importance of Curriculum: Ablation studies demonstrated that "Direct Training" (skipping the warm-up phase) resulted in lower performance, confirming that gradual modality alignment is crucial.
- Instruction Following: LLaRA exhibited high reliability, with a "Valid Ratio" exceeding 95%, meaning it consistently selected items from the provided candidate list rather than hallucinating.
- Semantic Reasoning: Case studies revealed that LLaRA can use its world knowledge to refine behavioral predictions. For instance, it can distinguish between a user's general interest in a genre and a specific preference for sub-genres (e.g., "war adventure") that a traditional model might miss.
Conclusion
LLaRA represents a significant step forward in integrating traditional recommendation signals with the power of Large Language Models. By treating behavior as a modality and employing curriculum learning, it successfully combines the "what" (content) with the "how" (behavior). While the computational cost of LLM inference remains a challenge for real-time systems, LLaRA provides a robust blueprint for the next generation of semantically-aware recommendation engines.
Summary updated