Subscribe
Explainers
8 min read

What Are Embeddings? How AI Turns Meaning Into Numbers

Embeddings turn words, images and products into lists of numbers so related things sit close together. How they work and how AI search uses them.

Olivetti-style cover reading EMBEDDINGS EXPLAINED and How AI turns meaning into numbers, with two dot clusters on a chart, a list of numbers, and the labels Words, Vectors, Distance.
Olivetti-style cover reading EMBEDDINGS EXPLAINED and How AI turns meaning into numbers, with two dot clusters on a chart, a list of numbers, and the labels Words, Vectors, Distance.

An embedding is a list of numbers that stands for a piece of data, such as a word, a sentence, a photo or a product. The numbers are chosen so that things with related meanings end up close together. IBM names text and image search engines, recommendation systems, chatbots and fraud detection systems among the applications that use embeddings.

Google's Machine Learning Crash Course puts it in one line: "An embedding is a vector representation of data in embedding space." This guide explains what that means in plain English, how similarity is measured, the difference between static and contextual embeddings, and what embeddings are used for. Each claim names the source page it comes from.

Flow diagram titled HOW AN EMBEDDING IS USED with four boxes: TEXT IN, EMBEDDING MODEL, LIST OF NUMBERS, MEASURE DISTANCE and USE IT, with the use labels search, clustering, recommendations and classification

The short version

  • An embedding turns data into a vector, which OpenAI's embeddings guide describes as a list of floating point numbers.
  • Closeness means relatedness. OpenAI's guide says: "Small distances suggest high relatedness and large distances suggest low relatedness."
  • IBM's explainer sums up the payoff: "In essence, embedding enables machine learning models to find similar objects."
  • Embeddings are not only for text. IBM covers words, text, images and audio, and the Sentence Transformers docs list text, images, audio and video.
  • The single numbers inside an embedding usually have no human-readable meaning. Google's course says the individual dimensions are rarely as understandable as its toy food examples.

Why AI needs numbers that carry meaning

A model cannot read the word pizza. It needs numbers. The simplest way to turn a list of items into numbers is one-hot encoding: give every item its own slot in a long list, and mark a 1 in that slot and 0 everywhere else.

Google's course walks through why this breaks down, using a food app with a dataset of 5,000 meal items. Each one-hot vector has 5,000 entries. Google lists the problems: large input vectors mean a huge number of weights in a neural network, more weights need more data to train, and they take more computation and more memory. It also notes that one-hot vectors carry no relationships. In Google's example, a hot dog should be closer to a shawarma than to a salad, but one-hot encoding cannot show that.

Embeddings fix both problems. Google's module describes embeddings as lower-dimensional representations of sparse data that address these issues. Instead of 5,000 mostly empty slots, each item gets a short, dense list of numbers, and similar items get similar numbers.

A map of meaning: the food example

Google's embedding space lesson builds the idea one dimension at a time.

  • One dimension. Put foods on a line from least like a sandwich to most like a sandwich, a scale Google calls sandwichness. Hot dogs and shawarma land near each other.
  • Two dimensions. Add a dessertness axis. Apple strudel now sits apart from the sandwiches. Google gives example coordinates: apple strudel at (0.5, 0.3) and hot dog at (0.2, -0.5).
  • Three dimensions. Add liquidness, and borscht separates from the rest. Tangyuan, a sweet soup, lands high on dessertness and liquidness and low on sandwichness.

Each extra number adds a direction the model can use to tell items apart. Google says each item in an embedding is represented with n floating-point numbers, typically in the range of minus 1 to 1 or 0 to 1.

Real embeddings use far more than three dimensions. Google notes that for word embeddings the number of dimensions is often 256, 512 or 1024, and that the dimensions a real model picks are rarely as easy to name as dessertness. The model learns where to put things during training. People do not hand-label each axis.

Google adds one more point that beginners miss: embeddings are usually specific to a task. Its example is that cereal and breakfast sausage would probably sit close together in a time-of-day model but far apart in a vegetarian versus non-vegetarian model.

How closeness is measured

Once two items are vectors, a computer can measure the distance between them. IBM names Euclidean distance and cosine similarity as ways to do it, and describes the dot product as a measure of how closely two vectors point in the same direction.

For its own models, OpenAI's guide answers the question directly. Asked which distance function to use, it says: "We recommend cosine similarity." It then adds: "The choice of distance function typically doesn’t matter much." The guide also says OpenAI embeddings are normalized to length 1, so cosine similarity can be computed with a dot product, and cosine similarity and Euclidean distance give identical rankings.

In plain terms: two texts about the same thing get vectors that point the same way, and a simple calculation turns that into a score.

Static embeddings vs contextual embeddings

Early word embeddings gave each word one fixed vector. The example Google's course uses is word2vec, introduced in the 2013 paper Efficient Estimation of Word Representations in Vector Space by Mikolov and colleagues. IBM describes Word2Vec as developed by Google in 2013, using a two-layer neural network. Google's course calls this a static embedding: one embedding vector per word.

Static embeddings have a known gap. Google's lesson on obtaining embeddings uses the word orange, which can mean a color or a fruit. With one static embedding, the word always sits in the same place, whatever the sentence. Google's course lists nine meanings of post to make the same point.

