AI engineering glossary · RAG vector search

What is HNSW?

HNSW (also called Hierarchical Navigable Small World): Hierarchical Navigable Small World, a graph-based index where each vector links to nearby vectors across several layers. Search starts at a sparse top layer and greedily hops toward the query, descending to denser layers. It gives fast, accurate search but uses substantial memory.

Level: advancedTopic: RAG vector search

HNSW: an example

With HNSW, a query over 10 million vectors visits roughly a few hundred nodes rather than all 10 million.

Related terms

More RAG vector search terms

Where you learn it

HNSW is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.