The Vector Database for Embeddings
A vector database stores embeddings, which are lists of numbers that capture the meaning of text, images, or audio. Two items with similar meaning have vectors that point in similar directions, so search becomes finding the vectors closest to a query vector.
Similarity search
The core operation is nearest neighbor search: given a query vector, return the stored vectors with the smallest distance. Distance is often cosine similarity or Euclidean distance. An exact search compares the query to every vector, which is too slow at scale.
Approximate nearest neighbor
To go fast, vector databases use approximate nearest neighbor or ANN indexes. A popular one is a navigable small world graph, which links each vector to a few neighbors and lets search hop greedily toward the closest match.
- ANN trades a little recall for huge speed gains.
- Indexes are tuned with parameters that balance accuracy and latency.
- Results often feed a language model in a retrieval pattern.
Key idea
A vector database indexes embeddings so a query finds its nearest neighbors quickly, usually through approximate search that trades slight recall for speed.