Lesson 9.8core4 h

Evaluating and observing LLM apps

Evals are the product

A RAG system is a pile of choices that can each be changed in a minute, and without measurement every change is a guess. Evaluation is what turns prompt-poking into engineering: golden datasets, retrieval metrics separated from answer metrics, RAGAS-style measures of faithfulness and context quality, LLM judges calibrated against humans, tracing in production, and the error-analysis loop that actually improves systems. Teams that build this muscle ship; teams that do not ship demos. The same craft extends to agents in 10.9 Evaluating agents.

You'll be able to

  • Describe the three levels of evaluation and where each belongs in a development workflow
  • Build and maintain a golden dataset from real, expert and synthetic questions
  • Define faithfulness, answer relevancy, context precision, context recall and answer correctness precisely
  • Design an LLM judge, measure its agreement with humans and control position and verbosity bias
  • Instrument a pipeline with traces and run evaluations in CI and on production samples

Key ideas

  1. Three levels of evaluation: deterministic assertions (Level 1, in CI), human and model grading (Level 2, per change), A/B tests (Level 3, product decisions).
  2. A golden set of 50–300 (question, reference, relevant chunks) items, built from real, expert and filtered synthetic questions, versioned, grown from failures, with a held-out slice.
  3. Separate retrieval metrics (recall@k, MRR, nDCG) from end-to-end metrics so a wrong answer is attributed to the right stage.
Show 4 more key ideas
  1. Faithfulness = supported claims / all claims; answer relevancy = cosine of regenerated questions to the original; context precision rewards relevant chunks ranked high; context recall checks the reference answer is covered.
  2. LLM judges: rubric, reasoning then verdict, binary criteria, pairwise with order swapping, calibration against 50–100 human labels (agreement, Cohen's κ).
  3. Trace every request (spans, tokens, cost, retrieved chunks), run evals in CI, sample production traces for review, chart scores per version.
  4. The core skill is error analysis: read fifty traces, cluster failures, fix the biggest bucket, repeat.

Suggested path through this lesson