By Plainly Editorial

Updated

First published

What are embeddings?

Filed under AI & modern tech

What is an embedding in simple terms?

An embedding model takes an input, say the sentence “How do I reset my password?”, and returns a fixed-length list of numbers, such as 1,536 decimal values. That list is called a vector. Every input the model processes, short or long, comes back as a list of the same length.

The individual numbers do not mean anything you could read on their own. What matters is how vectors relate to each other. “How do I reset my password?” and “I forgot my login” produce vectors that are close together. “Best pizza in Naples” produces one that is far away.

Embeddings are a building block, not a chatbot. They do not generate text. They turn content into a form that computers can compare quickly and at scale.

How do embeddings capture meaning?

Picture a map. On a normal map, two cities that are near each other have similar coordinates. An embedding is a set of coordinates on a “map of meaning”, except instead of two dimensions (latitude and longitude) it has hundreds or thousands. Texts about the same idea land in the same neighborhood.

The model learns where to place things by training on huge amounts of text. The core idea goes back to a simple observation: words that appear in similar contexts tend to have similar meanings. The 2013 word2vec work by Mikolov and colleagues at Google showed this could be learned efficiently from over a billion words, and that the resulting vectors captured relationships. A famous example: the vector for “king” minus “man” plus “woman” lands closest to “queen”.

Modern embedding models work on whole sentences and documents rather than single words. Sentence-BERT (2019) was an influential step, making it practical to compare large numbers of sentences by meaning.

How is similarity between embeddings measured?

The most common measure is cosine similarity. In plain English, it asks whether two vectors point in the same direction. If they point the same way the score is close to 1, meaning very similar. If they are unrelated the score is near 0. Length is ignored, so a short query and a long article can still match well.

Cosine distance is just 1 minus cosine similarity, so smaller distance means more similar. Some systems use the dot product or Euclidean (straight-line) distance instead. OpenAI’s embedding guide notes that its vectors are normalized to length 1, so dot product and cosine similarity give the same ranking.

Scores are relative, not absolute. A similarity of 0.8 might be excellent for one model and ordinary for another, so you usually rank results rather than rely on a fixed cutoff.

What are embeddings used for?

Semantic search: find documents that match the meaning of a query, not just its keywords. Retrieval-augmented generation (RAG): fetch the most relevant passages from your own documents and give them to an LLM so it can answer from them. Recommendations: suggest articles, products, or songs whose embeddings sit near things a person liked.

Clustering: group thousands of support tickets or survey responses into themes automatically. Deduplication: spot near-identical records, such as the same question asked in different words. Classification: label new items by comparing them with labeled examples. Anomaly detection: flag items that sit far from everything else.

How does semantic search with embeddings work step by step?

1. Split your documents into chunks, often a few hundred words each. 2. Run every chunk through an embedding model and store the vectors alongside the original text. 3. When a user searches, embed their query with the same model. 4. Find the stored vectors closest to the query vector. 5. Return those chunks, or pass them to an LLM to write an answer.

Two rules save a lot of grief. Always use the same model for documents and queries, because vectors from different models live on different maps and cannot be compared. And re-embed everything if you switch models.

What is a vector database?

A vector database stores embeddings and answers one question fast: which stored vectors are nearest to this one? Comparing a query against every stored vector is fine for a few thousand items but too slow for millions, so vector databases use approximate nearest neighbor indexes that find very close matches without checking everything.

You do not always need a dedicated product. Many general databases and search engines now support vector columns and similarity search. For a small project, an in-memory list and a few lines of code can be enough.

What do embedding dimensions mean?

Dimensions are the length of the vector. As of late 2026, OpenAI’s text-embedding-3-small returns 1,536 numbers by default and text-embedding-3-large returns 3,072, and both let you request shorter vectors. Other providers and open models commonly range from a few hundred to a few thousand.

More dimensions can capture finer distinctions but cost more to store and search. One million 1,536-dimension vectors stored as 4-byte floats take about 6 GB before any index overhead. Shorter vectors are often a sensible trade for large collections.

What are the limitations of embeddings?

Similar is not the same as correct or relevant. “The drug is safe for children” and “The drug is not safe for children” can embed close together, because they are about the same topic. Embeddings are weak at negation, exact numbers, and precise identifiers like product codes, where keyword search often does better.

They also inherit the gaps and biases of their training data, can struggle with specialist jargon or less common languages, and chunking choices strongly affect results. Many production systems combine embedding search with keyword search (called hybrid search) and add a reranking step to get the best of both.

Keyword search vs semantic (embedding) search

Keyword searchSemantic (embedding) search
Matches onExact words and close variantsMeaning, even with different wording
“forgot login” finds “reset password”?Usually notUsually yes
Exact codes, names, numbersStrongOften weak
Handles synonyms and paraphraseOnly with manual synonym listsBuilt in
Cross-language matchingNoYes, with multilingual models
ExplainabilityEasy: you can see matched wordsHarder: a similarity score
Setup costLowNeeds an embedding model and vector index
  • A help center where searching “can’t get into my account” returns the article titled “Resetting your password”
  • A RAG chatbot that embeds 5,000 internal policy pages and retrieves the three most relevant passages for each employee question
  • A support team clustering 20,000 tickets into themes and discovering a spike in complaints about one feature
  • An online store recommending products whose descriptions sit near items a shopper already viewed
  • A CRM cleanup job that flags “Acme Corp, NYC” and “ACME Corporation New York” as likely duplicates

Common questions

What is the difference between an embedding and a token?

A token is a chunk of text, often part of a word, that a model reads. An embedding is a list of numbers representing meaning. Inside an LLM each token is turned into an embedding, and embedding models also produce one vector summarizing an entire sentence or document.

Are embeddings the same as vectors?

An embedding is a vector, meaning a list of numbers, but not every vector is an embedding. The word embedding implies the numbers were learned so that similar content ends up close together. People often say vector embedding to mean the same thing.

Can you turn an embedding back into the original text?

Not exactly, and not by design. Embeddings are compressed summaries of meaning. However, research has shown that a surprising amount of the original text can sometimes be reconstructed, so treat embeddings of private data as sensitive rather than as anonymized.

Can embeddings represent images and audio?

Yes. Multimodal embedding models place images, text, and sometimes audio on the same map of meaning. That is how you can search a photo library by typing “dog on a beach”, because the text and matching photos land near each other.

Do I need to train my own embedding model?

Rarely. Off-the-shelf embedding models from AI providers or open-source libraries work well for most search and RAG projects. Fine-tuning an embedding model can help in specialist domains like law or medicine, but test the standard models on your own data first.

How much do embeddings cost?

Generating embeddings is usually among the cheapest AI operations, often a small fraction of the cost of generating text, since the model outputs one vector rather than many tokens. Storage and search can become the bigger cost at millions of vectors. Check current provider pricing before estimating.

Sources and further reading

  1. Efficient Estimation of Word Representations in Vector Space (Mikolov et al., 2013) — arXiv
  2. Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks (Reimers and Gurevych, 2019) — arXiv
  3. Vector embeddings — OpenAI

Glossary terms

Keep reading