AI engineering glossary · RAG vector search
What is nearest neighbour search?
Nearest neighbour search (also called NN search): The task of finding the stored items whose vectors are closest to a query vector under a chosen distance measure. Exact search compares against everything; approximate search trades a little accuracy for large speed gains.
Nearest neighbour search: an example
Given a query vector, return the 5 stored vectors with the smallest Euclidean distance.
Related terms
More RAG vector search terms
- nprobe
- Parent-document retrieval
- pgvector
- Post-filtering
- Pre-filtering
- Product quantisation
- Proposition indexing
- Query decomposition
Where you learn it
Nearest neighbour search is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.