May we use cookies so Meta, Google, LinkedIn and ChatGPT see your visit and we learn which ads work? PrivacyMay we use cookies to see which pages help, and let Meta, Google, LinkedIn and ChatGPT see your visit, so we know which of our ads work? That way we spend less on ads that do not work. We do not sell your data, and the site works the same if you decline. You can change your answer at any time under Cookie settings at the foot of the page. Privacy policy
Loading...
AI Engineering · Retrieval Rag
Free preview: the first part of this 15-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 211 other paid lessons
$35 once, by card or 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 211 other paid lessons
$35 once, by card or PayPal
See the Generative AI and Agentic AI coursein Retrieval Rag
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
You measured your chat feature at roughly a tenth of a cent per answer. Then you added retrieval so the model would stop making up policy, and the same answer now costs closer to three tenths. Nothing about the model changed. The question the user typed did not get longer. What changed is that every request now carries a few thousand tokens of retrieved context into the prompt, and you pay for those tokens on every single call.
That is the RAG cost surprise, and it catches teams because the shallow version of this topic talks about the price of an , which is the one number that barely matters. Embedding a query is a fraction of a cent. The bill is somewhere else. It is in the retrieved chunks you stuff into the prompt, which become input tokens metered on the generation call. It is in re-embedding a large corpus every time documents change. It is in the vector store you rent to serve searches at a latency your users tolerate. A RAG request pays several bills a plain LLM call never sees, and if you only optimize the model, you are polishing the smallest line item.
The token cost engineering lesson in the LLMOps chapter covers the parts every LLM call shares: prompt caching of a stable prefix, output caps, batching, resend growth in an agent loop. This lesson is the part that is unique to . Where does the retrieval money go, and what are the levers that move it: caching whole answers by query similarity, reusing embeddings instead of recomputing them, and cutting the context you send. By the end you will have run two calculators, one that prints your monthly bill with and without a cache, and one that shows exactly how a too-loose cache serves wrong answers.