DIY Retail Catalog Search Now Puts the Right Product First 85% of the Time, Up From 78%
Customers write requests however they like: "klopy bez bura" (roughly, "screws without a drill bit", in slang), or "bolt m6x40" typed with Cyrillic letters, and catalog search gets confused. Raft built a hybrid of BM25 and a fine-tuned embeddinggemma-300m, and trained a CatBoost reranker to tell product type apart from mere number matches. The right product now ranks first 85% of the time, up from 78%. Teams starting a similar project should begin with text normalization and error analysis, not a large model.
AI-processed from Habr AI; edited by Hamidun News
When a customer sends a request for "self-tapping screws 3.5×41 – 1000 pcs" or "screws without a drill bit" (in slang), a manager has to find the right catalog item fast. A DIY retailer's catalog holds tens of thousands of products, and a single wrong digit turns the right product into a useless one. Alexandra, a data scientist at Raft, described on Habr how her team built search for this task and raised the share of queries where the correct product ranks first to 85%. This is the second part of a series; the first covered the whole path from an incoming email to a commercial offer.
Normalization First, Models Second
The main problem with construction goods is that product names are full of numbers and dimensions: M6×40, 100×40×3000. People write them in different ways, and a standard tokenizer splits such strings into different terms, so classic BM25 does not see the match. The team introduced preprocessing for both queries and catalog names:
- the Cyrillic letters for "m" and "x" and the multiplication sign are replaced with Latin m and x;
- a comma in numbers becomes a period ("0,6" → "0.6");
- a number and its unit are separated by a space ("50mm" → "50 mm");
- dimensions are brought to a single format, punctuation is removed, and case is normalized.
The result: with BM25 alone, no embeddings, quality nearly doubled. According to the author, this is the cheapest way to improve the metrics.
Hybrid Search and Fine-Tuning the Embeddings
Next, the team added vector search on top of BM25. General-purpose models gave no gain: they struggle to tell apart products with similar numeric parameters. So the team fine-tuned a model on 124,228 triplets of "query – correct product – similar but wrong product". For example, for a query about a 2×2.5 cable, the "wrong" example was a 2×1.5 cable from the same series. These hard negatives teach the model to look at size, parameters, and brand, not only at the meaning of the name. They used MultipleNegativesRankingLoss via SentenceTransformer, with LoRA where needed.
The first experiment used the large multilingual-e5-large-instruct. On a golden set of 500 queries, the hybrid with it scored 44.5% in top-1 and 88.6% in top-20, better than pure dense search (40.0% and 85.1%) and BM25 combined with a reranker (39.3% and 81.8%). But the model proved too heavy: the system handles thousands of requests a day, and the team wanted to run inference on CPU without a GPU. So they switched to google/embeddinggemma-300m. After several runs with different hyperparameters, Hit Rate top-1 rose to 60%, and the team got about 89% in top-20. The next candidate is Qwen3-Embedding-0.6B, but only if it fits the latency and video memory budget.
A Reranker That Doesn't Confuse a Hammer With Paint
The hybrid was good at finding the right product among twenty candidates but often failed to put it first. For that, the team trained a CatBoost Ranker. The first version made characteristic errors: "hammer 1 kg" turned into 1 kg of paint, and "dowel 6×60" into a 6×60 washer. Secondary attributes (weight, size) matched while the product type was different. For a manager this looks worse than an error in a specification: it is unclear how paint ended up where a hammer should be.
The fix: split the query into a main word (the product type, the head) and a dependent part after prepositions such as "for", "by", "under", "from". In the query "hacksaw for metal", the head is "hacksaw" and "metal" is the qualifier. A head match became a separate feature: if the type does not match, that is a strong negative signal, even when the qualifier matches perfectly. For the head, the team also added semantic similarity, so that an "angle grinder" and its abbreviation "USHM" (the Russian acronym for angle grinder) count as the same product type.
To validate, the team assembled a new golden set of 1,700 queries that was not used in training and introduced the metric number_trap: the share of queries where the top result is a product with a matching number but a different type. Hit@1 rose from 78% to 85%. The final version has 14 features: word overlap (Jaccard and the share of query words found in the product), number match and number proximity, match of the type and dependent words, and the candidate's position in the hybrid results.
What to Take Into Your Own Work
- Start with normalization: it costs almost nothing and gives more than you might expect.
- Hard negatives are needed if numbers and specifications matter in your domain.
- For the reranker, devise a metric for your most painful error, like number_trap.
- Draw features from analysis of real errors.
Some limitations apply. The 60% and 85% figures come from different golden sets (500 and 1,700 queries), so they cannot simply be subtracted from each other. The results are tied to one catalog and one language, and the authors compared models on their own data. Still, the recipe itself — normalization, fine-tuning a small model on a CPU budget, and a reranker built on understandable features — transfers to any catalog where the digits in a name decide everything.
- Nov 24, 2026Canva opens its editor to AI agents: nearly 500,000 people have come in via MCP
- Nov 24, 2026Author builds two Gemini scripts: logos in frames get caught, face drift doesn't
- Nov 24, 2026TikTok Rolls Out Worldwide Face Protection Against Deepfakes and AI Video Checker
- Nov 24, 2026Datasette Agent Learns to Draw Charts From a Text Prompt in Chat
Key Questions Answered
What are the key details on Normalization First, Models Second?
The main problem with construction goods is that product names are full of numbers and dimensions: M6×40, 100×40×3000. People write them in different ways, and a standard tokenizer splits such strings into different terms, so classic BM25 does not see the match.
What are the key details on Hybrid Search and Fine-Tuning the Embeddings?
Next, the team added vector search on top of BM25. General-purpose models gave no gain: they struggle to tell apart products with similar numeric parameters. So the team fine-tuned a model on 124,228 triplets of "query – correct product – similar but wrong product". For example, for a query about a 2×2.5 cable, the "wrong" example was a 2×1.5 cable from the same series. These hard negatives teach the model to look at size, parameters, and brand, not only at the meaning of the name.
What are the key details on A Reranker That Doesn't Confuse a Hammer With Paint?
The hybrid was good at finding the right product among twenty candidates but often failed to put it first. For that, the team trained a CatBoost Ranker. The first version made characteristic errors: "hammer 1 kg" turned into 1 kg of paint, and "dowel 6×60" into a 6×60 washer. Secondary attributes (weight, size) matched while the product type was different. For a manager this looks worse than an error in a specification: it is unclear how paint ended up where a hammer should be.
Test Frontier LLMs & Autonomous Agents in One Workspace
Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.