How search ranking works for millions of Avito listings

Ilya Valyaev30 Sep 2024

Problem

Avito search must rank about 200 million listings for several thousand queries per second and answer in half a second. Results are not precomputed, so a listing posted five minutes ago is already searchable. Buyers, sellers and monetization via promotion services pull in different directions. About 25% of queries carry filters so narrow that the user sees almost nothing or an empty page. Offline ranking metrics do not always match A/B results, so each change needs a slow online check.

Example from the article: a query like "buy a sofa" needs diverse results, while a narrow query with model, region and price range must lead the buyer to a purchase.

Solution in brief

Ranking runs in stages: candidate retrieval from an inverted index, a cheap L1 ranker, a heavier L2 ranker, then promotion. Two CatBoost models (text relevance, deal probability) are trained on features logged in production, and about ten per-listing numbers feed the business heuristics. A change passes three gates: model metrics on logs, an offline replay of production queries, an A/B test.

Questions this case answers
  • How to rank results for a two-sided marketplace under a latency budget of about half a second when the target outcome is only observed through weak proxy signals
  • How to validate a ranking change that interacts with hand-written business rules, when logged data cannot reproduce the final results and offline metrics disagree with A/B tests
  • How to build a multi-stage search ranking pipeline that answers in half a second over about 200 million listings?
  • How to train a deal-prediction ranker when the platform does not reliably know whether a deal happened?

Tools and methods

  • CatBoost — relevance and deal models; faster inference than XGBoost and LightGBM.
  • Toloka — assessor labels for relevance.
  • Sphinx — search engine; its ranking factors supply cheap features.
  • Apache Kafka and Apache Spark — log features and join the target.
  • Offline replay with side-by-side review — checks the model and heuristics together before the A/B test.
Continue reading — it's free

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