AI systems
How does vector search work?
Vector search converts a query into an embedding and finds stored vectors that are nearby according to a similarity metric. Large systems usually use approximate nearest-neighbor indexes to trade a small amount of recall for much faster retrieval.
Step-by-step
- 1
Embed the query
The same embedding family used for indexed content transforms the incoming query into a numeric vector.
- 2
Produce a query vector
The vector captures patterns learned by the embedding model; it is not a literal database of meanings or facts.
- 3
Search the vector index
The system compares the query vector with indexed vectors using a configured metric such as cosine similarity, dot product, or Euclidean distance.
- 4
Retrieve approximate neighbors
Indexes such as HNSW or IVF can avoid scanning every vector, producing a candidate set much faster than exhaustive search.
- 5
Rerank when needed
The candidate list can be filtered or reranked using metadata, lexical scores, business rules, or a more expensive relevance model.
- 6
Return the best matches
The top-ranked items are returned directly or passed to another system, such as a retrieval-augmented generation pipeline.
Keep learning
Related visual explainers
How do AI agents work?
An AI agent combines a model with instructions, state, tools, and a control loop. Instead of producing only one response, the system can choose an allowed action, execute it, observe the result, update state, and continue until it reaches a stopping condition.
How does Redis caching work?
A Redis cache keeps frequently requested data in fast in-memory storage so an application can avoid repeating slower database or service work. A common cache-aside flow checks Redis first, falls back to the source on a miss, then stores the result with an expiration policy.