Narration · Module 20
RAG + Prompting
0:00 / 0:00
Module 20 · Text applications · 12 min

Retrieval-augmented
generation.

Semantic search, hybrid retrieval, GraphRAG.

Reading time12 min Audionarration available Prerequisites05 SourceTrack A · Gemini
§ 1

What this lesson covers.

This module is one of 42 in the curriculum. Below is the canonical interactive lesson — tabs, cards, and diagrams from the source repo, rendered inside the course shell. An audio narration runs alongside it - the sticky player at the top of the page plays the full Module 20 clip.

If you prefer to read first and play with the demos after, the interactive lesson sits below this section. If you'd rather hear it narrated while you scroll, hit play on the sticky audio bar at the top — or just let it autoplay.

Read / reason / test

Retrieved evidence still needs interpretation

High school · build the intuition

Retrieval places selected material near a question, but the generator can misunderstand it, cite the wrong passage or go beyond its support. Inspect the retrieved text before judging the answer. A citation helps only when its source supports the associated claim. Separating retrieval from answer review makes it possible to identify whether missing evidence or poor interpretation caused a failure.

College · work the example

First relevant ranks[1,2,4] give reciprocal ranks[1,0.5,0.25] and mean approximately 0.583. That is a ranking measurement under supplied relevance judgments, not an answer-correctness score. Evaluate evidence attribution separately. An improved mean can conceal a regression on an important query, so preserve individual results as well as aggregates.

Explain it back

Describe the process in your own words. Identify the assumption that makes this example work, then explain one conclusion it cannot establish.

Read the primary source or official documentation →

The numerical examples are authored teaching exercises, not measured model benchmarks. This extension adds context to the original lesson.

§ 2

The lesson itself.

Interactive lesson · ported from Gemini track Click tabs to navigate · hover cards for details

Retrieval-Augmented Generation (RAG)

Large Language Models are frozen in time the day they finish training. If you ask them about proprietary data or recent events, they confidently hallucinate. RAG solves this by turning the system into an "open-book test". But first, data must be systematically parsed, chunked, transformed into mathematical vectors, and pushed into a dense Vector Database.

Step 1: Data Ingestion & Chunking Pipeline
📄

Security
Manual.pdf

→
[Chunk 1] Dress code is business casual...
[Chunk 2] The override passcode is OMEGA-9...
[Chunk 3] Cafeteria Taco Tuesday...
→
Embedding Model
text-embedding-3
→
[0.12, -0.99, 0.45, ...]
[0.88, 0.21, -0.63, ...]
[-0.41, 0.33, 0.17, ...]
Step 2: Generation Context Window
System Prompt: You are a helpful assistant. Provide factual answers from the context.
[Retrieved Document: Chunk 2]
"The top secret override passcode for the mainframe is: OMEGA-9."
User Chat Interface
Vector Database
[Doc 011] Quarterly Earnings 2025: Revenue up 14%...
[Doc 501 / Chunk 1] Dress code is business...
[Doc 502 / Chunk 2] Security Protocol: The override passcode is OMEGA-9.
[Doc 503 / Chunk 3] Cafeteria Menu: Taco Tuesday...
[Doc 891] Holiday schedule updated for Dec...
§ DEMO

Try it: rag pipeline.

Type a question. Watch the four stages run - embed, retrieve, augment, generate - against an 8-document mini vector store.

RAG Pipeline · interactiveOpen standalone
§ PAPERS

Further reading.

The canonical references for this module. External links open in a new tab.

§ NEXT

What to read next.

Use the pager below to move sequentially through the curriculum, or jump to any module from the course index. Each track has a "Prereq: ↑ foundation" callout so you can backfill anything that wasn't clear.