How they work
An embedding model reads a passage and outputs a vector, typically a few hundred to a few thousand numbers long. To find related content, you embed the query with the same model and look for the stored vectors closest to it, using a measure such as cosine similarity. A question about annual leave can then match a passage about holiday entitlement, although the two share no words.
Where they are used
- Semantic search, and the retrieval step of retrieval-augmented generation.
- Duplicate detection, such as the same supplier entered twice under different spellings.
- Grouping and routing, such as sorting support tickets by topic.
- Recommendations: products or articles similar to one a user has viewed.
Arabic and English in one index
Multilingual embedding models place an Arabic question and an English passage with the same meaning near each other, so one index can serve both languages. Quality varies by model, especially for Gulf dialects, so test with real queries in both languages before you choose.
Common mistakes
- Mixing vectors from different models, or changing the model without re-embedding everything. The numbers are not comparable.
- Relying on vectors alone for codes, names and numbers. Combine them with keyword search, an approach known as hybrid search.
- Treating embeddings as anonymous. Text can be partly reconstructed from them, so protect them like the source and apply each document's permissions at query time.
- Embedding a whole long document as one vector, which blurs its meaning. Embed passages instead.
Related terms
Embeddings are usually stored in a vector database. They differ from fine-tuning, which changes the model instead of indexing content. See how we build knowledge assistants and Arabic AI assistants on top of them.