HNSW: How Vector Databases Search at Scale
Watch a Hierarchical Navigable Small World (HNSW) graph — the algorithm behind real vector databases — greedily descend through sparse upper layers into a dense bottom layer to find a query's nearest neighbors in a RAG retrieval index.
Every production RAG pipeline leans on an approximate nearest-neighbor index so retrieval stays fast as the knowledge base grows into the millions of chunks. This simulator builds a real Hierarchical Navigable Small World graph — the algorithm inside FAISS, Pinecone and Weaviate — over a synthetic embedding space, then animates a live query descending from a single sparse entry point through progressively denser layers, greedily hopping to the closest connected neighbor at each step before widening into a beam search on the bottom layer. Distance computations and the active layer update live as the search runs, and once it lands you get a real recall@10 score against an exhaustive brute-force search of the same index, so you can feel the exact speed/accuracy trade the M and ef parameters control.
Explore HNSW, a multi-layer graph where queries start at the top and greedily hop through layers to find nearest neighbors efficiently.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install