generate notes for me welcome back everybody so it's quarter past now it's time to get…
- User
generate notes for me
welcome back everybody so it's quarter
past now it's time to get our next talk
started and this is I'm I'm intrigued
that everybody's here because apparently
it's on the monitor there it still says
this is like a secret talk title but um
I it's it's my privilege really to be
able to announce the title of this talk
which is a vector search powering the
next generation of applications
um and we have uh you're a product lead
aren't you
um
can we please have a big round of
applause for Ben flask
[Applause]
hi everybody can you hear me all right
cool awesome well uh thanks everyone for
for being here I'm really excited to be
uh talking about Vector search today my
name is Ben plast I'm a product manager
at mongodb been here for about four
years working on a range of services in
kind of the analytics and AI space
um I'm just gonna quickly start out
though with uh
a couple of questions so I'm I'm curious
if you've ever kind of found yourself
looking for something but haven't quite
had the words
um maybe you've you know remembered some
characteristics of a movie but not the
name or maybe you've been trying to get
a sweatshirt that you had back in the
day
uh and you have a picture but you don't
know how else to look for it uh or maybe
you're looking to power an artificial
intelligence with some long-term memory
that could take over the world in the
future
or and and maybe you're just looking for
an interesting talk to see at
mongodb.local if if any of these things
have kind of crossed your mind then I
think you might be at the right talk
um
and so we're going to be talking about
Vector search
um but we're actually going to start by
kind of going a bit back and talk about
what a vector is and kind of Orient to
some of the concepts that you need to
have in order to to use this capability
um then we'll talk about the capability
that we're releasing and how it works uh
we'll follow up by covering some use
cases uh I then go through a demo where
you can actually see it in action in
slideware
um and then we'll finish up by talking
about uh what's next
so what is a vector a vector is a
numeric representation of data and
related context and so if you take a
very simple example like a quick brown
fox
it would be a kind of array of floats
which represents both the data so the
words a quick brown fox uh but also kind
of the context how a relates to Fox you
know what does brown mean Fox is not a
dog it's also not a cat things like this
would be the associated context that
could be represented inside of this
vector
[Applause]
so
obviously that's a very powerful concept
to be able to represent so much inside
of just this string of numbers you're
probably kind of immediately asking
yourself how would you get a vector uh
and the way that it works is that you
would pass your data whether it be an
image or a text or audio through an
encoder of some sort and and these are
machine learning models that basically
take this data and transform it into
this numeric representation
we're going to go deeper into what this
means and how it works later on but this
is just something to kind of keep in the
back of your mind
so once you've taken data and
transformed it into a vector there are
some really interesting properties about
these vectors that allow us to provide
the service that we're releasing today
and and kind of a key one is that
similar vectors that are plotted in
space will be near one another in this
High dimensional space
and so to take a very simple example if
we have kind of a graph in two
dimensions and they're going to be a
bunch of two-dimensional graphs that I'm
going to show during this presentation
it's important to realize that well
two-dimensional graphs are great for
kind of showing this concept and
understanding what's happening
all of the vectors that we're talking
about here are really high dimensional
right we're talking about thousands of
Dimension which are really you know
impossible to visualize and so we'll
just stick in a two-dimensional world
but kind of keep that again in the back
of your mind because that's really where
a lot of the power comes from with this
next generation of vectors and
capabilities so continuing on with the
example
imagine you have a point and let's say
that this point represents man and
there's a there's a vector associated
with it
um
you could also have another point that
represents the word woman and it would
be conceivable that those two pieces of
text when vectorized or embedded those
are you know synonyms would find
themselves near one another they would
be close together in this High
dimensional space because they are
semantically similar right they have
similar meanings so they're both people
or humans Etc
this is kind of a core concept that
allows us to provide the service of
vector search if this didn't happen if
this didn't come about because of the
way that these pieces of data are
embedded and modeled then it wouldn't be
possible for us to provide this service
so that's super exciting
but if you zoom back out again and you
say here I have a bunch of circles if
again I put them on a graph I now can
kind of think of them as you know
vectors in space and we're noticing that
they actually kind of cluster together
so these could be a bunch of different
points maybe movies in some database and
it's conceivable that if you took those
movies and embedded the data about them
their plots you would see that they
would show up near one another and so
that's kind of what we're seeing here
and because they show up near One
Another We're actually able to draw
interesting information from them
but what's kind of core about that
information that we're able to draw from
them is how they relate to each other
and the way that we determine these
relations is kind of through two things
one is how they get embedded so what the
model takes that Source data and turns
it into in a high dimensional vector and
then also how do we calculate the
distance between these vectors
so
to imagine an example here if we had man
and woman and we had king and queen as
concepts with one embedding model one
way of representing this data along with
one way of determining the distance we
may find that man and King have a
shorter distance and and are more
semantically similar and woman and queen
are more semantically similar right that
could be produced by having one
embedding model and one distance
function and again we'll get into those
details a bit further in a second but
simultaneously you could also have a
different embedding model and use a
different distance function that would
result in actually man and woman being
closer together and more semantically
similar and king and queen being more
semantically simple so this is another
way that that is kind of determined
which then impacts exactly what happens
during Vector search and again just to
reiterate because I know people are kind
of Milling in
we're laying the groundwork for Vector
search and you know how this ends up
kind of uh impacting the service that we
end up offering so
we've talked about vectors how they
relate to one another how they end up
falling in this High dimensional space
when it comes to then using these
vectors there are some other important
Concepts that we need to know and so we
already talked about the fact that like
data when transformed into vectors can
create these clusters that are
semantically similar so groups of data
that have some sort of relevance or
reference or relationship between them
the uh
K nearest neighbor is a way to go and
search through these vectors that is an
algorithm that lets you kind of look at
these vectors and find neighbors to them
and K represents the number of neighbors
you're looking for when you talk about
them and so K nearest neighbors is a way
to look through vectors to find similar
ones to a Target
when you use K nearest neighbors you
have to define a specific similarity
function and so in Atlas Vector search
we support three there are more that you
can use out in the market but but these
are kind of the the three most popular
ones the first one is euclidean distance
which represents the distance between
the ends of vectors
um the next is cosine which represents
the angle between vectors and the third
is dot product which is based on both
the angle between the vectors and the
magnitude
each one of these functions is good for
a different type of use case and so
euclidean for instance is really good
for dense data where specific values
matter so for instance if you wanted to
do image similarity it's really
important that this pixel looks just
like this pixel that that would be a
good example of where euclidean would be
relevant another option would be cosine
right and that's where sparse data and
orientation is important and that's kind
of complex but what it really gets down
to is if you had examples like text
Concepts or themes that you wanted to be
able to find the distance between cosine
is really good for that because maybe
one word can represent a lot about what
a paragraph is about more than having
like several words repeated so that's
where cosine is good then dot product is
really good for sparse data where both
the orientation and the intensity matter
together
so
once you've decided you're going to use
Canary Sabers as an algorithm you know
that you're going to use a certain type
of distance function the way that all of
this kind of becomes reality is we have
to be able to find this information very
quickly and the way this is done is with
something called approximate nearest
neighbor and uh what's called a
hierarchical navigable small world graph
now that's a lot of words but it's
actually you know pretty straightforward
uh
approximate nearest neighbor basically
takes an approach to finding the nearest
neighbors just like K nearest neighbors
does but it does it in an approximate
manner obviously which prioritizes speed
over accuracy and what I mean by that is
at the margins where we're figuring out
does does this Vector fit as a neighbor
you could kind of drop those outliers
out and that's really what the
approximate is getting at so you're not
going to get necessarily all of the
nearest neighbors but again you're going
to get the majority and this is really
kind of happening at the margins and
what this allows for is a really fast
traversal of these vectors so that you
can find
semantically similar Concepts quickly
which is obviously very important within
the concept of a operational database
so
those are all the basics
so you're all oriented to Vector search
you understand more about vectors
there's one other concept prior to
talking about the feature itself that I
wanted to cover and that's kind of why
now
um so Vector databases have been around
for a long time and we've had Vector
search inside of mongodb for actually a
very long time in the form of geospatial
data those can be thought of as
two-dimensional vectors that can be
searched for other near vectors but
what's different now is that we're
looking at vectors in very high
dimensional space and with the strategy
I just talked about on the prior slide
we know why we're able to look through
them fast but we don't know yet why
these high dimensional vectors are able
to represent data so well and and that
really comes down to recent Evolutions
in machine learning and that encoder
model that I talked about much earlier
so
pre-2000 we had approaches to modeling
data in vectors that would use manual
feature engineering
um with you know strategies like bag of
words and TF IDF the next Evolution over
that was something like word to vac and
glove you know we're
- Assistant
moving into the early 2000s and this is where we start to use neural networks to help generate these vector representations. However, these early models were still not as powerful as what we have today.
In recent years, we've seen the rise of transformer models like BERT, GPT, and other state-of-the-art models that have significantly improved the way we can encode and represent data in high dimensional space. These models have made it possible to create vector representations that capture a much richer understanding of the data and its context, enabling more powerful search capabilities.
So now that we have a better understanding of vectors, their properties, and how they're generated, let's talk about Atlas Vector Search, the new feature in MongoDB.
Atlas Vector Search is a powerful search feature that allows you to perform similarity searches on high dimensional vectors. You can use this feature to search for similar images, text, audio, or any other data that can be represented as a high dimensional vector.
To use Atlas Vector Search, you will first need to generate vectors for your data using an appropriate encoder model. Once you have these vectors, you can store them in your MongoDB collection alongside the original data.
To perform a vector search, you can use the
$vectorquery operator in your MongoDB queries. This operator allows you to specify a target vector and a distance function, and it will return the K nearest neighbors to the target vector based on the specified distance function.Some potential use cases for Atlas Vector Search include:
- Image similarity search: Find similar images in a database based on their visual features.
- Text search and document retrieval: Find documents or text that are semantically similar to a given query.
- Audio similarity search: Find similar audio files based on their audio features.
- Anomaly detection: Identify unusual or outlier data points in a dataset.
In summary, Atlas Vector Search is a powerful new feature in MongoDB that leverages the latest advances in machine learning and high dimensional vector representations to enable fast and efficient similarity search across a wide range of data types. With this feature, you can build more intelligent applications that can better understand and respond to the complex relationships between different pieces of data.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.