Overview
Builds a robust, repeatable evaluation harness for LLMs. Covers golden dataset construction, golden answer types (exact, fuzzy, LLM-as-judge), metric selection (accuracy, BLEU/ROUGE/BERTScore, custom, faithfulness/relevance), eval runner script, LLM-as-judge prompt templates, regression tracking (diff between runs), and integration into CI or a dashboard.
When to Use This Skill
- Comparing multiple models or prompt versions on the same task.
- Establishing a quality baseline before shipping a feature that uses LLMs.
- Detecting quality regressions after model or prompt changes.
- The user wants "to measure how good this is" or "track quality over time".
Prerequisites
- A task with clear success criteria.
- A set of test cases (even 20-50 is valuable to start; aim for 100+ for statistical significance).
- Access to the models being evaluated.
- (Optional but recommended) A small amount of human-labeled "golden" answers.
Steps
Construct the eval dataset:
- Representative of real usage (include edge cases and common failures).
- Columns:
id, input, expected_output (or rubric), metadata (difficulty, category).
- Version the dataset (git + a simple JSONL or CSV).
Choose evaluation method per task:
- Exact match / contains (for extraction, classification).
- Fuzzy (Levenshtein, normalized edit distance).
- BLEU / ROUGE / BERTScore (for generation, summarization).
- LLM-as-judge (most flexible for open-ended tasks).
- Human evaluation for high-stakes (sample).
LLM-as-judge (when used):
- Write a strong judge prompt with clear rubric and few-shot examples.
- Ask for a score (1-5 or 0-1) + reasoning.
- Run the same judge on all candidates for fair comparison.
- Validate the judge against human labels on a small set.
Build the eval runner:
- Load dataset.
- For each example: call model → parse output → compute metric(s).
- Aggregate scores (mean, per-category breakdown, failure cases).
- Save detailed results (JSON) + summary.
Regression tracking:
- Store results with git commit / prompt version / model version.
- Simple diff script: "compare run A vs run B — which examples got worse?"
- Fail CI if score drops more than X% on key metrics.
Output:
- Golden dataset template (with 10-20 examples).
evaluate.py script that is model- and prompt-agnostic.
- LLM judge prompt template.
- Results viewer (simple pandas + print or Streamlit).
- CI integration example (GitHub Action step that runs eval and comments on PR).
Examples
A complete harness for "customer support ticket classification + draft response" task: golden dataset (JSONL), runner script, LLM-as-judge prompt for response quality, automatic metrics, and a regression diff report is included.
Edge Cases & Error Handling
- Judge bias: Use the same judge model/version for all comparisons. Calibrate against humans.
- Output parsing failures: Treat as score 0 and log the raw output.
- Cost of eval: Sample or use cheaper judge models for high-volume evals; run full eval nightly.
Verification
- The harness runs end-to-end on the golden set without crashing.
- Scores are reproducible when re-running the same model + prompt.
- LLM judge scores correlate reasonably with human judgment on a validation subset (report the correlation).
- A known-better prompt/model scores higher than a known-worse one.
- Regression detection works (intentionally degrade a prompt and see the harness flag it).
- Success: You have a trustworthy, automated way to know whether a change improved, hurt, or had no effect on quality.
References
1---2name: evaluation-harness3description: Builds an evaluation harness to measure LLM accuracy, reliability, and performance on a task. Use when benchmarking models, comparing prompts, or tracking quality regressions.4license: Apache-2.05---67## Overview89Builds a robust, repeatable evaluation harness for LLMs. Covers golden dataset construction, golden answer types (exact, fuzzy, LLM-as-judge), metric selection (accuracy, BLEU/ROUGE/BERTScore, custom, faithfulness/relevance), eval runner script, LLM-as-judge prompt templates, regression tracking (diff between runs), and integration into CI or a dashboard.1011## When to Use This Skill1213- Comparing multiple models or prompt versions on the same task.14- Establishing a quality baseline before shipping a feature that uses LLMs.15- Detecting quality regressions after model or prompt changes.16- The user wants "to measure how good this is" or "track quality over time".1718## Prerequisites1920- A task with clear success criteria.21- A set of test cases (even 20-50 is valuable to start; aim for 100+ for statistical significance).22- Access to the models being evaluated.23- (Optional but recommended) A small amount of human-labeled "golden" answers.2425## Steps26271. **Construct the eval dataset**:28 - Representative of real usage (include edge cases and common failures).29 - Columns: `id`, `input`, `expected_output` (or rubric), `metadata` (difficulty, category).30 - Version the dataset (git + a simple JSONL or CSV).31322. **Choose evaluation method per task**:33 - Exact match / contains (for extraction, classification).34 - Fuzzy (Levenshtein, normalized edit distance).35 - BLEU / ROUGE / BERTScore (for generation, summarization).36 - LLM-as-judge (most flexible for open-ended tasks).37 - Human evaluation for high-stakes (sample).38393. **LLM-as-judge** (when used):40 - Write a strong judge prompt with clear rubric and few-shot examples.41 - Ask for a score (1-5 or 0-1) + reasoning.42 - Run the same judge on all candidates for fair comparison.43 - Validate the judge against human labels on a small set.44454. **Build the eval runner**:46 - Load dataset.47 - For each example: call model → parse output → compute metric(s).48 - Aggregate scores (mean, per-category breakdown, failure cases).49 - Save detailed results (JSON) + summary.50515. **Regression tracking**:52 - Store results with git commit / prompt version / model version.53 - Simple diff script: "compare run A vs run B — which examples got worse?"54 - Fail CI if score drops more than X% on key metrics.55566. **Output**:57 - Golden dataset template (with 10-20 examples).58 - `evaluate.py` script that is model- and prompt-agnostic.59 - LLM judge prompt template.60 - Results viewer (simple pandas + print or Streamlit).61 - CI integration example (GitHub Action step that runs eval and comments on PR).6263## Examples6465A complete harness for "customer support ticket classification + draft response" task: golden dataset (JSONL), runner script, LLM-as-judge prompt for response quality, automatic metrics, and a regression diff report is included.6667## Edge Cases & Error Handling6869- **Judge bias**: Use the same judge model/version for all comparisons. Calibrate against humans.70- **Output parsing failures**: Treat as score 0 and log the raw output.71- **Cost of eval**: Sample or use cheaper judge models for high-volume evals; run full eval nightly.7273## Verification74751. The harness runs end-to-end on the golden set without crashing.762. Scores are reproducible when re-running the same model + prompt.773. LLM judge scores correlate reasonably with human judgment on a validation subset (report the correlation).784. A known-better prompt/model scores higher than a known-worse one.795. Regression detection works (intentionally degrade a prompt and see the harness flag it).806. Success: You have a trustworthy, automated way to know whether a change improved, hurt, or had no effect on quality.8182## References8384- [RAGAS](https://docs.ragas.io/)85- [ARES](https://github.com/stanford-futuredata/ARES)86- [LLM-as-a-Judge](https://arxiv.org/abs/2306.05685)87- [HELM](https://crfm.stanford.edu/helm/latest/)88- [Big-bench](https://github.com/google/BIG-bench)