Eight interactive labs: text chunking, embeddings, semantic search, vector databases, the RAG pipeline, advanced retrieval, chat with your documents and evaluation, plus an assistant builder for your own documents and experiments that run in the browser.
- Home
- Text Chunking Lab
- Embeddings Lab
- Semantic Search Lab
- Vector Databases Lab
- RAG Pipeline Lab
- Advanced Retrieval Lab
- Chat with Documents Lab
- RAG Evaluation Lab
- GraphRAG Lab
- Multimodal RAG Lab
- RAG vs Fine-Tuning Arena
- Build your document assistant
- RAG engineering roadmap
- Project library
- Datasets library
- Algorithms and concepts
- Scientific references
- Glossary and FAQ
The HNSW index
← Back to Vector Databases Lab
Level 1: idea and analogy
Idea
HNSW is a multi-layer graph: sparse upper layers for fast jumps and a dense bottom layer for precise search. It starts at the top and descends, following the nearest nodes.
Analogy
Like a road map: you start on the highways between cities and then drop to small streets.
Level 2: how it works and when to use it
Steps
1. Insert each vector at a random layer.
2. Connect it to its nearest M neighbours in each layer.
3. When searching, descend greedily from the top, then widen by ef in the bottom layer.
When to use
When you want fast queries and high recall and can afford more memory.
Strengths
Low query time with high recall.
Level 3: mathematics, assumptions, limits
Assumptions
The neighbour count M and list size ef balance accuracy against cost.
Limits
More memory for the links, slower build, and deletion is harder. The version here is a simplified teaching implementation.
Level 4: pitfalls and references for researchers
Common pitfalls
Setting ef too low so recall drops unnoticed.
