All terms
AI
HNSW (Hierarchical Navigable Small Worlds)
HNSW is an approximate-nearest-neighbour algorithm. It builds a multi-layer graph where each node points to its nearest neighbours; queries traverse the graph greedily to find a high- quality top-K in logarithmic time.
By 2026, HNSW is the default index type in every credible vector database: pgvector, Qdrant, Pinecone, Weaviate, Milvus. The main parameters are m (neighbours per node, default 16) and ef_construction (build quality, default 64). Higher values give better recall at higher build cost. Query-time tuning via ef_search trades recall for latency.
Memory footprint matters: HNSW stores the graph in RAM for fast traversal. Past ~100M vectors, memory becomes the constraint and IVFFlat or quantised variants start to be worth it.