Indexing & Approximate Nearest Neighbor
ANN
Part of: Vector Databases & Production Search
Finding the exact nearest neighbor in a million 1,536-dimensional vectors requires, in the worst case, checking all million. So production systems quietly cheat: they accept "almost the nearest" in exchange for being a hundred times faster. That trade is the entire idea behind approximate nearest neighbor search, and it is why your vector DB feels instant. What it is Approximate nearest neighbor (ANN) search returns vectors that are very likely the closest, without guaranteeing they are exactly the closest. You give up a sliver of recall : the fraction of true nearest neighbors you actually find, and in return you get an enormous speedup. The structure that makes this possible is the index . The most common modern index is HNSW (Hierarchical Navigable Small World): a layered graph you walk to home in on close vectors fast. How it works HNSW builds a graph where each vector is a node connected to some of its near neighbors, arranged in layers: 1. Top layers are sparse : a few nodes with long-range links, like an express highway across the dataset. 2. Lower layers are dense : many nodes with short links, like local streets. 3. A search starts at the top , greedily hops toward the que
Challenge: Recall@k Benchmark