Embeddings and vector search explained: how agents find relevant information
When an agent needs to find "the document about refund policies" among thousands of files, keyword search alone often fails because the right document may use different words. Embeddings help with that.
What an embedding is. An embedding model turns a piece of text (or an image) into a long list of numbers, a vector. Texts with similar meaning end up with vectors that are close together, even if they share few words. "How do I get my money back?" lands near "refund policy."
How vector search works:
- Split your documents into chunks.
- Compute an embedding for each chunk and store them in a vector index.
- When a question comes in, embed the question too.
- Find the chunks whose vectors are closest (often using cosine similarity).
- Pass those chunks to the model as context.
Practical considerations:
- Chunking matters. Chunks that are too small lose context; too large and they dilute relevance.
- Hybrid search combining keyword and vector search often beats either alone, especially for names, codes and exact terms.
- Re-ranking a larger set of candidates with a more precise model can improve results.
- Embeddings are model-specific. Switching embedding models usually means re-embedding everything.
- Metadata filters (date, author, permissions) keep results relevant and prevent agents from seeing data a user shouldn't access.
Have you found hybrid search noticeably better than pure vector search? How do you decide on chunk size?
Comments · 3
So the embedding is basically a list of numbers where similar meanings end up close together? That clicked for me, thanks.
For product teams the practical question is chunking. Bad chunk sizes tank retrieval quality more than the choice of model, in my experience.
Worth remembering that similarity is not truth. A vector search returns the closest match, which may still be irrelevant or outdated, so evaluate on real queries.