SproutStackSproutStack home

What are Embeddings?

5 min readBeginner-friendlyFree to read

Read a little, play a little. No scary maths, and no rush.

Share:

Meaning as coordinates

An embedding turns text into a long list of numbers — a point in a high-dimensional space — positioned so that similar meanings land near each other. "Refund" and "return" end up neighbors; "refund" and "pineapple" end up far apart. The famous party trick: king − man + woman ≈ queen, because relationships become directions you can do arithmetic with.

Similarity is just an angle

To find "what matches this query," embed the query with the same model and measure cosine similarity — essentially the angle between arrows. Small angle, high score, close meaning:

q = embed("return policy?")
docs = embed_all(chunks)
best = top_k(cosine(q, docs), k=4)

Same model on both sides is non-negotiable: vectors from different models live in different spaces, and comparing them is numerology.

Why this changed search forever

Keyword search matches letters; embeddings match intent. "Cheap places to sleep" finds "budget hotels" with zero shared words. That single capability powers semantic search, RAG retrieval, recommendations, deduplication ("are these tickets the same issue?"), and clustering support tickets by topic. Try /animations/embeddings to watch the space.

A worked example: spotting duplicate tickets

A support team gets hundreds of tickets a day, and many describe the same outage in different words. Embeddings make the duplicates findable.

Each new ticket is embedded and compared with the open tickets from the past week. If the closest one scores above a threshold, the ticket is flagged as a likely duplicate and linked to it. "App crashes when I open settings" and "Settings screen closes the whole app" share almost no words but land close together.

The threshold is not universal. Each embedding model produces its own range of scores, so the team picks one by looking at real pairs: they sort 100 ticket pairs by score, mark which are truly duplicates, and choose the score where false matches start to appear. That ten-minute exercise beats any number copied from a blog post.

Choosing an embedding model

  • Input length. Every model has a maximum input, and text beyond it is cut off silently. Check it against your chunk size.
  • Dimensions. More numbers per vector can capture more nuance, but cost more storage and memory. Bigger is not automatically better.
  • Languages and domain. A model trained mostly on English web text may handle legal, medical, or non-English text poorly. Test on your own data.
  • Switching cost. Vectors from different models cannot be mixed, so changing models means re-embedding everything you have stored.

Embed passages, not whole documents

One vector for a 50-page manual averages every topic into a vague blur, so it matches nothing well. Embeddings work best on focused passages of a few paragraphs, each about one thing, which is exactly why RAG systems split documents into chunks before embedding them.

The honest limits

Embeddings confuse near-identical texts differing in one crucial word ("refundable" vs "non-refundable") and inherit training-data biases. That's why production RAG pairs them with keyword search (hybrid) and reranking — vectors for meaning, keywords for precision.

Remember this

  • Embeddings = meaning as coordinates; search = nearest neighbors by angle.
  • Same model both sides, or the scores mean nothing.

Check your understanding

5 questions · first-try answers earn the most XP

1. Why must you embed a query with the same model that embedded your documents?
2. Your search returns documents about "non-refundable" for the query "refund policy". Why does this happen?
3. What does "king − man + woman ≈ queen" illustrate?
4. What advantage does embedding search have over keyword search?
5. Why does the chapter recommend pairing embeddings with keyword search in production?

My notes

Saved in this browser. Highlight a line above and save it, or write it in your own words.

Nothing saved yet. Your highlights will live here.

References

Finished reading?

Ticking it here also ticks the chapter in the sidebar, the section count and your streak — it is all one number.

Practice this in an incident

Related chapters

Spotted a mistake or want a topic covered? Report an issue

📬 An occasional email when new lessons land

New lessons and showdowns, no more than a few times a month. No spam, unsubscribe anytime. We store your email only to send the newsletter.