How we built recommendations, dropped the contractor and made money

Danila Fedyukin21 Mar 2025

Problem

X5 Digital runs online grocery delivery (Pyatyorochka, Perekrestok, Vprok.ru) and bought its recommendations from an external contractor. Integration was slow: after the contractor re-registered as a Russian legal entity, a planned four-week re-integration took almost half a year because feeds and events changed. The team wanted to move three types of recommendations in-house, on the product page and at checkout, without losing conversion: substitutes, complements and personal ranking.

Example from the article: a Vprok.ru order for 8 a.m. is picked at 5 a.m.; if the picker offers a poor substitute for missing green peas, the customer is unhappy.

Solution in brief

Replace the contractor in three iterations, each starting from the simplest method and checked in an A/B test against the contractor. Substitutes came from TF-IDF similarity of product descriptions, complements from association rules over baskets, and personalization from a LightFM model with time-decayed purchase weights. Personal recommendations apply from the third order, with cross-sell as the fallback.

Questions this case answers
  • How to replace an outsourced recommender with an in-house one step by step, starting from the simplest candidate generator and validating each step against the vendor in an A/B test
  • How to decide at which interaction count a personal collaborative model should replace a non-personal fallback when a cold-start threshold must be chosen from offline ranking quality
  • How to replace a contractor's recommendation box with an in-house system without losing conversion?
  • How to recommend substitutes for out-of-stock items in online grocery?

Tools and methods

  • TF-IDF + cosine similarity — item-item substitutes from product data.
  • Association rules (support, confidence, lift) — complementary items from co-purchases in receipts.
  • LightFM — personal user-item model chosen over ALS by NDCG.
  • Exponential time decay — weights older purchases down.
  • PostgreSQL — storage for item vectors and the data mart.
  • A/B test — each step compared with the contractor.
Continue reading — it's free

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