Vector Databases
What is a Vector Database?
● A unique library that stores data as “vectors” (lists of numbers).
● Helps AI understand complex items like words, images, and sounds.
How Does a Vector Database Work?
● Embeddings: Groups of vectors that AI uses to “remember” things.
● Use Cases:
○ Chatbots: Understands conversation context.
○ Image Recognition: Finds similar images.
○ Recommendations: Suggests similar items based on your activity.
Benefits of Vector Databases
● Flexibility: Handles text, images, audio, and more.
● Scalability: Stores millions or billions of data points.
● Speed: Fast searches and comparisons.
Why Vector Databases Are Essential for AI
● Acts as AI’s memory for understanding and comparing complex info.
● Crucial for businesses adding AI capabilities.
When to Use a Vector Database
● Unstructured Data: For text, images, or audio.
● Finding Similar Items: Like related articles, products, or sounds.
● High-Dimensional Data: For complex features in data.
How Vector Databases Are Structured
● Each piece of data (text, image, etc.) is stored as a vector.
● AI finds similar items by comparing “distances” between vectors.
Summary
● A vector database is a “smart library” for AI.
● Makes it easier for AI to recognize, compare, and understand complex data.
Transcript
0:00 Okay, so, now that we understand RAG, we need to understand how an agent uses Retrieval
Augmented Generation to go to a vector database, and what exactly a vector database is, and sort
of how they work.
0:11 So, learning about vector databases today, uhm, it sounds technical, and at first it might sound
like, what is this guy talking about?
0:18 But, break it down into something simple. Something that's simple and easy to understand. So,
imagine it like a unique kind of library that doesn't just store books in, like, rows and shelves.
0:28 Uhm, instead, think of it as, like, it stores items in a way that the AI can understand and make
sense of, kind of like a memory bank.
0:35 So, it's like a special library, like I said. It's not using, you know, regular data. Sort of structured
type of data with rows and columns, like a regular library with rows, tables, uh, shelves.
0:47 But in a vector database, information is stored in vectors, which are kind of groups of numbers
that represent certain things.
0:55 These numbers don't look like words or pictures. Uhm, they're more like lists of numbers that
represent text. Images, sounds, uhm, in a way that the computers can understand because it's sort
of like a multidimensional relational database.
1:09 So it's 3D, it's not just like a, an x-axis, y-axis. It's like, stuff goes this way, stuff comes this way,
it goes all over.
1:16 As you can see in this picture, kind of like, uhm, you know, it's like relational. So you'd be
looking over here for, you know, your animals and then the AI is going to find stuff that's related to
that stuff.
1:24 You go over here for fruits and you've got, like, you know, Apple and Google. So, uhm, it has to
use context to understand, like, where to put them in this, in these dimensions.
1:32 And as you can see up here would be like the vector, that's sort of like the number, numerical
representation of the data.
1:38 And so that's how it's going to work as far as, like, relations. Bye. What exactly is one vector? A
vector is the list of numbers that kind of describes the complex object.
1:48 So, uhm, a vector might represent the word car and then there'd be a list of numbers that
describe its meaning.
1:54 So, that's the numbers that it uses based on, like, the characteristics. So in here, like, you
know, 0.34, 2.5, 0.35.
2:02 These kind of represent different aspects of whatever, uhm, the specific item or the specific text
and then things that are, have similar number structures are kind of relationally in the same area.
2:13 So, that may have been the worst explanation ever. It may have been great. Uhm, let me know.
Hopefully you guys, that makes sense, but we're going to keep diving in and making it a little more
simple.
2:21 So, this is basically going to help the AI understand characteristics rather than, like, specific
static hard-coded things in a database.
2:32 So, the magic in this vector database is something called embeddings. So, next video we'll talk
more about embeddings, but basically embeddings are a group of vectors.
2:41 Vectors that the AI uses to remember things. So, it's like turning words or images into numbers,
and obviously that's how it matches with relation.
2:48 But, let's go through some, uhm, fun use cases. So, chatbots and language models. By storing
relationships between words as vectors, these databases can help chatbots understand that.
3:01 So, if you say, tell me a joke, the AI can understand what you want and respond with humor.
Image and video recognition is cool.
3:10 You can search for similar images on the internet, because the vector database allows the AI to
recognize similar images and compare them and place them near ones that it already knows.
3:19 And then, like other search recommendations, for if you're looking for a product online, the
vector database helps the system suggest similar things based on what you've liked or searched
before.
3:30 So, you've had a lot of interaction already with vector databases without even realizing it, you
know, because of, I don't know, Google searching, that sort of stuff.
3:38 Now, we're just actually trying to configure them and set them up for our AI. And so, we have to
really understand how they work.
3:44 Okay, so, now let's talk about the benefits of using one. So, three main things I wanted to point
out here is flexibility, scalability, and speed, and performance.
3:54 Speed and performance kind of together. But, uhm, flexibility, the database can handle tons of
different types of data, text, images.
4:01 Sounds, and you can kind of just, you know, embed them in there, you don't need to change
them and manipulate them too much.
4:07 Obviously, there's some things as far as, like, optimizing it, but just for today's sake, you don't
have to change it too much.
4:14 Scalability, vector databases can store millions and even probably billions of data points.
Making them perfect for AI models that need tons of information to work well, which ideally, when
we're helping out, you know, businesses with implementing some of these agents and these RAG
aspects, it's going
4:31 to be a lot of data. So tons of data, super scalable. That's huge. So then also speed and
performance. Um, since the data is in number form, the AI can then.
4:41 And search and compare and find relations super, super quick compared to maybe having to
go through thousands of rows in a Excel spreadsheet, which are going to make the processes like
responding and getting answers much smoother, much faster.
4:56 So why are these essential for AI? Think of it as like the AI's memory. The AI needs to answer a
question.
5:02 Make a recommendation, keep conversation going. It's going to go pull information from that
vector database. So it gives it the power to have context, history, comparisons, all that kind of stuff.
5:13 And so another big question is when do you actually use one? When would you rather just have
stuff in a structured database, an Excel table, Compared to wanting to put something in vector
stores?
5:24 So the vector database is best for situations where you want to find similarities or patterns in
data that don't really fit neatly into, um, you know, structured database forms like rows and columns.
5:36 So text, images, and audio, obviously I've said that a couple of times, but that's like a great use
of it.
5:41 Especially like, you know, huge, just reading walls of text and being able to extract stuff really
quick is where the vector databases really shine.
5:49 But the big thing is unstructured data. So if you have information that doesn't go into, um, rows
and columns, the vector database is going to help by organizing that in a way that the AI can easily
compare and search through.
6:01 It's a lot easier. to find similar things like we talked about, text images, audio, say once again,
and then high dimensional data.
6:07 If it's super complex with many features, um, it's super easy to measure these similarities and
find stuff that you need.
6:14 So then how is, how our vector database is structured? It is sort of, it's converting each piece of
data into a vector, into a numerical form vector, or a list of numbers.
6:27 So each number is going to represent a feature or quality of the data. Like I said, so just off the
top of my head, let's say we're talking about cars and you have like numbers, numbers, numbers.
6:39 The first one could be like representing how fast the car can go. Second one's going to be
representing the type of engine.
6:44 Third one can be representing the color, this kind of stuff. And so that's how it's going to
compare stuff so that you, if you were looking for a vintage blue car with a specific engine, it would
be able to find that kind of stuff even if it wasn't hard-coded into the description.
7:02 of the car, if that makes sense. So, um, in summary, basically, it's a powerful tool for finding
similar things in complex data.
7:11 Um, it's going to help the AI understand and remember things, making it, you know, very
essential for recommendation systems or search engines or any other type of application that has
might need to recognize patterns from just simple natural language keywords.
7:27 Yeah, it's just like a smart library stores information and it's a database that's really important
for AI, um, for the future of AI, it's going to help all of us create more advanced, uh, you know, use
cases, more advanced applications.
7:41 Then, um, I guess then what we currently would be doing if we were using a Google Sheet. So
that hopefully broke down, you know, vector databases in a good way.
7:52 Um, if you were to search vector database on Google and you'd see a lot of relational, um,
images that I think that really helps me sort of grasp the concept, but.
8:02 Yeah, we will move on to next module here.