Large Language Model Empowered Embedding Generator for Sequential Recommendation

Qidong Liu, Xian Wu, Wanyu Wang, Yejing Wang, Yuanshao Zhu, Feng Tian, Yefeng Zheng

Abstract

Sequential Recommender Systems (SRS) typically rely on ID-based embeddings, which suffer from the "long-tail problem": items with few interactions lack sufficient data to form meaningful representations. While Large Language Models (LLMs) possess rich semantic knowledge, directly applying them to recommendation tasks is hindered by the semantic gap and information loss during vector compression. We present LLMEmb, a novel framework that transforms LLMs into effective embedding generators for SRS. LLMEmb utilizes a two-stage approach: (1) Supervised Contrastive Fine-Tuning (SCFT) to refine the LLM's focus on recommendation-relevant item attributes, and (2) Recommendation Adaptation Training (RAT) to align these semantic embeddings with user behavioral patterns through a specialized adapter. Our evaluation across three real-world datasets shows that LLMEmb significantly boosts performance for tail items—nearly tripling the Hit Rate in some cases—while maintaining inference efficiency through embedding caching.

Introduction: The Long-Tail Challenge

Sequential Recommender Systems are the backbone of modern digital platforms, powering "what to watch next" or "customers also bought" features. Traditionally, these systems use ID-based embeddings, where each item is mapped to a unique vector learned from user behavior. However, this approach creates a "rich-get-richer" cycle. Popular items accumulate data and high-quality embeddings, while "tail items"—those with few interactions—remain poorly represented. This "long-tail problem" makes niche or new items virtually invisible to the recommendation engine.

While LLMs offer deep semantic understanding of items via their textual descriptions, they cannot be used as-is. There is a significant semantic gap because LLMs are not trained for recommendation tasks, and a semantic loss occurs when compressing high-dimensional LLM vectors into the compact spaces required by SRS.

Methodology: The LLMEmb Framework

The proposed LLMEmb framework addresses these challenges through a two-stage training pipeline designed to extract and adapt semantic knowledge for recommendation.

Stage 1: Supervised Contrastive Fine-Tuning (SCFT)

In the first stage, a pre-trained LLM (such as LLaMA-7B) is fine-tuned using Parameter-Efficient Fine-Tuning (PEFT) via LoRA. To make the model sensitive to recommendation-relevant features, the authors employ attribute-level data augmentation. By randomly dropping attributes (e.g., brand, category) from an item's description to create multiple views, the LLM is trained with a contrastive loss to recognize that different textual descriptions refer to the same item. This process ensures the LLM focuses on the specific textual details that drive user preferences.

Stage 2: Recommendation Adaptation Training (RAT)

The second stage bridges the gap between textual semantics and collaborative user behavior. A trainable Adapter (a two-layer neural network) is introduced to map the LLM's high-dimensional output to the SRS embedding space.

The two-stage LLMEmb framework consisting of Supervised Contrastive Fine-Tuning (Stage 1) and Recommendation Adaptation Training (Stage 2).

Crucially, during this stage, the LLM parameters are frozen to preserve the semantic richness learned in Stage 1. The Adapter is trained using Collaborative Alignment, which aligns the LLM-generated embeddings with the behavioral patterns captured by a traditional SRS backbone. This ensures that the resulting embeddings are both semantically grounded and behaviorally relevant.

Experimental Results

LLMEmb was evaluated on three diverse datasets: Yelp (points of interest), Amazon Beauty, and Amazon Fashion. It was tested against multiple backbones, including GRU4Rec, Bert4Rec, and SASRec.

Solving the Long-Tail Problem

The most significant impact of LLMEmb is seen in tail item performance. On the Yelp dataset with a SASRec backbone, LLMEmb improved the Hit Rate (H@10) for tail items from 0.1142 to 0.2951. As shown in Figure 2(a), traditional models like SASRec see a sharp decline in performance as item popularity decreases, despite tail items making up the majority of the catalog. LLMEmb effectively flattens this curve.

Analysis of the long-tail problem (a) and the resulting embedding distribution shift from SASRec (b) to LLMEmb (c).

Embedding Distribution and Efficiency

Visualization of the embedding space via t-SNE reveals that traditional ID embeddings for tail items are often sparse and isolated (Figure 2b). In contrast, LLMEmb-generated embeddings are more uniformly distributed and better integrated with popular items (Figure 2c). This improved distribution allows the model to better generalize across the entire item space.

Importantly, LLMEmb maintains high efficiency. Because the embeddings are pre-computed and cached after training, the system adds zero computational overhead during the inference phase, making it suitable for real-time production environments.

Discussion and Conclusion

While LLMEmb dramatically improves tail item recommendations, the authors noted a "Seesaw Problem": a slight trade-off where the most popular items may see a minor performance dip compared to models optimized purely for popularity. However, the overall improvement in system health and the ability to surface "hidden gems" far outweighs this cost.

Future work may explore better balancing mechanisms for collaborative and semantic signals, as well as the use of smaller, more resource-efficient LLMs. By effectively turning LLMs into embedding generators, LLMEmb provides a robust path forward for building more inclusive and accurate recommender systems.

Summary updated

BibTeX
@inproceedings{liu2025large,
  author = {Qidong Liu and Xian Wu and Wanyu Wang and Yejing Wang and Yuanshao Zhu and Xiangyu Zhao and Feng Tian and Yefeng Zheng},
  title = {{Large Language Model Empowered Embedding Generator for Sequential Recommendation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2025},
  doi = {10.1609/aaai.v39i11.33327},
}
Figure