We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
AI Engineering · Tokens And Embeddings
Free preview: the first 2 parts of this 18-part lesson.
Already bought the course? Sign in to read the whole lesson.
this lesson is part of
Generative AI and Agentic AI Engineering
Unlock this lesson and the 208 other paid lessons
$35 once, by PayPal
See the Generative AI and Agentic AI courseread the rest of this lesson in
Generative AI and Agentic AI Engineering
Unlock this lesson and the 208 other paid lessons
$35 once, by PayPal
See the Generative AI and Agentic AI coursein Tokens And Embeddings
This lesson is part of the AI Engineering course. Unlock the full course, a separate one-time payment, for lifetime access.
One-time payment by card or PayPal
Get Lifetime AccessOne-time payment: UPI, card or netbanking
Get Lifetime AccessFoundation lessons of this course are free, no payment needed. Try them now
In a library, a card index finds books by the exact words on the card. Ask it for "why my website feels slow" and it finds nothing, because no card says that.
A good librarian works differently. She hears what you mean, and points you to the right shelf, where books on the same subject stand together.

Semantic search is the librarian. It uses , from the last lesson, to find text by meaning. In this lesson I build it over every lesson on this site, ask it real questions in six languages, and measure how often it points to the right shelf.
Why does this matter to you as an engineer? Almost every AI product that answers questions about your own documents starts with a search step. A help bot looks up the right help page. A chat assistant over company files first finds the few files that matter, and only then asks a language model to write an answer. If the search step brings back the wrong text, the language model writes a confident answer from the wrong text. So the quality of the whole product often depends on this one quiet step.
People also do not ask in your words. They describe their problem, not the name of the solution. And many of them do not write in English at all. This lesson shows how far meaning-based search can close that gap, and where it still fails.
If a word below is new, read its line. Embedding and come from the last lesson.

Semantic search. Finding text by meaning, using , instead of by matching words.
Keyword search. Finding text by the words it shares with the question. No model involved.
Document. Any piece of text you want to be able to find. Here, one lesson's title and short description.
Index. The stored embeddings of all your documents, made once, before anyone searches.
Top 5. The five documents that scored highest for a question.
Ranked first. The document with the highest score.
Ollama. A free program that runs AI models on your own computer.
bge-m3 and nomic-embed-text. The two embedding models from the last lesson. bge-m3 was trained on many languages; nomic-embed-text mostly on English.
Rank. A document's place in the sorted list of scores. Rank 1 is the top result; rank 49 means 48 documents scored higher.
Cosine similarity, as a reminder from the last lesson: a score for how closely two embeddings point in the same direction. Near 1 means very close in meaning; lower means further apart. Every score you see in this lesson is a cosine similarity.