Free · Daily brief + weekly playbookDaily 60-sec AI Voice Brief + Weekly Production AI Agent PlaybookGet the brief →
ReleaseInsight · On RadarHabr: Ozon Tech→ original

Ozon trains a small model to generate search suggestions within 300 ms

Search suggestions on Ozon have to appear within 300 ms, or the user notices the lag. They used to be picked from a prebuilt index and ranked with gradient boosting, but rare queries and typos like Adibas hit a ceiling. Now a compact transformer with hundreds of millions of parameters completes the query using clicks, filters and past queries. Takeaway: a small model is enough for search, as long as filters and result checks surround it.

AI-processed from Habr: Ozon Tech; edited by Hamidun News
Ozon trains a small model to generate search suggestions within 300 ms
Source: Habr: Ozon Tech. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr: Ozon Tech ↗
Editor-in-Chief
InferenceTensorRT-LLM on a GPU cluster, tens of thousands of requests per second
Two training stagespretraining on event chains, then fine-tuning for suggestions
Output filtersban lists, a check that results are non-empty, duplicate removal

You type "cross" into the search bar, and a moment later "nike sneakers", "running sneakers" and "kids' sneakers" appear beneath it. Ozon has 300 milliseconds for all of this. If the system thinks longer, the user sees a "freeze" and finishes the query by hand. The search team described how it approached this limit from the other side: it stopped selecting suggestions from a ready-made list and started generating them.

Why the classic setup hit a ceiling

For a long time, suggestions were built the way recommender systems work. First comes retrieval: candidates are pulled by prefix from a prebuilt index. Then gradient boosting over decision trees ranks them by relevance, popularity and other features. The setup is stable and predictable, which is why many large search engines use it.

But it has three weak spots. First, the system chooses only from what it already knows: nobody will suggest "purple sneakers with unicorns and sequins" if no such query exists in the index. Second, prefix search handles typos poorly: Adibas and Adidas are nearly the same thing to a human, but not to an index. Third, quality is capped by features that engineers came up with. Every new signal requires manual work, and complex patterns, such as rare but regular purchases, do not fit into a fixed set of factors. The index gets more expensive, and new features deliver less and less.

How the generative model works

Ozon did not take an off-the-shelf LLM. Marketplace language consists of brands, SKUs, abbreviations and transliteration such as "iphone 17 pro" or "powerbank 20000" (typed in Cyrillic), and a ready-made model does not know how these words relate to shopper behavior on a specific platform. So the team trained a compact decoder-only transformer with a few hundred million parameters. Instead of ordinary text, it receives a sequence of actions: queries, clicks, views, filter actions and add-to-cart events.

Training runs in two stages:

  • Pretraining on chains of user events. A chain can include about a hundred actions and span months. The loss is computed over all tokens, and the model learns the platform's general language: which queries follow one another, and how typos and spelling variants lead to the same products.
  • Fine-tuning for suggestion generation. The context and an incomplete prefix serve as the condition, and the loss is computed only over the tokens of the target suggestion. For example, after a query about a Samsung tablet, a memory filter and a click on the Galaxy Tab S11 Ultra, the target is "case for samsung galaxy tab s11 ultra".

Several options in the response come from beam search, which keeps multiple likely continuations at once. The team started with "taptags", short continuations of the query. These are closer to a language model's native task and less noisy than full suggests, which must lead straight to a good results page. Full suggestions are the next step.

Control and production

Generation removes the control the index provided: a suggestion from a database can be checked and banned in advance, but a generated phrase cannot. The risks are quite practical: clumsy grammar, duplicates like "nike men's sneakers" and "men's sneakers nike", extra continuations for an already complete query, profanity from user logs, and attractive suggestions that return no products.

Ozon covers these at two levels. Before launch, it computes an offline metric called expected actions count. It shows how many actions a user needs to reach the target query that was followed by a useful action, such as adding to the cart. Typo-correction quality is measured separately. This does not replace A/B tests, but it reflects the user scenario better than "did the suggestion match the log". At inference time, ban lists and regular expressions run, a result-size check filters out suggestions with empty results, and logical duplicates are removed.

For inference, the team uses TensorRT-LLM on a GPU cluster. Requests are balanced across several GPUs and assembled into batches, which allows tens of thousands of requests per second within the 300 ms limit.

The first iterations were modest. Basic generation of short continuations and then multi-word suggestions raised CTR but barely moved conversion metrics. So a rise in clicks does not yet mean users buy faster. The third step addressed typos: the training set was supplemented with organic corrections from the spell-checker and synthetic errors based on the statistics of real typos. The team also added a special correction token so the model can not only complete a query but also fix the part already typed.

For search developers, the takeaway is this: a small domain model with session history can replace the "index plus ranking" pairing, but only together with strict post-processing and a metric tied to the user's path. The provided excerpt of the material contains no final figures for business-metric gains, so it is too early to judge the final effect from it. The architecture and the list of pitfalls, however, can be used as a checklist.

Story

Key Questions Answered

Why the classic setup hit a ceiling?

For a long time, suggestions were built the way recommender systems work. First comes retrieval: candidates are pulled by prefix from a prebuilt index. Then gradient boosting over decision trees ranks them by relevance, popularity and other features. The setup is stable and predictable, which is why many large search engines use it. But it has three weak spots.

How the generative model works?

Ozon did not take an off-the-shelf LLM. Marketplace language consists of brands, SKUs, abbreviations and transliteration such as "iphone 17 pro" or "powerbank 20000" (typed in Cyrillic), and a ready-made model does not know how these words relate to shopper behavior on a specific platform. So the team trained a compact decoder-only transformer with a few hundred million parameters. Instead of ordinary text, it receives a sequence of actions: queries, clicks, views, filter actions and add-to-cart events.

What are the key details on Control and production?

Generation removes the control the index provided: a suggestion from a database can be checked and banned in advance, but a generated phrase cannot. The risks are quite practical: clumsy grammar, duplicates like "nike men's sneakers" and "men's sneakers nike", extra continuations for an already complete query, profanity from user logs, and attractive suggestions that return no products. Ozon covers these at two levels. Before launch, it computes an offline metric called expected actions count.

ZK
Zhemal Khamidun — Head of AI at Alpina Digital · MIPT (academic supervisor of the Tech Entrepreneurship department). Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

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.

Try Nomad AI →Launch Nomad Agent
Jemal Hamidun

Editor-in-chief · Cite this analysis

Jemal Hamidun

Head of AI at Alpina Digital · Academic Supervisor of the Tech Entrepreneurship Department at MIPT

Head of AI & CPO of AlpinaGPT at Alpina Digital, Academic Lead of Tech Entrepreneurship at MIPT. Founder of Hamidun News and Vibe Academy.

Ready-to-paste citation for journalists, blogs and Telegram channels

Source: Hamidun News — Ozon trains a small model to generate search suggestions within 300 ms https://news.hamidun.com/en/news/16915/ozon-trains-a-small-model-to-generate-search-suggestions-wit

What do you think?
Loading comments…