Product matching on a marketplace: what happens under the hood of product comparison

Ivan Mordovets24 Oct 2024

Problem

A marketplace must find the listed product identical to each incoming one, so that category managers and the dynamic pricing team can compare offers. The catalog holds millions of products, and many look almost the same. Different products can have near-identical photos, while one product can have several photos from different angles. Text can mislead too: four T-shirt colors may share one photo.

Example from the article: two photos of one lawn mower from different angles, plus a photo of a different but very similar lawn mower, must be sorted into identical and different.

Solution in brief

Megamarket's matcher retrieves candidates with two models: a ViT image encoder trained with a metric-learning loss, and a BERT-based text bi-encoder trained on category-aware negatives. FAISS returns n candidates, half from each model. A cross-encoder rescores them on text, and CatBoost adds price and category. A per-category threshold and a top-1 pick give the match.

Questions this case answers
  • How to find the single identical item for a query item in a catalog of millions when many different items look and read almost the same
  • How to train an embedding model on images where one entity has several different views and different entities look nearly alike
  • How to build a candidate-then-rerank matching pipeline from two modalities within a fixed GPU budget
  • How to find the identical product in a catalog of millions for every incoming product offer?

Tools and methods

  • ViT with Curricular Face loss — image encoder that separates near-identical products
  • Logistic regression — ranker over image-embedding features
  • BERT-like bi-encoder — text candidate model with cosine similarity
  • Category-tree negatives — hard negatives from the deepest category level first
  • FAISS on GPU — nearest-neighbor search over the catalog
  • Cross-encoder — multilingual BERT-like reranker
  • CatBoost — final model over cross-encoder score, price and category
Continue reading — it's free

Google or a one-time email code. No password.