Embedding
Embeddings turn text or other data into vectors so similar items can be compared mathematically.
Use embeddings when semantic similarity matters more than exact keyword matching.
Use when
- Semantic search
- Document clustering
- Similar question matching
- Retrieval candidate generation
Avoid when
- Exact identifiers
- Numeric calculations
- Permission checks
- Cases where keyword matching is enough
Why embeddings matter
Embeddings make semantic search possible. They let a system connect “refund policy” with “how do I get my money back” even when the exact words differ.
In most RAG systems, embeddings are used to find candidate chunks before the model answers. They are a retrieval tool, not a truth engine.
When exact search is better
If users search for IDs, codes, names, dates, or exact phrases, plain full-text search can be stronger. Many production systems use hybrid search because semantic and keyword signals catch different failures.
Common mistakes
- Assuming embeddings understand permissions or business rules.
- Using only semantic similarity for exact lookup.
- Never testing different chunk sizes.
Next decision
Pair embeddings with a vector database when you need scalable similarity search. Add hybrid search when exact terms matter.