Why LLM Evaluation Is Hard — and Non-Negotiable
From the course LLM Evaluation and Testing: Shipping Reliable AI
Built-in AI Professor Exclusive
Ask anything about the lesson and get an instant answer. The AI Professor knows the course content and helps you learn more effectively.
Most engineering teams can ship a web service they can reason about: the same input yields the same output, a failing assertion is unambiguous, and a green test suite means the behavior is locked in. LLM-powered systems break every one of those assumptions. The model is stochastic, the space of acceptable outputs is enormous and fuzzy, and a change that looks harmless — swapping a model version, editing one line of the system prompt, reordering few-shot examples — can silently shift quality across thousands of requests. Evaluation is the discipline that turns "it feels better" into "it is measurably better on the cases we care about, with no regression on safety." Without it you are flying blind, and in production that blindness is expensive.
This lesson frames the whole course. It explains why the familiar testing playbook collapses when the unit under test is a language model, what a real evaluation harness looks like at its core, and the maturity ladder that separates a demo from a dependable product. Everything that follows — metrics, judges, datasets, RAG and agent evals, CI and monitoring — is an elaboration of the ideas introduced here.
Why the usual testing playbook fails
Traditional software testing rests on two properties: determinism and exact correctness. A function that adds two numbers has exactly one right answer, and a unit test pins it forever. LLM outputs violate both properties at once, and they violate them in ways that are not fixable with a cleverer assertion.
- Non-determinism. With any temperature above zero the same prompt produces different completions. Even at temperature zero you cannot rely on byte-identical output: providers batch requests, floating-point reductions on GPUs are not associative, and the vendor may silently update the served checkpoint. "Reproducible" for an LLM means "statistically stable," not "identical."
- No single correct answer. For "summarize this support ticket" there are thousands of good summaries and thousands of bad ones. Correctness is a fuzzy region in output space, not a point. An exact-match assertion against one reference rejects perfectly good outputs and accepts nothing useful.
- Semantic, not lexical, equivalence. "The payment failed because the card expired" and "Charge declined: expired card" mean the same thing and share almost no tokens. Any metric that compares surface strings scores them as wildly different, which is exactly backwards.
- Emergent, high-dimensional failure modes. LLMs fail in ways ordinary functions cannot: hallucinated facts, subtle instruction-following drift, format violations, tone problems, prompt-injected content, refusal on benign requests, and sycophancy. A single pass/fail bit cannot represent this surface.
The practical consequence is blunt: you cannot assert output == expected. You need graded, multi-dimensional evaluation that tolerates paraphrase while still catching real regressions. The rest of the discipline is about building measurements that behave well under exactly these conditions.
The cost of shipping without evals
Teams that skip systematic evaluation do not avoid evaluation — they outsource it to production and to their users. The symptoms are predictable. A prompt tweak that improves one demo quietly degrades ten other intents. A model upgrade the vendor promised was "strictly better" changes the output format just enough to break a downstream JSON parser. A retrieval change lifts recall but floods the context with distractors and lowers answer quality. Because nobody measured, the regression surfaces days later through complaints, churn, or a support escalation, and debugging starts from zero because there is no baseline to compare against.
Consider a concrete scenario. A fintech support assistant is upgraded from one model generation to the next because the newer model is cheaper and faster. In a five-minute manual check it looks great. Two weeks later, refund-related tickets spike. Investigation reveals the new model is subtly more cautious and now appends a disclaimer that trips a regex the downstream ticketing system uses to auto-categorize messages. No error was thrown anywhere; the pipeline "worked." The only missing ingredient was an eval that scored format conformance and category routing on a representative set before the change shipped. The fix took an afternoon; finding the problem took two weeks and eroded trust.
"Vibes-based development" — eyeballing a handful of outputs after each change — feels fast and is genuinely useful in the first days of a project. But it does not scale, it misses rare-but-severe failures, and it cannot run automatically on every commit. The entire purpose of an eval suite is to convert that manual squinting into a repeatable, quantitative gate that a machine can enforce while you sleep.
Evaluation is a first-class product surface
The maturity ladder for LLM applications is worth memorizing, because most teams can locate themselves on it honestly:
| Level | Practice | What it catches | What it misses |
|---|---|---|---|
| 1 | Manual spot checks in a playground | Obvious breakage | Everything rare or subtle |
| 2 | A saved set of hard prompts re-run by hand | Known failure cases | New regressions; runs only when remembered |
| 3 | Automated offline eval suite with metrics + thresholds | Quantified regressions on a dataset | Live-traffic drift |
| 4 | That suite wired into CI as a merge gate | Regressions before they merge | Production-only behaviors |
| 5 | Online evaluation + monitoring on real traffic | Drift, novel inputs, real user harm | — (this is the goal) |
The gap between a hobby project and a reliable product is almost entirely the climb from level 1 to levels 3–5. The point is not to reach level 5 on day one; it is to keep climbing and to never let a serious change — new model, new prompt, new retrieval strategy, new tool — ship without being judged against the same yardstick as the last one.
A minimal harness makes the problem concrete
Here is the trap that motivates everything in this course. The naive test uses exact string match, and it fails on a semantically perfect answer:
# naive_test.py - why exact match is the wrong default
reference = "The payment failed because the card had expired."
model_output = "Charge declined: the customer's card was expired."
def exact_match(pred: str, ref: str) -> bool:
return pred.strip() == ref.strip()
assert exact_match(model_output, reference) # FAILS - yet the answer is correct
Because exact_match returns False, this "test" would block a good output. The fix is not a better string comparison; it is a different kind of check. A robust harness scores along the axes that matter and asserts on thresholds, not identity:
# harness.py - the shape every eval framework generalizes
from dataclasses import dataclass
@dataclass
class Case:
prompt: str
expected_facts: list[str] # things that MUST appear (semantically)
forbidden: list[str] # things that must NOT appear (PII, competitors)
def evaluate(case: Case, output: str, judge) -> dict:
covers = judge.entailment(output, case.expected_facts) # 0..1 semantic coverage
leaks = any(judge.contains(output, f) for f in case.forbidden)
return {
"coverage": covers,
"safe": not leaks,
"passed": covers >= 0.8 and not leaks,
}
Three ideas recur across every tool we will study. First, a dataset of cases that represents the traffic you care about, including the rare and the adversarial. Second, a scorer that understands meaning rather than surface form — an embedding metric, an entailment check, or an LLM judge. Third, an explicit pass threshold that encodes your quality bar so the result is a decision, not a vibe. LangSmith, promptfoo, Braintrust, DeepEval and Ragas are all production-grade elaborations of exactly this skeleton. When a tool feels overwhelming, ask which of these three pieces each feature belongs to and it snaps into place.
The five properties of a healthy eval practice
A mature evaluation practice has five properties. Use them as a self-audit checklist for any suite you inherit or build.
- Representative. The dataset mirrors real traffic — the common cases and the long tail of rare, hard, and adversarial inputs. An eval that only contains easy cases lies to you by reporting numbers that production will not reproduce.
- Multi-dimensional. Correctness, faithfulness, format conformance, safety, tone, cost and latency are separate signals. Collapsing them into one number hides which dimension moved and why.
- Comparative. You always score a change against a baseline, so you read deltas ("+3% coverage, no safety regression"), not uninterpretable absolutes ("0.81").
- Automated. It runs on every change, not when someone remembers. Automation is what turns evaluation from a pre-launch ritual into an always-on gate.
- Honest. It is designed to surface regressions, not to produce a flattering number. An eval you can game by prompt-tuning to the test set is worse than none, because it manufactures false confidence.
Common pitfalls before you write a single metric
Even experienced teams stumble on the same rocks. Testing on the same handful of demo prompts that were used to build the feature — the model looks perfect because you tuned to those exact cases. Measuring only average score and missing that the average hides a catastrophic 2% of inputs where the system does real harm. Treating one green run as proof despite the underlying non-determinism, when you should run enough samples to separate signal from noise (a topic this module returns to). Letting the eval set leak into prompts or fine-tuning, which quietly turns your held-out measurement into training data and inflates every number. And optimizing the metric instead of the product — Goodhart's law applies with force to LLMs, because they are extraordinarily good at satisfying the letter of a rubric while missing its spirit.
From a vibe to a number: a worked example
Suppose your team keeps saying the assistant "feels worse at refunds lately." That sentence is unactionable. Turn it into a measurement in four moves. First, collect the cases: pull thirty real refund conversations from the last month, redacting personal data. Second, define the rubric for each: the good answer confirms the order, states the refund policy accurately, and never promises a timeline the business cannot keep. Third, score each output on three binary sub-checks — order confirmed, policy accurate, no over-promise — and compute the pass rate per check. Fourth, compare to a baseline: run the previous prompt version over the same thirty cases.
Now "feels worse" becomes "policy accuracy dropped from 93% to 74% after last week's prompt edit, concentrated in partial-refund cases." That statement is debuggable: you know the dimension (policy accuracy), the magnitude, and the slice (partial refunds). You can form a hypothesis, change one thing, and re-run the exact same thirty cases to confirm the fix. Notice how little machinery this required — thirty cases, three checks, one baseline — and how much clarity it bought. Every advanced technique in this course is a way to make this basic loop more representative, more automatic, and more trustworthy, but the loop itself is always the same: cases, rubric, score, compare.
In practice: where to start
If you are staring at a system with no evals, do not try to leap to level 5. Collect twenty to fifty real inputs, write down for each what a good and a bad answer looks like, and build the smallest harness that scores coverage and safety and prints a pass rate. That single afternoon converts "I think it's fine" into a number you can move deliberately. Then grow the set as production surprises you, wire the suite into CI, and only then reach for online monitoring. Evaluation is not a chore bolted on before launch; it is the instrument panel that lets you fly the system at all.
This material is educational and does not constitute legal advice. Where later lessons touch privacy, data protection and compliance, treat the guidance as a starting point and verify it against your own obligations and jurisdiction.
**[Easy]** Why can you not reliably use `assert output == expected` to test an LLM feature?
Enjoyed it? All 30 lessons look like this.
You just read a complete lesson, exactly as it appears in the platform. Create your account in under a minute and pick the option that fits you best:
Up next in the course
Unlock all 30 lessonsEverything you'll learn in this course
1 Foundations: Why LLM Evaluation Is Hard and Essential 4 lessons
- Why LLM Evaluation Is Hard — and Non-Negotiable Reading now 50 min
- The Evaluation Taxonomy: Offline vs Online, Reference-Based vs Reference-Free 50 min
- Building Your First Eval Harness with pytest 50 min
- Reading Eval Results: Variance, Significance and Confidence 50 min
2 Classic Metrics and Why They Fail on Open-Ended Text 3 lessons
- Exact Match, BLEU, ROUGE and String Metrics 50 min
- Embedding-Based Metrics: BERTScore and Semantic Similarity 50 min
- When Classic Metrics Mislead You 50 min
3 LLM-as-a-Judge: Design, Bias and Calibration 3 lessons
- Designing an LLM Judge 50 min
- Judge Biases and How to Mitigate Them 50 min
- Calibrating and Validating Your Judge Against Humans 50 min
4 Building Evaluation Datasets 3 lessons
- Golden Sets and Test Case Design 50 min
- Edge Cases, Adversarial Inputs and Slices 50 min
- Synthetic Data Generation for Evals 50 min
5 The Evaluation Tooling Landscape 3 lessons
- promptfoo: Config-Driven Evaluation and Red-Teaming 50 min
- LangSmith, Langfuse and Braintrust: Tracing and Eval Platforms 50 min
- DeepEval: Pytest-Native LLM Testing 50 min
6 Evaluating RAG Systems 3 lessons
- Retrieval Metrics: Recall, Precision, MRR and NDCG 50 min
- Generation Metrics: Faithfulness, Answer Relevancy and Ragas 50 min
- End-to-End RAG Evaluation and Failure Attribution 50 min
7 Evaluating AI Agents 3 lessons
- Task Completion and Success Metrics 50 min
- Trajectory and Tool-Call Evaluation 50 min
- Multi-Turn and Simulation-Based Agent Evaluation 50 min
8 Safety, Guardrails and Red-Teaming Evaluation 3 lessons
- Safety Evals and Guardrail Testing 50 min
- Adversarial Testing and Red-Teaming 50 min
- Eval Data Privacy, Governance and GDPR 50 min
9 Evaluation in Production: CI/CD, A/B Testing, Monitoring and Cost 4 lessons
- Regression Testing Prompts in CI/CD 50 min
- Online Evaluation and A/B Testing in Production 50 min
- Monitoring Quality Drift and Human Annotation 50 min
- The Cost of Evaluation 50 min
10 Final Quiz — LLM Evaluation and Testing 1 lessons
- Final Assessment — Shipping Reliable AI 45 min
Everything you need to learn effectively
Interactive quizzes
Check your knowledge at the end of every lesson with scored quizzes and feedback.
Personal notes
Save notes on every lesson, accessible anytime from your dashboard.
Scheduled reviews
Revisit lessons exactly when it matters, at the right intervals — so you remember for the long term.
Progress & Achievements
Track your progress, unlock achievements, and visualize what you've learned.
Bookmarks
Save the lessons that matter and find them instantly when you need them.
Questions & Answers
Ask questions right on the lesson and get answers from our team.
Good to know before you start
How do I get access to the course?
You can read the first lesson in full for free, right on this page — no account needed. For the rest of the course you create an account, pick the subscription that fits — a single course or a bundle — and get access immediately after your payment is confirmed. Everything happens 100% online.
Can I cancel my subscription anytime?
Yes. Cancel anytime, straight from your account, in just a few clicks. Your access stays active until the end of the period you have already paid for.
What does the subscription for this course include?
All 30 lessons in the course, interactive quizzes, the AI professor built into every lesson (select any passage and it explains it on the spot), personal notes, automatically saved progress, and content updates included.
Is there a fixed learning schedule?
No. You learn at your own pace, on any device. Lessons are structured step by step, and the platform saves your progress automatically, so you can pick up right where you left off — anytime.
Ready to unlock all the content?
Just this course — €49 + VAT / month — or every IT Pro course, with smart quizzes and the full AI Professor, in the bundle at €399 + VAT / month.
