Swiggy
Medium
How would you prove that AI search is better than keyword search? Which offline and online metrics would you use?
This is an experimentation question. Not a "show me the demo" question. AI search costs more per query, so it has to prove it wins where it matters and doesn't lose where keyword search is already good.
Step 1. Clarifying Questions
- Which search? Assume Swiggy food search.
- What is AI search here? Assume LLM query understanding plus semantic retrieval, compared with today's keyword search with spelling correction.
- Replace or blend? Assume we are deciding whether to replace.
Why it matters: keyword search is strong on head queries like "biryani" or a restaurant name. AI search adds latency and inference cost. If it only wins on 10% of queries, a blend may beat a full switch.
Step 2. Hypothesis
AI search wins on long-tail and descriptive queries ("something light for dinner", "paneer wala kuch"), ties on head queries, and risks losing on latency.
Step 3. Segment queries first
- Head: dish or restaurant names, most of the volume (assume ~70%, illustrative)
- Torso: dish plus modifier ("veg biryani near me")
- Tail: descriptive, Hinglish, misspelt
Every metric below is read by segment. An average hides the story.
Step 4. Offline evaluation
- Golden set: a few hundred queries per segment from logs, with results graded 0 to 3 by trained raters.
- Metrics: NDCG@10, Recall@K, MRR, zero-result rate, and hard constraint violations (non-veg shown to a veg filter, over budget).
- LLM as judge to scale labelling, checked against human labels first.
- Gate: AI must be equal or better on head and clearly better on tail before going online.
Trap: click logs from the keyword system carry position bias. Don't treat them as clean labels.
Step 5. Online evaluation
- A/B test randomised by user, 2 to 4 weeks, to get past novelty.
- Primary: search-to-order conversion.
- Secondary: zero-result rate, reformulation rate, search abandonment, time to first add-to-cart, average click position.
- Guardrails: p95 latency, cost per search, average order value, share of orders going to big chains (does the new ranking starve small restaurants?).
- Interleaving: mix results from both rankers in one list and see which gets the clicks. It needs far less traffic than an A/B test and is good for quick ranking calls.
Step 6. The long-term trap
Users have learnt to type short keywords because that is what works. AI search's value may grow as they learn to type naturally. Track the share of descriptive queries over a few months, not just week one.
Step 7. Decision
- Wins on tail, flat on head, latency in budget: ship.
- Wins on tail, loses on head or latency: route by query type. Keyword for head, AI for the rest.
- No online lift despite offline wins: the offline labels don't reflect what users want. Fix the eval set before trying again.
Interview tip: say "offline tells you if it is better, online tells you if it matters". Then show a decision rule for each outcome.
Community Answers (0)
No answers yet. Be the first to share your approach!