Use cases and patterns
Vector databases show up in many products, but the building blocks are always the same: embed, store, search, filter, rank. Here's how the most common use cases put those blocks together.
Semantic search
Goal: find documents by meaning, not just keywords.
- Embed documents (in chunks) and queries with the same model.
- Use hybrid search (dense + keyword) for robustness with names and codes.
- Rerank the top candidates for the best ordering.
- Show snippets and highlight why a result matched.
Retrieval-augmented generation (RAG)
Goal: give an LLM the right context to answer from your own data.
- Chunk documents carefully; store text and source metadata with each vector.
- Retrieve top candidates with permission filters, rerank, then pass the best chunks to the LLM with citations.
- Evaluate retrieval (recall@k) separately from answer quality.
The RAG Handbook covers this end to end.
Recommendations
Goal: "people who liked this also liked…" or "more like this".
- Embed items (from content, behaviour, or both) and optionally users.
- Search for items near the current item or the user's vector.
- Filter out items already seen, out of stock, or not allowed in the user's region.
- Often uses dot product, where vector length can encode popularity or strength.
Duplicate and near-duplicate detection
Goal: find the same thing written differently — duplicate support tickets, repeated questions, copied content.
- Embed each new item and search for neighbours above a similarity threshold.
- Tune the threshold on labelled examples of duplicates and non-duplicates.
- For whole-dataset deduplication, batch similarity search (often on GPUs or with libraries like FAISS) is efficient.
Classification and routing
Goal: assign a category or route a request without training a classifier.
- Store labelled examples as vectors.
- For a new item, find its nearest labelled neighbours and take a vote (k-nearest-neighbour classification).
- Useful for ticket routing and intent detection, and easy to update — just add examples.
Image and multimodal search
Goal: search images with text ("red running shoes") or with another image.
- Use a multimodal embedding model that maps images and text into the same space.
- Store image vectors with product or asset metadata.
Anomaly detection
Goal: spot unusual events — fraud, failures, odd log lines.
- Embed events; items far from all their neighbours (low similarity to everything) are candidates for review.
- Works best combined with domain rules and human review.
Memory for AI assistants and agents
Goal: let an assistant remember facts and past conversations.
- Store summaries of past interactions or user facts as vectors with user IDs.
- Retrieve relevant memories for each new message, filtered strictly by user.
- Expire or summarise old memories to control growth.
Almost every use case is the same recipe with different ingredients: what you embed, how you filter, and how you rank the final results.