Automated Product Classification and Attribute Extraction Using Vision LLMs

shopify · E-commerce · year n/a · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: E-commerce product taxonomy and enrichment

Shopify needed to infer reliable product categories and attributes from flexible merchant listings at very large scale so downstream taxes, search, recommendations, compliance, and merchandising systems could use structured product data.

Constraints:

Architecture

Shopify first built a controlled product taxonomy with about 12,000 categories and finite attribute values. The classification pipeline then uses a two-step vision-LLM process: first, image and product text produce a category plus product/image metadata; second, the predicted category determines which controlled attributes are injected into a prompt for extraction. Hallucinated categories are corrected post hoc through nearest real-category lookup rather than constrained grammar. To make the system affordable at tens of millions of daily predictions, Shopify builds synthetic golden datasets with GPT/Claude/Gemini agreement and human validation, fine-tunes smaller models, evaluates with Ray/SGLang over about 2 million records, and serves through both low-latency Kubernetes/LM Deploy paths and high-throughput Kafka/Dataflow/Triton-style batching.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  merchant-product-listing[Merchant product listing] --> category-prediction-model[Category prediction model]
  shopify-product-taxonomy[Shopify product taxonomy] --> category-prediction-model
  category-prediction-model --> post-hoc-taxonomy-matcher[Post-hoc taxonomy matcher]
  post-hoc-taxonomy-matcher --> shopify-product-taxonomy
  category-prediction-model --> attribute-extraction-model[Attribute extraction model]
  shopify-product-taxonomy --> attribute-extraction-model
  synthetic-label-pipeline[Synthetic label pipeline] --> fine-tuning-infrastructure[Fine-tuning infrastructure]
  fine-tuning-infrastructure --> evaluation-pipeline[Evaluation pipeline]
  attribute-extraction-model --> real-time-serving-path[Real-time serving path]
  attribute-extraction-model --> high-throughput-batch-path[High-throughput batch path]
  real-time-serving-path --> merchant-feedback-queue[Merchant feedback queue]
  merchant-feedback-queue --> synthetic-label-pipeline
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Merchant product listing Provides product image, title, description, and merchant-entered product-type information. Category prediction model
Shopify product taxonomy Defines controlled categories, attributes, and finite values for product classification. Category prediction model, Attribute extraction model
Category prediction model Uses product image and text to predict taxonomy category and related metadata. Merchant product listing, Post-hoc taxonomy matcher, Attribute extraction model
Post-hoc taxonomy matcher Maps hallucinated category strings to the closest valid taxonomy category. Category prediction model, Shopify product taxonomy
Attribute extraction model Extracts category-specific attributes from controlled value lists into structured JSON. Category prediction model, Shopify product taxonomy, Real-time serving path, High-throughput batch path
Synthetic label pipeline Uses GPT, Claude, Gemini, and human annotators to create category and attribute fine-tuning data. Fine-tuning infrastructure
Fine-tuning infrastructure Runs model training with SkyPilot, Hugging Face artifacts, and experiment tracking. Synthetic label pipeline, Evaluation pipeline
Evaluation pipeline Uses Ray, actor pools, SGLang, and hierarchical metrics to evaluate models over large datasets. Fine-tuning infrastructure
Real-time serving path Serves low-latency merchant-facing predictions from Kubernetes/LM Deploy. Attribute extraction model, Merchant feedback queue
High-throughput batch path Processes API and bulk-created products through Kafka/Dataflow and batched inference. Attribute extraction model
Merchant feedback queue Collects merchant corrections and routes them through vetted human/LLM review before model use. Real-time serving path, Synthetic label pipeline

Data flow

Merchant product images, titles, and descriptions enter a vision-LLM category predictor. The category is validated against Shopify's taxonomy and used to select relevant controlled attributes. A second LLM call extracts category-specific attributes into structured JSON. Synthetic labels from multiple frontier models plus human annotators create fine-tuning data, while merchant corrections and human/LLM vetting feed ongoing evaluation. Predictions are served either directly in the admin UI or through high-throughput Kafka/Dataflow batch pipelines for API and bulk-created products.

