Skip to main content

RAG systems: grounding a language model in your own documents

A retrieval-augmented pipeline that turns a general language model into a trustworthy assistant over your own procedures, notes and reports.

Course duration: 7h

What you will learn

  • Decide when RAG is the right tool, and when fine-tuning or a longer context window would fit better
  • Extract clean text from PDF, HTML and office documents while keeping the metadata that citations depend on
  • Chunk long documents so that a table, a numbered list or a heading survives the split
  • Choose an embedding model, build an HNSW index and filter searches with document-level metadata
  • Combine dense and lexical search, then rerank the shortlist with a cross-encoder
  • Assemble the final prompt with citations and an explicit abstention instruction
  • Evaluate faithfulness, relevance and coverage on a set of annotated questions
  • Cache embeddings and answers, break down the cost per question, and reindex incrementally
  • Assemble a full document assistant with permissions and a minimal user interface

Prerequisites

  • Course 16 — Large language models
  • Course 17 — Prompt engineering

Course modules

  1. Why ground a model in documents
  2. Text extraction: PDF, HTML, office documents
  3. Chunking: size, overlap, structure awareness
  4. Embeddings and vector databases
  5. Dense, lexical and hybrid search
  6. Reranking retrieved passages
  7. Building the final prompt and citing sources
  8. Evaluation: faithfulness, relevance, coverage
  9. Caching and cost control
  10. Project: a complete document assistant

The red thread

Every module works on the same corpus: around 300 internal procedures for a mid-sized company, a mixture of PDF, HTML and Word or spreadsheet files. Rules of procedure, quality manuals, incident notes, service notes. The pipeline is built one stage at a time — extraction, chunking, embeddings and index, retrieval, reranking, prompt, evaluation, cost — and the last module wires everything together into a working document assistant with document-level permissions.

The reference stack is deliberately open and modest: Chroma or pgvector for the index, a multilingual open embedding model, and the language model from course 16. Everything runs on a laptop.

Assessment and certificate

The course ends with a 40-question exam covering every module. On success, a certificate of completion is issued; its number can be verified by anyone on the platform.

Free courses, by contrast, end with a 5-question quiz and a certificate preview, without certification.