This chapter shifted from retrieval to generation. Up until now, every chapter was about finding good documents. Here, we took those retrieved documents and had an LLM actually use them to answer, summarize, or cite information.
The core idea is simple: retrieve relevant context with search, then hand that context to an LLM so it can generate an answer instead of just returning a list of documents.
RAG (Retrieval-Augmented Generation)
Search for relevant documents, then pass those documents into an LLM prompt so it generates an answer grounded in that context. That's it. Retrieve, then generate.
Multi-Document Summarization
Search usually returns more than one relevant document, so the LLM has to combine them into one answer instead of just repeating a single source. A good summary also depends on who's asking. A parent looking for kid-friendly movies wants different info than a film critic.
Conflict Handling
Documents can disagree with each other. The chapter named three kinds of conflicts: factual (different release years), opinion (masterpiece vs overrated), and emphasis (action vs emotional story). This was mostly conceptual for us since Webflyx uses a curated dataset, not user reviews, so we didn't build actual conflict detection. It's more of a "know this exists" concept.
Citations
The LLM is prompted to cite which document it pulled info from, using markers like [1] and [2]. Worth noting: this is just prompting. The model generates the citations itself, and nothing in the code checks whether those citations are actually accurate. It's a trust-the-prompt approach, not a verified one.
Question Answering vs Summarization
Summarization gives a broader synthesis across documents. Question answering is more direct, it's meant to answer one specific question instead of covering everything the search results touch on. The chapter also pointed out that different question types (factual, analytical, opinion) probably need different instructions in the prompt.
I built out cli/augmented_generation_cli.py across the lessons, adding a new subcommand each time:
rag: the baseline command. Search for results, then ask the LLM to generate a natural-language answer using those results.summarize: takes the search results and asks the LLM to synthesize them into one dense summary instead of answering a specific question.citations: same idea as summarize, but the prompt also asks the LLM to include [1], [2] style citations and mention it if sources disagree.question: takes a direct question, searches, and asks the LLM to answer casually and concisely instead of writing a full summary.