AI Glossary

Embeddings

LLM foundationsPublished By Simon Budziak

Embeddings are numeric vectors that a model produces to represent the meaning of a piece of text, so that two passages with similar meaning end up as nearby points in that vector space, even when they share almost no words in common.

How do embeddings actually capture meaning?

An embedding model reads a chunk of text and outputs a fixed-length array of numbers, typically hundreds to a few thousand dimensions. What matters is not any single number but the position it defines: “cancel my order” and “I want a refund” land close together, while “cancel” the movement verb and “cancel my order” land far apart, because the model learned meaning from context during training, not from keyword overlap.

Why do embeddings matter for retrieval?

Embeddings are the mechanism that makes RAG work: a query gets embedded, every document chunk was embedded ahead of time and stored in a vector database, and retrieval finds the chunks whose vectors sit closest to the query’s. A weak or mismatched embedding model is one of the most common reasons retrieval returns passages that look related but do not answer the question, reaching the LLM as thin, misleading context.

What actually decides embedding quality?

Model choice, chunk size, and domain fit. A general-purpose embedding model trained on web text underperforms on dense technical or legal language, and a chunk that is too long dilutes its own vector, burying the one sentence that mattered among ten that did not.

Frequently asked questions

Are embeddings specific to one LLM?

No. Embeddings come from a separate, smaller text-to-vector model, not from the LLM that generates answers. A RAG system can pair any embedding model with any generation model, though switching the embedding model means re-indexing every document.

How is embedding similarity actually measured?

Usually cosine similarity: the angle between two vectors. A small angle means the two passages are close in meaning; a wide angle means they are unrelated, regardless of shared vocabulary.

Summarize this page with

See how this works in a real workflow