Skip to content
BENIBIX Learn

Approximate Nearest Neighbor (ANN)

Also known as ANN Search, Approximate k-NN

A fast search for close vectors that may miss a few of the very best.

Think of it like

Think of it like you only check the streets near your house, not the whole town. You still find the closest shop.

Example

Emma searches 10 million vectors. Checking all of them takes seconds. With an approximate index, it takes a few milliseconds and finds 97 of the true top 100.

Why it matters

It is what makes vector search fast enough to run while a person waits.

Definition

Approximate nearest neighbor search finds vectors very close to the query, without checking every one. It uses an index to look only where a match is likely. It is much faster, but it may miss a few of the true best ones. Good settings still find well over 90 percent of them. Most vector databases work this way.
Exact search checks every vector. Approximate search checks a small part and still finds most of the best.

Common mistake

Tuning only for speed. Push it too far and the right text drops out of the results without any error.

Key takeaways

  1. 1
    Skips most vectors. Looks where it is likely.
  2. 2
    Speed for a little accuracy. A fair trade.
  3. 3
    Tune and measure. Check what it misses.