ANN Algorithms Exhaustive vs Approximate Exhaustive (brute-force) search compares the query against every stored vector — 100% recall, O(N) per query. Approximate Nearest Neighbor (ANN) trades a few percent recall for 10-1000x speedup. Break-even heuristic: - Under 100k vectors: brute-force is fine (use in FAISS / in ES). - 100k-10M: HNSW is the go-to. - 10M-1B+: HNSW with quantization, IVF+PQ, DiskANN, or a sharded combo. HNSW (Hierarchical Navigable Small World) Multi-layer graph where upper layers are sparse long-range links and lower layers are dense local links. Search starts at the top,…