Enhancing LLM-based Recommendation through Semantic-Aligned Collaborative Knowledge

Zihan Wang, Jinghao Lin, Xiaocui Yang, Yongkang Liu, Shi Feng, Daling Wang, Yifei ZhangarXiv 2025

TL;DR

Large Language Models (LLMs) excel at recommendation reasoning but struggle to process abstract user and item IDs. SeLLa-Rec bridges this gap by explicitly aligning the semantic spaces of traditional collaborative filtering models and LLMs using contrastive learning and a hybrid projection layer. This allows the LLM to effectively ingest collaborative knowledge, achieving state-of-the-art recommendation performance on both warm and cold data.

What Problem Does This Paper Address?

Traditional recommendation systems (Collaborative Filtering or "Collabs") excel at finding behavioral patterns from user interactions like clicks and ratings. However, they suffer severely from data sparsity and the notorious "cold-start" problem (making recommendations for brand-new users or items).

On the flip side, LLMs bring rich world knowledge and open-ended reasoning to recommendation tasks, making them excellent at handling cold-start scenarios using textual descriptions. However, LLMs fail at processing abstract, sparse identifiers like user/item IDs.

While recent hybrid methods try to feed collaborative embeddings into LLMs as special prompt tokens, they ignore a fundamental issue: the massive discrepancy in knowledge distribution and semantic space between the two architectures. This semantic mismatch creates a bottleneck, preventing the LLM from truly understanding collaborative signals.

Methods

The authors introduce SeLLa-Rec (Semantic-Aligned LLM-based Recommendation), a three-layer framework consisting of a Collaborative Knowledge Foundation Layer (bottom), a Hybrid Projection Layer (middle), and an LLM Recommendation Layer (top).

To make these layers work in harmony, the authors design a clever three-stage hierarchical training strategy:

  1. LLM Fine-Tuning (Stage 1): The LLM backbone (Qwen2-7B-Base) is fine-tuned using Low-Rank Adaptation (LoRA) on recommendation-specific text prompts to adapt its generative space to a binary classification task (predicting "Yes" or "No" for a recommendation).
  2. Bidirectional Semantic Alignment (Stage 2): Item semantic embeddings are distilled from the fine-tuned LLM. These embeddings serve as contrastive learning targets (using an InfoNCE loss) to train the downstream Collab model (Matrix Factorization). This forces the Collab model to "pre-align" its collaborative embeddings with the LLM's semantic space before any projection happens.
  3. Hybrid Projection & Token Injection (Stage 3): The framework introduces three special tokens into the LLM's prompt: <User_ID>, <Item_ID>, and <Warm_ID>. The Hybrid Projection Layer maps the aligned collaborative user/item embeddings and the collaboratively-enhanced semantic embeddings into these token slots. Crucially, this projection layer is initialized using parameters from Stage 2 (a warm-up approach) rather than random weights, minimizing information loss during dimensional transformation.
Figure 1: The overall framework of SeLLa-Rec. The right part depicts SeLLa-Rec’s structure, while the left illustrates the origins of the pre-trained components. The numbered markers ①, ②, and ③denote the sequential training stages for SeLLa-Rec.

Datasets

The framework was evaluated on two widely recognized public benchmark datasets:

  • MovieLens-1M: A classic dataset of user-movie interactions. Ratings (1-5) are converted to binary labels (threshold > 3).
  • Amazon Book: A large-scale subset of the Amazon Product Review dataset. To ensure data quality, it was filtered for users with more than 20 interactions, and ratings were binarized (threshold > 4).

Crucially, both datasets were partitioned chronologically (by time) rather than randomly. This choice ensures that the test set includes items not seen in earlier periods, effectively simulating a realistic, natural cold-start scenario.

Key Insights and Ideas

  • Alignment Before Projection: Traditional methods try to map a frozen Collab model's embeddings directly to an LLM via a projection layer. SeLLa-Rec argues this is insufficient. By altering the Collab model's training objective using contrastive learning, the collaborative knowledge inherits the LLM's distribution characteristics at the foundational level.
  • The Power of the <Warm_ID> Token: Instead of just mapping user and item IDs, SeLLa-Rec splits item features into a collaborative token (<Item_ID>) and a collaboratively-enhanced semantic token (<Warm_ID>). This dual representation preserves both behavioral patterns and textual semantics.
  • Visualizing the Semantic Bridge: Using t-SNE visualizations, the authors demonstrate that contrastive learning (CL) drastically narrows the distributional gap between LLM and Collab embeddings, providing clear visual evidence of successful semantic alignment.
t-SNE distribution of item embeddings with and without contrastive learning alignment.

Key Results

SeLLa-Rec achieves state-of-the-art performance, outperforming strong baselines (including recent hybrid models like CoLLM and BinLLM) by an average of 4% in AUC and UAUC metrics across both datasets:

  • MovieLens-1M: Achieves an AUC of 0.7606 and a User-Average AUC (UAUC) of 0.7464.
  • Amazon Book: Reaches an AUC of 0.8837 and a UAUC of 0.7459.

Furthermore, data split analysis confirms that while traditional Collab models fail on cold data and pure LLMs underperform on warm data, SeLLa-Rec achieves comprehensive improvements across both warm and cold subsets simultaneously.

Limitations and Future Work

  • Task Scope: The paper focuses primarily on the click-through rate (CTR) prediction task (binary classification). Extending this alignment framework to generative recommendations or multi-item list reranking remains an open direction.
  • Collab Simplicity: For downstream collaborative filtering, the authors utilized a relatively simple Matrix Factorization (MF) model. Exploring how more complex graph neural networks (like LightGCN) or sequential recommenders behave under this strict semantic alignment framework could yield further improvements.
  • Frozen Backbone Constraints: During the final projection training stage, the LLM parameters are frozen to save compute. Jointly fine-tuning the entire pipeline end-to-end might unlock an even higher performance ceiling.

Summary updated

BibTeX
@misc{wang2025enhancing,
  author = {Zihan Wang and Jinghao Lin and Xiaocui Yang and Yongkang Liu and Shi Feng and Daling Wang and Yifei Zhang},
  title = {{Enhancing LLM-based Recommendation through Semantic-Aligned Collaborative Knowledge}},
  year = {2025},
  eprint = {2504.10107},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2504.10107},
}
Figure