Module 10 Lesson 3: Vector Stores
The AI's database. Where to store and how to query millions of AI vectors locally.
Vector Stores: The Library Shelves
Once you have turned your text into vectors (lists of numbers), you need a place to put them. You can't just put them in a standard Excel sheet or a SQL database easily. You need a Vector Store.
1. Why a special database?
Standard databases are designed to search for text: "FIND the row where Name = 'Sudeep'". Vector databases are designed to search for math: "FIND the top 5 rows where the vector is NEAREST to [0.1, 0.4, -0.9]".
2. Popular Local Vector Stores
ChromaDB (Best for Beginners)
- Format: Open Source, Python-friendly.
- Advantage: It's "In-memory." You don't need to install a server. Just
pip install chromadband it creates a folder on your SSD. - Integration: Works perfectly with Ollama.
FAISS (High Performance)
- Created by: Meta.
- Advantage: Extremely fast for massive datasets (millions of rows).
- Downside: A bit harder to set up and manage than Chroma.
Qdrant / Weaviate
- Format: Running in a Docker container.
- Advantage: These are professional, production-grade databases that you can scale to gigabytes of data.
3. The Database Content
A row in a Vector Store usually contains three things:
- The ID: (e.g.,
doc_1_page_1). - The Vector: The list of numbers from Ollama.
- The Metadata: The actual human text and the source filename (e.g.,
manual.pdf).
4. Querying the Store
When you ask a question:
- Ollama turns your question into a Query Vector.
- The Vector Store runs a "Similarity Search."
- It returns the top 3 most relevant "Human Text" chunks.
- You give those 3 chunks to your LLM (Llama 3) to summarize.
Summary Table: Which Database?
| Task | Recommendation |
|---|---|
| Learning RAG | ChromaDB |
| Small Local App | SQLite (with vector extension) |
| Enterprise Data | Qdrant (Docker) |
| Billion-row scale | FAISS |
Key Takeaways
- Vector Stores are optimized for "Nearest Neighbor" math searching.
- ChromaDB is the easiest local starting point for Python developers.
- A "Row" in these databases links Math (Vectors) back to Text (Human words).
- The database is the "Library" and Ollama is the "Researcher" who reads the books.