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

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

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.

Assumes: text classification basicssentence embeddingsfine-tuning pre-trained models

Related posts

  • Using Rich Image and Text Data to Categorize Products at Scale

    Shopify Engineering mediumAdept

    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.

  • Supercharged Customer Service with Machine Learning

    Hugging Face mediumAdept

    A walkthrough of building a classifier that flags very unsatisfied customer messages by framing the problem as 5-class sentiment text classification. Covers choosing a dataset on the Hugging Face Hub, settling on English Amazon Reviews Multi (1-5 star labels, 200k training examples) over GLUE, Amazon polarity, Tweet eval and Yelp, and choosing a pretrained model by checking GLUE/SuperGLUE leaderboards, landing on microsoft/deberta-v3-base. It then shows code to load and tokenize the data with Datasets and Transformers and fine-tune the model, pushing checkpoints to the Hub.

  • Opinion Classification with Kili and HuggingFace AutoTrain

    Hugging Face mediumAdept

    Kili's annotation platform and Hugging Face AutoTrain combine into an active-learning pipeline that classifies about 40,000 Google Play reviews of the Medium app into Subscription, Content, Interface and User Experience, then applies sentiment analysis to the classified reviews. The walkthrough covers creating a Kili labeling project through the web UI and the Python API, uploading data in batches of at most 100, and flagging changed samples between dataset versions for re-review. It then exports the labels to CSV and trains a model with AutoTrain and a second one without it.

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

  • How we think about text classification in the LLM era

    Medium Engineering mediumAdept

    Medium replaced its aging NSFW story classifier with a prompt-based LLM classifier that runs inside Snowflake Cortex SQL queries. It needs only a human-labelled evaluation set, oversampled to a 50/50 split, plus curator-written guidelines. Mixtral 8x7b matched or beat the legacy model on precision and recall for about $250/month, scoring only distribution-eligible stories. The team judged LLMs a poor fit for its topic and spam models. Topic labels come free from writer tags and let that model adapt to trends, while spam is an adversarial, full-volume workload where a static model and fixed prompt fall behind and costs rise.

The quest for software engineering knowledge.

Look:
Layout: