T1 · Beginner · 7 minStable · Last reviewed: 2026-08-19Early draft

What Is an Embedding

In one line · An embedding turns text into a list of numbers (a vector) that represents its meaning, so texts with close meanings get close numbers.

Glossary:EmbeddingModelRAGToken
Why it matters

This is the foundation the whole semantic-search and RAG world stands on — without it, you treat the vector as a black box that fails and you don't know why.

Picture a big map where every sentence lands on a point. Sentences that mean similar things sit near each other; unrelated ones land in totally different regions.

An analogy

Like shelving every book by its topic rather than its title — similar books end up on the same shelf even when their titles look nothing alike.

'The cat eats' and 'the kitten is feeding' get very close vectors despite sharing no word; 'the cat eats' and 'the car is fast' land far apart.

How it works

An embedding model (a neural network trained on huge amounts of text) takes your text, splits it into tokens, and outputs a fixed-length vector — say 768 or 1024 numbers. No single number means anything on its own, but the whole vector represents where the text sits in 'meaning space.' During training the model learned to place texts that appear in similar contexts near each other. Crucially: a vector only makes sense inside its own model — you can never compare a vector from model A with one from model B.

Practice

🧪 Try it: embed two sentences that mean nearly the same thing plus a third unrelated one, and print the first 10 numbers of each vector. The raw numbers will look meaningless — but measure similarity between them and the close pair really is closer. That cements the idea that meaning lives in the relations between vectors, not in the numbers themselves.

Common mistakes

The biggest mistake: embedding your documents with one model, then months later embedding queries with a different model (or a newer version of the same one) — results turn to noise because the two spaces don't match. Second: assuming the vector 'understands' facts — it represents similarity of meaning, not truth. Third: embedding text longer than the model's limit and having it silently truncated.

When to use it

Use embeddings when you need to compare texts by meaning: semantic search, clustering similar documents, 'more like this' recommendations, or duplicate detection even when the wording differs.

When NOT to use it

Skip them when you need exact literal matching — an invoice number, an error code, an API name — keyword search is faster and more precise there. And don't lean on them for arithmetic or logic: embeddings measure similarity, not reasoning.

LET'S BUILD ITDone reading — now build it yourself.Embed two sentences and inspect the numbers