HNSW (Hierarchical Navigable Small World) is a multi-layer graph: each vector is a node linked to nearby nodes; upper layers are sparse long-range shortcuts, lower layers are denser.
Search starts at the top layer, greedily hops to closer neighbors, drops to the next layer, and at the bottom layer explores a candidate list to collect the nearest neighbors.
M is the number of links per node (higher gives better recall but more memory); efConstruction is the candidate list size while building (higher gives a better graph but slower build); efSearch is the candidate list size at query time (higher gives better recall but slower queries) and can be tuned on a live index, while M and efConstruction are fixed at build time.
Strengths: high recall and low latency, good for steady inserts. Weaknesses: large memory (vectors plus links), slow bulk builds, and awkward deletes.
Loading…