From A fun and absurd introduction to Vector Databases by Alexander Chatzizacharias
Vector databases facilitate semantic search on your data.
Vector database
Distance (far) or similarity (close):
Euclidean distance
Cosine similarity
Hamming
Manhattan
Indexing algorithms:
Exact nearest neighbor: linear search, k-nearest neighbors, space partitioning.
Approximate nearest neighbor:
Vector databases
From Rerankers and Two-Stage Retrieval by Picone
Retrieval Augmented Generation (RAG) is more than putting documents into a vector DB and adding an LLM on top.
Recall and context window
Maximize retrieval recall by retrieving plenty of documents and then maximize LLM recall by minimizing the number of documents that make it to the LLM
Solution: Reranker model
Reranker
Given a query and document pair, the reranker reorders the documents by relevance to our query using a similarity score.
Two stages: