Skip to main content

Embeddings & Vector Search

Intermediate

An embedding turns a piece of text into a list of numbers (a vector) that captures its meaning. Texts with similar meaning get vectors that are close together — even if they share no words. That's the trick behind semantic search and RAG.

What you'll learn
  • Picture an embedding as a point in a space arranged so that similar meanings sit near each other
  • Tell keyword search from semantic search — and know why hybrid search usually wins
  • Walk the four steps of a vector search, from chunking to nearest-neighbor lookup
  • Avoid the three mistakes that quietly ruin retrieval quality: bad chunk sizes, mixed embedding models, and no metadata filters
  • Decide when you actually need a vector database and when you don't

The intuition​

Imagine every sentence placed as a point in a huge multi-dimensional space, arranged so that similar meanings sit near each other. "How do I reset my password?" lands near "I forgot my login," far from "best pizza in Rome."

  • Keyword search matches literal words ("password" finds "password").
  • Semantic search matches meaning — "I can't sign in" finds the password-reset doc even without the word "password."

Best results often combine both (hybrid search).

How a vector search works​

Guided walkthrough1 of 4
  1. Split each document into chunks first, then embed each chunk and store the vectors in a vector database. This is the step you do once, ahead of time.

Practical notes​

  • Chunking matters. Too big = noisy matches; too small = lost context. Tune it.
  • Use one embedding model consistently — vectors from different models aren't comparable.
  • Metadata + filters (date, source, type) make retrieval far more precise.
  • A vector DB isn't always needed — for small corpora, a simple in-memory search is fine.
Press Enter or Space to flip the card. Use the left and right arrow keys to move between cards.Term shown.
1 / 9

Check yourself

0/3
  1. A user searches "I can't sign in" and gets back the password-reset doc, which never uses the word "sign in". What made that work?
  2. You re-embed your documents with a newer embedding model but leave the existing query path untouched. What breaks?
  3. Your retrieved chunks are topically right but keep missing the detail the answer needed. Which knob is the first suspect?
Key takeaways
  • An embedding is meaning as a point in space — nearness means similar meaning, not shared words.
  • Semantic search finds what keyword search misses, but hybrid search usually beats either alone.
  • Four steps: embed and store chunks, embed the query, find nearest vectors, return the chunks.
  • One embedding model, used consistently on both sides. Vectors from different models aren't comparable.
  • Chunk size and metadata filters do more for retrieval quality than the choice of vector database.
  • For a small corpus, a simple in-memory search is enough — a vector DB isn't a requirement.

Next​