Day 09·Control and verify·2 min read
Evaluation, iteration and safety
You cannot tell whether a prompt change helped without a fixed test set. Build a small eval before you tune anything, grade it three ways, and guard against prompt injection.
By the end
Build a small eval set, choose between code checks, LLM-as-judge and human review, and explain why prompt injection is harder to stop when it is indirect.
You cannot tell whether a prompt change helped without a fixed test set. So build a small eval before you tune anything.
Learn
- Eval set. 20 to 50 realistic inputs, including the edge cases that broke things before. Write down what success means for each one.
- Three ways to grade.
- Code checks: word count, valid JSON, banned phrases, required fields.
- LLM-as-judge: a second model scores against a rubric. Watch for its biases toward longer answers, the first option shown, and its own style.
- Human review: the slowest, but the ground truth for tone and usefulness.
- Iterate one change at a time. Rerun the whole set after each change, or you will not know which change mattered.
- Prompt injection. Instructions hidden in user input, documents, web pages or tool results. Delimit untrusted content, limit tool permissions, and require approval for risky actions.
- Other risks. System prompt leakage, biased or unsafe outputs, and personal data in prompts or logs.
Drill
- Write a script that runs your Day 1 slogan prompt 30 times at three temperatures.
- Auto-check word count and a banned list ("go green", "save the planet").
- Add an LLM judge scoring originality from 1 to 5, and compare it to your own ratings on 10 samples.
Check yourself
- Why change only one thing between eval runs?
- What makes indirect prompt injection harder to stop than direct injection?
Test yourself
6 multiple-choice questions and 8 flashcards on this lesson, shuffled every time, with the reason behind every answer.