Chapter CWhat are embeddings?Page 1 of 8

What are embeddings?

Meaning as numbers

An embedding is a list of learned numbers that places related items near one another in a mathematical space.

~13 minHook and intuition

1Try it yourself

Simulation game

Embedding galaxy

Select a word-planet, then tap the night sky where its meaning belongs.

Before you start

Why this matters

Suppose someone searches a recipe collection for “quick morning meal.” A keyword system may miss a page titled “Ten-minute breakfast,” because the exact words do not match. A useful semantic system should notice that quick relates to ten-minute, morning meal relates to breakfast, and both phrases describe similar intent. Computers cannot directly measure the distance between two meanings. An embedding model supplies a practical bridge: it converts each piece of text into numbers so that numerical closeness often reflects useful semantic relatedness.

2Learn the idea

Read

A location for meaning

An embedding is a vector: an ordered list such as [0.12, -0.44, 0.81, ...]. Real text embeddings may contain hundreds or thousands of values. The model applies the same learned conversion to every item, so the vectors occupy one shared space. Search software can then compare a query vector with stored document vectors.

Imagine a deliberately simplified two-dimensional map. “Puppy,” “dog,” and “canine” might land in one neighborhood. “Kitten” and “cat” might occupy a nearby neighborhood, while “mortgage refinancing” lands far away. This picture is an intuition, not a literal map inside a production model. Real spaces have many dimensions and can encode several kinds of relationship at once.

The important property is relative position. The number 0.12 alone says almost nothing. The whole vector becomes useful when compared with vectors produced by the same compatible model.

Teach

Learned from patterns, not a dictionary

An embedding model learns statistical patterns from training data. Texts used in similar contexts tend to receive representations that support similar downstream behavior. The model does not consult a hand-written table saying that “physician” equals “doctor.” It learns from many examples in which words, sentences, or documents appear in related contexts.

That distinction creates both power and limits. The system may connect paraphrases never listed in a thesaurus, such as “my screen went dark” and “display will not turn on.” It may also learn accidental associations, stereotypes, popularity effects, or gaps present in its data. An embedding represents patterns the model learned, not an objective measurement of meaning.

Training methods differ. Some models learn by bringing paired texts closer, such as a question and its relevant answer, while pushing unrelated examples apart. Others adapt representations learned during broader language-model training. You do not need the training algorithm to use embeddings, but you should know that the geometry reflects a particular model, objective, and dataset.

Read

One item, one fixed-length vector

The input can be a word, sentence, paragraph, image, product, user action, or another item supported by the model. Regardless of input length, the model usually returns a vector of a fixed size. A three-word query and a 300-word passage might both become 768-number vectors.

Fixed length makes large-scale comparison practical. A database can store vectors in rows and build an index over them. At query time, it embeds the new query and asks for nearby stored vectors. This pattern supports semantic search, recommendation, clustering, duplicate detection, classification, and retrieval for AI assistants.

Compression is involved. A fixed-size vector cannot preserve every fact, punctuation mark, and nuance of an arbitrarily long passage. It emphasizes patterns useful under the training objective. Keep the original item and its metadata; the vector is an indexable representation, not a reversible encoding. You generally cannot reconstruct the exact source text from an embedding.

Read

A tiny neighborhood example

Pretend a toy model returns these two-number vectors:

  • “reset my password” → [0.9, 0.1]
  • “cannot sign in” → [0.8, 0.2]
  • “change billing address” → [0.1, 0.9]

The first two points are close, so a search for password help might retrieve the sign-in article even without identical wording. The billing vector points in a different direction. Production behavior is not this clean, and two dimensions are far too small for realistic language. The example only demonstrates how a ranking can emerge from geometry rather than exact term overlap.

Closeness also does not prove equivalence. “How to reset a password” and “Do not reset the password” share topic and vocabulary, so they may be close despite opposite instructions. Embeddings are candidate generators. The application still needs filters, exact checks, reranking, or human judgment where distinctions matter.

Read

What an embedding is not

An embedding is not a database record, although databases store embeddings. It is not the original content, although it represents aspects of that content. It is not a probability, confidence score, or truth score. A vector does not tell you whether a sentence is factual.

It is also not automatically comparable with every other vector. Vectors from different models can have the same number of dimensions yet use incompatible spaces. Even versions of one model may change geometry. Mixing them in one index is like comparing map coordinates from different planets.

Finally, “near” depends on a chosen similarity rule and the application. A customer asking “How do I cancel?” might be topically close to both a cancellation policy and a retention script. Only the first may be appropriate for self-service. Relevance comes from the model, metric, source collection, filters, and evaluation together.

Read

From intuition to a system

A minimal embedding search system follows five steps: collect source items, split them into useful units, embed each unit, store vectors with the original text and metadata, then embed a query and retrieve nearby items. Every step changes quality. Poor chunks can hide the answer; stale content can retrieve obsolete guidance; the wrong similarity setup can distort rankings.

The next pages unpack those decisions. First, keep one durable mental model: embeddings turn items into coordinates in a learned space, and comparisons among those coordinates expose patterns of relatedness. They are useful because numbers are easy for software to store and compare, not because numbers make meaning perfectly understood.

Checking tutor…

Continue learning · glossary & guides