Retrieval P95 latency tripled after the corpus grew from 1M to 20M vectors — diagnose it
Same topic, related formats. Practice these next.
Same topic, related formats. Practice these next.
After your corpus grew from 1M to 20M vectors, retrieval P95 latency roughly tripled even though query volume is unchanged. Diagnose the likely causes and describe how you would bring latency back down without tanking recall.
Latency tracking corpus size points at the ANN index: params tuned for 1M over-explore at 20M, and the index may have spilled out of RAM. Fix: re-tune to a recall target, shard, quantize — not just bigger hardware.
Imagine a library that grew from one room to twenty rooms overnight, but the same number of visitors come each day. Each visitor now walks much farther to find a book, so the average wait time triples even though nobody new showed up. Two things went wrong. First, the search instructions you wrote for one room — "check these few shelves" — now make people wander far more shelves to be just as sure they found the right book. Second, the catalog that used to sit on the front desk no longer fits, so it got moved to a back basement, and every lookup means a slow trip downstairs. The fixes are to rewrite the search instructions for the bigger building, split the books across several buildings searched at the same time, and shrink the catalog so it fits back on the desk.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.
Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example.
Everything important, quickly.
4 min: localize to the ANN index, walk the stale-params and memory-spill causes, describe the isolation diagnosis, then prioritize re-tune, shard, quantize over buying hardware.
Real products, models, and research that use this idea.
What an interviewer would ask next. Try answering before peeking at the approach.
Red flags and common mistakes that signal junior thinking. Click to expand.
Throwing a bigger box at it without re-tuning — you pay for capacity while the search still over-explores far more candidates than it needs.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.