Source-linked AI summary

Adapting Large Language Models by Integrating Collaborative Semantics for Recommendation

Bowen Zheng, Yupeng Hou, Hongyu Lu, Yu Chen, Wayne Xin Zhao, Ming Chen, Ji-Rong Wen

arXiv:2311.09049v4cs.IR

TL;DR

LLM-based recommenders must bridge language semantics and the collaborative semantics of item-based recommendation. LC-Rec learns meaningful, non-conflicting item indices and uses alignment-tuning tasks to integrate both semantics, reporting stronger performance than competitive baselines, including a 25.5% average improvement in full-ranking evaluations.

  • Problem

    LLMs model language semantics, whereas recommender systems encode collaborative semantics through item identifiers, creating a semantic gap for recommendation.

  • Method

    LC-Rec combines tree-structured vector quantization with uniform semantic mapping for item indices and alignment-tuning tasks that integrate language and collaborative semantics.

  • Results

    25.5% average performance improvement is reported over all baseline methods in full-ranking evaluations across three public datasets.

  • Takeaways & Limitations

    LC-Rec directly generates items from the entire item set and adapts LLMs to sequential recommendation through learned item indices and semantic alignment.

Abstract

from arXiv · show

Recently, large language models (LLMs) have shown great potential in recommender systems, either improving existing recommendation models or serving as the backbone. However, there exists a large semantic gap between LLMs and recommender systems, since items to be recommended are often indexed by discrete identifiers (item ID) out of the LLM's vocabulary. In essence, LLMs capture language semantics while recommender systems imply collaborative semantics, making it difficult to sufficiently leverage the model capacity of LLMs for recommendation. To address this challenge, in this paper, we propose a new LLM-based recommendation model called LC-Rec, which can better integrate language and collaborative semantics for recommender systems. Our approach can directly generate items from the entire item set for recommendation, without relying on candidate items. Specifically, we make two major contributions in our approach. For item indexing, we design a learning-based vector quantization method with uniform semantic mapping, which can assign meaningful and non-conflicting IDs (called item indices) for items. For alignment tuning, we propose a series of specially designed tuning tasks to enhance the integration of collaborative semantics in LLMs. Our fine-tuning tasks enforce LLMs to deeply integrate language and collaborative semantics (characterized by the learned item indices), so as to achieve an effective adaptation to recommender systems. Extensive experiments demonstrate the effectiveness of our method, showing that our approach can outperform a number of competitive baselines including traditional recommenders and existing LLM-based recommenders. Our code is available at https://github.com/RUCAIBox/LC-Rec/.

I. INTRODUCTION

Sequential recommendation models user interaction histories, while LLM-based recommenders face a gap between language semantics and collaborative semantics. LC-Rec addresses this gap through item indexing and alignment tuning, enabling autoregressive recommendation without candidate sets.

  • Background: Sequential recommenders commonly represent user histories as item ID sequences processed by neural architectures.Existing approaches include RNNs, CNNs, GNNs, and Transformers.
  • Motivation: LLMs offer semantic understanding and generation for recommendation, but their language semantics differ from the collaborative semantics encoded by recommender systems.This gap is identified as a fundamental challenge in adapting LLMs to recommendation.
  • Approach: LC-Rec integrates language and collaborative semantics through learned item indices and specially designed alignment-tuning tasks.The model casts recommendation as autoregressive token generation and uses tree-structured vector quantization with uniform semantic mapping.
  • Approach: LC-Rec performs sequential recommendation by directly generating items without relying on candidate sets.This generative formulation treats recommendation similarly to normal text generation.
  • Results: 25.5% average performance improvement is reported for LC-Rec over all baseline methods in full ranking evaluations.The experiments use three public datasets and a LLaMA model with 7B parameters.

B. Large Language Models for Recommendation

LLM-based recommendation methods seek to use language modeling for recommendation, but simple prompting cannot bridge the gap between language and collaborative semantics. LC-Rec instead combines item-index tokens with alignment-oriented recommendation tasks.

  • Challenge: A major challenge is that simple prompt design cannot bridge the gap between LLM language semantics and recommender collaborative semantics.The gap limits direct transfer from natural-language modeling to recommendation.
  • Framework: LC-Rec represents recommendation inputs and outputs using item-index tokens alongside language tokens.The framework depicts language semantics, language tokens, item-index tokens, and language-collaborative alignment.
  • Alignment Tasks: Its alignment tasks include asymmetric item prediction based on historical item representations.The displayed task uses item-index sequences to predict the title of the next item.

