Optimizing Marketplace Operations with Language Models

Anastasia Yanina25 May 2024

Problem

Most queries in Wildberries search are served by presets: hard-coded result lists, in effect a dictionary from a query to products, refreshed almost daily. Complex queries match no preset. The team wants to split such a query into several simple presets and answer online in 50–100 ms for 99% of requests. The first versions took from 500 ms to 2–3 seconds. Numbers in a query also pulled results toward presets with the same numbers, and the model misread some Russian abbreviations.

Example from the article: "I want to cook lasagna" should map to the presets "lasagna recipes", "lasagna" and "for cooking lasagna"; "I want fish or meat for dinner" should map to "fish" and "meat".

Solution in brief

Fine-tune multilingual E5-large on open Russian and English pair data plus internal marketplace data, so that one encoder serves search, support and duplicate detection. For search, match the query to presets by E5 similarity, re-rank with NLI, and compress the preset index with IVFPQ quantization to meet the latency budget.

Questions this case answers
  • How to decompose a complex free-text query into several simple predefined queries and retrieve their results within a sub-100 ms latency budget
  • How to fine-tune one multilingual text encoder with contrastive pairs and check it against its base model on open and internal benchmarks, for search and duplicate detection
  • How to map a complex marketplace search query to several simple presets with under 100 ms online latency
  • How to build one fine-tuned text encoder for search, support and duplicate detection in a Russian-language store

Tools and methods

  • multilingual E5-large — base encoder, fine-tuned on open and internal data
  • NLI re-ranking — cleans up the preset candidates that E5 returns
  • IVFPQ (inverted file with product quantization) — compressed index for fast nearest-neighbor search
  • MTEB, encodechka, RuBQ, internal benchmarks — offline checks of the encoder
  • OpenChat-3.5 — LLM fine-tuned for product-support answers
Continue reading — it's free

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