1---2name: llm-evaluation-framework3description: Use when performing llm evaluation framework — provides a structured framework for evaluating large language models (LLMs) for production use. Covers task-specific benchmarking, safety testing, cost analysis, latency measurement, prompt engineering evaluation, and comparison across models to select the optimal LLM for a given use case.4---56# LLM Evaluation Framework78## Phase 1: Evaluation Criteria Definition91. Define use case requirements10 - [ ] Task type (generation, classification, extraction, summarization, Q&A)11 - [ ] Input characteristics (length, language, domain)12 - [ ] Output requirements (format, length, structure)13 - [ ] Latency requirements (real-time vs. batch)14 - [ ] Throughput requirements (requests per minute)15 - [ ] Cost constraints (per-token or per-request budget)16 - [ ] Privacy and data residency requirements17 - [ ] Safety and content policy requirements182. Define evaluation metrics and weights1920### Evaluation Criteria Weights2122| Criterion | Weight (%) | Minimum Threshold | Measurement Method |23|-----------|-----------|-------------------|-------------------|24| Task quality | % | | Human eval + automated metrics |25| Latency | % | < ms | P50, P95, P99 |26| Cost | % | < $/1K tokens | Token-based pricing |27| Safety | % | Pass all checks | Red team + automated |28| Reliability | % | > % uptime | API availability |29| Context window | % | > K tokens | Model spec |3031## Phase 2: Evaluation Dataset Creation321. Build evaluation datasets33 - [ ] Representative inputs from real use case34 - [ ] Edge cases and adversarial inputs35 - [ ] Multi-language inputs (if applicable)36 - [ ] Long-context inputs (if applicable)37 - [ ] Ground truth / reference outputs for automated scoring38 - [ ] Minimum 100+ examples per task category392. Create human evaluation rubrics403. Define automated evaluation metrics (BLEU, ROUGE, exact match, F1)4142### Dataset Summary4344| Category | Examples | Ground Truth | Difficulty | Purpose |45|----------|---------|-------------|-----------|---------|46| Standard inputs | | Yes/No | Normal | Baseline quality |47| Edge cases | | Yes/No | Hard | Robustness |48| Adversarial | | N/A | Hard | Safety |49| Domain-specific | | Yes/No | Variable | Domain fitness |50| Long context | | Yes/No | Variable | Context handling |5152## Phase 3: Quality Evaluation531. Run task-specific quality benchmarks54 - [ ] Generate outputs for all evaluation examples55 - [ ] Score with automated metrics56 - [ ] Conduct human evaluation on sample57 - [ ] Evaluate instruction following accuracy58 - [ ] Test structured output generation (JSON, XML)59 - [ ] Assess factual accuracy and hallucination rate602. Compare across models6162### Quality Comparison6364| Model | Automated Score | Human Score (1-5) | Hallucination Rate | Instruction Following | Overall Quality |65|-------|----------------|------------------|-------------------|---------------------|----------------|66| | | | % | % | /100 |6768## Phase 4: Performance & Cost Evaluation691. Measure performance characteristics70 - [ ] Time to first token (TTFT)71 - [ ] Tokens per second (throughput)72 - [ ] P50, P95, P99 end-to-end latency73 - [ ] Latency under concurrent load74 - [ ] Rate limit behavior75 - [ ] Context window utilization impact on latency762. Calculate cost per use case77 - [ ] Input token cost78 - [ ] Output token cost79 - [ ] Total cost per request (average)80 - [ ] Monthly projected cost at expected volume8182### Performance & Cost Comparison8384| Model | TTFT (ms) | P50 (ms) | P95 (ms) | Tokens/sec | Input $/1M | Output $/1M | Cost/Request |85|-------|----------|---------|---------|-----------|-----------|------------|-------------|86| | | | | | $ | $ | $ |8788## Phase 5: Safety & Reliability Evaluation891. Test safety and content policies90 - [ ] Harmful content generation resistance91 - [ ] PII handling and redaction92 - [ ] Bias in outputs across demographics93 - [ ] Jailbreak resistance94 - [ ] Content policy compliance95 - [ ] Confidentiality (does not leak training data)962. Test reliability97 - [ ] API uptime and error rates98 - [ ] Consistency of outputs (temperature=0 determinism)99 - [ ] Graceful degradation under load100 - [ ] Rate limit recovery behavior101102## Phase 6: Selection & Recommendation1031. Score each model across all criteria1042. Apply weights to calculate overall score1053. Consider operational factors (vendor relationship, support, SLA)1064. Evaluate fine-tuning potential if needed1075. Make recommendation with justification108109### Final Comparison Matrix110111| Model | Quality | Latency | Cost | Safety | Reliability | Weighted Score | Rank |112|-------|---------|---------|------|--------|-------------|---------------|------|113| | /100 | /100 | /100 | /100 | /100 | /100 | |114115## Counter-Rationalizations116117| Shortcut | Counter | Why |118|----------|---------|-----|119| "We can skip some steps for this case" | Adapt the workflow steps, don't skip them | Skipped steps are where incidents and oversights originate |120| "The user seems to already know what to do" | Complete all workflow phases with the user | The workflow catches blind spots that experience alone misses |121| "This is a minor case, full process is overkill" | Scale the process down, don't turn it off | Minor cases become major when unstructured; the process scales, not disappears |122| "I'll fill in the details later" | Complete each section before moving on | Deferred details are forgotten; real-time capture is more accurate |123| "The template output isn't necessary" | Always produce the structured output format | Structured output enables comparison, audit trails, and handoff to other teams |124125## Output Format126- **Evaluation Dataset**: Test cases with ground truth127- **Quality Report**: Per-model quality metrics and human eval results128- **Performance Report**: Latency and throughput benchmarks129- **Cost Analysis**: Per-model cost projections at expected volume130- **Recommendation**: Selected model with justification and tradeoffs131132## Action Items133- [ ] Define evaluation criteria and weights for use case134- [ ] Build evaluation dataset with representative examples135- [ ] Run quality benchmarks across candidate models136- [ ] Measure performance and calculate costs137- [ ] Conduct safety and reliability testing138- [ ] Select model and document decision rationale139- [ ] Set up monitoring for model quality in production