HNSW
HNSW (Hierarchical Navigable Small World) is a graph-based index for approximate nearest neighbor (ANN) search over vectors. It stores vectors in several layers of proximity graphs and starts each search in the sparse top layer, narrowing down as it moves to denser lower layers; the original paper reports logarithmic complexity scaling.[1] The balance between accuracy and speed is tuned mainly with M (connections per node), efConstruction (candidate list size while building) and ef / efSearch (candidate list size while searching).[1][5] HNSW works best when the graph and vectors sit in memory, so memory use is its main cost.[7]