Lesson 5 of 6 · 25 min

Testing Quality and Safety Before Go-Live

Build an evaluation set from real tasks, add safety tests, and compare models and settings with evidence.

XDQ Tutor · AI guide

Hello. In this lesson I will take you through 3 ideas, one at a time.

  1. An evaluation set from real tasks
  2. Safety tests
  3. Compare with evidence

Why it matters: Build an evaluation set from real tasks, add safety tests, and compare models and settings with evidence. After each idea I will ask you one quick question.

An evaluation set from real tasks

The short version: Collect 50 to 200 real examples of the task, with the answer a good employee would give.

Collect 50 to 200 real examples of the task, with the answer a good employee would give. Remove or mask personal data first. Include easy, typical and hard cases, and a few the model should refuse. This set becomes the yardstick for every model, prompt and setting you try.

Decide how to score before you run anything. Some tasks have one right answer, such as a field extracted from an invoice. Others need a rubric, such as whether a reply is accurate, complete and in the right tone. Have two people score a sample to check the rubric is clear.

Quick check

What should you do with personal data before building an evaluation set?

Safety tests

The short version: Add a separate set of safety tests.

Add a separate set of safety tests. Include prompt injections hidden in documents, attempts to reveal the system prompt, requests for other users' data and requests the policy says to refuse. Each test has an expected safe behaviour, and any failure blocks the release until it is fixed and re-tested.

  • Injection: hidden instructions in a document, email or web page
  • Leakage: asking for the system prompt or another user's records
  • Policy: requests the model must refuse
  • Actions: an agent asked to do something outside its permissions
Quick check

What happens when a safety test fails?

Compare with evidence

The short version: Run the same sets on each candidate: different models, sizes and quantisation levels.

Run the same sets on each candidate: different models, sizes and quantisation levels. Record quality scores, safety results, speed and memory use in one table. The cheapest option that meets the quality bar and passes every safety test is usually the right choice.

Keep the sets and rerun them on every upgrade. A newer model is not automatically better for your task, and the only way to know is to measure it the same way you measured the current one.

Quick check

Why rerun the sets on every upgrade?

Key takeaways
  • Build an evaluation set of 50 to 200 real, masked examples
  • Decide how to score before you test
  • Safety failures block the release until fixed
  • Rerun the same sets on every upgrade
Try it

Build a first evaluation set of 30 examples for one task, with expected answers and a scoring rule. Add five safety tests. Run them on your current setup and record the scores as your baseline.

That is the lesson.
Mark it complete to track your progress on this device.
← PreviousSecurity Controls for Self-Hosted AINext lesson →Running Costs, Upgrades and Data Residency