Preparing your design workspace

Loading the problem and your latest saved attempt…

Design Hierarchical Product Category Classification

Place merchants' products in a three-level taxonomy with confidence-based depth, serve suggestions in the editor and categories to search and feeds, respect merchant choices, and evaluate and launch new models safely.

Problem statement

Design the machine learning system that places every product in a multi-level product taxonomy, and plan its launch and evaluation.

For this exercise, assume an e-commerce platform where independent merchants create and edit their own products: a title, a description, images, variants and the merchant's own free-text product type and tags. The platform owns one product taxonomy with three levels, for example Apparel > Shoes > Running Shoes.

Search filters, browsing pages and product feeds sent to other sales channels read each product's category, so a wrong category hides a product from shoppers who would want it.

For this exercise, also assume: - A merchant may pick a category in the product editor. While the merchant edits, the editor shows suggested categories, and the merchant can accept one or choose another. - A category chosen by a merchant, or set by the platform's own reviewers, is never overwritten by the model.

- The catalog team's targets: at least 90% of the third-level categories the system assigns are correct, and a third-level category is assigned to at least 75% of products. When the system is unsure, it assigns only the first or second level rather than guess.

- The taxonomy changes a few times a year: categories are added, split, merged or retired, and each change is a new taxonomy version.

Training the image and text encoders from scratch, the merchant-facing editor interface, and how other sales channels map the taxonomy to their own are out of scope.

What to build

  1. When a merchant creates or edits a product, the system assigns a category path in the current taxonomy, as deep as it is confident (first, second or third level), with a confidence for each level.
  2. In the product editor the merchant sees suggested categories while editing and can accept one or choose another; a merchant's or reviewer's choice is never replaced by the model.
  3. A new model's quality is known at each level before it changes what merchants and readers see, and a bad model can be undone.
  4. When the taxonomy adds, splits, merges or retires categories, affected products move to the new version, and every reader can tell which taxonomy version a product's category belongs to.

At scale

  • For this exercise, assume about 200 million active products from independent merchants; about 2 million products are created or edited each day, and one merchant's bulk import can add 100,000 products in a few minutes.
  • For this exercise, assume the taxonomy has about 25 first-level, 500 second-level and 5,000 third-level categories; products are very unevenly spread, and about 30% of third-level categories have fewer than 100 labeled products.
  • For this exercise, assume suggestions must appear in the editor within 1 second at p95, a saved product must have its category within 10 minutes at p95, and re-classifying every product after a model or taxonomy change must finish within 3 days.
  • For this exercise, assume merchants pick a category themselves for about 40% of products and about one in five of those picks is wrong; an in-house labeling team can check about 3,000 products a day.