ML//RAG//vector database
A vector database is a database that stores vectors paired with resources (chunked into paragraphs of about 500 tokens), and its core operation is finding the \(N\) nearest vectors to a given one, fast. The math is cosine similarity between the question (embedded on the fly) and the stored vectors.
A vector database is a database that stores vectors paired with resources (chunked into paragraphs of about 500 tokens), and its core operation is finding the NNN nearest vectors to a given one, fast. The math is cosine similarity between the question (embedded on the fly) and the stored vectors.
HNSW (Hierarchical Navigable Small World graphs) builds a graph where similar vectors are neighbors, so a search hops through about 40 nodes instead of checking all 10M vectors, from O(n)O(n)O(n) down to O(logn)O(\log n)O(logn).
IVF (Inverted File Index) clusters the vectors into buckets first and searches only the closest ones: one drawer instead of the whole filing cabinet.
Pinecone, Weaviate, Chroma, Qdrant, Supabase and FAISS are implementations.