4 supporting quotes
“but the first step is I give it an I give it the image of the product I give it the the details of the text and the”transcript, stated
“to predict the category and then once I you know the category then I ask it to predict the rest of the attributes now”transcript, stated
“the attributes are dependent on the category right and I want to inject into my prompt the specific attributes that are only relevant for that category”transcript, stated
“here we built a data flow pipeline Kafka in Kafka out right so something writes into Kafka saying hey this product needs”transcript, stated

Why this architecture

Shopify split category prediction from attribute extraction because attributes are category-specific; a t-shirt and a screwdriver need different prompts and value sets. The taxonomy constrains a previously unbounded merchant vocabulary into about 12,000 categories and finite attribute values. Fine-tuning smaller models is necessary because frontier vision LLMs are too expensive for tens of millions of daily predictions. The serving architecture splits real-time UI predictions from high-throughput batch/API inference because each path optimizes for different latency and batching needs.

4 supporting quotes
“looked at that product type and there are tens of millions of unique things that are in that product type right so”transcript, stated
“right like there's like 12,000 or so categories in our system usually it's like 50 or so categories that dominate all sales and”transcript, stated
“the kind of attributes that you would have for a t-shirt for example neck neck cut and sleeve length and whatever make no sense”transcript, stated
“sneak peek into 10 minutes from now the volume of what we have to use this for is in the tens of millions every day”transcript, stated

Models used: vision LLMs · GPT · Claude · Gemini · fine-tuned smaller models · multilayer perceptron baseline

Scale

Alternatives considered (roads not taken)

Ask merchants to select standardized categories

Rejected because: Merchants ignored the request because it added workflow friction and did not directly help them.

“cool uh why not why don't we just ask the merchants we can ask them what this is and we can give them a standardized list of things and say select from this”transcript, stated
“could we did and most Merchant will just ignore you right they're kind of like this doesn't help me I'm just going to”transcript, stated

Use real-world distribution for training data

Rejected because: Dominant categories would hide poor long-tail performance, so Shopify intentionally enforces a uniform training distribution.

“question um in fact we intentionally do not mimic re uh real world distribution in our training data set right because if”transcript, stated
“almost we artificially enforce a uniform Distribution on our training data set and so training training uh distribution”transcript, stated

Constrained grammar for taxonomy-valid categories

Rejected because: Grammar enforcement hurt more than it helped, so the team allowed hallucinations and corrected them with post-hoc lookup.

“you could enforce grammar and at the time of like inference you kind of like selectively mask off certain Logics”transcript, stated
“where we ended up with we tried to do the uh the grammar it actually hurt us more than it helped us and then we were”transcript, stated

Use GPT-4-class models directly for all predictions

Rejected because: Frontier model quality was attractive but cost was too high for production volume.

“I could use if gp4 was free for me guess what like I don't have a job I can just use gp4 right but it isn't free and I”transcript, stated

Patterns

structured-output-contract (output-control)

The model emits category and attribute predictions against controlled taxonomy values as structured JSON.

“we had like very structured output we wanted very structured output”transcript, stated
“it's the same structure Json output”transcript, stated

synthetic-data-generation (data)

Shopify uses GPT, Claude, Gemini, and LLM agreement to generate category and attribute labels before human validation.

“I do that with GPT I do that with Claude I do that with Gemini and then I take the intersection of those things”transcript, stated

fine-tuning-adaptation (model-operations)

The team fine-tunes smaller models from synthetic/human-validated datasets to manage cost and quality at scale.

“once you're satisfied with that guess what you now have a data set that you can use for fineing that's what we did”transcript, stated

cost-aware-routing (operations)

Shopify adds caching, trigger logic, and separate low-latency/high-throughput inference paths to reduce production cost.

“we added caching layers and we we basically added a bunch of business logic around when does it even make sense to make predictions”transcript, stated

human-in-the-loop-gate (governance)

Human annotators validate synthetic data and merchant feedback before it becomes training signal.

“we sample some of that and we send it to human annotators and we go hey can you check the work of these llms”transcript, stated
“it has to go through some level of wetting on our side and that is both human as well as llm wetting”transcript, stated

Tradeoffs

Use a two-call category-then-attribute pipeline

Chose category prediction followed by category-specific attribute extraction over one prompt that extracts every possible attribute at once.

