HNSW (Hierarchical Navigable Small World)
Also known as: Hierarchical Navigable Small World
A graph-based ANN index with log-time approximate search, excellent recall/latency trade-off.
An approximate nearest neighbor index that builds a multi-layer graph where higher layers act as expressways for fast greedy search. The dominant ANN algorithm for in-memory vector search at scale.
In practice
Most production vector stores (FAISS, Qdrant, Weaviate, Pinecone) use HNSW under the hood. Expect questions on its M, efConstruction, and ef params.
How it compares
HNSW is one ANN index algorithm; vector databases are the systems that bundle it with storage and APIs.
Related topics
Related terms
AI System Design
End-to-end design of production LLM systems: ingestion, retrieval, serving, eval, monitoring.
BM25
Classical TF-IDF-style lexical scoring: a surprisingly strong baseline, still the first stage of many hybrid RAG pipelines.
Chunking
Cutting documents into retrievable pieces before embedding them.
Context Engineering
Deciding what makes it into the model's context window (prompt + RAG + history + memory), and why.
Context Window
The max number of tokens a model can attend to at once.
Cosine Similarity
Compare two vectors by the cosine of their angle; the default similarity metric for embedding search.