Type "how do I get my money back" into the search box on a help site. A traditional search box hunts for those exact words. The page you need is called "Refund policy" and contains none of them, so it never shows up.
A search built on embeddings finds it anyway. Instead of matching words, it has turned every page on the site, and your question, into a position on a kind of map, where texts about the same thing sit close together. "Money back" and "refund" are neighbours on that map, so the refund page is found. An embedding is that position: a piece of text written out as a list of numbers, chosen so that texts with similar meaning get similar numbers. It's what sits under search that understands what you meant, "chat with your documents" tools and many recommendation systems.
Why it matters
Keyword search breaks down whenever the person who wrote a page and the person looking for it choose different words for the same thing, and people often do. You ask about money back; the page says refund. Embeddings search by meaning, so the page turns up either way. The same trick lets a chatbot answer from a company's own documents. It finds the passages closest to your question, then writes its reply from them.
How it works in outline
- An embedding model is a neural network trained for one job: read a piece of text and turn it into a fixed list of numbers, hundreds or a few thousand. Think of the list as coordinates on a map with hundreds of directions instead of two.
- The model learned where to put things by reading over a billion pairs of texts that belong together, such as a question and its answer, or a title and the article under it. Each time, it was nudged to place the two texts near each other.
- To compare two texts, you compare their lists. The usual score is called cosine similarity. It's 1 when the two lists point the same way, close to 0 when the texts have nothing in common, and below 0 when they point away from each other.
- To search, you run every page through the model once and keep the lists. When a question comes in, you run it through the same model and return the pages whose lists are closest.
We tried this ourselves with a small, free embedding model called all-MiniLM-L6-v2, which runs on an ordinary laptop and describes each text with 384 numbers. We gave it the question and seven short passages, then scored how close each one was to the question. The diagram follows the question through the four steps and shows where four passages ended up.
The table has all seven.
| Passage | Similarity |
|---|---|
| There is no way to get your money back. | 0.785 |
| Getting your money back: a guide to refunds. | 0.763 |
| Refund policy: purchases can be returned within 30 days for a full refund. | 0.460 |
| Refunds are not available on digital downloads. | 0.403 |
| Cancel your subscription at any time from the account page. | 0.284 |
| Opening hours: Monday to Friday, 9am to 5pm. | −0.037 |
| Tomato seedlings need six hours of sun a day. | −0.079 |
The refund policy scores 0.460 even though it shares no words with the question, and the tomato seedlings score below zero. That is the search doing its job. The top result, at 0.785, tells you there's no way to get your money back at all.
Why the nearest result is not always the right one
The score measures how much two texts are about the same thing. "There is no way to get your money back" is about exactly what the question is about, so it lands right beside it. The number can't tell you whether a passage answers the question, or whether it's true or still current. Embedding search hands you the passages most like your question, and you, or the chatbot reading them, still have to judge which one helps.
A smaller reason: with millions of pages, the search takes a shortcut instead of checking every list, and can miss the true nearest one. A widely used tool for this kind of search, pgvector, says its index "trades some recall for speed".
Where you meet it
- Help-centre search that finds the right page from a clumsy question, and most "chat with your PDF" tools, which fetch the pages closest to each question and let the language model write from them. That recipe is called retrieval-augmented generation, or RAG, after a 2020 paper.
- Recommendations: items whose descriptions sit near one you liked become the suggestions.
- A "vector database", a store that keeps the lists for a whole collection and finds the closest ones quickly. It comes as an add-on to ordinary databases and as a product of its own.
- The models. OpenAI's documentation lists the embedding models it sells. Anthropic's says it has none of its own and points customers to Voyage AI. Free ones like the model in our test run offline on a laptop.
