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 part of this 17-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
A computer cannot compare meanings. It can only compare numbers. So how does a search engine know that "reset my password" and "I forgot my password" ask the same thing, when they share only one word?
The answer is an .

Think of a huge map. Every sentence gets a pin. Sentences that mean the same thing get pins close together. Sentences about different things get pins far apart. To find what someone means, you look for the pins nearest to theirs.
An embedding is the position of that pin, written as numbers. In this lesson I measure two real embedding models on my laptop, and test the thing that matters most for a global audience: do they understand other languages?
Why does this matter to an engineer? Because a great deal of AI work is finding the right text. A help page search must find the answer when the user's words differ from the page's words. A chatbot that answers from your company's documents must first find the few paragraphs that fit the question. Matching exact words fails in both cases: "reset my password" and "I forgot my password" share only "my password", and a question in Hindi shares no words at all with an English page. Embeddings let a program compare meaning instead of spelling, using ordinary arithmetic on numbers.
The last two lessons turned text into tokens. Tokens are only labels: in GPT-4o's tokenizer, ID 382 is " is", and the ID next to it in the list is not any closer to " is" in meaning than an ID far away. An embedding is different. Its numbers are placed so that distance means something.