Fast nearest-neighbour search over embeddings.
Made for you now: slide lessons from basics to production, usually with code and a quiz. See a finished one
Comparing a query to every stored vector is exact but slow once you have millions. A vector database trades a little accuracy for large speed-ups using approximate nearest-neighbour (ANN) indexes.
HNSW builds a layered graph: search enters at a sparse top layer and walks closer to the query layer by layer. IVF clusters vectors and searches only the nearest clusters. Both are tuned by parameters that trade recall against latency and memory.
Real queries also filter (tenant, date, language), so databases store metadata beside each vector. Many systems combine vector search with keyword search (hybrid) because exact terms still matter.
Step 1
Query
User question text.
Step 2
Embed query
Same model used for the chunks.
Step 3
ANN search + filter
Index returns top-k nearest, limited by metadata.
Step 4
Top-k chunks
Text plus source for each hit.