
Share
Semantic IDs allow language models to understand product data, merging recommendation systems with AI chatbots for smarter, more conversational recommendations that bridge the gap between human queries and digital products.
When I first heard about Semantic IDs, it immediately piqued my interest. The concept is straightforward: instead of using random hash IDs for items like videos, songs, or products, we use semantically meaningful tokens that a language model (LLM) can naturally understand. This opens up the possibility of training an LLM-recommender hybrid on rich behavioral data, leveraging the strengths of both worlds.
The result? A language model that can converse in both natural language and item IDs, effectively becoming a "bilingual" model where items are part of its vocabulary. Not only can it recommend items based on historical interactions, but it can also reason about its choices, offer explanations, and even creatively name product bundles-all through natural language interactions.
To achieve this, we need to extend the LLM's vocabulary with semantic ID tokens (e.g., <|sid_0|>, <|sid_1|>, <|sid_2|>). These tokens represent items in our catalog. Here’s a step-by-step breakdown:
This approach combines the best of both recommender systems (RecSys) and language models:
By merging these capabilities, we get a model that can:

To implement this, follow these steps:
Data Preparation:
Model Training:
Evaluation:
Eugene Yan has provided a demo video and code to help you get started:
Note that this is a small model with basic finetuning, so the effectiveness can vary based on how you prompt it. It’s also not as general-purpose and robust as most LLMs due to limited finetuning.
The LLM-RecSys hybrid using Semantic IDs represents a significant step forward in recommendation systems. By combining the rich behavioral data of RecSys with the natural language capabilities of LLMs, we can create more interactive, explainable, and steerable recommendation models. This approach opens up new possibilities for personalization and user engagement.
Tags
Original Sources
About the author
Kai built ML infrastructure at a Bay Area startup before developing an obsession with transformer architectures and inference optimisation that eventually pulled him out of product work entirely. A stint at a compute research lab sharpened his instinct for what actually matters in a model release versus what is marketing. He writes from the inside — from the perspective of someone who has debugged the systems he is describing at three in the morning. He is allergic to hype and instinctively drawn to the unglamorous plumbing questions that everyone else skips over.
More from The Engineer →This Week's Edition
16 September 2025
133 articles
Related Articles
Related Articles
More Stories