Skip to main content

Lab 12: Contextual Retrieval Upgrade

Difficulty: Intermediate · Estimated time: ~3–5 hours

Objective

Upgrade a baseline RAG system to contextual retrieval:

  • heading-aware chunking
  • context strings per chunk
  • measurable improvements with RAGAS

Requirements

  • Keep a baseline run (classic chunking)
  • Add contextual chunks (doc title + section path + source)
  • Evaluate both using the same question set

Deliverables

  • chunking_baseline.py and chunking_contextual.py
  • eval_questions.jsonl (at least 30 questions)
  • results.md with RAGAS deltas