Free course · 13 lessons · Advanced

LLM Evals and Guardrails

Know whether your LLM feature works and keep it safe: eval sets from real traffic, code, model and human graders, LLM-as-judge biases, evals in CI with confidence intervals, input and output guardrails, false refusals, personal data in prompts and logs, online monitoring, prompt and model changes, evaluating agents, and red-teaming. Every lesson starts from a real failure and has a runnable Python simulation.

Start the course

1. Building Evals That Mean Something

Turn "it seems better" into numbers: eval sets from real traffic, the right grader for each criterion, unbiased model judges and evals in CI.

  1. From Vibes to an Eval Set — Twenty hand-picked prompts miss the questions users actually ask; sample real traffic, stratify by type and label what good looks like.
  2. Code Graders, Model Graders and Humans — Using one grader for everything is either too strict or too vague; match the grader to the criterion and calibrate model graders against humans.
  3. LLM-as-Judge Pitfalls: Position and Length Bias — Pairwise judges favour the first answer and the longer answer; swapping order and controlling length keep comparisons fair.
  4. Evals in CI: Catching Regressions Before Users Do — A 2-point drop in pass rate may be noise or a real regression; per-case comparison and confidence intervals tell you which.

2. Guardrails Around the Model

Check what goes into the model and what comes out: injection and abuse, output validation, over-blocking, and personal data.

  1. Input Guardrails: Prompt Injection and Abuse — A system prompt that says "never reveal your instructions" is not a security control; layered input checks and least privilege are.
  2. Output Guardrails: Validating What the Model Says — Model output goes into HTML, databases and other systems; validate structure, content and policy before anything acts on it.
  3. Over-Blocking: Measuring False Refusals — Guardrails tuned only to stop bad requests start refusing good ones; measure both error types and choose thresholds deliberately.
  4. PII and Secrets in Prompts and Logs — Customer messages carry card numbers, emails and secrets into prompts, traces and eval sets; redact at the boundaries.

3. Quality in Production

Keep quality up after launch: online evaluation, safe prompt and model changes, evaluating agents, and red-teaming.

  1. Online Evaluation and Monitoring — Offline evals pass while production quality drifts; grade a sample of live traffic continuously and alert on changes.
  2. Prompt and Model Changes Without Surprises — An unpinned model alias or an untested prompt edit changes behaviour overnight; version, evaluate and roll out gradually.
  3. Evaluating Agents: Outcomes, Not Exact Paths — Agents reach the same goal in many valid ways; grade the final state and key constraints, not a fixed sequence of steps.
  4. Red-Teaming Your LLM Feature — Users will try things your eval set never imagined; a maintained adversarial suite measures attack success before they do.

4. Capstone

Plan evaluation and guardrails for a high-stakes assistant.

  1. Capstone: An Eval and Guardrail Plan for a Banking Assistant — Design the evaluation, guardrails and monitoring for an assistant that answers account questions and can move money between a customer's own accounts.

Was this page helpful?