Topics / Vector databases
How do vector databases work?
The problem as a graph
The graph shows your query as an active node in a space of stored entities. Each stored entity has a position; the edges are closeness relations. At first the relation to the matching neighbours is still empty — the database measures the distances and activates exactly the shortest ones. Distant nodes stay passive or empty and never surface in the answer.
Graph as text
- Query (as a vector) → Embedding model (active)
- Embedding model → Nearest-neighbour search (active)
- Nearest-neighbour search → Close match (empty)
- Nearest-neighbour search → Distant entity (passive)
- Close match → Answer / next query (empty)
- Answer / next query → Query (as a vector) (passive)
Step by step
- Turn every item into an entity with a position: an embedding model translates text, image or sound into a long row of numbers, a vector. These numbers are the entity's coordinates in space.
- Store these vectors instead of indexing words. A vector database does not keep the wording but the location — and locations can be compared even when the words are completely different.
- Turn your query into a vector with the same model. Now the question itself is an entity in the same space, with its own coordinates beside all the stored entities.
- Measure the closeness: the database looks for the nearest neighbours of your query point. Each short distance is a relation that jumps from empty to active — that is the heart of the search.
- Redirect the energy onto the close matches instead of exact words. That way you find what fits in meaning — 'dog' lies near 'puppy' even without a shared word.
- Note which new entities the answer opens up and ask the next question as a new point. The space stays — you only move further within it.
Seen through the model
Imagine you search a large photo collection for 'a dog in the snow', but no caption says exactly that. A classic word search comes back empty, because the words do not appear literally. A vector database thinks differently: every photo is an entity with a position in space, and your query becomes a point right beside them.
Now the database measures which stored entities lie closest to your query point. The picture of a puppy in winter uses quite different words but sits in a similar position — the relation between query and match jumps from empty to active and pulls the photo in. A beach picture lies far away; its relation stays passive and never surfaces.
This is also how AI chatbots that look up sources work: the question becomes a vector, the nearest text chunks are activated and handed to the model. This is one way to see vector databases — not a finished truth about the maths behind them, but a lens. What feels similar lies close; and searching means activating the shortest relation instead of hunting for the exact word.
Frequently asked
What is a vector database, explained simply?
A vector database stores items not as words but as a position in a space. An embedding model turns text, image or sound into a row of numbers, a vector — the entity's coordinates. Similar items land close together. Searching then means finding the nearest neighbours of a query point, rather than matching words exactly.
How does a vector database find similar items?
It measures distances. Your query is turned into a vector by the same model, so it becomes a point in the same space. The database then looks for the closest stored points (nearest-neighbour search). Each short distance is a relation that becomes active; far-away entities stay passive and never surface. Closeness replaces exact word matching.
Why does AI need vector databases?
Language models guess text from patterns and easily forget what lies outside them. A vector database gives them a searchable memory: the question becomes a vector, the nearest text chunks are activated and looked up (retrieval). This couples guessed text to concrete sources. One possible reading, but a practical way to make AI guess less.
Keep thinking
Related terms: Entity, Relation, The three states: empty, active, passive, Network level