Skip to course content
Free RAG fundamentals course

Introduction to RAG and Knowledge Assistants

Unit 03.00: What an embedding actually measures

An embedding turns a passage into a list of numbers, positioned so that passages about similar things point in similar directions. Every useful and every dangerous property of retrieval follows from that one sentence.

Direction, angle, and why wording stops mattering

The example below uses four hand-placed vectors instead of a real model, so the geometry is inspectable rather than mysterious. Cosine similarity measures the angle between two directions: 1.0 means the same direction, 0.0 means perpendicular.

Watch what happens to money back, which shares no word with refund.

refund vs refund     : 1.000
refund vs money back : 0.999
refund vs invoice    : 0.768
refund vs shipping   : 0.000

money back scores near 1.0 against refund without a single shared token. That is the whole reason embeddings beat keyword search - a user who types "I want my money back" reaches a policy that never uses the word.

invoice sits in between: a related topic, not a synonym. shipping is perpendicular. Nothing here encodes whether any of these statements is true, current, or applicable to the person asking. The geometry captures aboutness and nothing else, which is the constraint the next unit pushes against.

The mistake this prevents

One consequence is worth naming early. Because the geometry blurs meaning together, it also blurs the things you least want blurred: a product code, an error number, an account reference. ERR-4417 and ERR-4471 are near-identical strings about the same subject, so they sit close together, and a vector search for one will happily return the other. Exact tokens are what keyword search is good at, which is why production systems usually run both and merge the results - the hybrid retrieval you will see referenced everywhere. Use lexical matching for identifiers and vector search for language.

The mistake is reading a high similarity score as a correctness signal. It means "these are about the same subject." A retrieval system tuned to maximise similarity is tuned to find on-topic passages, which is necessary and nowhere near sufficient.

Takeaway

Embeddings measure aboutness, which is why they handle paraphrase so well. Correctness, currency and applicability are separate properties, carried in metadata and checked by code you write.