Contextual embeddings solve this by letting the surrounding words change the vector. Google explains that transformer models use a self-attention layer to weight how relevant the other words in a sequence are to each word, and add positional information. The result is an input embedding that is unique to each text sequence. If you want the mechanics, our plain-English transformer explainer covers attention, and our guide to tokens explains the pieces of text a model embeds.

What embeddings are used for

OpenAI's guide lists six uses for its embeddings:

  • Search, where results are ranked by relevance to a query string.
  • Clustering, where text strings are grouped by similarity.
  • Recommendations, where items with related text strings are recommended.
  • Anomaly detection, where outliers with little relatedness are identified.
  • Diversity measurement, where similarity distributions are analyzed.
  • Classification, where text strings are classified by their most similar label.

IBM adds a recommendation example: users and items (movies, products, articles) each get an embedding, and the dot product of a user's vector and an item's vector gives a recommendation score. IBM says the higher the dot product, the more likely the user is to be interested in the item.

Hugging Face's tutorial builds a small FAQ search engine: it embeds a set of Medicare FAQs, then compares a user's question to them and returns the closest match. That is semantic search in its smallest form. The search matches meaning, not exact keywords.

Embeddings also cross formats. Hugging Face's tutorial says you can create an embedding of an image and compare it with a text embedding to check whether a sentence describes the image. Our EmbeddingGemma 2 explainer covers one multimodal embedding model in detail.

Embeddings, vector databases and RAG

Retrieval-augmented generation (RAG) lets a chatbot look up passages from a set of documents before it answers. Our RAG explainer walks through how that lookup works and where embeddings fit.

OpenAI's guide says you can save an embedding vector in a vector database, and for searching over many vectors quickly it recommends using one. For the engineering side, see our technical comparisons of vector databases for production RAG and of embedding models and rerankers.

How long is an embedding?

Length (the number of dimensions) varies by model. As of November 2026, OpenAI's guide says the default length is 1,536 for text-embedding-3-small and 3,072 for text-embedding-3-large. In the example code on the Sentence Transformers home page, Qwen3-Embedding-0.6B returns vectors of 1,024 numbers and EmbeddingGemma 2 returns vectors of 768.

Bar chart titled HOW MANY NUMBERS PER EMBEDDING, drawn to scale from zero: text-embedding-3-large 3,072; text-embedding-3-small 1,536; Qwen3-Embedding-0.6B 1,024; EmbeddingGemma 2 768; text-embedding-3-large shortened 256

Longer is not free. OpenAI's guide says that using larger embeddings, for example storing them in a vector store for retrieval, generally costs more and consumes more compute, memory and storage than using smaller embeddings. Its newer models let developers shorten embeddings with a dimensions parameter. OpenAI says that on the MTEB benchmark, a text-embedding-3-large embedding shortened to 256 numbers still outperforms an unshortened text-embedding-ada-002 embedding of 1,536. The guide links that shortening to a training technique described in the Matryoshka Representation Learning paper. Our technical Matryoshka explainer covers the math.

Where to learn more and try it

  • Google Machine Learning Crash Course, Embeddings module. The module page gives an estimated length of 45 minutes. It assumes you know the earlier modules: Introduction to Machine Learning, Linear regression, Working with categorical data, and Neural networks. Its learning objectives include visualizing word2vec embeddings and describing contextual embeddings.
  • Hugging Face, Getting Started With Embeddings. The tutorial (published June 23, 2022) builds the FAQ search engine above in Python. It says: "The open-source library called Sentence Transformers allows you to create state-of-the-art embeddings from images and text for free." The tutorial uses a Hugging Face account token, and some API steps may have changed since 2022, so treat the code as a guide. That caution is our reading, not the tutorial's.
  • Sentence Transformers documentation. The docs cover computing embeddings and similarity scores in Python. They say over 25,000 pre-trained Sentence Transformers models are available on Hugging Face (count as of November 2026).
  • OpenAI embeddings guide. The guide shows how to call the embeddings API and walks through use cases on a food-reviews dataset. It is a paid API. The guide says: "Requests are billed based on the number of tokens in the input."
  • MTEB leaderboard. The Sentence Transformers docs point to the Massive Text Embeddings Benchmark (MTEB) leaderboard, a Hugging Face Space, for state-of-the-art models. OpenAI's guide also reports its models' MTEB scores.

New to the other terms here? Our AI glossary defines vectors, tokens, RAG and more. To see how embeddings differ from changing a model itself, read What Is Fine-Tuning?.

Limits to keep in mind

  • The numbers are hard to read. Google says that often the process of finding a lower-dimensional space is not interpretable by humans, and the resulting embeddings are difficult to understand.
  • One task, one map. Google says embeddings will usually be specific to the task, so a vector built for one job may not suit another.
  • Static embeddings miss context. Google's orange example shows how a single vector per word blurs different meanings.
  • Size costs money. OpenAI says that using larger embeddings, for example in a vector store, generally costs more and uses more compute, memory and storage.

Bottom line

An embedding is a vector representation of data, in Google's words, and its job is to put related things close together. OpenAI's guide says small distances suggest high relatedness. That is how search, recommendations, clustering and RAG find what matches. Our reading: if you understand the food map in Google's course and the idea that distance means relatedness, you understand the core of how AI search and document chatbots find what they show you.

Sources

ExplainersEmbeddingsRAG