AI Engineering: Evaluation & Iteration
What you will learn
How to measure whether your AI system is improving, building test sets, and avoiding regressions when you change prompts or models.
Why evaluation matters
Without measurement, you cannot tell if a prompt change helped or hurt. A change that improves one query may break five others. You need a test set.
Building a test set
A test set is a collection of example inputs with expected outputs:
{
"system_prompt": "Summarize emails concisely.",
"test_cases": [
{
"input": "Hi team, meeting moved to 3pm. —Alice",
"expected": "Meeting moved to 3pm.",
"rubric": ["Contains the time change", "Excludes sender name", "Under 10 words"]
},
{
"input": "URGENT: Server down since 2am. Need help.",
"expected": "Server outage reported. Action needed.",
"rubric": ["Conveys urgency", "Mentions server issue", "Short and direct"]
}
]
}
Automated evaluation
| Method | When to use |
|---|---|
| Exact match | Format-critical outputs (JSON, schema validation) |
| LLM-as-judge | Subjective quality (helpfulness, tone, creativity) |
| Semantic similarity | Answers that should have the same meaning but different wording |
| Human review | Safety-critical or high-stakes outputs |
| A/B testing | Compare two prompts/systems with real users |
Regression testing
Every time you change a prompt, model, or parameter, run your test set:
- Before the change: record baseline scores
- Apply the change
- Run the same test set
- Compare: did scores go up or down?
If you cannot measure improvement, revert the change.
Version your prompts
Treat prompts like code:
- Keep prompts in version control (git)
- Tag prompt versions (
prompt-v2.3) - Document what each version changed and why
- Use prompt management tools (LangSmith, Weights & Biases Prompts, or a simple spreadsheet)
Common mistakes
- Testing on the same examples you used to develop the prompt — you overfit to those examples.
- Using the same model to evaluate that you're testing — the judge model may share blind spots.
- Not having a test set at all — changes become guesswork.
- Changing multiple things at once — you won't know what caused the improvement or regression.
Quick check below!