ByHeartAI
Beginner8 min read

What are Embeddings?

An embedding is a list of numbers (a vector) that captures the meaning of something — so a computer can measure how similar two things are with math.

Explain like I'm new to AI

Computers don't understand words — they understand numbers. An embedding turns a word, sentence, image, or document into a list of numbers (a vector) that captures its meaning.

The magic: things with similar meaning get similar numbers. So "dog" and "puppy" land close together, while "dog" and "spreadsheet" land far apart. This lets software do something powerful — compare meaning, not just spelling.

Click around this "meaning map" — related words sit near each other:

Click any word — its 3 nearest neighbors (closest in meaning) light up.

dog is closest to puppy, cat, kitten — because they share meaning, not spelling.

Embeddings place similar meanings near each other. Real spaces have hundreds of dimensions; this is a 2D snapshot.

Mental model

Imagine a giant map where every idea is a dot. Related ideas cluster together; unrelated ideas are far away. An embedding is simply the coordinates of an idea on that map. Real maps have hundreds of dimensions, not two — but the intuition is identical.

How it works

  1. A trained embedding model reads a piece of text (or image).
  2. It outputs a fixed-length vector — for example 384, 768, or 1536 numbers.
  3. Similar inputs produce vectors that are close together, measured by cosine similarity or distance.
  4. To compare two things, you compare their vectors — no keywords required.

The numbers themselves aren't human-readable; what matters is their relative positions.

Real-world example

Search "how do I reset my password?" and an embedding-based system can find a help article titled "Recovering your account credentials" — even though they share no exact words — because their meanings are close. This is the engine behind semantic search, recommendations, and RAG.

Technical explanation

Embeddings map inputs into a high-dimensional vector space where geometric closeness reflects semantic similarity. Modern text embeddings come from transformer models trained with contrastive objectives (pull similar pairs together, push dissimilar pairs apart). The same idea extends to images, audio, and code, and to multimodal models that place text and images in one shared space (so "a photo of a beach" lands near actual beach photos). Embeddings power semantic search, clustering, classification, deduplication, recommendations, and retrieval for RAG.

Common mistakes

Common mistake

Confusing embeddings with tokenization. Tokenization splits text into token IDs; embedding turns those into meaning-carrying vectors. And an embedding vector represents whole meaning, not one number per letter.

  • Assuming keyword overlap equals similarity — two texts with no shared words can still be highly similar.
  • Comparing embeddings from different models — vectors are only comparable within the same model.

When to use it

  • Semantic search, clustering, recommendations, deduplication, and retrieval for RAG.

When NOT to use it

  • Exact-match lookups (IDs, SKUs, error codes) where a plain keyword index is faster and precise.

Alternatives

  • Keyword / full-text search (lexical, not semantic); often combined with embeddings in hybrid search.

Quick quiz

Question 1 of 3

What is an embedding?

Question 2 of 3

Why can embedding search match texts that share no words?

Question 3 of 3

True or false: embeddings from two different models can be compared directly.

Related concepts

  • Similarity: Cosine, Dot Product & EuclideanSimilarity metrics measure how close two embedding vectors are; cosine similarity compares direction, dot product adds magnitude, and Euclidean measures distance.
  • What is RAG?RAG retrieves relevant external information and gives it to a language model as context before it answers.
  • What is Vector Search?Vector search finds the stored items whose embeddings are closest to a query embedding — the nearest-neighbor operation behind semantic search.

Further reading

NextSimilarity: Cosine, Dot Product & Euclidean

Last reviewed: 2026-09-01 · Written by ByHeart AI · Reviewed by ByHeart AI