Despite ANN dominating production retrieval, Flat (brute force) search remains the right call in two specific situations. Name and briefly justify both.
Two situations: (1) tiny corpora under ~100k vectors where ANN's build overhead exceeds the savings, and (2) generating the exact recall@K ground truth used to tune any ANN index.
Imagine you have a shoebox of 500 baseball cards and a friend hands you one card asking 'which of mine is closest to this?' The dumbest possible answer, flip through every single card, takes a few seconds and you're done. Building a fancy filing system would take longer than the answer itself. **That's the tiny-corpus case.** The other situation is when you're tuning the fancy filing system: you need to know the right answer to grade it on, and the only way to know the right answer is to flip through every card. Flat is slow but it never lies, which is exactly what you need when you're measuring how often a fast method tells the truth.
Detailed answer & concept explanation~4 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.
3 min: name both situations (tiny corpora + recall ground truth), justify each with concrete numbers, cite a vendor that exposes Flat, mention the regulated-context niche.
| Property | Flat | HNSW | IVF |
|---|---|---|---|
| Recall | 1.0 (exact) | Tunable, typically 0.90-0.99 | Tunable, typically 0.85-0.97 |
| Build time | Zero | Minutes to hours | Minutes (k-means) |
| Memory overhead | Just the vectors | Vectors + graph edges | Vectors + centroids |
| Query latency at 100M vectors | Seconds-minutes | Sub-millisecond | Single-digit milliseconds |
| Query latency at 10k vectors | <1 ms | <1 ms (but build overhead) | <1 ms (but build overhead) |
| Use case in 2026 | Small corpora + ground truth + regulated | Default production ANN | Large corpora + compression |
Real products, models, and research that use this idea.
- Pinecone exposes a Flat index type explicitly for tiny corpora and offline ground truth jobs.
- Weaviate ships a Flat vector index recommended for classes under 10k objects.
- Qdrant supports collections without an ANN index for the same regime.
- Every ANN benchmark on ANN-Benchmarks.com reports recall against a Flat baseline.
- Faiss ships `IndexFlatL2` and `IndexFlatIP` as the canonical ground truth indexes used in every production evaluation script.
What an interviewer would ask next. Try answering before peeking at the approach.
QHow would you generate a Flat ground truth for a 100M-vector corpus when running Flat on the full corpus is infeasible?
QWhy does Faiss ship both IndexFlatL2 and IndexFlatIP separately rather than unifying them?
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.
Assuming Flat is always obsolete because ANN is faster. Flat is the only exact method, which means it is the only valid ground truth for measuring an ANN index's recall, and it is the cheapest option on small corpora.
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.