Clustering billions of products for agentic commerce with Catalog API
Shopify's Catalog groups billions of merchant product listings under Universal Product Identifiers (UPIs) using a precision-first pipeline. It sets a hard precision threshold and maximizes recall under it, because a wrong merge is worse for buyers than a missed variant. A singleton detector parses Liquid theme code and resolves most shops deterministically. The remaining catalogs are pre-chunked with HNSW/FAISS nearest-neighbor graphs and sparse UPGMA average linkage (distance threshold 0.25, max 200 products per chunk). A two-stage LLM pipeline then extracts brand and model strings using a 'core value proposition' test, and a second critique pass flags outliers in each proposed cluster. Dynamically generated strict JSON schemas, with one required property per product ID, guarantee every product is labeled without skips or malformed output.
Related posts
- Cross-store product clustering across millions of stores
Shopify Engineering hardMasterShopify 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.
- Beyond classification: How AI agents are evolving Shopify's product taxonomy at scale
Shopify Engineering easyNoviceShopify maintains its 10,000+ category, 2,000+ attribute product taxonomy with a multi-agent LLM system. One agent analyzes the taxonomy's structure and another analyzes real merchant product data. A synthesis step merges their proposals, and an equivalence-detection agent finds cases where a specific category equals a broader category plus attribute filters (e.g., Women's Golf Shoes = Athletic Shoes + Activity Type=Golf + Gender=Women). Change-type and domain-specific LLM judges filter proposals before human review, as in a MagSafe-compatible attribute approved at 93% confidence. A Telephony pilot compressed what would have been years of manual expansion into weeks.
- Evolution of Product Classification at Shopify: From Categories to Comprehensive Product Understanding
Shopify Engineering mediumAdeptShopify'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. A Dataflow pipeline makes two dependent calls to a VLM service (currently Qwen2VL 7B with FP8 quantization, served via NVIDIA Dynamo on Kubernetes with in-flight batching and KV caching): one predicts the category, the other predicts category-specific attributes, and both must succeed. Training data comes from multiple LLM annotators, with judge models arbitrating disagreements and humans reviewing edge cases. The system handles over 30 million predictions a day, merchants accept 85% of predicted categories, and hierarchical precision and recall doubled compared with the earlier neural approach.
- Leveraging multimodal LLMs for Shopify’s global catalogue: Recap of expo talk at ICLR 2025
Shopify Engineering mediumAdeptShopify'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. The system has four layers: streaming product data with change data capture, multi-task product understanding, graph-based product matching (LSH and embedding candidates, discriminator edge pruning, connected components) and canonical record reconciliation. Training each model to predict a randomly selected subset of fields kept it generalizable and cut median latency from 2s to 500ms and GPU usage by 40%. LLM-agent annotation with an LLM arbitrator, instruction-following eval metrics and active learning driven by low token probabilities support 40M inferences a day on Triton with FP8 quantization.
- Understanding Etsy’s Vast Inventory with LLMs
Etsy Code as Craft mediumAdeptEtsy extracts structured product attributes such as color, material and dimensions from unstructured listing titles, descriptions and photos using LLMs. It does this because sellers rarely fill optional attribute fields, and passing raw text and images into search would add too much latency. The pipeline injects per-listing JSON context (listing data, expert-picked few-shot examples, taxonomy rules) into parallel prompts routed through LiteLLM across regions, then validates outputs with Pydantic. Evaluation moved from error-prone human labels to expert-reviewed "silver labels" from frontier LLMs, and each run first scores a ground-truth sample and aborts if precision or recall drift from baseline. In target categories, complete attribute coverage rose from 31% to 91%, and LLM-inferred attributes in search filters raised filter engagement and conversion.