Rationale: Only the known category tells the model which controlled attributes and values are relevant.

“the attributes are dependent on the category right and I want to inject into my prompt the specific attributes”transcript, stated

Fix hallucinated categories after inference

Chose post-hoc nearest taxonomy lookup over grammar-constrained decoding.

Rationale: Constrained grammar hurt performance, while post-hoc correction handled rare invalid category outputs.

“we tried to do the uh the grammar it actually hurt us more than it helped us”transcript, stated
“let's just fix it post”transcript, stated

Separate real-time and high-throughput serving paths

Chose low-latency UI serving plus Kafka/Dataflow batch inference over one inference path for all product creation modes.

Rationale: Merchant UI changes need quick responses, while API/bulk creation is throughput-sensitive and benefits from large batches.

“there were actually two different modes in which this thing had to run one it had to run realtime low latency”transcript, stated
“there it's less latency sensitive but it is high high throughput”transcript, stated

Do not automatically train on all merchant feedback

Chose feedback queue with human and LLM vetting over direct merchant-feedback ingestion into training.

Rationale: Some corrections are contextual or subjective, and some product-category mistakes have legal or safety consequences.

“we do not automatically take Merchant feedback and incorporate them into the model”transcript, stated
“for example a gun what's a gun and what's an airsoft like what what's a real gun versus what's an airsoft gun versus a toy gun”transcript, stated

Gotchas (what bit them)

Merchant-provided product types are too unconstrained for ML targets.

Root cause: Merchants can name and organize products however they want, creating tens of millions of unique product-type values.

Resolution: Build and govern a product taxonomy with controlled categories, attributes, and finite values.

“the merchant can say whatever they want to say there”transcript, stated
“we've created a taxonomy of both categories and attributes”transcript, stated

Vision LLMs can hallucinate invalid taxonomy categories.

Root cause: The model can output a plausible category string that does not exist in the controlled taxonomy.

Resolution: Apply a post-hoc phase/index lookup to map outputs to the closest real category; this occurs less than 2% overall.

3 supporting quotes
“that particular line of category doesn't exist”transcript, stated
“we take the answer as the model gives us and then we kind of just do a phase index lookup”transcript, stated
“it happens less than 2% of the time uh overall”transcript, stated

Merchant feedback is not always ground truth.

Root cause: Some attributes such as color or regulated product categories are subjective or high-stakes, so merchant corrections can be ambiguous.

Resolution: Queue feedback for human and LLM vetting instead of automatically training on every merchant correction.

“we do not automatically take Merchant feedback and incorporate them into the model”transcript, stated
“it has to go through some level of wetting on our side and that is both human as well as llm wetting on top of it”transcript, stated

Training distribution and serving distribution intentionally diverge.

Root cause: Real-world product volume is dominated by about 50 common categories, but optimizing only for those would hurt long-tail category quality.

Resolution: Train on an artificially uniform category distribution while accepting serving skew in production.

“usually it's like 50 or so categories that dominate all sales and everything else is like this long tail”transcript, stated
“we artificially enforce a uniform Distribution on our training data set”transcript, stated

Evaluation

Shopify evaluates with large offline datasets, hierarchical precision/recall, baselines against an existing neural-network classifier, merchant accept/correct/delete signals, and separate continuous human annotation.

Metrics: about 2 million evaluation records · precision and recall · hierarchical precision and recall · merchant correction/accept/delete signals · human-annotator evaluation · long-tail category performance under uniform training distribution

3 supporting quotes
“our evaluation data set is about 2 million records”transcript, stated
“you have your Precision recall this is a hierarchical problem so you have hierarchical Precision hierarchical recall”transcript, stated
“we do have a separate continuous process of human evaluation we have our own annotators annotating and evaluating our predictions”transcript, stated

Outcomes

The system handles tens of millions of daily predictions across a taxonomy of about 12,000 categories, with evaluation over about 2 million records.

3 supporting quotes
“compared to the Bas line that's how it looked like it was there was clear Improvement like it is better”transcript, stated
“search and recommendation system taxes legal compliance right like there's a bunch of like it is a foundational data piece within Shopify”transcript, stated
“we've seen Merchants adopted we've seen Merchants give us feedback”transcript, stated