← Resources
By Hisako Aoyagi
— Localization Engineer
·
· INSIGHT
What Are Embeddings? The Vectors Behind AI Search and RAG
An embedding is a vector that represents meaning — text with similar meaning maps to nearby vectors. This explains what embeddings are, how they power semantic search and RAG, how similarity is measured, what dimensions mean, the model landscape, and how embeddings differ from keyword search.
What an embedding is
A text embedding is a numerical representation of meaning — a list of numbers (a vector) that captures the semantic content of a word, sentence, or document, so that pieces of text with similar meaning map to vectors that sit close together. An embedding model takes unstructured input and outputs a dense, fixed-length vector, unlike the sparse word-count vectors of older methods.
The defining property is simple and powerful: similar meaning produces nearby vectors. Two sentences that mean the same thing land close together even if they share no words, and unrelated text lands far apart. That single property is what makes meaning-based search possible.
How embeddings are used
Embeddings underpin a lot of modern AI. The biggest uses are semantic search (find by meaning, not exact words) and retrieval for [RAG](/articles/building-a-knowledge-base-from-docs) — embedding your documents and your query, then fetching the nearest chunks to ground an answer. They also power clustering, classification, deduplication, recommendations, and reranking.
The through-line is "find things that mean something similar." Wherever you need that — search, retrieval, grouping, or matching — embeddings are usually the mechanism underneath.
Similarity and dimensions
Similarity between two embeddings is measured by the distance or angle between their vectors, most commonly cosine similarity — the cosine of the angle, where 1 means identical direction and 0 means unrelated. Many models return vectors normalized to length one, which makes cosine similarity equal to a plain dot product and faster to compute.
Dimensions are how many numbers are in the vector. More dimensions can capture more nuance but cost more storage and compute; common sizes run from a few hundred to a few thousand. A useful modern trick is Matryoshka representation, which front-loads the most important information into the first dimensions so an embedding can be truncated to fewer dimensions with limited quality loss — trading a little accuracy for large storage savings.
The model landscape
There's a wide field of embedding models. Hosted options include OpenAI's text-embedding-3 family, Voyage (strong for RAG, code, and legal), and Cohere's multimodal Embed line. Open-weight, self-hostable models include the BGE family (small to large, with strong multilingual variants) and newer entrants. The standard way to compare them is MTEB — the Massive Text Embedding Benchmark — and its public leaderboard.
Two cautions: treat any specific leaderboard ranking as time-sensitive, since the field moves fast and benchmark versions aren't directly comparable across releases; and don't fixate on a single "#1 model" — the best choice depends on your domain, languages, latency, and whether you need to self-host.
Embeddings vs keyword search
Embeddings power semantic search, which matches meaning — it finds conceptually related results even with no shared words. Keyword (lexical) search matches exact terms and excels at exact strings like error codes, SKUs, and product names. Each misses what the other catches: semantic search can miss an exact identifier; keyword search can miss a synonym.
That's why [hybrid search](/articles/hybrid-search-bm25-vector) — combining keyword and vector retrieval and merging the results — is the recommended default for most production systems. And for RAG specifically, embeddings come after [chunking](/articles/chunking-strategies-for-rag): you split documents into chunks, embed each, store them in a [vector database](/articles/choosing-a-vector-database), and retrieve the nearest ones at query time.
Embeddings in osFoundry
Embeddings are the engine behind osFoundry's knowledge bases and vector search. When you add documents, osFoundry chunks them, turns each chunk into an embedding, and stores those vectors so the system can retrieve by meaning rather than exact keywords. Embeddings are generated through a managed embedding layer, so you get high-quality semantic retrieval without standing up, hosting, or paying to run an embedding model yourself.
That same vector layer powers semantic search and RAG retrieval across your notes, knowledge bases, and records, grounding AI answers in your own content. The result is that meaning-aware search and retrieval are built in, with the embedding infrastructure handled for you — you work with documents and questions, not vectors and indexes.
Frequently asked questions
- What is an embedding in simple terms?
- An embedding is a list of numbers (a vector) that represents the meaning of a piece of text, so that text with similar meaning produces vectors that sit close together. It turns words into coordinates in a space where distance corresponds to similarity in meaning — which is what lets computers search and compare by meaning rather than exact words.
- How are embeddings used in AI search and RAG?
- You embed your documents (usually after chunking them) and store the vectors, then embed the user's query and retrieve the chunks whose embeddings are nearest to it. Those retrieved chunks ground the model's answer. The same mechanism powers semantic search, clustering, classification, deduplication, and recommendations.
- How is similarity between embeddings measured?
- Most commonly with cosine similarity — the cosine of the angle between two vectors, where 1 means the same direction (very similar) and 0 means unrelated. Many models return length-normalized vectors, which makes cosine similarity equivalent to a dot product and faster to compute. Other distance measures exist but cosine is the usual default.
- What are embedding dimensions, and do more mean better?
- Dimensions are how many numbers make up the vector, typically from a few hundred to a few thousand. More dimensions can capture more nuance but cost more storage and compute, and beyond a point add little. Some models support truncating the vector (Matryoshka representation) to fewer dimensions with small quality loss, trading accuracy for big storage savings.
- What's the difference between semantic search and keyword search?
- Semantic search uses embeddings to match meaning, so it finds related results even without shared words — but can miss exact identifiers. Keyword search matches exact terms and nails codes, SKUs, and names, but misses synonyms and concepts. They're complementary, which is why hybrid search (both combined) is the recommended default for production.
- Which embedding model should I use?
- It depends on your needs, not a single leaderboard winner. Hosted options like OpenAI, Voyage, and Cohere are strong and easy; open models like the BGE family are self-hostable and good for multilingual or on-prem use. Compare candidates on MTEB, but weigh your domain, languages, latency, and self-hosting requirements — and treat rankings as time-sensitive.
- Do I need to chunk documents before embedding them?
- For RAG, yes. You split documents into chunks, embed each chunk, and store them, so retrieval returns focused, relevant passages rather than whole documents. Chunk size and overlap meaningfully affect quality — smaller chunks favor precise lookups, larger ones favor broader context — so it's worth tuning alongside the embedding model.
Sources