Embedding
An embedding is a list of numbers that represents the meaning of a piece of data, such as a sentence, a document, or an image. Items with similar meanings get similar numbers, so a computer can measure how close two things are in meaning. Embeddings power semantic search, recommendations, and the retrieval step in RAG.
What does embedding mean in AI?
In everyday English, to embed something is to fix it firmly inside something else. In AI, an embedding places a piece of data inside a mathematical space, as a point, where its position reflects what it means. The result is a vector: a long list of numbers, often hundreds or a thousand or more of them.
How embeddings work
The analogy: think of a map where every word or sentence gets a location, and things with related meanings end up as neighbors. Google's machine learning course uses food as an example: in a well-trained embedding, "hot dog" and "shawarma" sit closer together than "apple strudel" and "borscht."
The precise version: an embedding model, a neural network trained for this job, reads the input and outputs a vector with a fixed number of dimensions. The distance between two vectors can be calculated, and that distance works as a measure of how similar the two items are. A common measure is cosine similarity, which compares the direction two vectors point.
Individual dimensions rarely mean anything a person could name. The meaning lives in the pattern across all of them.
Embeddings, vector search, and semantic search
Embeddings are what make semantic search possible. You embed every entry in a collection once and store the vectors, usually in a vector database. At search time, the query is embedded into the same space, and the system returns the entries whose vectors are closest. That nearest-neighbor lookup is called vector search.
Because it matches meaning instead of exact words, it handles synonyms and different phrasing that keyword search misses. The same lookup is the retrieval step in most RAG systems.
A real example of embeddings
A help center has six hundred articles. A customer types "can I get my money back if the box was crushed?" No article contains those words, but one titled "Refunds for items damaged in shipping" has an embedding very close to the question's embedding, so semantic search returns it first.
Why embeddings matter and when you would use them
Use embeddings whenever you need to find, group, or compare things by meaning: search over your documents, "related articles" suggestions, grouping similar support tickets, spotting duplicates, or feeding the right passages to a model. They are usually produced by a dedicated embedding model rather than a chat model. Anthropic, for example, does not offer its own embedding model and points developers to providers such as Voyage AI.
Common misconceptions about embeddings
- An embedding is a compressed copy of the text. It captures meaning for comparison; you cannot reliably read the original text back out of it.
- Any two embeddings can be compared. Only vectors from the same embedding model share a space. Mixing models gives meaningless distances.
- More dimensions always means better results. Larger vectors cost more to store and search, and the right size depends on the task.
Embedding in practice
Embeddings are the engine under retrieval. See how they fit into a full system in our guide to RAG (retrieval-augmented generation), then read the semantic search entry for the search side of the story.
Frequently asked questions
What is an embedding in AI?
An embedding is a list of numbers that represents the meaning of a piece of data, such as a sentence or an image. Similar meanings produce similar numbers, so a computer can measure how close two things are in meaning.
What does embedding mean in simple terms?
Think of a map where every piece of text gets a location, and things that mean similar things end up as neighbors. The embedding is that location, written as a list of numbers.
How are embeddings used in search?
Every document is embedded once and stored, usually in a vector database. A search query is embedded the same way, and the system returns the documents whose embeddings are closest. This is called semantic or vector search, and it matches meaning rather than exact words.
What is the difference between an embedding and a token?
A token is a small unit of text, like a word or part of a word, that a model reads and writes. An embedding is a list of numbers that represents the meaning of a token, a sentence, a document, or an image.
Can I compare embeddings from different models?
No. Each embedding model creates its own space, so distances only make sense between vectors from the same model. If you switch embedding models, you need to re-embed your documents.
New to all this? Start with what an AI agent really is, browse the full glossary, or explore the learning hub.
← Back to the glossary