Embeddings and semantic search
How AI turns text into lists of numbers that capture meaning, why that lets search find "reset my password" when the document says "forgotten login", and where embeddings are used in real products.
๐ฏ By the end of this lesson you will be able to:
- Explain what an embedding is using a simple map analogy
- Compare keyword search with semantic search and know when each is better
- Recognise everyday uses of embeddings: search, duplicates, recommendations and grouping
In this lesson
The problem with keywords
Traditional search matches words. Search a help centre for "can't sign in" and you may miss the article titled "Recovering a forgotten password", because they share no words. People use different words for the same idea, so keyword search often fails exactly when people need help most.
Modern AI products solve this with embeddings: a way of turning any piece of text into a list of numbers that represents its meaning. Texts with similar meanings get similar numbers, even if they use completely different words.
A map of meaning
Imagine a huge map where every sentence has a location. Sentences about passwords and logins sit in one neighbourhood; sentences about refunds and invoices sit in another; sentences about holidays are far away. An embedding is simply the coordinates of a piece of text on that map. Real embeddings have hundreds or thousands of coordinates instead of two, but the idea is the same: close together means similar in meaning.
How semantic search works
- Prepare: split your documents into passages and create an embedding for each one using an embedding model. Store the passages and their embeddings in a database built for this, often called a vector database.
- Search: when someone asks a question, create an embedding for the question.
- Match: find the stored passages whose embeddings are closest to the question's embedding. These are the most similar in meaning.
- Show or use: display them as search results, or pass them to a language model to answer the question (that is RAG, the next lesson).
| Keyword search | Semantic search | |
|---|---|---|
| Matches | Exact words | Meaning |
| Strong at | Codes, names, error numbers, exact phrases | Natural questions, different wording, other languages |
| Weak at | Synonyms and paraphrases | Exact identifiers such as an order number or error code |
| Typical use | Find ERR-4032 in logs | "Why can't my customer log in?" |
Where embeddings are used
- Search across help centres, wikis, policies and code by meaning.
- Finding duplicates: spot bug reports or tickets that describe the same problem in different words.
- Recommendations: suggest articles, products or courses similar to what someone just viewed.
- Grouping: cluster thousands of survey comments or reviews into themes without reading them all first.
- Routing: send an incoming request to the team whose past requests it most resembles.
Duplicate bug detection
New report: "App freezes when I upload a large photo on Android."
Closest existing reports by meaning: 1. "Crash on image upload over 10 MB (Android 14)": very similar 2. "Upload spinner never stops for big pictures": similar 3. "Dark mode colours wrong on settings page": not similar
None of the top matches share the exact word "freezes", but the meaning matches. A tester can link duplicates in seconds.
Limits to know
- Similar is not the same as correct. The closest passage can still be out of date or wrong.
- Passage size matters. Very long passages blur several topics together; very short ones lose context. Teams test different sizes.
- Embeddings reflect their training. Specialist jargon or rare languages may be placed less accurately. Test with your own content.
- Keep them up to date. When documents change, their embeddings must be recreated, or search returns stale text.
What this means for your role
Developer
You'll call an embedding model, store vectors and query by similarity. Choose passage size and overlap carefully, and consider hybrid search when exact identifiers matter.
Tester / QA
Test search with paraphrases, typos, other languages and exact codes. Measure whether the right passage appears in the top few results for a set of known questions.
Business Analyst / PO
Write search requirements as example questions with the documents that should come back. Those examples become the test set.
Tech Lead / Architect
Decide where embeddings are stored, how they are refreshed when content changes, and who can see which documents, because search must respect permissions.
Project / Delivery Manager
Plan time for preparing and cleaning content. Semantic search is only as good as the documents behind it.
Scrum Master / Agile
Duplicate detection and grouping can save the team hours in backlog refinement. Suggest a small trial on old tickets.
Try it: keyword versus meaning
- Pick a question your customers or colleagues ask, and write it three different ways using different words.
- Search your company wiki or help centre with each version and note whether the right page appears.
- Then ask an AI assistant to rewrite your question into five alternative phrasings. Notice how many ways people express one need, which is the problem semantic search solves.
Key takeaways
- An embedding is a list of numbers representing the meaning of text, like coordinates on a map of meaning.
- Semantic search finds text by meaning; keyword search finds exact words. Hybrid search uses both.
- Embeddings power search, duplicate detection, recommendations, grouping and routing.
- Similar is not the same as correct: content quality, passage size and freshness still matter.
Key terms
- Embedding
- A list of numbers that represents the meaning of a piece of text (or an image).
- Semantic search
- Search that matches by meaning rather than exact words.
- Vector database
- A database designed to store embeddings and quickly find the closest ones.
- Hybrid search
- Combining keyword and semantic search in one query.
Check your understanding
Answer all 5 questions. Score 3 or more to complete the lesson.
1. What is an embedding?
2. Semantic search can match "can't sign in" to an article titled "Recovering a forgotten password" because:
3. Which search is usually better for finding the exact error code ERR-4032?
4. A tester wants to find bug reports describing the same problem in different words. What helps most?
5. Documents were updated last week but search still returns old text. What is the likely cause?