How we built an alternative product matching system at X5 Digital: experience, pitfalls and results

Danila Fedyukin19 Dec 2025

Problem

A grocery retailer needs to know which of its products are the same as, or closest to, products sold on the market, because the matches drive pricing and assortment decisions. An outside contractor did this work, but fixing its errors was slow, and private-label and ready-to-eat items still needed manual mapping. The team set two quality metrics, coverage of the assortment by matches and match accuracy, and two load targets: 20 million products in three days and at least 77 RPS for the whole pipeline.

Example from the article: names that mention 200 ml and 100 ml contradict each other, so the candidate is dropped without running the model.

Solution in brief

Treat matching as search. Embed the market product, retrieve 10 nearest candidates from a vector index of the company assortment, and score each pair with a classifier. Scoring was too slow, so rules on numbers and tokens settle the obvious pairs first. On GPU, several uvicorn workers share one MIG slice.

Questions this case answers
  • How to link items from an external catalog to an internal catalog at high volume when brand and identifier fields are missing or unreliable
  • How to raise inference throughput of a text model on a fixed hardware slice that can host only one pod
  • How to match our products to competitor products at a scale of 20 million items in three days without paying an outside vendor?
  • How to match non-branded goods such as private-label and ready-to-eat food automatically?

Tools and methods

  • E5-small — encoder that won the recall@k comparison
  • FAISS with HNSW and an ID map — vector index that returns product IDs
  • BERT and CatBoost — candidates for the pair classifier; the neural model separates better
  • Rule-based pre-filter — number and token comparison: sure match, sure non-match, or no answer
  • ONNX, FastAPI, uvicorn workers — serving, scaled by processes
  • NVIDIA MIG — GPU partitioning that forced multiprocessing
Continue reading — it's free

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