How Shopify sorts every product into one category tree, and knows when to stop
In 2020 and 2021 Shopify engineers described how they put millions of merchants' products into one shared category tree. The first version read English text only. The second added the photo and other languages, and a threshold at every level. The reported gain has no baseline, but the design holds up.

Two shops sell the same sock. One calls it a "woolen long sock," the other a "blue striped long sock." That example opens a 2020 post by Jeet Mehta and Kathy Ge of Shopify: sellers describe the same thing in different words, and search, ads and channel feeds need one shared name for it. Shopify wrote about its answer twice: the first version in April 2020, the second in a September 2021 post by Kshetrajna Raghavan. The second is better, and its best idea is knowing when to say less.
The problem: thousands of categories, in a tree
Shopify mapped products to the Google Product Taxonomy, "a list of over 5,500 categories" arranged as a tree, from Animals & Pet Supplies down to Dog Beds. "Both the sheer number of categories in the taxonomy and the complex structure and relationship between the different classes make this a hard problem to model and solve."
The inputs do not help much. The title, description, tags and product type are typed by the seller, and "multiple merchants selling the same product can use different values for Product Type." By 2020 the category already fed "20+ teams across Shopify", including filling in category details when a seller lists on Facebook Marketplace.
How they built it
2020: text only, kept simple. The first system read the title, description, collection, tags, vendor and product type, and turned the words into fixed-length numbers with a hashing step in PySpark. It skipped images on purpose: "we decided to err on the simpler side and stick with text-based data." A trick called Kesler's Construction let one logistic regression score a product against thousands of classes. To predict, it scored the top level, took the best branch, scored only that branch's children, and repeated "until we've reached a leaf node."
It was also scored fairly. Calling a dress a shirt is less wrong than calling a phone a shirt, so the team used hierarchical precision and recall, which give credit for the levels a prediction gets right. Wrong answers flowed back through events and an in-house labelling tool, a "human-in-the-loop setup."
2021: text and photo, one output per level. The second system added the image and dropped the English-only limit. Pre-trained models turn each input into an embedding: "Multi-Lingual BERT for text" and "MobileNet-V2 for images". One network then makes seven predictions, one per level of the tree. Each level's answer is fed, with the original embeddings, into the next: knowing a product sits in Dog Supplies makes Dog Beds easier to guess.

The seven losses are combined "in a weighted fashion," and class weights stop the common categories from drowning out the rare ones. In training, a child prediction may disagree with its parent, so a good guess lower down can correct a bad one higher up. At prediction time the tree is enforced: pick the best top level, then the best child of that, down to Level 7. The model has "over 250 million parameters" and was trained with distributed TensorFlow on Google Cloud.
Stop when unsure. Each level has its own confidence threshold, so "not all products have predictions at every level." In the post's dog-bed example the first three levels pass and the fourth does not, so the answer stops at the third. The team also checked small corners of the tree by hand. Overall numbers "can also mask model performance in small pockets of the taxonomy", so for sensitive categories such as "Religious and Ceremonial" they "manually tuned thresholds".
What it delivered
The headline: the new model "increased our leaf precision by 8% while doubling our coverage", where coverage is the share of products that get a prediction at all. The post does not give the starting precision, does not say whether 8% means points or a relative gain, and its closing says "almost doubling". It never says where its training labels came from. The 2020 post reports no accuracy at all. These are Shopify-reported numbers: read them as direction, not as a target.
What has changed since
The tree is now open. Shopify publishes its own Standard Product Taxonomy on GitHub under the MIT licence, with dated stable releases since June 2024. By our count the 2026-08 release has 14,606 categories, and Indonesian names were added in a release published in May 2025.
The model changed shape. In May 2025 Shopify wrote that it had moved to open vision-language models, "from LlaVA 1.5 7B to LLaMA 3.2 11B, and now to Qwen2VL 7B", with "an impressive 85% acceptance rate" from merchants. Acceptance is not accuracy. The same post dates the image-and-text model to 2020, a year before the post that describes it, so Shopify's own timeline is loose. A July 2025 recap says commercial APIs work "at a smaller scale" but "our volume makes them prohibitively expensive", that several LLMs now label the training data, and that people still set the test labels.
The category also carries more weight. Shopify's help page says it drives collections, feeds to other channels, the tax rate under Shopify Tax and "Return reasons in the returns process". In June 2026 Shopify said its Catalog maps products to this taxonomy for AI shopping agents, through a protocol "co-developed" with Google. The public Google file, meanwhile, still carries version 2021-09-21.
Why it matters for your business
Most Indonesian online sellers have no category tree around them at all. In BPS's Statistik E-Commerce 2024, released in November 2025, the most used sales media were instant messaging (94.76%), social media (29.66%) and marketplaces (17.23%); a business could name more than one. Marketplaces carried about 15.79% of the transaction value. For many sellers, a catalog is the first place a category gets written down.
The rules now ask for that structure. Permendag 19/2026, in force since 8 June 2026, replaced Permendag 31/2023. Its Pasal 15 asks sellers to give, where the goods require it, an SNI or registration number, a halal certificate number, a safety registration number, a food or pharmaceutical licence number, and whether the goods are made in Indonesia. What the item is decides which of those apply. Pasal 47 makes a business responsible for the AI it uses, asks that what it shows be "benar, jelas, akurat", and asks platforms for a way to complain about or correct it. That is our reading as engineers, not legal advice.
Indonesian names are not a solved problem either. We searched the category names in Shopify's 2026-08 release and the Google file for goods that the halal product-type decree, KMA 748/2021, lists by name. Tasbih has a node, "Prayer Beads". Sajadah, mukena, sarung and peci have no node under their own name in either list. Attributes might cover them; we did not check. Shopify hand-tuned its religious branch for a reason, and an Indonesian catalog will need the same care.
How we would build it today

- Split three outputs from day one. A browse category, attributes (material, origin, size) and compliance fields (SNI, halal, BPOM). Several duties turn on an attribute, not on the category name.
- Pin one tree release. Shopify's open taxonomy is a sound start: MIT, dated releases, Indonesian names. Map it to each marketplace you sell on in its own column, and have a native speaker read the names.
- Label a gold set by hand before any model. Real listings, phone photos, mixed Indonesian and English titles, two people per item. Never train on it.
- Race two baselines on that set. A vision-language model that walks the tree a few branches at a time, against a small classifier on text and image embeddings with one output per level, the 2021 shape. Compare precision per level, coverage and cost per 1,000 listings.
- Threshold each level and allow a stop. If even the top level is unsure, send the item to a person. Tune sensitive branches by hand.
- Never let a model write a licence, halal or registration number. The seller enters it; the model may only point to where it appears.
- Build the correction path now. Show the seller the category, let them change it, and store the prediction, the final value, who changed it and when. Every edit is a free label.
- Version everything. Log the tree release, model or prompt version and thresholds with each prediction, and re-run the gold set before switching releases.
For a small shop, steps 1, 2 and 6 plus one person checking the unsure items are a fair start. The model earns its place when the catalog outgrows that person.