Vector Databases simply explained. Learn what vector databases and vector embeddings are and how they work. Then I'll go over some use cases for it and I briefly show you different options you can use.
0:00 Introduction to Vector Databases and Their Purpose
1:31 How Vector Embeddings and Indexing Work
3:51 Use Cases and Available Vector Database Options
Recently vector databases got a lot of fame with companies raising hundreds of millions of dollars
to build them and people calling it a new kind of database for the AI era. On the other hand,
for many projects it might be an overkill solution and using a traditional database
or even just a NumPy ND array might work just fine. But there is no doubt that vector databases
are extremely fascinating and allow many great applications, especially when you want to give
large language models like GPT-4 long-term memory. So in this video I will explain in a very
beginner-friendly way what vector databases are and how they work. We will go over some use cases
for them and then I will briefly show you some options you can use. So let's get started. So let's
start with the why. Over 80% of the data out there is unstructured, such as social media posts,
images, videos or audio data. You cannot easily fit them into a relational database. Let's take
an image as an example. If you want to put this into a relational database in order to search for
similar images, what ends up happening is that often we manually assign keywords or tags to it
because from the pixel values alone we cannot really search for similar images. And the same
holds true for unstructured text blobs or audio and video data. So we either have to assign tags
or attributes to it, often manually, or we can find a different representation to store the data.
And this brings us to vector embeddings and vector databases. In short, a vector database
indexes and stores vector embeddings for fast retrieval and similarity search.
So let's take a step back and look at those two important components. First, it uses clever
algorithms to calculate the so-called vector embeddings. This is done by machine learning
models. A vector embedding is just a list of numbers that represents the data in a different
way. For example, you can calculate an embedding for a single word, a whole sentence, or an image.
And now we have numerical data that the computer can understand. One easy possibility we get with
vectors is to find similar vectors by calculating the distances and doing a nearest neighbor search.
So we can easily find similar items. For simplicity, I display a 2D case here, but in
reality, of course, those vectors can have hundreds of dimensions. But just storing the data as
embeddings is not enough. Performing a query across 1000s of vectors based on its distance
metric would be extremely slow. And this is why those vectors also need to be indexed. So the
indexing process is the second key element of a vector database. An index is a data structure
that facilitates the search process. So the indexing step maps the vectors to a new data
structure that will enable faster searching. This is a whole research field on its own and
different ways to calculate indexes exist. So I won't go into details here, just know that indexes
are needed for efficient search. So let's go over some use cases. I already mentioned that we can
use vector databases to equip large language models with long term memory. This is for example,
what you can easily implement with lang chain, we can use it for semantic search when we need to
search not for exact string matches, but rather based on the meaning or context of our question,
we can also use it for similarity search for images, audio or video data. So we can say, hey,
find me a similar image to this one. And we don't need to use some keywords or tags to describe the
image. And we can use a vector database as a ranking and recommendation engine. For example,
for online retailers, it can be used to suggest items similar to past purchases of a customer
since we can simply identify the nearest neighbors of an item in our database. So now that you know
some use cases, let's go over some options you can use as a vector database. There are a number
of vector databases available. For example, we have pine cone, VV eight, chroma, Redis also has
a vector database, kudrend, milvus or Vespa AI. So I won't go into details here. But if you want
to see a separate video with an in depth comparison, then let me know in the comments below.
All right, I hope you now have a good understanding of what vector databases are and what you can do
with them. If you want to see more explainer videos and AI tutorials, then make sure to
subscribe to our channel and then I hope to see you in the next video. Bye