Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Shopify Engineering 12 min read Case study mediumAdept

Using Rich Image and Text Data to Categorize Products at Scale

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. Multilingual BERT text embeddings and MobileNet-V2 image embeddings feed stacked hidden layers, with each level's output passed into the next level's prediction. Training combines the seven per-level losses with weights and uses class weights to handle imbalance, without forcing child predictions to match the parent. At inference, a Keras subclass model walks the taxonomy and only considers descendants of the chosen parent, and per-level confidence thresholds are hand-tuned for sensitive categories. The 250M-parameter model, trained with data-parallel distributed TensorFlow on GCP, raised leaf precision by 8% and nearly doubled coverage.

Assumes: neural network classificationtransfer learningprecision and recall

Related posts

  • Evolution of Product Classification at Shopify: From Categories to Comprehensive Product Understanding

    Shopify Engineering mediumAdept

    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. 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.

  • Cross-store product clustering across millions of stores

    Shopify Engineering hardMaster

    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.

  • Data-Centric Machine Learning: Building Shopify Inbox’s Message Classification Model

    Shopify Engineering mediumAdept

    Shopify Inbox's message classifier improved from ~70% to ~90% accuracy, and from ~35% to ~80% high-confidence coverage, by investing in better training data rather than model tweaks. The v1 prototype used Universal Sentence Encoder embeddings with UMAP/HDBSCAN clustering and semi-supervised labeling on 40,000 examples. For v2, the team fine-tuned DistilBERT on 20,000 human-labeled messages. Those labels came from a 45-topic taxonomy built with support advisors and domain experts, refined through inter-annotator agreement exercises, and scrubbed of personal information with Presidio and Faker. Model predictions were then used to surface underrepresented topics for further annotation.

  • Leveraging multimodal LLMs for Shopify’s global catalogue: Recap of expo talk at ICLR 2025

    Shopify Engineering mediumAdept

    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. 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.

  • Clustering billions of products for agentic commerce with Catalog API

    Shopify Engineering mediumAdept

    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.

The quest for software engineering knowledge.

Look:
Layout: