Abstract
Characterizing users and items through vector representations is crucial for various tasks in recommender systems. Recent approaches attempt to apply Large Language Models (LLMs) in recommendation through a question and answer format, where real users and items (e.g., Item No.2024) are represented with in-vocabulary tokens (e.g., "item", "20", "24"). However, since LLMs are typically pretrained on natural language tasks, these in-vocabulary tokens lack the expressive power for distinctive users and items, thereby weakening the recommendation ability even after fine-tuning on recommendation tasks. In this paper, we explore how to effectively tokenize users and items in LLM-based recommender systems. We emphasize the role of out-of-vocabulary (OOV) tokens in addition to the in-vocabulary ones and claim the memorization of OOV tokens that capture correlations of users/items as well as diversity of OOV tokens. By clustering the learned representations from historical user-item interactions, we make the representations of user/item combinations share the same OOV tokens if they have similar properties. Furthermore, integrating these OOV tokens into the LLM's vocabulary allows for better distinction between users and items and enhanced capture of user-item relationships during fine-tuning on downstream tasks. Our proposed framework outperforms existing state-of-the-art methods across various downstream recommendation tasks.
Introduction
When Large Language Models (LLMs) are deployed for recommendation tasks, users and items are typically represented using standard text. For instance, "Item No. 2024" is tokenized into "item", "20", and "24". This approach introduces a significant "mapping problem." First, these numeric tokens are already "overloaded" with pre-existing linguistic meaning; an LLM might incorrectly associate "Item 20" and "Item 21" simply due to their numerical sequence, regardless of their actual category. Second, the limited vocabulary of LLMs leads to "semantic collisions," where thousands of distinct items share the same few tokens, diluting the model's ability to capture unique collaborative signals.
The META ID Framework
To address these limitations, we propose META ID (META-path-guided IDentifier), a framework that utilizes custom Out-Of-Vocabulary (OOV) tokens to represent users and items. The process involves three key stages:
- Meta-path-based Embedding: We analyze the user-item interaction graph using "meta-paths" (e.g., User-Item-User sequences) to train a skip-gram model. This ensures that users and items with similar interaction patterns are positioned closely in the embedding space.
- OOV Token Generation: These embeddings are clustered using K-Means. Each item is then assigned a unique ID composed of a "coarse-grained" cluster token (e.g.,
<CT10>) and a "fine-grained" distance-based token (e.g.,<88>). - LLM Integration: The LLM’s vocabulary is expanded to include these OOV tokens. Rather than random initialization, we use a linear transformation layer to align the OOV token embeddings with the collaborative features learned from the interaction graph.
As shown in Figure 1, standard Random IDs (RID) and Sequential IDs (SID) fail to capture the underlying item relationships, whereas META ID produces a similarity matrix that closely aligns with the ground truth.
Experimental Evaluation
We evaluated META ID on three real-world datasets from the Amazon Product Reviews collection: Sports & Outdoors, Beauty, and Toys & Games. To quantify the effectiveness of our IDs, we introduced two new metrics: Diversity Score (DS), measuring the distinctness of ID representations, and Memorization Score (MS), measuring how well IDs capture ground-truth correlations.
Our results demonstrate that META ID consistently outperforms state-of-the-art methods like SASRec and P5. In sequential recommendation tasks on the "Sports" dataset, META ID achieved a Hit Ratio (H@5) of 0.0392, nearly doubling the performance of traditional baselines. Figure 6 illustrates that META ID achieves significantly higher diversity and memorization scores compared to RID, SID, and Collaborative IDs (CID).
Discussion and Future Work
The primary advantage of META ID is providing the LLM with a "clean slate." By using OOV tokens without pre-existing linguistic associations, the model can dedicate its full expressive capacity to learning recommendation-specific patterns.
However, challenges remain. The current framework relies on a fixed database; if a new item enters the system without interaction history, the model cannot generate a meta-path-based ID (the "cold start" problem). Additionally, while the two-level token system is effective for thousands of items, scaling to trillions of entities may require more complex hierarchical structures. Future research will focus on dynamic vocabulary updates and cold-start mitigation strategies.
Summary updated