C. Implicit Recommendation oriented Alignment

LC-Rec’s recommendation-oriented alignment uses learned item indices to connect language and collaborative semantics in a generative recommendation framework. The approach is designed for practical settings such as full ranking.

  • Recommendation Setting: The method targets full-ranking recommendation rather than relying only on a supplied candidate set.This setting is identified as a practical recommendation scenario for the proposed approach.
  • Motivation: LC-Rec addresses the language-collaborative semantic gap through item indexing and alignment tuning.These two aspects are presented as the main components for adapting LLMs to sequential recommendation.
  • Item Indexing: Uniform semantic mapping gives learned item indices unique representations while preserving similarities between item textual semantics.The indexing method uses vector quantization over LLM-based text embeddings and mitigates conflicts in index assignment.
  • Alignment Tuning: LC-Rec’s alignment tasks enhance language-collaborative integration beyond the target recommendation task itself.The framework is described as integrating collaborative semantics into LLMs for recommendation.

B. Learning Item Indices for Semantic Integration

LC-Rec learns item indices by applying residual vector quantization to LLM-derived item embeddings, producing compact, hierarchical representations for autoregressive recommendation. The approach further targets meaningful item similarity, conflict-free allocation, and semantic integration with LLMs.

  • Vector Quantization Indexing: The item-indexing design must capture item similarities, avoid allocation conflicts, and generalize to new items.These properties motivate replacing large vanilla-ID vocabularies with learned semantic indices.
  • Vector Quantization Indexing: LLM-encoded item text provides the initial item representation for residual-quantized index learning.RQ-VAE recursively quantizes residual vectors from coarse to fine, generating multi-level codewords as item indices.
  • Vector Quantization Indexing: The RQ-VAE objective combines reconstruction loss with residual-quantization loss to reconstruct item embeddings while aligning codebook and residual vectors.The loss also includes a stopgradient operator and coefficient β, usually set to 0.25.
  • Vector Quantization Indexing: Residual quantization creates tree-structured item indices with a larger expression space than traditional VQ at smaller codebook sizes.Its coarse-to-fine structure is suited to autoregressive generation.

2) Conflict Mitigation via Uniform Semantic Mapping:

LC-Rec mitigates conflicts caused by multiple items sharing a tree leaf by uniformly distributing final-level semantic assignments. It formulates this redistribution as an optimal transmission problem and solves it with Sinkhorn-Knopp.

  • Conflict Mitigation via Uniform Semantic Mapping: Tree-structured indexing can place multiple items in one leaf, creating index conflicts that supplementary IDs do not solve semantically.Adding a final layer introduces semantically irrelevant distributions and may affect original item representations.
  • Conflict Mitigation via Uniform Semantic Mapping: Uniform semantic mapping distributes item semantics across final-level codebook embeddings to avoid clustering conflicting items.The method adds a uniform-distribution constraint to the original formulation.
  • Conflict Mitigation via Uniform Semantic Mapping: The final-level assignment is formulated as an optimal transmission problem whose mapping scheme is solved with the Sinkhorn-Knopp algorithm.The semantic-mapping cost is based on the distance between residual vectors and codebook vectors.
  • Conflict Mitigation via Uniform Semantic Mapping: Item-index construction first generates indices, then uniformly redistributes final-level codewords within each conflicting group.This two-stage process can improve efficiency and reduce unnecessary batching noise.

C. Aligning Language and Collaborative Semantics in LLMs

LC-Rec aligns language and collaborative semantics by treating learned item indices as generative tokens and tuning LLMs on sequential item prediction. Because direct fine-tuning on this task leaves the semantic gap insufficiently addressed, additional alignment is needed.

  • Sequential Item Prediction: LC-Rec casts recommendation as token generation so the LLM can autoregressively generate item indices.The item indices are integrated into the vocabulary for generative recommendation.
  • Sequential Item Prediction: Sequential item prediction prompts the LLM with chronologically ordered historical item-index sequences to predict the user’s next item.The task uses personalized recommendation instructions based on current interaction history.
  • Sequential Item Prediction: Simply fine-tuning on sequential item prediction is insufficient to integrate language and collaborative semantics because of the large semantic gap.The learned indices remain out-of-vocabulary tokens before alignment with the LLM’s semantic space.

