Skip to main content

Vector search

Lesson notes

Given a query vector, find the nearest stored vectors — the k-nearest-neighbor problem. Exact search compares against everything (correct but O(N)); approximate nearest neighbor (ANN) structures give up a sliver of recall to answer in milliseconds at millions of vectors. This lesson sets up why hashmaps and B-trees are useless here and indexes are their replacement.

Key ideas

  • kNN vs ANN — the correctness/latency trade
  • Why classic indexes don't work in high dimensions
  • Recall vs latency as the tuning dial

Further reading