Skip to content

Cookies

We use cookies to enhance your experience. Learn more

ResearchMethod

Semantic IDs: a catalog a model can read

A model can’t read a product number. Semantic IDs give every merchant and item a short code that carries meaning, so the model can predict an order the way it predicts a word.

Three clusters of small paper squares, red, blue and green, on sand paper, and beside each one larger square of its color.

The problem with product numbers

A catalog names its items with arbitrary numbers. Two burgers from two restaurants share nothing in their numbers, and a model that sees only those numbers has to learn each one from scratch. With millions of items, most of them rarely ordered, it never sees enough of any one to learn it.

From an item to a code

  1. Profile

    Each merchant and each item is described from what is known about it: its text, its picture, its place in the catalog.

  2. Embed

    The description is placed in a space where similar things lie close together.

  3. Compress

    Its place in that space is written as a short code of a few tokens. The first token names a broad family; each one after it narrows the meaning.

How a code narrows, token by token. The codes are invented for this example.
CodeFirst tokenSecond tokenThird token
<156><032><089>Prepared foodBurgersA smash burger
<156><032><013>Prepared foodBurgersA classic burger
<156><214><041>Prepared foodSushiA salmon set

Teaching the codes to speak

A code is useful once the model can move between it and language in both directions: given a code, say what it is; given a description, find the code. Pre-training therefore mixes histories with tasks that tie codes to text.

  • Predicting the next code in a history.
  • An item and its description, each from the other.
  • An item and a description of its picture.
  • A person’s profile and the history it summarizes.
  • An item and its place in the catalog’s categories.
  • A merchant and its menu.

General instruction data is mixed in as well, so the model stays fluent outside commerce while it learns the catalog.

What it makes possible

Because codes are tokens, an item, a merchant or a person can stand directly in the model’s context, in the middle of a sentence. An item the model has never seen ordered still has a code whose first tokens it knows, so it can be recommended on its first day. And the same model that writes a notification can name the item the notification is about.

Author

  • Magnet research

Keep reading

  • Publication

    One model for the whole home page

    A shopping app’s home page is filled by many recommenders, each tuned for its own slot. This model writes one page per person, per meal moment: the title, the subtitle and what to show. In a live test on one slot it brought 137% more orders from that list.

  • Publication

    New robots, old tricks: teaching robots to speak AI

    A post of November 2026 on a year of wiring Darwin, the Prosus humanoid robot. Five parts spoke five protocols, and the post asks what a robot should tell an AI agent about its actions before the agent can use it.

  • Method

    Meet the large commerce model

    Language models learn from text. Magnet Decision learns from what people search for, look at, buy and come back for. Here’s how it’s built.