---
title: "Cross-store product clustering across millions of stores"
description: "Shopify groups listings of the same product across millions of stores under a global Universal Product Identifier using a three-stage pipeline: embedding-based approximate nearest-neighbor retrieval to find candidate pairs, tiered pair scorers, and graph clustering."
url: "https://swe.quest/articles/cross-store-product-clustering-across-millions-of-stores-c9b1fdcfbed466c6"
canonical: "https://shopify.engineering/catalog-clustering-part-ii"
source: "Shopify Engineering"
published: "2026-10-20"
difficulty: "hard"
kind: "Case study"
reading_minutes: 13
tags: ["machine-learning","ecommerce","vector-search","algorithms","llms"]
---

# Cross-store product clustering across millions of stores

A post on [Shopify Engineering](https://swe.quest/sources/shopify.md), published 2026-10-20, 13 min read, Case study. Original: [https://shopify.engineering/catalog-clustering-part-ii](https://shopify.engineering/catalog-clustering-part-ii)

## Summary

Shopify groups listings of the same product across millions of stores under a global Universal Product Identifier using a three-stage pipeline: embedding-based approximate nearest-neighbor retrieval to find candidate pairs, tiered pair scorers, and graph clustering. The scorers trade cost for precision. L1 is a GBDT on cheap pair features run over trillions of pairs, L2 is a fine-tuned multilingual E5 cross-encoder over both listings' text, and L3 is an image-aware reranker for selected pairs. All three are trained on LLM-judge labels validated against human annotations. To scale clustering, the graph is split into size-bounded components with a parallelized, score-ordered bounded union-find whose budget is degree-weighted. Within each component, hierarchical agglomerative clustering uses a learned GBDT merge rule built on support, coverage, cohesion and contradiction features, tuned for precision first and trained iteratively on its own policy's decisions.

Written by swe.quest, not by the author.

**Difficulty:** Hard: written for specialists in the field

## Topics

- [Machine learning](https://swe.quest/tags/machine-learning.md) (AI & ML)
- [E-commerce](https://swe.quest/tags/ecommerce.md) (Domains)
- [Vector search](https://swe.quest/tags/vector-search.md) (Data & databases)
- [Algorithms](https://swe.quest/tags/algorithms.md) (Architecture & design)
- [LLMs](https://swe.quest/tags/llms.md) (AI & ML)

## Prerequisites

- embeddings and ANN search ([easy posts on RAG & retrieval](https://swe.quest/tags/rag.md?difficulty=easy))
- gradient boosted trees
- union-find
- hierarchical clustering

## Keywords

Shopify Catalog, UPI, E5, cross-encoder, GBDT, union-find, hierarchical agglomerative clustering

## Related posts

- [Clustering billions of products for agentic commerce with Catalog API](https://swe.quest/articles/clustering-billions-of-products-for-agentic-commerce-with-catalog-api-20619778c8b2f613.md): Shopify Engineering · 2026-06-17 · Medium · 13 min read · LLMs, E-commerce, Vector search, Algorithms, Evaluation
  Shopify's Catalog groups billions of merchant product listings under Universal Product Identifiers (UPIs) using a precision-first pipeline.
- [Evolution of Product Classification at Shopify: From Categories to Comprehensive Product Understanding](https://swe.quest/articles/evolution-of-product-classification-at-shopify-from-categories-to-comprehensive-f7af0d3e764e6a0d.md): Shopify Engineering · 2025-05-08 · Medium · 8 min read · Inference & serving, Machine learning, E-commerce, LLMs, ML platforms
  Shopify's product classification evolved from a 2018 TF-IDF logistic regression model through a 2020 multi-modal classifier to a Vision Language Model system built on the Shopify Product Taxonomy, which covers over 10,000 categories and 1,000+ attributes.
- [Beyond classification: How AI agents are evolving Shopify's product taxonomy at scale](https://swe.quest/articles/beyond-classification-how-ai-agents-are-evolving-shopify-s-product-taxonomy-at-4a4993e179b43e33.md): Shopify Engineering · 2025-10-09 · Easy · 10 min read · AI agents, LLMs, E-commerce, Evaluation
  Shopify maintains its 10,000+ category, 2,000+ attribute product taxonomy with a multi-agent LLM system.
- [Using Rich Image and Text Data to Categorize Products at Scale](https://swe.quest/articles/using-rich-image-and-text-data-to-categorize-products-at-scale-d20fb07ad5fcc987.md): Shopify Engineering · 2021-09-08 · Medium · 12 min read · Machine learning, Model training, E-commerce, Computer vision
  Shopify rebuilt its product categorization model as a multi-task, multi-class neural network that predicts all seven levels of the hierarchical Google Product Taxonomy.
- [Leveraging multimodal LLMs for Shopify’s global catalogue: Recap of expo talk at ICLR 2025](https://swe.quest/articles/leveraging-multimodal-llms-for-shopify-s-global-catalogue-recap-of-expo-talk-at-5a595806db6311fb.md): Shopify Engineering · 2025-07-16 · Medium · 11 min read · LLMs, E-commerce, Model training, Inference & serving, Evaluation
  Shopify's Global Catalogue uses fine-tuned open-source vision LLMs (LLaVA 1.5 7B, then LLaMA 3.2 11B, now Qwen2VL 7B) to classify, extract attributes from, standardize and match billions of merchant product listings.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
