Skip to content
ML Academy

LLMs, GenAI, RAG, agents, evaluation · insight-0534

Never draw few-shot demonstrations from the evaluation set

Evidence type
practitioner heuristic
Difficulty
medium
Roles
Applied AI, Data scientist
Industries
cross-industry

Summary: situation, action, reason, boundary

  1. Situation

    To improve a classification prompt quickly, an engineer copies the hardest misclassified eval cases into the prompt as examples.

  2. Action

    Keep a separate pool for demonstrations, check new demonstrations for overlap with eval items (exact and near-duplicate), and rerun evaluation on a held-out split after any demonstration change.

  3. Reason

    Copying test items into the prompt is test-set leakage in a new form; the score measures memorised cases rather than generalisation.

  4. Boundary

    Few-shot prompts, retrieved-example prompts, prompt-optimisation tools.

Symptom or risk

The eval score jumps because those items are now answered from the prompt, and the reported gain does not appear in production.

Exceptions

Using eval failures to understand error types is fine; write new, similar examples rather than copying.

Trade-offs

Maintaining two pools takes some discipline and storage.

Pitfalls

Automatic prompt optimisers that select demonstrations using the same set they report on.

Lessons and concepts