Problem
Yandex Lavka (quick grocery delivery) wanted an assistant that answers food questions and puts products into the answer text. A plain LLM does not know the assortment or stock, and a good ML search returns items that match the query but look wrong inside an answer. Users also try to hack the assistant.
Example from the article: a plov recipe answer got "salt for dishwashers" for "salt" and "a lamb bone for dogs" for "lamb"; a question about "Medoveynik from Lavka" (a cake sold only there) was answered as if it were a typo for honey cake.
Solution in brief
A chain builds the answer: a safety model, a generative LLM, a text splitter that cuts the text into blocks, and NER plus the existing search that attaches products to each block. A second LLM call removes irrelevant products. Products found from the user's query go into the prompt before generation.
Questions this case answers
- How to make a generative assistant attach matching catalog items to its free-text answer without showing wrong matches
- How to cut the latency of an LLM post-filter by shortening what is sent to the model
- How to build an LLM assistant that answers grocery queries and inserts relevant in-stock products into the answer
- How to find food entities in a generated answer and link them to catalog search
Tools and methods
- YaGPT 5 Pro (32B) — generative model and product post-filter, no fine-tuning
- DSSM safety classifier — fast CPU filter of unsafe queries, fine-tuned on own pool
- BoBERT 0.5B token classifiers — text splitter and food NER
- Existing Lavka ML search — tightened toward precision
- LLM and assessor labeling — GPT-4 few-shot labels, assessors for the splitter
- MCP — planned replacement for the fixed pipeline
Google or a one-time email code. No password.
