What is Embedding?

An embedding is a list of numbers representing a piece of content in a space where geometric closeness corresponds to semantic similarity, so that meaning becomes something you can measure arithmetically.

The plain definition

An embedding model maps content — a sentence, a document, an image, a product — to a fixed-length vector, typically a few hundred to a few thousand numbers. The vector has no individually interpretable dimensions. What matters is relative position: content with similar meaning lands near other similar content.

That single property is unusually useful, because it converts a fuzzy human question ('what else is like this?') into a well-defined mathematical one (nearest neighbours by cosine similarity). Keyword search matches strings; embedding search matches meaning, so 'how do I cancel my subscription' retrieves a document titled 'ending your plan' despite sharing almost no words.

What they are actually used for

Semantic search and retrieval. The dominant use, and the mechanism underneath retrieval-augmented generation. Embed the corpus once, embed the query at request time, return nearest neighbours from a vector database.

Deduplication and entity resolution. Near-duplicate records defeat exact hashing entirely; embedding distance catches them. This matters for data quality generally and specifically for preventing duplicate leakage across training data splits.

Recommendations. Represent items and user histories in the same space, then recommend by proximity. This handles cold-start far better than collaborative filtering, because a brand-new item still has a content embedding.

Clustering and classification. Embeddings are strong general-purpose features. Freeze the embedding model, train a small classifier on top, and you have a competitive model from a few hundred labelled examples — the cheapest form of transfer learning.

The mistakes that cost the most

Mixing embedding models. Vectors from different models are not comparable — not even different versions of the same model. If you re-embed with a new model, you must re-embed the entire corpus. Teams discover this when retrieval quality collapses inexplicably after a routine upgrade.

Chunking badly. For retrieval, what you embed matters more than which model you use. A whole 40-page document averaged into one vector is too diffuse to match anything precisely; a single sentence lacks the context to be interpretable. Chunk on semantic boundaries — sections, headings — with modest overlap, and keep enough surrounding context that a retrieved chunk stands alone.

Assuming similarity means relevance. Cosine similarity measures topical resemblance, not usefulness. A question and a near-identical question are highly similar; the question and its answer may not be. This is why serious retrieval pipelines add a reranking stage, and why hybrid search — combining embeddings with keyword matching — reliably outperforms either alone, particularly on product codes, names, and exact identifiers where lexical matching is simply correct.

  • Distance means similarity — meaning becomes arithmetic you can index and query
  • Never mix models — vectors from different models or versions are incomparable
  • Chunking dominates quality — what you embed matters more than which model embeds it
  • Hybrid beats pure vector — combine with keyword search for codes, names, and identifiers
FAQ

More on Embedding.

What is the difference between an embedding and a vector database?

The embedding is the representation; the vector database is the infrastructure that stores millions of them and finds nearest neighbours quickly. An embedding model produces vectors, a vector database indexes and searches them. You can hold a few thousand vectors in memory with a plain numerical library and skip the database entirely — it becomes necessary at scale, or when you need filtering, persistence, and updates.

How large should embeddings be?

Larger vectors capture more nuance and cost more to store and search, and the returns flatten quickly. Common production sizes run from 384 to 1,536 dimensions. Many current models support dimensionality truncation, letting you keep a shorter prefix of the vector with modest quality loss — often the right trade at scale. Benchmark retrieval quality on your own queries at two or three sizes rather than assuming bigger is better.

Free consultation

Applying this to a
real system?

We build and ship production machine learning. If embedding is part of a problem you are working on, tell us about it.

Start the conversation

or write to us at [email protected]