Embedding
An embedding is a numeric vector representation of data — such as text, images, or audio — designed so that items with similar meaning or content are positioned close together in vector space.
Definition
An embedding is a numeric vector representation of data — such as text, images, or audio — designed so that items with similar meaning or content are positioned close together in vector space.
Overview
Machine learning models operate on numbers, not raw text or pixels, so embeddings serve as the bridge between real-world data and a model's internal computations. An embedding model is trained so that semantically similar inputs — like the words "happy" and "joyful," or two similar product images — produce vectors that are close together by a distance metric such as cosine similarity, while dissimilar inputs produce vectors that are far apart. In large language models, tokens produced during tokenization are first converted into embedding vectors, which are then processed through layers using the attention mechanism to build increasingly rich, context-aware representations. Separately, standalone embedding models are widely used to convert entire documents, sentences, or images into a single vector for downstream use. These standalone embeddings are the foundation of vector search and semantic search: documents are embedded once and stored in a vector database, and a query embedding is compared against them to retrieve the most relevant matches — the core mechanism behind retrieval-augmented generation. The blog post How Large Language Models Actually Work explains this pipeline in more detail.
Key Concepts
- Represents data as a numeric vector capturing semantic meaning
- Similar items produce vectors that are close together in vector space
- Used internally by language models after tokenization
- Standalone embedding models convert documents or images into single vectors
- Foundation of vector search, semantic search, and RAG pipelines
- Distance metrics like cosine similarity measure embedding closeness
Use Cases
Frequently Asked Questions
From the Blog
How to Choose an Embedding Model for Search
Choosing an embedding model for search means balancing retrieval quality, dimension size, cost, and language coverage against your data. Here's how to decide.
Read More AI & TechnologyEmbedding Dimensionality: The Trade-offs You Actually Feel
Embedding dimension sets your index memory, your query latency and the ceiling on retrieval quality, and those three do not move together. Learn the formula that predicts memory before you index, where extra dimensions stop paying for themselves, and how truncation-friendly embeddings let you choose after the fact.
Read More AI & TechnologyInside the Transformer: Every Block, Explained in Order
Follow a single token through a transformer: tokenisation, embedding, positional information, attention, the feed-forward block, normalisation, and the final projection to a probability distribution. By the end you will know what every field in a model config controls and where training instability comes from.
Read More AI & TechnologyVector Search in Production: Indexes, Filters and Scale
Production vector search is four decisions: which index family you build, how filters interact with that index, how you shard and refresh as the corpus grows, and how you measure recall rather than assume it. Get those right and embedding search stays fast under real traffic; get them wrong and it degrades quietly.
Read More