Approximate Nearest Neighbor (ANN) search finds the k closest vectors to a query without exhaustive comparison. Algorithms like HNSW, IVF-PQ, and ScaNN trade exact recall for orders-of-magnitude speedup, making semantic search feasible at production scale.
Index build and rolling refresh pipeline for production ANN search.
Higher M (32-64) and ef (200-500) → better recall, larger memory + slower build. M=16, ef_search=64 is a strong default for 1M vectors.
Product Quantization compresses 1536-dim float32 (6KB) to ~96 bytes. Use PQ when RAM is the bottleneck, accept ~5% recall loss.
Post-filter is fast but may return <k results if filter is selective. Pre-filter (Pinecone, Qdrant) needs metadata-aware indexes.
Combine BM25 + dense vectors via Reciprocal Rank Fusion. Catches exact-match queries (UUIDs, codes) that vectors miss.
Average latency hides graph traversal stalls. Track P99; use ef_search clamping to bound worst-case.
Build new index in shadow, validate recall on golden set, atomic alias swap. Never mutate a live index in place.
Sign in to share your feedback and join the discussion.