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.

Level: beginnerTopic: RAG vector search

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.