LLM-Enhanced Recommendation

Large Language Models Enhanced Collaborative Filtering

LLM-CF generates reasoning examples offline, retrieves relevant examples at serving time, and uses an in-context learning module to enhance collaborative filtering without online LLM inference.

CIKM 2024 Co-first author Zhongxiang Sun, Zihua Si, Xiaoxue Zang, Kai Zheng, Yang Song, Xiao Zhang, Jun Xu
LLM-CF

Distilling LLM world knowledge and reasoning into collaborative filtering through offline CoT generation and in-context learning.

How can the world knowledge and reasoning of an LLM improve collaborative filtering across historical user-item interactions, while keeping LLM text generation outside the online recommendation path?

From the research problem to mechanism and evidence

The figures below follow their order in the paper. Each section connects the figure to the question it resolves and the conclusion it supports.

1

Problem

Connecting language-derived knowledge with collaborative signals

LLM-CF uses an offline language-model teacher to build reusable reasoning examples, then retrieves those examples to improve a conventional recommender's prediction.

LLM-CF Connecting language-derived knowledge with collaborative signals figure

Collaborative filtering learns from patterns across user-item interactions. An LLM can add information about product attributes, user preferences, and the compatibility between a history and a candidate item. A prompt about one user and one item covers only a small part of the interaction data. LLM-CF brings similar historical interactions into the prediction context, together with reasoning generated from them.

The dashed boundary in the figure separates offline generation from online serving. Below it, RecGen-LLaMA writes a reusable collection of reasoning examples. Above it, the recommendation model receives a learned feature derived from retrieved examples. Serving still requires feature encoding, retrieval, ICT, and the backbone model; it does not require a fresh LLM-generated response for each request.

How to read this figure
  • Follow the lower path from recommendation data through RecGen-LLaMA to the in-context CoT dataset.
  • The retrieved examples feed a collaborative-filtering feature into the recommender alongside its original user and item features.
2

Method

From retrieved examples to an ICT feature

The full pipeline combines offline reasoning generation, top-K example retrieval, and a short transformer-decoder sequence that produces an additional feature for the backbone recommender.

LLM-CF From retrieved examples to an ICT feature figure

Each stored example contains recommendation features, a generated chain of thought, and its historical interaction label. The teacher prompt on the right asks about the user's history, the candidate item's attributes, their compatibility, and possible interest in diversity. The historical label is supplied during this offline generation. The reported collection is sampled from one tenth of the training interactions.

For a current query, the retrieval module uses BGE to embed its textual user and item features and selects similar examples by cosine similarity. Examples from future time steps are excluded. The selected context contains equal numbers of positive and negative historical labels, preventing its label balance from becoming a shortcut. The current query's unknown label is not supplied to ICT.

At the upper right, each historical example becomes a feature embedding, a reasoning embedding, and a label embedding. ICT places these triples before the current query feature in a transformer-decoder sequence. With four examples, the sequence has thirteen positions. The query's final hidden representation becomes the LLM-enhanced collaborative-filtering feature. The reported decoder has two layers and two attention heads.

Training combines the recommendation objective with a cosine reconstruction loss for historical reasoning embeddings. This auxiliary objective encourages the learned feature representations to retain information from the reasoning examples. Ranking models concatenate the resulting feature with their original features; retrieval models add it to the user vector. For candidate retrieval, the current target item's information is masked to avoid exposing the answer.

How to read this figure
  • Read the left-hand path bottom to top: generate examples, retrieve neighbors, encode the context, and predict.
  • The reconstruction branch trains representations to carry reasoning information; online prediction uses the learned feature, not generated prose.
3

Method

Training a teacher that can recommend and still explain

RecGen-LLaMA is trained by mixing recommendation data with general instruction data. The study evaluates the trade-off using recommendation AUC and MMLU accuracy.

LLM-CF Training a teacher that can recommend and still explain Amazon Beauty panel

Amazon Beauty

LLM-CF Training a teacher that can recommend and still explain Amazon Sports panel

Amazon Sports

The horizontal axis measures recommendation AUC; the vertical axis measures MMLU accuracy. Full-parameter tuning on recommendation data alone improves recommendation performance but sharply reduces MMLU accuracy. This trade-off matters because the teacher's next task is to generate informative reasoning examples.

The paper compares data mixing with LoRA, noise-based tuning, representation regularization, and weight interpolation. RecGen mixes recommendation examples with LIMA and alpaca-gpt4 instruction data and retains a useful position on both axes in these experiments. The figure establishes this measured balance; MMLU is the general-capability benchmark used here.

How to read this figure
  • Compare points on both axes: a larger recommendation AUC alone does not describe the teacher's performance.
  • The mixed-data RecGen settings motivate the teacher used to generate the stored CoT examples.
4

Results

How much retrieved context is useful?

The context-size study compares zero, two, four, six, and eight examples, plus a four-example setting without the positive/negative label-balance constraint.

LLM-CF How much retrieved context is useful? figure

Each panel holds the backbone fixed and plots AUC on the three datasets. Several curves improve when moving from two to four examples, but their peaks occur at different context sizes. Individual settings favor two, six, or eight examples, while others decline with longer contexts. Four examples are the selected practical configuration, not a universal optimum across all curves.

The n4_noc setting removes the label-balance constraint. Its changes differ across datasets and backbones. Keeping the balanced setting makes the main comparison less dependent on the proportion of positive labels in the retrieved context. The ranking, retrieval, and ablation tables below show the main experimental evidence.

How to read this figure
  • Compare n2, n4, n6, and n8 within a panel; different backbones have different response curves.
  • n4_noc changes label balance at fixed context length, so it addresses a different question from adding examples.

Main results: ranking, retrieval, and ablation

