A vector database stores high-dimensional vectors (embeddings) instead of just raw text, images, or audio.
These embeddings let you search by meaning/similarity, not just by exact keywords or file names.
-
Images:
Models like CLIP (by OpenAI) convert images to vectors.
Example: A photo of mountains and sun becomes a unique vector (e.g.[0.23, 0.99, ...]). -
Text:
Models like GloVe, OpenAI Embeddings, BERT convert sentences to vectors.
Example:"Apple is a fruit." → [0.031, 0.245, ...] -
Audio:
Models like Wav2Vec2 encode sound files into vectors for search and retrieval.
Process:
All these models are trained on massive datasets.
Each embedding is a summary of "meaning" or "features"—the deeper the layer, the more abstract/semantic the representation.
With millions of items, keyword search is limiting.
Embeddings let you find "similar" items—e.g. images of sunsets, sentences with the same intent, or similar-sounding audio clips—even if the exact words/pixels are different.
- Compares your query vector to every stored vector.
- Accurate, but slow for large data.
- Divides vectors into clusters/classes.
- Searches only in the most relevant clusters for speed.
- Good for large databases (10k+ items).
- Builds a multi-layer graph.
- Quickly finds the closest vectors by graph traversal.
- Super fast and scales well.
pip install chromadbstreamlit run chromadb_demo.pyImage/Text/Audio
↓
[ Embedding Model ]
↓
[ Vector ]
↓
[ Vector DB (ChromaDB, FAISS, etc) ]
↓
Similarity Search (Flat / IVF / HNSW)Combines a vector DB with an LLM (like GPT) for "chat with your data" or "document QA" use cases.
Process: Query is embedded → Find top-k similar items from DB → Feed into LLM for generation.