Testing, Evaluating, and Improving AI Products
Why AI features need evaluation, and how: test sets, human review, guardrails, monitoring, red-teaming, and public benchmarks.
Artificial Intelligence · Lesson 6
Why AI features need evaluation, and how: test sets, human review, guardrails, monitoring, red-teaming, and public benchmarks.
Traditional software is largely deterministic: given the same input, you get the same output, and a test either passes or fails. AI features break that assumption. The same prompt can yield different answers, a model can state falsehoods with total confidence (hallucination), and it can reflect biases present in its training data. So 'it worked when I tried it' is far weaker evidence for an AI feature than it is for ordinary code.
That does not mean evaluation is hopeless; it means you need methods suited to uncertain, open-ended behavior. Teams that ship reliable AI treat evaluation as a continuous discipline, building test sets, having humans review outputs, adding guardrails, watching production, and iterating, rather than a one-time checkbox before launch.
Ordinary tests compare output against a single expected answer. AI outputs are non-deterministic, can hallucinate, can carry bias, and often have no single correct form. So you cannot simply compare against one expected string. Instead you evaluate qualities such as accuracy, helpfulness, safety, and tone, which require judgment rather than an exact match.
Collect representative and hard examples, including edge cases and known failure modes, into an evaluation set you can run repeatedly. Because outputs vary, you often grade with rubrics and human reviewers, or a carefully checked model-as-judge, and you track whether a change helps or hurts across the whole set rather than on a single lucky example.
Guardrails are checks around the model: input filters, output validation, refusal rules, and limits on what actions it may take. Monitoring watches real usage for new failures, drift, and user reports. Findings feed the next iteration. The loop does not end, because the space of possible inputs is effectively infinite and the world keeps changing.
Imagine adding an AI that drafts customer-support replies. You assemble a test set of 200 real past questions with known good answers, including tricky ones about refunds, angry customers, and questions the documentation does not cover. You run the feature across the set and have reviewers score each reply for accuracy, tone, and whether it invented a policy. You discover it fabricates refund rules on 8 of the 200, a hallucination you would never have caught from a single happy-path demo. You add a guardrail that blocks refund claims not found in the docs, re-run the set, and confirm the fix without breaking the rest.
A single impressive demo is the opposite of evaluation. Showing the feature answer one well-chosen question proves almost nothing, because a non-deterministic system can look brilliant once and fail on the next input. Worse, cherry-picked demos create false confidence that survives right up until real users hit the cases you never tried. Evaluation exists precisely because one good run is not evidence of reliability.
Two real practices anchor modern AI evaluation. The first is red-teaming: deliberately trying to make a system fail, producing harmful, biased, or false output, before release. Major AI labs have publicly described doing this. OpenAI's 2023 GPT-4 System Card documented an extensive red-teaming effort in which outside domain experts probed the model for dangerous capabilities and harmful behavior, and Anthropic has published research on red-teaming language models to surface harms. Red-teaming is adversarial evaluation: you learn a system's weaknesses by attacking it on purpose.
The second is shared benchmarks. Academic and industry groups have built standardized test suites so different models can be compared on common tasks; examples include GLUE and SuperGLUE for language understanding, MMLU (Massive Multitask Language Understanding) for broad knowledge, and Stanford's HELM (Holistic Evaluation of Language Models), which deliberately reports many metrics rather than a single number. Benchmarks give a common yardstick, but they are imperfect: models can be tuned to the test, benchmarks age, and a high score on a suite does not guarantee good behavior on your specific product. Treat them as one signal among several, not as proof of quality.
Pick an AI feature you use. Write five inputs: two ordinary, two edge cases, and one designed to trip it up. Run them and score each for accuracy and safety. You have just built the seed of an evaluation set.
Think Like a Maester: With AI, one good answer is a demo; many hard answers, scored honestly, are evidence.
AI features need evaluation like any product, but their non-deterministic, sometimes hallucinated or biased outputs make 'it worked once' nearly worthless as evidence. Practical evaluation is a continuous loop: build representative test sets including hard cases, grade with rubrics and human review, add guardrails, monitor real usage, and iterate. Two real practices anchor the field: red-teaming, where teams attack their own systems to find failures before release, documented by labs such as OpenAI and Anthropic, and public benchmarks like GLUE, MMLU, and HELM that let models be compared on shared tasks while remaining imperfect and gameable. Treat evaluation as an ongoing discipline, not a one-time gate, and let honest, repeatable measurement, rather than a single impressive demo, decide whether an AI feature is ready.
Mark this lesson complete to track your progress.