Overview
Shipping a prompt change without an evaluation suite means trusting that "it feels better" on a handful of manually-checked examples, which reliably misses regressions on dimensions nobody happened to spot-check, consistency, tone, an edge case like sarcasm. A real eval suite scores against defined success criteria using the grading method that fits the question: exact match for single-right-answer tasks, embedding similarity when wording can vary but meaning shouldn't, and LLM-graded scoring for genuinely subjective qualities a fixed rule can't capture. Hallucination reduction is a related but distinct discipline, and the cheapest, most effective techniques are concrete and specific: explicitly permitting "I don't know" as a valid answer, and for long documents, requiring the model to extract and cite direct quotes before generating analysis, rather than answering freely from memory of the text.
Quick Reference
| Grading method | Best for |
|---|---|
| Exact match | Single-right-answer tasks (classification, categorical labels) |
| Embedding similarity | Meaning should match a reference even if wording varies |
| Reference-based (e.g. ROUGE-L) | Comparing generated text (summaries) against a reference |
| LLM-graded (Likert or binary) | Subjective qualities: tone, empathy, professionalism |
| Hallucination technique | What it does |
|---|---|
| Allow "I don't know" | Removes pressure to fabricate a confident-sounding answer to a real gap |
| Extract quotes before analyzing | Grounds the response in verifiable source text, not free recall |
| Cite a supporting quote per claim | Makes every claim auditable; unsupported claims get retracted |
| Chain-of-thought verification | Surfaces faulty reasoning before it becomes the final answer |
Syntax
def evaluate_exact_match(model_output, correct_answer):
return model_output.strip().lower() == correct_answer.strip().lower()Examples
As our M&A advisor, analyze this report on the potential
acquisition of AcmeCo by ExampleCorp. <report>{{REPORT}}</report>
Focus on financial projections, integration risks, and regulatory
hurdles. If you're unsure about any aspect or if the report lacks
necessary information, say "I don't have enough information to
confidently assess this."Volume over polish for automated evals
Official guidance is explicit: more test cases with slightly-lower-signal automated grading beats fewer, hand-graded ones. Structure eval questions for automated scoring so you can run them at real scale, not as an occasional manual spot-check.
Visual Diagram
Common Mistakes
- Testing a prompt change on a handful of clean, manually-picked examples instead of a real eval suite covering edge cases.
- Using exact-match grading for a task where wording legitimately varies but meaning should match, producing false failures.
- Never telling the model uncertainty is an acceptable answer, leaving it under implicit pressure to always produce a confident, complete response.
- Treating any single hallucination-reduction technique as sufficient; official guidance is explicit that these reduce, not eliminate, hallucination, critical claims still need independent validation.
Performance
- LLM-graded evals cost a real model call per graded example, meaningfully more expensive than exact-match or embedding-similarity grading; reserve them for qualities that genuinely need subjective judgment.
- Extracting quotes before analysis adds a real generation step and token cost on long documents, a deliberate trade against measurably better grounding, not a free improvement.
Best Practices
- Build an automated, task-specific eval suite covering real edge cases before shipping a prompt change, not just a manual spot-check.
- Match the grading method to the question: exact match for single right answers, similarity for flexible wording, LLM-graded for subjective quality.
- Explicitly permit "I don't know" in prompts where a real information gap is possible, it's one of the cheapest, most effective hallucination reductions available.
- For long-document tasks, require quote extraction and per-claim citation before analysis, and treat unsupported claims as ones to retract, not keep.