We use analytics cookies.We use cookies to analyze site traffic and improve your experience.
Loading...
AI Engineering · Retrieval Rag
Free preview: the first 2 parts of this 21-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 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
Let me start with a picture.
Imagine a library. You ask two people the same question: "bring me every book that mentions Google."
The first person walks to a big pile of books, picks up the ten that look most likely, and brings them back. That is all they can carry. They never check the rest of the pile.
The second person goes to the card index. Long ago, someone read every book once and wrote a card for each name inside it. So the second person opens the drawer marked "Google" and reads the full list.

Most search in AI apps works like the first person. It returns the top 10 results, and stops.
On this site, Google is mentioned in 47 of our 818 lessons. A top-10 search can bring back at most 10 of them. In the lab below, it found 9.
Today we look at questions that ask for all of something, and why normal search cannot answer them. Then we compare two ways that have no top-10 limit: an index built by a model, and a plain text filter. The first is the starting idea of a method called GraphRAG. The second turns out to be very hard to beat.
Please read this slide slowly if any word is new. Every slide after it uses these words.

Document. One page of text. Here, a document is a short summary of one lesson on this site, about 750 characters long. There are 818 of them.
Search system. A program that takes a question and returns the documents most likely to answer it. In a RAG system, search is the first step. RAG stands for . A RAG app first searches your documents. Then it gives the best ones to a language model. A language model is the kind of AI that writes text, like the one behind ChatGPT. The model then writes the answer.
Top 10. The first 10 documents a search system returns. Almost every RAG system returns a fixed number like this. Engineers call that number k, so "top k" means "the first k results".
Share found. For a question with many right documents, the share of them that the search returned. If 20 documents are right and the search returns 5 of them, the share found is 5 out of 20, which is 25 percent.
Name. Here, the name of a real product, company or tool, like Kafka, or Google. Engineers call these entities.
Graph. A map that says which documents mention which names. You build it once, ahead of time, by reading every document. A full knowledge graph also stores how names relate to each other. Using a graph like this to answer questions is called GraphRAG.
Prompt and call. A prompt is the text you send to a language model. A call is one request to the model: one prompt in, one reply out.

This is the whole path in one picture. Keep step 2 in mind: it is where list questions break.