Hierarchical navigable small world

Clustering and community detection algorithm From Wikipedia, the free encyclopedia

Hierarchical navigable small world

The Hierarchical navigable small world (HNSW) algorithm is a graph-based approximate nearest neighbor search technique used in many vector databases.[1] Nearest neighbor search without an index involves computing the distance from the query to each point in the database, which for large datasets is computationally prohibitive. For high-dimensional data, tree-based exact vector search techniques such as the k-d tree and R-tree do not perform well enough because of the curse of dimensionality. To remedy this, approximate k-nearest neighbor searches have been proposed, such as locality-sensitive hashing (LSH) and product quantization (PQ) that trade performance for accuracy.[1] The HNSW graph offers an approximate k-nearest neighbor search which scales logarithmically even in high-dimensional data.

It is an extension of the earlier work on navigable small world graphs presented at the Similarity Search and Applications (SISAP) conference in 2012 with an additional hierarchical navigation to find entry points to the main graph faster.[2] HNSW-based libraries are among the best performers in the approximate nearest neighbors benchmark.[3][4]

A related technique is IVFFlat. [5]


Use in vector databases

HNSW is a key method for approximate nearest neighbor search in high-dimensional vector databases, for example in the context of embeddings from neural networks in large language models. Databases that use HNSW as search index include:

Several of these use either the hnswlib library[15] provided by the original authors, or the FAISS library.

References

Loading related searches...

Wikiwand - on

Seamless Wikipedia browsing. On steroids.