L

Learn AI

Track progress · learn offline

Open

Lesson 2 of 7

Embeddings

6 min read

"Cancel my plan" and "how do I end my subscription" share almost no words. To a keyword search they're strangers. So how does retrieval know they mean the same thing?

Meaning as a point in space

An embedding turns a piece of text into a list of numbers — a vector — that acts like coordinates for its meaning. Text with similar meaning lands in nearby spots; unrelated text lands far apart. The model learned this map by reading enormous amounts of text.

An embedding places text in a space where distance means similarity — close points mean similar things.

Search by meaning, not words

Once every passage is a point, finding relevant text is just finding nearby points. "Cancel my plan" lands right next to "end my subscription" even with no shared words — so retrieval matches on meaning. This is why RAG can answer a question phrased nothing like the document that answers it.

Nearest points = closest in meaning. That's how retrieval finds the right passage even when the words don't match.

Real embeddings have hundreds or thousands of dimensions, not two — but the intuition holds exactly: closer means more similar. The 2D picture is just that map flattened so you can see it.

The shape of it

A user asks "how do I get my money back?" Your docs only ever say "refunds". Why does embedding-based retrieval still find it?

Continue in the app

Take the whole RAG & Search course — tracked

Get your personalized path, progress and streaks in the app — this lesson and every next one, in order.