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
Open a set of nesting dolls and line them up. The smallest one is tiny, but it is still a whole doll, with a face and a painted dress. Nothing important was left off to make it small.

An from nomic-embed-text is a list of 768 numbers. Every one of them takes 4 bytes to store, for every document you keep. For a million documents that is about 3 GB, just for the embeddings.
So a fair question is: do you need all 768? Could you keep only the first 256, a third of the size, and still find the right documents? Some models lose very little. Others lose more. This lesson measures two of them.

Dimension. One number in an . nomic-embed-text gives 768 of them, bge-m3 gives 1,024.
Shorter embedding. Keep only the first N numbers of the list, then scale them so the length is 1 again. Lesson 7 showed why length 1 matters: then cosine, dot product and distance all agree.
dimensions. A setting you can send to Ollama's /api/embed, which does the cutting for you.
Matryoshka. The Russian name for nesting dolls. It is also the name of a way of training an embedding model so that the first numbers carry the most meaning, and the later ones add detail.
Model card. The page a model's makers publish with it, saying what it is for and how to use it. For many models it lives on Hugging Face, a website that hosts models.
Top 5. The right lesson was among the first five results.
Noise. Small differences that happen by chance. They go away, or flip, if you run the test again with other questions.