Start here
Embeddings in plain language
A document titled “annual leave entitlement” may help someone asking about “holiday allowance” even when the words differ. Text embeddings can help connect these phrasings. They represent learned relationships rather than a dictionary of exact matches.
An embedding is not the original text and is not a generated answer. Its individual coordinates are usually not readable labels such as “holiday” or “employee”. Similarity is useful evidence for ranking, but does not establish truth, user permission or the relevance of a specific exception.
How it works
Represent
Use an embedding model to convert each item into a vector. Keep source text and useful metadata alongside it.
Compare
Represent the query in a compatible space and compare it with stored vectors using the selected distance or similarity measure.
Evaluate
Inspect the returned items for the actual task. Model choice, document boundaries, language and domain vocabulary affect results.
Illustrative example · Fictional data
Finding the right leave policy
- Input
- Three fictional document titles: “Annual leave entitlement”, “Office opening hours” and “Unpaid leave approval”. Query: how many paid holiday days do staff receive?
- Process
- Embed the query and documents with a compatible model. Retrieve candidates, then inspect their full passages and current policy versions.
- Expected output
- The annual-leave document is the expected useful result. The unpaid-leave document may be related but cannot answer the entitlement question on its own.
- How to check it
- Record whether the correct passage is among the results. Add exact employee codes, unusual abbreviations and a second language to expose where keyword or hybrid search may work better.
Where it helps
- Finding passages that use different wording from a question.
- Grouping feedback by topic before human inspection.
- Recommending related items using representations suited to that task.
Embeddings versus keywords
- Keyword search
- Useful for exact identifiers, quoted phrases and terminology that must match.
- Embedding search
- Useful for related meanings and paraphrases, depending on the model and data.
- Hybrid search
- Combines signals from both approaches and requires evaluation on representative queries.
Common pitfalls
- Vectors from different models are not automatically comparable, even if their lengths match.
- Changing the embedding model commonly requires re-embedding the stored collection.
- Embeddings are not a privacy mechanism. Treat representations and associated metadata according to the sensitivity of the source.
Put the idea to work
Try it yourself
Create ten fictional document titles and five paraphrased queries. Decide the expected matches before trying search. Compare keyword matches with semantic results and write down one failure from each approach.
Common questions
Do embeddings require a vector database?
No. Small collections can be searched in memory. A database becomes useful for persistence, filtering, updates, access integration and scale. Libraries such as FAISS or a simple NumPy similarity search are enough for prototypes and collections of a few thousand items.
Are all embeddings multilingual?
No. Language coverage depends on the model. Evaluate the languages and specialist terms your users actually use. Some embedding models are trained mainly on English, while others cover many languages. Test retrieval quality in Hindi or other languages before committing to one.
Are embeddings required for every RAG system?
No. RAG can retrieve information with keyword search or other retrieval methods. Embeddings are a common option. Keyword search such as BM25 is strong for exact terms, codes and names. Many production systems combine keyword and embedding retrieval for better coverage.
Your next step
Continue learning
Connected concepts
Sources and further reading
Examples on this page are teaching exercises using fictional information. They are not client case studies or measured outcomes.
