Lecture 7

Retrieval-Augmented Generation (RAG)

How retrieval-augmented generation grounds LLM answers in real documents — the end-to-end pipeline, retrieval strategies, evaluation, and when a system should retrieve at all.

Sabrina Wahler
90 min
Back to schedule
Slides (PDF) Slides (PPTX) Recording (YouTube) Companion Tutorial



arXiv logo
Lewis et al. — "Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks" Paper
arXiv:2005.11401 · NeurIPS 2020 · The original RAG paper — end-to-end retriever + generator training
arXiv logo
Gao et al. — "Precise Zero-Shot Dense Retrieval without Relevance Labels" (HyDE) Paper
arXiv:2212.10496, 2022 · Retrieves using embeddings of a hypothetical LLM-generated answer instead of the raw query
arXiv logo
Khandelwal et al. — "Generalization through Memorization: Nearest Neighbor Language Models" (kNN-LM) Paper
arXiv:1911.00172 · ICLR 2020 · Retrieves at every token by interpolating with a nearest-neighbor datastore lookup
arXiv logo
Jiang et al. — "Active Retrieval Augmented Generation" (FLARE) Paper
arXiv:2305.06983 · EMNLP 2023 · Retrieves again mid-generation whenever the model's own confidence drops
arXiv logo
Schick et al. — "Toolformer: Language Models Can Teach Themselves to Use Tools" Paper
arXiv:2302.04761, 2023 · Models learn to emit API/search calls on their own during generation
arXiv logo
Bertsch et al. — "Unlimiformer: Long-Range Transformers with Unlimited Length Input" Paper
arXiv:2305.01625 · NeurIPS 2023 · Approximates full attention with a nearest-neighbor index over token embeddings
arXiv logo
Shi et al. — "REPLUG: Retrieval-Augmented Black-Box Language Models" Paper
arXiv:2301.12652, 2023 · Treats the LLM as a frozen black box and tunes only the retriever around it
sentence-transformers logo
sentence-transformers Documentation Website
sbert.net · The embedding model library used in the paired tutorial's retriever
FAISS logo
FAISS (Facebook AI Similarity Search) Website
github.com/facebookresearch/faiss · The vector index used for nearest-neighbor retrieval in the paired tutorial
Paired Tutorial — Chemistry RAG Assistant Tutorial
Hands-on lab building a chunk/embed/retrieve/generate pipeline over chemistry abstracts, with faithfulness & relevance evaluation