2) Explicit Index-Language Alignment:

LC-Rec adds explicit index-language and recommendation-oriented alignment tasks so LLMs learn bidirectional mappings between item indices and language, then apply both semantic types to recommendation. Asymmetric tasks deliberately vary condition and target representations to strengthen this integration.

  • Explicit Index-Language Alignment: Explicit alignment tasks train the LLM to generate item indices from titles or descriptions and recover item information from indices.This mutual prediction aligns item indices with language semantics in both directions.
  • Explicit Index-Language Alignment: Asymmetric item prediction changes the representations of conditions and targets, making the task harder than mapping index sequences to target indices.The task can request titles, expected features, or recommendations from index or title histories.
  • Explicit Index-Language Alignment: Recommendation-oriented tasks include predicting items from user intentions and inferring explicit preferences from historical index sequences.Reviews provide evidence for extracting intentions, while GPT-3.5 supplies explicit preference estimates from interaction histories.
  • Explicit Index-Language Alignment: The learned indices support sequential recommendation and can extend to bundle prediction and explanation generation as common LLM tokens.The paper focuses primarily on sequential item prediction while describing broader instruction-tuning applicability.

D. Training and Inference

LC-Rec trains an LLM through conditional generation tasks that integrate language and collaborative semantics, then generates recommendations directly from the entire item set. Its inference procedure uses beam search over item-index tokens while constraining illegal indices and optimizing decoding complexity with KV caching.

  • Training: LC-Rec formats its tuning tasks as sequence-to-sequence conditional language generation and optimizes the negative log-likelihood of target responses.The method is implemented with LLaMA as its backbone.
  • Training: Each training example uses one sampled instruction template per epoch, because repeating data may lead to overfitting.The authors report that this strategy performs better for their 7B-parameter LLaMA model than repeatedly examining specific data.
  • Inference: During inference, beam search decodes the top n items from the entire item set through the item-index structure, assigning zero probability to illegal indices.This directly supports generation of valid item indices during recommendation.
  • Inference: With KV Cache, autoregressive decoding complexity decreases from O(HN^2dL) to O(N^2dL + HNdL).Here H is the number of index levels, L the number of layers, N the sequence length, and d the hidden-state dimension.
  • Method positioning: Compared with text-based and index-based related methods, LC-Rec targets full-ranking recommendation while integrating language and collaborative semantics in an LLM.The approach uses unique item indices, reduces vocabulary size, and adds alignment tasks for semantic integration.

IV. EXPERIMENT

The experiment evaluates LC-Rec on three Amazon review datasets against representative sequential recommenders, including text-to-text, generative retrieval, and conventional neural baselines. The section defines the dataset sources and summarizes the compared model families and reporting setup.

  • Experimental setup: The evaluation uses three Amazon review subsets: Musical Instruments, Arts, Crafts and Sewing, and Video Games.The data span May 1996 to October 2018, and item records include titles and descriptions.
  • Baseline models: LC-Rec is compared with P5-CID, TIGER, Caser, HGN, GRU4Rec, BERT4Rec, SASRec, FMLP-Rec, FDSA, and S3-Rec.These baselines cover text-to-text, generative retrieval, CNN, gating-network, recurrent, Transformer, MLP, feature-sequence, and self-supervised approaches.
  • Baseline models: Traditional sequential recommenders include CNN-, hierarchical-gating-, RNN-, bidirectional-Transformer-, unidirectional-Transformer-, and all-MLP-based models.The listed examples are Caser, HGN, GRU4Rec, BERT4Rec, SASRec, and FMLP-Rec.
  • Baseline models: FDSA separately models item-level and feature-level sequences through self-attention, while S3-Rec pre-trains by maximizing mutual information between items and attributes.These methods introduce item-content information beyond item IDs and collaborative relationships.
  • Baseline models: P5-CID uniformly models recommendation tasks with T5 and uses collaborative item indexing, whereas TIGER predicts semantic IDs with an encoder-decoder Transformer trained from scratch.Both are generative or index-based baselines for sequential recommendation.

