Zenaique

Predict the shape of recall and latency on an IVF index of 10M vectors as nprobe sweeps from 1 to 50.

Predict output·Medium·4.0 · 0·~2 min·Asked atDatarobotLinkedinPinecone·Relevant atNVIDIA
Attempt it
You have an IVF index over 10M 768-dim vectors, with nlist = 4096. You measure recall@10 and average query latency while sweeping nprobe across {1, 4, 16, 32, 50}. Predict the qualitative shape of both curves.
TL;DR

Recall climbs steeply then plateaus near ~0.95 by nprobe ~32; latency rises linearly. Pick the smallest nprobe that hits your recall SLO; everything past that is wasted CPU.

Memory aid
Sign in to see the mnemonic that makes this stick.
Easy to grasp

An IVF index is like a library where every book has been presorted into one of 4096 themed rooms. When you walk in with a query, you don't search every room; you only open the few rooms whose theme is closest to what you want. **nprobe** is how many rooms you open. Open 1 room: you might miss the book if it ended up in a neighboring room. Open 16 rooms: you almost always find what you want. Open 50 rooms: you waste a lot of time walking through rooms whose contents you didn't need. The catch is that walking each new room takes a fixed amount of time (the room is a fixed size), but the chance of finding new matches drops off fast after the first few rooms. So time goes up in a straight line and accuracy goes up in a curve that flattens out.

Key concepts

Concept explanation~2 min read

Everything you need to truly understand this topic: intuition, mechanics, step by step explanation, code, formulas, and worked example. Click to expand.

IVF tuning is one of those production tasks where the math is not deep but the intuition is load bearing. If a candidate cannot sketch the two curves on a whiteboard, they have never actually tuned an IVF index. The interview is testing whether they have moved from "I read about ANN" to "I have run a recall sweep and picked an operating point."

How IVF spends its query budget

IVF's query cost has two pieces. First, the centroid scan: compute the distance from the query to each of nlist centroids and sort to find the top nprobe. This is nlist distance ops regardless of nprobe. For nlist=4096, that is 4096 dot products per query, which is fast but not free.

Second, the partition scan: for each of the nprobe selected partitions, compute the distance from the query to every vector inside. If the partitions are balanced (which k-means roughly guarantees), each holds about N / nlist vectors. So the partition-scan cost scales linearly with nprobe.

For N=10e6 and nlist=4096, each partition holds ~2440 vectors. nprobe=16 scans ~39k vectors total; nprobe=50 scans ~122k. Compared to the 4096 centroid distances, the partition scan dominates once nprobe exceeds 2 or 3.

Why recall is concave, not linear
Tuning in practice
Sign in to unlock the full deep dive.

Situations where this technique stops working.

Sign in to see when this approach fails.

2–4 min · Everything important, quickly.

Sign in to see the quick scan of the deep dive.
nprobeRecall@10 (typical)Latency multiple
10.50-0.651x
4~0.80~4x
160.90-0.93~16x
320.94-0.96~32x
500.95-0.97~50x

Real products, models, and research that use this idea.

  • Faiss IndexIVFFlat and IndexIVFPQ both expose nprobe as a runtime parameter; tuning sweeps are the canonical first step in any Faiss deployment.
  • Milvus exposes nprobe per query for IVF-family indexes; production deployments at LinkedIn and Salesforce pin it after ground-truth sweeps.
Sign in to see more production examples.

What an interviewer would ask next. Try answering before peeking at the approach.

QHow would you pick nlist for a new corpus?
A

Rule of thumb: nlist ~ sqrt(N) so partitions hold ~sqrt(N) vectors. For N=10M, nlist=4096 lands at ~2440 vectors per partition, which is the SIMD sweet spot.

2 more follow-ups an interviewer would ask next. Sign in to reveal them.

Red flags & common mistakes

The phrases that signal junior thinking. Click to expand.

Most common mistake

Pushing nprobe higher and higher in pursuit of recall without noticing that the curve has plateaued; you pay linear latency for sub-percent recall gains.

Sign in to see all red flags and common mistakes.

60 second bullets to scan on the way to the call.

  • Recall@10 curve is concave; latency curve is approximately linear

  • Per-partition scan cost is ~N/nlist distance computations

Sign in to unlock the revision sheet.

Primary sources. Browse if you want the original framing.

Similar questions

Same topic, related formats. Practice these next.

4 curated
Next question
What does RAG primarily help with in LLM based applications?
MCQ·Easy