Definition
Hierarchical Navigable Small World (HNSW) is a graph-based approximate nearest neighbor (ANN) search algorithm that organizes high-dimensional vector embeddings into a multi-layered structure for logarithmic-time retrieval. In RAG pipelines, it balances high search throughput and recall at the cost of significantly higher RAM consumption compared to quantization-based indexing.
It is a specific indexing algorithm, not a vector database or an embedding model itself.
"An express elevator system in a skyscraper: the top floor has very few stops for fast traversal across the city, while the ground floor stops at every single door for precise location."
- Approximate Nearest Neighbor (ANN)(Algorithmic Category)
- Vector Indexing(Prerequisite)
- Product Quantization (PQ)(Alternative/Complement)
- Cosine Similarity(Distance Metric)
Conceptual Overview
Hierarchical Navigable Small World (HNSW) is a graph-based approximate nearest neighbor (ANN) search algorithm that organizes high-dimensional vector embeddings into a multi-layered structure for logarithmic-time retrieval. In RAG pipelines, it balances high search throughput and recall at the cost of significantly higher RAM consumption compared to quantization-based indexing.
Disambiguation
It is a specific indexing algorithm, not a vector database or an embedding model itself.
Visual Analog
An express elevator system in a skyscraper: the top floor has very few stops for fast traversal across the city, while the ground floor stops at every single door for precise location.