Vector Database in an Easy Way

Many people think a Vector Database is just a traditional database with AI built into it. This isn't entirely true, but it's a very common misconception.
Understanding Vector Databases
In this article, I'll explain what a Vector Database is in the simplest way possible. A Vector Database is a database designed to store data such as text, images, and audio in the form of vectors. A vector is simply a collection of numbers that represents the original data.
It's important to understand that a Vector Database does not convert data into vectors. That job is done by an Embedding Model, an AI model that transforms data into numerical representations called embeddings. Once the embedding is created, it is stored inside the Vector Database. So, why do we need to convert data into numbers?
Why Use a Vector Database?
You can see that banana, green apple, and pear are located close to each other because they have similar meanings. The same goes for boats and ships. Meanwhile, football is much farther away because it belongs to a completely different concept. In general, the closer two vectors are, the more similar their meanings are. The farther apart they are, the less related they become.
How Does It Work?
The process is actually very simple.
1. Convert data into vectors First, data such as text, images, or audio is processed using an Embedding Model. The result is a vector. 2. Store the vectors Next, those vectors are stored inside the Vector Database. For example, if you have 1,000 documents, you'll end up storing 1,000 vectors. At this point, the database is only storing data. No searching happens yet. 3. When a user asks a question Imagine a user asks, "How do I deploy a NestJS application?" That question is also converted into a vector using the same Embedding Model. Now the Vector Database has two things:
- Vectors from all stored documents.
- The vector representing the user's query.
The database then calculates the distance between the query vector and every stored vector. The vectors with the shortest distance are considered the most relevant. Finally, the retrieved data is sent to the LLM as context, allowing the AI to generate a more accurate answer.
So, Where Is the AI?
At the beginning of this article, we mentioned a common misconception that a Vector Database is simply a database with AI. Now that we've seen how it works, we can understand why that isn't entirely correct. The AI is not inside the Vector Database. The AI is used in the Embedding Model, which converts data into vectors. The Vector Database simply stores those vectors and finds the most similar ones when a query arrives. If we simplify the entire system, it looks like this:
- Embedding Model → Converts data into vectors.
- Vector Database → Stores vectors and performs similarity search.
- LLM → Uses the retrieved data as context to generate an answer.
These three components work together, but each has a different responsibility. So when someone says "A Vector Database is a database with AI," the statement isn't completely wrong, but it isn't completely correct either. The AI creates the vectors, while the Vector Database stores them and searches for the most relevant ones based on similarity.