Course Outline
Check off topics as you go, and take each module's test when you're ready. Everything is saved locally in your browser — nothing is uploaded, no account needed.
A note on this course
This course teaches general, vendor-neutral concepts for building AI apps with retrieval. It avoids benchmark numbers and pricing, which change constantly, and doesn't depend on any one database or model provider. It builds on our Generative AI & Prompt Engineering and AI Agents & Automation courses.
Module 1 — Embeddings & Search
1 What Are Embeddings?
An embedding is a list of numbers (a vector) that represents the meaning of a piece of text, so that texts with similar meaning end up with similar vectors. An embedding model reads a sentence and outputs, say, a few hundred or thousand numbers. You never read these numbers directly — you compare them.
This is what lets software say "how do I reset my password" and "I forgot my login" are about the same thing, even though they share almost no words.
2 Semantic vs. Keyword Search
Keyword search finds documents containing the words you typed (think classic search with exact terms, product codes, or names). Semantic search embeds the query and finds documents whose embeddings are closest in meaning, even with no word overlap.
Each has strengths: keyword search is precise for exact identifiers like an error code or a person's name; semantic search is better for natural-language questions. Many real systems combine both.
3 Vector Databases & Similarity
A vector database (or a database with a vector index) stores embeddings and quickly returns the ones nearest to a query vector. Closeness is measured with a similarity measure, most commonly cosine similarity — roughly, how much two vectors point in the same direction.
For large collections, exact comparison against every vector is slow, so systems use approximate nearest-neighbour indexes that trade a small amount of accuracy for big speed gains.
4 Chunking Documents
Long documents are split into chunks before embedding, because a single embedding of a 50-page file blurs everything together, and a model can only read so much at once. Chunks that are too small lose context; chunks that are too big dilute meaning and waste space.
Common practices: split on natural boundaries (headings, paragraphs), keep a small overlap between neighbouring chunks, and store metadata (source, title, section) with each chunk so answers can cite where they came from.
Module 2 — RAG Pipelines
5 The RAG Pipeline End to End
Retrieval-Augmented Generation (RAG) gives a model relevant information at question time instead of relying only on what it memorised during training. The basic flow:
1. Index: split docs into chunks -> embed -> store
2. Retrieve: embed the question -> find the closest chunks
3. Augment: put those chunks into the prompt
4. Generate: the model answers using that contextThis lets a model answer about private, recent, or domain-specific content without retraining it.
6 Improving Retrieval Quality
Most RAG failures are retrieval failures: the right chunk was never found, so the model had nothing good to work with. Common improvements:
- Hybrid search — combine keyword and semantic results.
- Reranking — retrieve a wider set, then use a second model to reorder it by true relevance.
- Query rewriting — turn a vague or conversational question into a better search query.
- Metadata filters — restrict results by date, product, or source.
7 Agentic RAG & Graph RAG
Simple RAG does one retrieval and one answer. Agentic RAG lets an agent decide whether to retrieve, rewrite its query, search again, or use a different tool when the first results are weak. This suits multi-part questions that need several lookups.
Graph RAG stores entities and the relationships between them (a knowledge graph), which helps with questions about how things connect — useful when meaning lives in links, not just in single passages.
8 Common RAG Failure Modes
Even with retrieval, a system can fail in recognisable ways: the right document was never retrieved; the right chunk was retrieved but buried among irrelevant ones; the model ignored the context and answered from memory; or the source itself was outdated or wrong.
Telling these apart is the key debugging skill: check what was retrieved first, then check what the model did with it.
Module 3 — Evaluating AI Apps
9 Why Evals Matter
AI outputs vary, and a handful of impressive demos hides failures. An eval is a repeatable test that measures how well your AI feature does on a set of realistic inputs. Without evals, every prompt tweak or model swap is a guess — you can't tell if it made things better or quietly broke something.
10 Building a Test Set
A good test set (sometimes called a golden dataset) is a collection of realistic inputs paired with what a good answer looks like. Start small — even a few dozen real examples helps — and include the hard cases: ambiguous questions, questions with no answer in your documents, and past failures. Add every new bug you find, so it can never silently return.
11 LLM-as-Judge & Its Limits
Reviewing thousands of answers by hand doesn't scale, so teams often use a second model as a judge to score outputs against criteria (is it correct, grounded, polite?). It's fast and cheap, but judges have biases — for example favouring longer answers — and can be wrong.
Good practice: write clear rubrics, spot-check the judge against human ratings, and keep humans in charge of the hardest calls.
12 Groundedness & Hallucination
A grounded answer is supported by the retrieved sources; a hallucination states something unsupported as if it were fact. For RAG, measure retrieval and generation separately: did the right chunk appear in the results, and did the answer stick to it?
Techniques that help: instruct the model to answer only from the provided context, require citations, and have it say "I don't know" when the context lacks the answer.
Module 4 — Shipping AI Apps
13 Cost, Latency & Caching
Cost mostly follows the number of tokens you send and receive, and latency follows model size and output length. Levers to pull: send less (retrieve only the best few chunks), use a smaller model for easy steps, stream the response so users see output sooner, and cache repeated work such as embeddings or identical prompts. Check your provider's current pricing and caching features, since they change often.
14 Guardrails & Security
Guardrails are checks around the model: validating inputs and outputs, filtering unsafe content, limiting which tools and data the app can touch, and masking personal data. For RAG, apply the user's own access rules at retrieval time so people only get answers drawn from documents they're allowed to see.
Treat retrieved text as untrusted: a document can contain hidden instructions (prompt injection), so never give the model broader permissions than the task needs.
15 On-Device vs. Cloud AI
A model can run in the cloud (powerful, easy to update, needs a connection and sends data out) or on the device (works offline, keeps data local, low per-request cost, but limited by the phone or laptop's hardware and usually smaller models). Many apps mix the two: a small local model for quick private tasks and a larger cloud model for hard ones.
16 RAG, Fine-Tuning or Just a Better Prompt?
Start simple. A better prompt fixes unclear instructions. RAG fits when the model needs facts it doesn't have — private, changing, or large knowledge bases. Fine-tuning fits when you need a consistent style, format or specialised behaviour, and is a poor way to inject frequently changing facts. Try them in that order, and let your evals tell you whether the extra complexity paid off.