AI Glossary Term

What does “HNSW” mean?

Definition

A graph-based index structure for fast approximate nearest-neighbor search over high-dimensional vectors.

How HNSW works

Diagram for HNSW, layers from top to bottom: Top layer: few nodes, long jumps; Middle layer: more nodes, shorter jumps; Bottom layer: all vectors, fine search.Top layer: few nodes, long jumpsMiddle layer: more nodes, shorter jumpsBottom layer: all vectors, fine search

Example

A search enters at the sparse top layer, hops toward the query across long links, drops a layer, and repeats, ending in the dense bottom layer with the closest vectors. It is like using highways, then streets, then your destination's block.

Why it matters

HNSW is one of the most widely used indexes in vector databases because it gives fast, accurate searches.

Common questions

What does HNSW stand for?

Hierarchical Navigable Small World, introduced by Malkov and Yashunin in 2016.

What is the trade-off?

It uses a fair amount of memory and takes time to build the index.

Can it be updated?

Yes, vectors can be added, though deleting and heavy updates need care.

See also