Module 8, Lecture 8.1 | Retrieval-Augmented Generation (RAG)
Modules 4 and 7 managed context after it accumulated; this lecture asks where useful information comes from in the first place. A model does not know recent events, private knowledge such as a codebase or a company's product manuals, or high-precision facts it saw only in compressed form during training. Putting everything into the context fails, because the window is finite, every token is paid for on every call, and quality degrades with length. Retrieval-augmented generation (RAG) supplies only what the current query needs: retrieve relevant information, augment the context with it, and generate. The model itself is unchanged; only its context is. The lecture separates the setup phase, which prepares a knowledge source for retrieval, from the query phase that runs on every request, and compares two ways to wire retrieval: the developer's code retrieves before the model call (classic RAG), or the model calls a search tool, as Claude Code does with glob and grep. It contrasts RAG with fine-tuning, which changes model weights and suits style and format, and closes on the framing for the rest of Module 8: RAG is a category, and vector search is one implementation alongside web search, database queries, file reads, and API calls.
Read the full lecture narrative