Embeddings quietly power semantic search, retrieval-augmented generation, recommendations, and clustering. If you understand this one idea, a huge amount of modern AI stops being mysterious. Here it is, without the math.
The Core Idea: Meaning as Coordinates
An embedding turns a piece of text (or an image, or audio) into a list of numbers โ a vector โ that represents its meaning. The key property: things with similar meaning get vectors that are close together, and unrelated things get vectors that are far apart.
Think of it as placing every sentence on a map where distance means similarity. "How do I reset my password?" and "I forgot my login credentials" land right next to each other, even though they share almost no words:
"reset my password" โ [0.12, -0.44, 0.89, ...]
"forgot my credentials" โ [0.10, -0.41, 0.91, ...] (very close)
"best pizza in Chicago" โ [-0.77, 0.33, -0.05, ...] (far away)
Why This Is Powerful
Keyword search only matches literal words, so it misses "credentials" when you searched "password." Embeddings match on meaning, so semantically related text is found even with zero shared words. That is the leap that makes modern search feel intelligent.
How Similarity Is Measured
To find related items, you compare vectors โ typically with cosine similarity, which measures the angle between them. Closer angle, more similar meaning. A vector database does this comparison across millions of vectors fast:
results = vector_store.similarity_search( query="how do I cancel my subscription?", k=3 # the 3 closest chunks by meaning )
Where You'll Meet Them
Embeddings are the retrieval half of RAG: you embed your documents once, embed each incoming question, and pull the closest chunks to feed the LLM. They also drive recommendations ("items similar to this") and clustering ("group these tickets by topic"). Same idea, different application.
Summary
An embedding maps meaning to coordinates, so similar things sit close together in vector space and you can find related content even when the words differ. Similarity is measured by the angle between vectors, and a vector database makes that search fast at scale. Once you see text as points on a map of meaning, semantic search, RAG, and recommendations all reveal themselves as the same trick.