Module 5 Lesson 2: Vector Databases
The Memory of AI. Understanding how we store and search 'Meaning' using embeddings and specialized databases.
Vector Databases: Searching for Meaning
In a normal database (like Excel), you search for exact words. If you search for "Dog," you only find rows that have the word "Dog." In an AI system, we want to search for Similar Concepts. If I search for "Pet," I want to find "Dog," "Cat," and "Puppy."
This is possible thanks to Vector Databases.
1. Embeddings Redux
Remember Embeddings from Module 2? They turn text into a list of numbers (a Vector) that represents "Meaning."
- String: "I love my puppy." $\rightarrow$ Vector:
[0.12, -0.98, 0.45, ...]
2. Similarity Search
A Vector Database stores these lists of numbers. When you ask a question, the database looks for the numbers that are Closest to your question's numbers in a mathematical space.
- This is called Semantic Search.
3. Top Tools Overview
- Pinecone: The "Cloud" industry standard. Very fast and handles millions of documents.
- Chroma / Weaviate: Open-source databases you can run yourself for privacy.
- Postgres (pgvector): Adds AI "Meaning Search" to a standard SQL database your company likely already uses.
4. Visualizing the Vector Space
graph TD
A[Puppy] --- B[Dog]
A --- C[Cat]
D[Toaster] --- E[Oven]
C -.- D[Far Apart: Different Meanings]
A -.- B[Close: Same Meaning]
💡 Guidance for Learners
Think of a Vector Database as a Library where books aren't organized by "Author Name," but by "Subject Matter." All the books about "Love" are on one shelf, regardless of the title.
Summary
- Vector Databases enable search by meaning, not just keywords.
- They store Embeddings, which are mathematical representations of text.
- Similarity Search retrieves the most relevant content for a RAG system.
- Pinecone and Chroma are the leading choices for developers building AI apps.