Experiments use the 2019 Amazon Sports & Outdoors, Beauty, and Toys & Games subsets with leave-one-out splits. CTR evaluation pairs each positive interaction with one sampled negative. The three AUC tables reproduce the main ranking comparison across all six backbones; higher is better. KD, KAR, and LLM-CF use the same 7B LLaMA2 family and consistent backbone architectures. LLM-CF improves all 18 unaugmented-backbone AUC values and leads the four-framework comparison in 16 of 18 settings. Full LogLoss results are available in the paper's Table 3.

Ranking AUC: Amazon Sports

BackboneBackbone onlyKDKARLLM-CF
DeepFM0.79900.80430.79910.8137
xDeepFM0.81580.81690.81610.8196
AutoInt0.80030.80120.80390.8088
DCNv10.80230.80400.80240.8092
DCNv20.81100.81120.80870.8131
DIN0.79860.80230.79710.8089

Paper Table 3. LLM-CF has the highest AUC for each of the six Sports backbones.

Ranking AUC: Amazon Beauty

BackboneBackbone onlyKDKARLLM-CF
DeepFM0.78530.79590.78700.8044
xDeepFM0.80650.81040.81010.8113
AutoInt0.79490.79610.79390.8090
DCNv10.81460.81470.81650.8182
DCNv20.80280.80570.80030.8033
DIN0.78610.79340.78610.7967

Paper Table 3. DCNv2 is an exception: KD reaches 0.8057, above LLM-CF's 0.8033.

Ranking AUC: Amazon Toys

BackboneBackbone onlyKDKARLLM-CF
DeepFM0.76810.77130.76980.7881
xDeepFM0.78360.78650.78980.7947
AutoInt0.76300.76350.76830.7754
DCNv10.76210.76520.76510.7702
DCNv20.77740.78270.77590.7812
DIN0.75860.76520.76200.7783

Paper Table 3. DCNv2 again favors KD. For DeepFM, LogLoss falls from 0.5770 to 0.5581 as AUC rises.

Candidate retrieval: HIT@10 / NDCG@10

BackboneSettingSportsBeautyToys
SASRECBackbone only0.0203 / 0.01010.0648 / 0.02930.0646 / 0.0251
SASREC+ LLM-CF0.0349 / 0.01540.0652 / 0.02930.0723 / 0.0321
YoutubeDNNBackbone only0.0177 / 0.00910.0272 / 0.01280.0229 / 0.0110
YoutubeDNN+ LLM-CF0.0191 / 0.00940.0291 / 0.01390.0285 / 0.0138
GRU4RECBackbone only0.0268 / 0.01350.0470 / 0.02410.0411 / 0.0202
GRU4REC+ LLM-CF0.0317 / 0.01640.0504 / 0.02500.0380 / 0.0192
SRGNNBackbone only0.0146 / 0.00730.0341 / 0.01690.0284 / 0.0137
SRGNN+ LLM-CF0.0210 / 0.01010.0359 / 0.01740.0302 / 0.0144

Paper Table 4. Each cell is HIT@10 / NDCG@10; higher is better. Training uses 128 sampled negatives per interaction. GRU4REC on Toys declines on both metrics.

What contributes? DeepFM ablation AUC

VariantSportsBeautyToys
Backbone only0.79900.78530.7681
Without text features0.81370.80300.7880
Without CoT + reconstruction0.80090.79800.7766
Base LLaMA2 teacher0.81320.79730.7806
Mean pooling instead of decoder0.80710.79860.7739
LLM-CF0.81370.80440.7881

DeepFM rows from Paper Table 5. Removing CoT also removes its reconstruction loss, so this ablation does not isolate the two effects. Other backbones have individual exceptions to the full model's advantage.

What the results show

  • Against the unaugmented backbone, ranking AUC improves in all 18 combinations. Against KD and KAR as well, LLM-CF has the highest AUC in 16 of 18; the two exceptions are DCNv2 on Beauty and Toys.
  • Candidate-retrieval HIT@10 improves in 11 of 12 combinations. GRU4REC on Toys is the negative-transfer case, so the result does not imply uniform gains for every backbone.
  • The DeepFM ablations support the value of reasoning examples and the ICT decoder. They measure downstream recommendation performance, not the faithfulness of the teacher's generated reasoning.

What this project establishes

1

Knowledge transfer through historical examples

Offline-generated reasoning and retrieved user-item interactions jointly supply an additional feature to conventional recommendation models.

2

Broad ranking gains with identifiable limits

The main ranking comparison improves every unaugmented backbone's AUC, while the explicit KD and retrieval exceptions show where transfer is less effective.

3

An explicit offline/online serving boundary

LLM generation stays offline. Online serving computes retrieval and a small ICT module alongside the backbone, allowing the stored reasoning to be reused.

Position in the broader research program

LLM-CF is an earlier knowledge-transfer project in my recommendation research. It studies how LLM-generated reasoning and collaborative interaction data can improve a smaller decision model, with a clear separation between teacher generation and serving.

This work connects to my broader interest in how models acquire and use knowledge. Here, the evidence concerns recommendation accuracy, the contribution of retrieved reasoning examples, and transfer across backbones. Later projects examine internal organization, failure mechanisms, and metacognitive control more directly.

Resources and Citation

@inproceedings{sun2024large,
  title={Large Language Models Enhanced Collaborative Filtering},
  author={Sun, Zhongxiang and Si, Zihua and Zang, Xiaoxue and Zheng, Kai and Song, Yang and Zhang, Xiao and Xu, Jun},
  booktitle={Proceedings of the 33rd ACM International Conference on Information and Knowledge Management},
  doi={10.1145/3627673.3679558},
  year={2024}
}