How AI Finds Similar Things — Vector Search Explained (AI · EXPLAINED #2)

How AI Finds Similar Things — Vector Search Explained (AI · EXPLAINED #2)

Last time, we saw that AI turns everything into a vector, a point in space. That unlocks something powerful. If meaning is a location, then finding similar things becomes finding nearby points. Search becomes geometry. To compare two vectors, the AI looks at the angle between them. Point in nearly the same direction, and they're similar, a cosine close to one. Point in different directions, and they're not. That single number, cosine similarity, ranks how related any two things are. So to answer a query, the AI embeds it into the same space, then grabs the closest points, its nearest neighbors. Ask for a loyal pet, and the vectors for dog and cat light up, while airplane stays dark. No keywords. Just distance. But there's a catch. A real system holds millions, even billions of vectors. Comparing your query against every single one, one by one, is far too slow. Brute force simply doesn't scale. The fix is a vector index. Ahead of time, it groups nearby vectors into regions. A query then searches only the handful of regions around it, and finds great matches in milliseconds. This is approximate nearest-neighbor search. Put it together, and you have a vector database. Embed your data once, and you can search it by meaning, instantly. It's how recommendations, semantic search, and the retrieval step inside modern chatbots all work. Query, embed, find the nearest neighbors. That's retrieval.