AI Foundations · Module 02
Introduction to RAG and Theoretical Foundations
Where retrieval-augmented generation comes from, the difference between what a model remembers and what it looks up, and how RAG compares with long context windows, fine-tuning and prompt engineering.
Học xong bạn làm được
- Explain parametric and non-parametric memory
- Describe the move from the original RAG paper to in-context RAG
- Compare long-context models with RAG
- Choose between fine-tuning, RAG and prompt engineering for a given need
Bài học
- Introduction to RAG and Theoretical Foundations
LLMs such as ChatGPT, Gemini, Claude and Llama still suffer from a knowledge cutoff, hallucinations and no access to private enterprise data. RAG lets them use external data without fine-tuning. It began with the 2020 paper by Patrick Lewis and colleagues at FAIR, which combined parametric memory (BART) with non-parametric memory (a dense Wikipedia index).
- The Shift to In-Context RAG
The name RAG survived, but the way it is built changed. The original 2020 RAG trained the retriever and generator together and changed their weights; modern RAG keeps the LLM's weights fixed and works by "Retrieve and Prompt" - retrieve the right data and put it into the prompt - which is flexible, cheap and easy to use on private data.
- The RAG Landscape in 2026
Models with 1M+ token windows make "stuff it all in" viable for corpora under about a million tokens, but RAG stays essential for large knowledge bases, live data, cost, citations and access control; the production pattern is hybrid. RAG itself has moved through four generations - naive, advanced, modular and agentic.
- Fine-tuning vs RAG vs Prompt Engineering
Prompt engineering suits formatting, persona and simple tasks; RAG suits dynamic knowledge that needs citations; fine-tuning suits changes in behaviour and consistent style; production systems combine all three. Start with prompting, add RAG when knowledge is too large, dynamic or sensitive, fine-tune to change how the model behaves.