DEV Community

Cover image for The database that AI uses
Manas Mishra
Manas Mishra

Posted on

The database that AI uses

Imagine you have a huge toy box

Inside it are thousands of toys — cars, dolls, robots, animals.

Now suppose I ask you:

“Can you find toys that are similar to this red racing car?”

You wouldn’t look for toys with the same name.
You’d look for toys that feel similar - maybe other cars, maybe fast-looking toys, maybe red ones.

That’s how a vector database works.

Turning Things into Numbers

Computers don’t understand toys, pictures, or sentences the way humans do, so they convert everything into numbers. These special lists of numbers are called vectors. For example, a picture of a cat, a sentence like “I love pizza”, or even a voice recording can all be transformed into long lists of numbers such as
[0.21, 0.88, 0.03, 0.77, ...]

That list of numbers is called a vector.

Storing the Vectors

A vector database is just a special toy box. But instead of toys, it stores those number lists (vectors).

It doesn’t organize them alphabetically. Instead, it organizes them by how similar they are.

Finding Similar Things

If you show it a new sentence: "Pizza is my favorite food". It turns that sentence into numbers too.

Then it looks inside the database and asks:
"Which stored number list is most similar to this one?"

Even if the words are different, they can understand that the meaning is close. That’s why AI chatbots can:

  • Find similar documents
  • Answer questions from your files
  • Recognize similar images
  • Recommend products

Simple Example

Think of it like this:

  • Normal database: Finds exact matches (same name).
  • Vector database: Finds similar matches (same meaning or feeling).

Top comments (0)