3) Evaluation Settings:

The study evaluates sequential recommendation with standard leave-one-out ranking metrics and reports implementation settings for item-index construction and LLM fine-tuning. Across three datasets, LC-Rec consistently achieves the best performance, with its gains attributed to semantic indexing and alignment.

  • Evaluation settings: Evaluation uses top-K HR and NDCG at K=1, 5, and 10 under a leave-one-out protocol.The latest interaction is test data, the second latest is validation data, and earlier interactions form the remaining sequence.
  • Evaluation settings: Item indices use four levels of 256 codebook vectors, each with dimension 32, after LLaMA encodes item titles and descriptions.Mean pooling aggregates token representations, and RQ-VAE encoder and decoder modules are implemented as MLPs with ReLU activations.
  • Evaluation settings: LC-Rec fine-tuning uses LLaMA, appends item-index tokens as OOV tokenizer tokens, trains for four epochs, and uses an overall batch size of 128.The reported optimizer is AdamW with learning rate 5e-5 and weight decay 0.01, with cosine scheduling and warmup.
  • Overall performance: LC-Rec consistently maintains the best performance on all three datasets and significantly improves over the baseline methods.The reported overall results are presented in Table III.
  • Overall performance: The authors attribute LC-Rec’s performance to uniform-semantic vector-quantization indexing and effective integration of collaborative semantics into the LLM.They describe these components as capturing item similarities, supporting semantically lossless final-level generation, and fusing language with collaborative semantics.

C. Ablation Study

The ablation study evaluates semantic alignment tasks, item indexing methods, and their effects on recommendation and semantic integration. LC-Rec’s indexing and alignment designs improve performance across the reported analyses.

  • Semantic alignment tasks: LC-Rec combines sequential prediction with MUT, ASY, ITE, and PER semantic alignment tasks.These tasks include explicit index-language alignment and implicit recommendation-oriented alignment.
  • Semantic alignment tasks: Adding multiple semantic alignment tasks to sequential recommendation significantly improves performance on Arts and Games.All evaluated instruction-tuning tasks benefit sequential recommendation, with further gains potentially available from additional alignment tasks.
  • Item indexing: LC-Rec outperforms Vanilla ID, Random Indices, and LC-Rec w/o USM in the Games indexing comparison.The comparison covers single-item IDs, random multi-level indices, and indices without uniform semantic mapping, using HR@5 and NDCG@5.
  • Item indexing: Applying alignment tasks boosts the three base indexing methods, especially Random Indices and LC-Rec w/o USM.The results indicate that the alignment tasks improve recommendation performance independently of the indexing method.
  • Further analysis: LC-Rec significantly improves item prediction from user intentions and retains some intention-index linking without intention-task training.The zero-shot variant was not trained on the user-intention item-prediction task.
  • Further analysis: PCA visualizations show that LC-Rec aligns item-index tokens with the LLM’s original item-text semantic space.Without semantic integration, item-index tokens remain incompatible with that space.
  • Further analysis: LC-Rec performs best when distinguishing items with similar language or collaborative semantics.The comparison includes SASRec, non-fine-tuned LLaMA, ChatGPT, and an LC-Rec variant using titles instead of indices.

E. Case Study

The case study examines how multi-level item indices encode hierarchical and recommendation-relevant semantics. Generated content becomes more target-specific across index levels, while LC-Rec retrieves related items using both language and collaborative semantics.

  • Hierarchical index semantics: Using only the first index produces coarse but relevant title semantics, while later indices progressively refine the generated item title.The third level provides further refinement, and the fourth contributes relatively less semantic information.
  • Hierarchical index semantics: The proportion of content changes decreases as additional index levels are included.This pattern is consistent with the coarse-to-fine quantization process used to construct the indices.
  • Recommendation-relevant semantics: LC-Rec generates related items matching the source game’s category and platform, whereas language similarity can return a duplicate game for another platform.The comparison uses cosine similarity between item-text embeddings as the language-semantic baseline.
  • Recommendation-relevant semantics: The case study presents item indices as integrating language and collaborative semantics for recommendation.The conclusion reports that LC-Rec uses vector-quantized indices and semantic alignment tasks to adapt LLMs for sequential recommendation.
Loading 2311.09049v4…