← AI Terminology
HNSW - Hierarchical Navigable Small World
HNSW is a graph-based ANN index that links vectors in a hierarchical small-world graph for fast approximate nearest-neighbour search with strong recall.
It is the default index type in many vector databases.
It is the default index type in many vector databases.
Why It Matters in AI
HNSW offers excellent speed/recall and incremental inserts, making it the practical default for RAG corpora. Knowing M, efConstruction, and efSearch parameters is everyday vector-DB tuning.
Key Points
| Aspect | Description |
|---|---|
| Cons | Memory-heavy vs some compressed IVF-PQ setups |
| Pros | High recall, good latency, dynamic inserts |
| Params | M (degree), efConstruction, efSearch |
| Related | ANN, FAISS HNSW indexes |
| Used in | Milvus, Qdrant, Weaviate, pgvector HNSW, hnswlib |
| Structure | Multi-layer proximity graph; greedy search from top layer |
Simple Analogy
A multi-level highway system: zoom on long-range links first, then exit onto local roads to the exact address.
Common Usage Examples
efSearch=64for higher recall- Qdrant/Milvus HNSW collections
- hnswlib Python bindings
- Memory plan: graph edges dominate RAM
Summary
In short: HNSW is the hierarchical graph index powering most production vector search — fast, high-recall approximate nearest neighbours.