Fill in the IVF nlist rule of thumb.
nlist ~ sqrt(N). Larger makes centroid comparison dominate per query work; smaller forces each partition to be large and slow to scan.
Imagine sorting a million books into boxes. Too few boxes means each box is huge and you waste time digging through one. Too many boxes means you spend forever picking which box to look in. The sweet spot is when the number of boxes is about the same as the number of books per box, which math says is roughly sqrt(N).
Detailed answer & concept explanation~2 min readEverything 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. 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.
Derive the optimum from T(nlist) = nlist + nprobe * N / nlist. Discuss the 4*sqrt(N) refinement, k-means training cost at scale, and why nprobe (not nlist) is the recall knob.
Real products, models, and research that use this idea.
- FAISS wiki - Guidelines to choose an index lists nlist = sqrt(N) to 16*sqrt(N) depending on recall target and corpus size.
- Milvus IVF index docs recommend nlist starting at 4*sqrt(N) for production, often refined upward.
- Pinecone p2 pods use IVF-PQ internally with nlist tuned around 4*sqrt(N) at their billion-vector scale.
- OpenSearch's IVF implementation defaults to nlist = sqrt(N) and exposes it as a build-time parameter.
What an interviewer would ask next. Try answering before peeking at the approach.
QWhy does the per query work split evenly when nlist = sqrt(N)?
QWhat is the difference between nlist and nprobe?
Don't say thisRed flags and common mistakes that signal junior thinking. Click to expand.
Red flags and common mistakes that signal junior thinking. Click to expand.
Setting nlist proportional to N (linear growth) or treating it as a recall knob; the recall knob is nprobe, and nlist is a structural balance.
The night-before-the-interview bullets. Scan these on the way to the call.
Primary sources. Skim if you want the original framing.
Same topic, related formats. Practice these next.