Exact and Approximate Vector Search
In this article
- Trace one vector search from the question to the text the model receives, and name what each step hands to the next.
- Explain why exact search is the default and the yardstick for every faster search.
- Decide from corpus size and a latency budget whether an approximate index is worth adding, and say how to check what it costs.
- Say where an access filter runs and what the model must never receive.
- Terms defined here: index record, vector search, top-k results, metadata filter, exact kNN, approximate nearest neighbor search.
Overview
Your search code turns the customer's question into a list of numbers that stands for its meaning, a vector, and holds thousands of stored vectors, one per piece of text, or chunk. Which ones come back, how long does that take, and what goes on to the model? The obvious answer, compare the question with every stored vector and keep the closest, is correct and is where you should start. It stops being enough when the store grows a hundredfold and every search must still finish fast.
Brightline, a made-up home-internet provider, runs a support assistant that searches about 2,000 chunks of its help pages, router manuals and staff handbook and puts the best 3 into each request. Brightline now plans to add about 200,000 chunks of past conversations. Follow one question through the search, then decide whether the bigger store needs a faster search that may miss a few of the closest results, and how to check what that costs.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- What one search does
- One question, traced
- Exact search is the default
- When exact search gets too slow
- Two paths, one ending
- Common mistakes
- Sources
- Check yourself, 13 questions