Paj Digital Labs
All articles
AI & Automation

AI Evaluation Sets: Keep the Test Data Out of the Tuning Loop

An evaluation stops being independent when every prompt revision is shaped around its answers. Separate development examples from held-out cases and measure meaningful failure categories.

Paj Digital Labs 4 min read
Robotic gripper sorting components on a laboratory workbench
Editorial illustration · AI & Automation

A team adjusts a prompt until it scores almost perfectly on twenty examples. They announce that the system is ready. What they may have built is a prompt that knows those twenty examples very well.

Evaluation is useful only when it gives evidence beyond the cases you used to construct the system. That requires a separation between development data and held-out judgement, plus a task definition concrete enough to score.

Define the decision being tested

For a document classifier, name the classes and ambiguous cases. For a summariser, define required facts, forbidden inventions and the expected treatment of missing evidence. A vague quality score hides disagreements that matter operationally.

Choose failure categories tied to the task: wrong classification, omitted critical fact, unsupported assertion, privacy leak or invalid structured output. A single average can conceal a rare but unacceptable failure.

Decide which failures block release and which require a manual review path. Those thresholds should follow product risk and user needs, not whichever score makes the current model look strongest.

Separate the datasets

Use development examples for prompt iteration and debugging. Keep a validation set for comparing candidate changes. Reserve a held-out test set for less frequent release judgement.

Record which examples have been inspected during tuning. Once a failed held-out case becomes a prompt demonstration or a repeatedly targeted fix, it is no longer fully independent evidence. Keep it as a regression case, and refresh independent evaluation thoughtfully.

Avoid near-duplicates across splits. Two documents from the same template with only a name changed can leak the same answer pattern. Split by customer, template family, time period or another meaningful grouping when appropriate.

Preserve real difficulty

Include missing fields, messy formatting, conflicting facts, unusual languages and cases that should be rejected or escalated. A production workflow sees more than clean demonstrations.

Do not fill the held-out set solely with synthetic examples generated by the same model you are evaluating. Synthetic cases are useful, especially for adversarial boundaries, but they can share the generator's assumptions and style.

Use authorised, reviewed real examples where permitted, and minimise sensitive data. Evaluation storage deserves access controls and retention rules just like production inputs.

Score independently where possible

For structured outcomes, deterministic checks often provide strong evidence. Validate a schema, compare a known class or confirm required identifiers. For open-ended answers, use a rubric and reviewer agreement.

python
def score_classification(predictions, expected):
    if len(predictions) != len(expected):
        raise ValueError(class="text-code-string">"Prediction count must match evaluation cases")
    if not expected:
        raise ValueError(class="text-code-string">"Evaluation set must not be empty")
    correct = sum(p == e for p, e in zip(predictions, expected))
    return {class="text-code-string">"correct": correct, class="text-code-string">"total": len(expected),
            class="text-code-string">"accuracy": correct / len(expected)}

This simple accuracy measure is only suitable for a defined classification task. Check per-class results and the costs of particular mistakes. A dominant easy class can produce high accuracy while the important minority class fails.

Model-based graders can help scale review, but they have their own biases and instability. Calibrate them against human judgements and avoid giving the grader the candidate model's self-evaluation as if it were evidence.

Record the complete experiment

Store model identifier, prompt version, decoding settings, tool versions, retrieval configuration and dataset revision. A score without those details is difficult to reproduce.

If outputs vary, run repeated trials for representative cases and report the variation. Do not choose the best run after seeing results. That turns randomness into another hidden tuning step.

Compare candidates on the same cases. Review newly introduced regressions even when the average improves. An improvement on routine summaries may not compensate for leaking private data on one adversarial document.

Check contamination beyond examples

Retrieval can leak reference answers into evaluation. If the test question's solution sits in the indexed development notes, the system may simply retrieve it. Decide whether retrieval is part of the real task or an accidental shortcut.

Tool mocks can also make a benchmark easier than production. A perfectly formatted mock invoice service does not capture real timeout and permission failures. Include those boundaries in separate integration tests.

Keep the evaluation harness itself under review. A scorer that silently skips invalid outputs can make a failing candidate look better by reducing the denominator.

Make release evidence honest

Report case counts, categories, known gaps and the evaluation date. Avoid claiming that a small test set proves reliability for every future document. Keep a manual route for cases outside the supported distribution.

After release, collect permitted failure feedback and turn reproducible issues into regression examples. Maintain the separation between those known cases and new independent checks.

The best evaluation process does not protect the current prompt from criticism. It creates a way to discover that the next change is worse, or that the entire task boundary was misunderstood. That is what makes a passing score useful evidence rather than a rehearsed performance.

Paj Digital Labs

The engineering journal of Paj Digital Solutions — hosting, server infrastructure and web engineering, written by the people who run the servers.

Related reading