0
Act 2

Understanding

4 / 4

Semantic Search & Embeddings

Act 2 · ~6 min

Theory

If RAG is "give the AI your documents," embeddings are how it actually finds the right page inside them.

An embedding is a numerical fingerprint of a piece of text. Similar meaning → similar fingerprints. That similarity powers the retriever that grabs the right chunk for a RAG answer.

Keyword search

Query: "cancel my subscription"

Misses: "end my monthly plan," "close my account," "stop billing." Same meaning, different words.

Semantic search (embeddings)

Catches "end my plan," "close my account," "stop billing," and translations like "cancela mi suscripciĂłn." Meaning, not wording.

Related ideas you'll see:

  • Word embedding. The original — one vector per word. Today most systems embed whole sentences.
  • Embedding model. A specialised model whose job is producing good embeddings.
  • Semantic similarity. The score between two vectors. Higher = closer meaning.
  • Vector database. Storage tuned for "give me the 10 vectors closest to this one."

Why it matters even if you never run one:

  • "Chat with your PDF" works because of embeddings.
  • Photo apps finding "beach pictures" → embeddings on images.
  • "More like this" recommendations → embeddings on the items.

AI is getting good at "I know what I mean but not the words." Embeddings are the reason.