Embeddings
Embeddings are lists of numbers that represent text, images, audio or other data so that similar items end up close together in a vector space.
Roadmap step 1 of 4: Tokens and embeddings. Try it: Transformer Explainer: tokenization and embedding ↗
What it is
An embedding is a fixed-length vector produced by a model for an input such as a word, sentence, image or audio clip. The model is trained so that the position of the vector reflects meaning or content, not surface form. Items with related meaning land near each other, while unrelated items land far apart.
Why it matters
Embeddings let software compare meaning with simple math, which powers semantic search, recommendations, clustering, deduplication and retrieval for LLM applications. They turn messy unstructured data into a form that databases and classifiers can handle. Choosing a good embedding model strongly affects the quality of search and retrieval systems.
How it works
A neural network, often a transformer, maps the input to a vector, typically with hundreds or thousands of dimensions. Training uses objectives such as contrastive learning, which pulls matching pairs together and pushes non-matching pairs apart. At use time, you embed your documents and a query, then rank by a similarity measure such as cosine similarity, often using a vector index for speed. Multimodal embedding models place different data types, such as text and images, in the same space.