CodeBaobab
COURSE 13 OF 21

RAG and Retrieval Systems

Retrieve useful evidence, ground generated answers, and measure retrieval separately from generation.

Background reading
Free course preview

Introduction to Retrieval-Augmented Generation

Retrieval-augmented generation, or RAG, finds relevant information from an external collection and gives that evidence to a language model before it writes an answer.

A language model can produce a confident sentence by repeatedly selecting likely next tokens. That process can create fluent text even when the model has no reliable evidence for the claim it is making.

For example, ask about an internal policy that was never in the model’s training data. The model may still complete the answer in a plausible style. Fluency tells us that the continuation reads well; it does not tell us that the policy is correct.

Retrieval-augmented generation addresses this problem by finding relevant source passages before the answer is written. We can then evaluate two separate questions: did retrieval find the needed evidence, and did the generated answer use that evidence correctly?

Continue learning

Continue with Pro

Get Pro on codebaobab.com.

See Pro plans
Complete course

What you will learn next

  1. 01Prompt Engineering
  2. 02Hallucination
  3. 03Grounding and Verification
  4. 04Retrieval-Augmented Generation
  5. 05Chunking and the Unit You Retrieve
  6. 06Sparse, Dense, and the Index
  7. 07Preparing a Query for Retrieval
  8. 08From Retrieved Candidates to Model Context
  9. 09Diagnosing a RAG Failure
  10. 10LLM-as-a-Judge
  11. 11Updating Retrieved Knowledge
  12. 12Designing a Travel Policy RAG System
  13. 13Testing an LLM Judge for Reliability
  14. 14Review
  15. 15References