LLM Evaluation

LLM Evaluation

Guides an AI agent in building evaluation strategies for LLM applications with automated metrics, human review, LLM judges and benchmarks to catch regressions.

Skill files2 files

references/

SKILL.md146 lines
1
---
2
name: llm-evaluation
3
description: Implement comprehensive evaluation strategies for LLM applications using automated metrics, human feedback, and benchmarking. Use when testing LLM performance, measuring AI application quality, or establishing evaluation frameworks.
4
---
5
6
# LLM Evaluation
7
8
Master comprehensive evaluation strategies for LLM applications, from automated metrics to human evaluation and A/B testing.
9
10
## When to Use This Skill
11
12
- Measuring LLM application performance systematically
13
- Comparing different models or prompts
14
- Detecting performance regressions before deployment
15
- Validating improvements from prompt changes
16
- Building confidence in production systems
17
- Establishing baselines and tracking progress over time
18
- Debugging unexpected model behavior
19
20
## Core Evaluation Types
21
22
### 1. Automated Metrics
23
24
Fast, repeatable, scalable evaluation using computed scores.
25
26
**Text Generation:**
27
28
- **BLEU**: N-gram overlap (translation)
29
- **ROUGE**: Recall-oriented (summarization)
30
- **METEOR**: Semantic similarity
31
- **BERTScore**: Embedding-based similarity
32
- **Perplexity**: Language model confidence
33
34
**Classification:**
35
36
- **Accuracy**: Percentage correct
37
- **Precision/Recall/F1**: Class-specific performance
38
- **Confusion Matrix**: Error patterns
39
- **AUC-ROC**: Ranking quality
40
41
**Retrieval (RAG):**
42
43
- **MRR**: Mean Reciprocal Rank
44
- **NDCG**: Normalized Discounted Cumulative Gain
45
- **Precision@K**: Relevant in top K
46
- **Recall@K**: Coverage in top K
47
48
### 2. Human Evaluation
49
50
Manual assessment for quality aspects difficult to automate.
51
52
**Dimensions:**
53
54
- **Accuracy**: Factual correctness
55
- **Coherence**: Logical flow
56
- **Relevance**: Answers the question
57
- **Fluency**: Natural language quality
58
- **Safety**: No harmful content
59
- **Helpfulness**: Useful to the user
60
61
### 3. LLM-as-Judge
62
63
Use stronger LLMs to evaluate weaker model outputs.
64
65
**Approaches:**
66
67
- **Pointwise**: Score individual responses
68
- **Pairwise**: Compare two responses
69
- **Reference-based**: Compare to gold standard
70
- **Reference-free**: Judge without ground truth
71
72
## Quick Start
73
74
```python
75
from dataclasses import dataclass
76
from typing import Callable
77
import numpy as np
78
79
@dataclass
80
class Metric:
81
name: str
82
fn: Callable
83
84
@staticmethod
85
def accuracy():
86
return Metric("accuracy", calculate_accuracy)
87
88
@staticmethod
89
def bleu():
90
return Metric("bleu", calculate_bleu)
91
92
@staticmethod
93
def bertscore():
94
return Metric("bertscore", calculate_bertscore)
95
96
@staticmethod
97
def custom(name: str, fn: Callable):
98
return Metric(name, fn)
99
100
class EvaluationSuite:
101
def __init__(self, metrics: list[Metric]):
102
self.metrics = metrics
103
104
async def evaluate(self, model, test_cases: list[dict]) -> dict:
105
results = {m.name: [] for m in self.metrics}
106
107
for test in test_cases:
108
prediction = await model.predict(test["input"])
109
110
for metric in self.metrics:
111
score = metric.fn(
112
prediction=prediction,
113
reference=test.get("expected"),
114
context=test.get("context")
115
)
116
results[metric.name].append(score)
117
118
return {
119
"metrics": {k: np.mean(v) for k, v in results.items()},
120
"raw_scores": results
121
}
122
123
# Usage
124
suite = EvaluationSuite([
125
Metric.accuracy(),
126
Metric.bleu(),
127
Metric.bertscore(),
128
Metric.custom("groundedness", check_groundedness)
129
])
130
131
test_cases = [
132
{
133
"input": "What is the capital of France?",
134
"expected": "Paris",
135
"context": "France is a country in Europe. Paris is its capital."
136
},
137
]
138
139
results = await suite.evaluate(model=your_model, test_cases=test_cases)
140
```
141
142
## Detailed patterns and worked examples
143
144
Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
145
146

© Seth Hobson · MIT · source · posted by @OpenSourceBuffGuy on promptparty.com

@OpenSourceBuffGuy

I find openly licensed prompts and post them here.

0 followers · 14,621 prompts

More by @OpenSourceBuffGuy

See all
Sea turtle carrying floating film studio island prompt image

Sea turtle carrying floating film studio island

Draws a giant sea turtle carrying a floating island film studio through a starry sky, where fairies polish rough film strips into golden film.

image-prompt, nano-banana, 3d-render, cartoon, fantasy-world, creatures, animals, whimsical, dreamy, cinematic, dramatic-lighting, vibrant-colors, bokeh, miniature, widescreen, night-scene, illustration, concept-art, surreal, storytelling, clay-3d

Desert buggy escapes drones past industrial outpost prompt image

Desert buggy escapes drones past industrial outpost

Builds a 15-second desert chase video where a racer in an armored buggy escapes drones past an industrial outpost, using five reference images with set jobs.

video-prompt, hailuo, action, multi-shot, timed-beats, camera-movement, reference-image, character-consistency, negative-prompt, cinematic, sci-fi, cars, landscape, aerial-view, tracking-shot, photorealistic, sound-effects, structured-output, long-form, widescreen

1 view
Cozy Pixel Art Farm Island Village prompt image

Cozy Pixel Art Farm Island Village

Draws a cozy 16-bit pixel-art farming village across six small islands joined by bridges, with exact counts for buildings, animals and crops.

image-prompt, gpt-image, pixel-art, isometric, game-assets, concept-art, maps, worldbuilding, cozy, vibrant-colors, ocean, landscape, wide-shot, widescreen, game-development, video-games, structured-output, whimsical, summer, high-angle, aerial-view, animals, negative-prompt, cityscape

1 view

Reviews

Loading reviews…

Discussion

Loading comments…