AI Evaluation and Monitoring
Operating contract
Inputs
| Input |
Required |
Purpose |
| Domain evidence |
yes |
feature contract, representative dataset, quality dimensions, baseline, thresholds, and risk class |
Outputs
- Produce: evaluation plan, scored results, confidence and failure slices, release verdict, and monitoring thresholds.
Capability and permission boundaries
Default to read-only analysis. Read only scoped records; redact secrets and regulated data. Writes, execution, network calls, production configuration, customer communication, billing changes, and delegation require explicit authority and an identified owner. Never widen tenant, time-window, or system scope implicitly.
Degraded mode
When required telemetry, evidence, execution, network access, or write authority is unavailable, return a partial result with each unassessed item labelled, preserve the safest existing state, and state the evidence or approval needed to continue. Never convert missing evidence into a pass.
Decision rules
| Condition |
Action |
| Scope, owner, or threshold is missing |
Stop the affected decision and request it |
| Evidence is incomplete but read-only analysis is safe |
Produce a qualified partial result and gap list |
| A mutation exceeds authority or tenant boundary |
Block it and route for approval |
| Evidence meets the stated threshold |
Issue the output with provenance and owner |
Anti-Patterns
- Treating absent evidence as success. Fix: mark the check unassessed and name the missing source.
- Expanding one tenant or workflow to all tenants. Fix: enforce supplied scope at every query and action.
- Performing a production write during analysis. Fix: emit a reviewed change plan until authority is explicit.
- Reporting a metric without population, window, or source. Fix: attach all three.
- Hiding a failed threshold inside an average. Fix: report failure slices and the remediation owner.
Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.
Use When
- Use when setting up quality assurance for AI features — defining evaluation criteria, measuring output quality, using AI-as-judge, monitoring production AI, detecting drift, and building user feedback loops
Evidence Produced
| Category |
Artifact |
Format |
Example |
| Correctness |
AI evaluation harness configuration |
Markdown doc covering eval set, scoring rubric, and acceptance thresholds |
docs/ai/eval-harness-assistant.md |
| Correctness |
Latest AI evaluation results |
Markdown doc reporting pass-rate, regression deltas, and outlier examples |
docs/ai/eval-results-2026-04-16.md |
References
- Use the links and companion skills already referenced in this file when deeper context is needed.
Overview
Evaluation is the biggest bottleneck to successful AI deployment. Define evaluation criteria BEFORE building. Without evaluation, you cannot know if your AI feature is working, degrading, or harming users.
Core principle: Evaluation-driven development. Like TDD for AI — define what "good" means first, then build.
Evaluation Contract
Every production AI feature needs an evaluation contract before release:
- Task definition: what the model must do, for whom, in which workflow.
- Business metric: time saved, revenue influenced, conversion lift, defect reduction, service quality, risk reduction, or cost avoided.
- Quality metrics: correctness, completeness, relevance, tone, actionability, citation quality, and domain compliance.
- System metrics: latency, cost per successful task, availability, retry rate, fallback rate, and tool failure rate.
- Safety metrics: PII exposure, prompt-injection resistance, harmful output, policy violations, and unauthorized action attempts.
- Release threshold: minimum pass rates and maximum regression allowed versus the current production baseline.
- Rollback trigger: metrics or incidents that require disabling the feature or reverting prompt/model/tool versions.
Evaluation Dimensions
| Dimension |
What to Measure |
Method |
| Format |
Is output valid JSON/schema? Correct length? |
Automated rules |
| Factual accuracy |
Does output match the provided context? |
AI-as-judge or RAG citation check |
| Safety |
Toxic, harmful, or brand-risk content? |
Classifier or AI-as-judge |
| Instruction-following |
Did it follow format/tone/language rules? |
Automated + AI-as-judge |
| Relevance |
Does output address the user's question? |
AI-as-judge |
| Cost |
Tokens per request; cost per feature |
Logged automatically |
| Latency |
Time to first token; total response time |
Logged automatically |
Evaluation Workflow
1. Define criteria before building
2. Create golden test set (20–50 examples with expected outputs)
3. Run automated format checks on every new model/prompt version
4. Run AI-as-judge for quality checks
5. Compare against previous version — only deploy if metrics hold or improve
6. Monitor production: track live metrics + user feedback
7. Retrain/reprompt when drift detected
For features that recommend, generate, rank, automate, or trigger consequential
actions, load references/ai-human-oversight-evaluation.md.
Evaluate the problem, human, system, model, inputs, and outputs separately. Do not
call a model-quality pass a product-quality pass. Require evidence for correction,
contest, undo or safe fallback, escalation, consent/notice, and the audit event.
Evaluation Dataset Design
- Build separate sets for development, release gating, adversarial testing, and production monitoring.
- Include real examples, expert-created examples, edge cases, multilingual/local examples, low-resource context, and abuse attempts.
- Version each case with task, tenant/domain, source, expected behavior, rubric, and data sensitivity.
- Keep leakage out of evals: do not let the same generated examples drive both prompt tuning and final release scoring.
- Refresh cases after production incidents, new user behavior, platform changes, policy changes, or model migrations.
Release Gates
| Gate |
Required Evidence |
| Prompt/model change |
Eval comparison against previous version, cost and latency delta |
| New tool/action |
Permission tests, dry-run tests, approval-path tests, failure-mode tests |
| RAG/index change |
Retrieval precision samples, citation checks, stale-data checks, tenant isolation checks |
| Fine-tune |
Baseline comparison showing prompts/RAG were insufficient, holdout eval results, rollback plan |
| Production launch |
Monitoring dashboard, alert thresholds, owner, incident playbook, user feedback channel |
Do not ship an AI feature because a demo looked good. Ship it because it passes the evaluation contract.
Creating a Golden Test Set
CREATE TABLE ai_eval_cases (
id INT AUTO_INCREMENT PRIMARY KEY,
feature_name VARCHAR(100), -- 'invoice_analysis', 'sales_report'
input TEXT NOT NULL, -- the user query or document
expected_output TEXT, -- ideal output (or key elements of it)
eval_criteria JSON, -- {"format": "json", "must_contain": ["total", "vendor"]}
created_by INT,
created_at TIMESTAMP DEFAULT NOW()
);
Build test cases from:
- Real production queries (once live)
- Domain expert-crafted examples
- Edge cases: empty input, wrong language, very long input, adversarial input
Automated Evaluation (No LLM Cost)
Run these on every deployment:
class AiEvaluator {
public function evaluateFormat(string $output, array $criteria): EvalResult {
$score = 0;
$issues = [];
// JSON validity
if (($criteria['format'] ?? null) === 'json') {
$decoded = json_decode($output, true);
if (json_last_error() !== JSON_ERROR_NONE) {
$issues[] = 'Invalid JSON';
} else {
$score += 25;
// Required keys
foreach ($criteria['required_keys'] ?? [] as $key) {
if (!array_key_exists($key, $decoded)) {
$issues[] = "Missing key: $key";
} else {
$score += 10;
}
}
}
}
// Length constraints
if (isset($criteria['max_words'])) {
$wordCount = str_word_count($output);
if ($wordCount > $criteria['max_words']) {
$issues[] = "Too long: {$wordCount} words (max {$criteria['max_words']})";
} else {
$score += 15;
}
}
// Must-contain terms
foreach ($criteria['must_contain'] ?? [] as $term) {
if (stripos($output, $term) === false) {
$issues[] = "Missing expected term: $term";
} else {
$score += 10;
}
}
return new EvalResult($score, $issues);
}
}
AI-as-Judge
Use a strong model to evaluate your AI feature's outputs. Reliable for quality, relevance, and tone.
function judgeAiOutput(string $input, string $output, string $criteria): array {
$judgePrompt = <<<PROMPT
You are evaluating the quality of an AI assistant's response.
Evaluation criteria:
{$criteria}
User input:
---
{$input}
---
AI response to evaluate:
---
{$output}
---
Score the response on each criterion from 1–5 (5 = excellent).
Explain your reasoning briefly, then give an overall score (1–5).
Format your response as JSON:
{
"relevance": {"score": X, "reason": "..."},
"accuracy": {"score": X, "reason": "..."},
"tone": {"score": X, "reason": "..."},
"overall": X
}
PROMPT;
return callLLM('gpt-4o', $judgePrompt, temperature: 0.1);
}
AI-judge best practices:
- Use a stronger model as judge than the one being evaluated
- Ask for reasoning BEFORE score (reduces positional bias)
- Use pairwise comparison (A vs B) for relative quality rather than absolute scores
- Multiple judges + average for high-stakes decisions
- Watch for self-serving bias (GPT-4 favours GPT-4 outputs)
Production Monitoring
Metrics to Track Per Feature
CREATE TABLE ai_quality_metrics (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
tenant_id INT NOT NULL,
feature_name VARCHAR(100),
prompt_version VARCHAR(10),
model VARCHAR(50),
format_valid BOOLEAN,
latency_ms INT,
tokens_in INT,
tokens_out INT,
judge_score DECIMAL(3,2), -- 1.00–5.00 from AI judge (async)
user_rating TINYINT, -- 1–5 from explicit feedback
thumbs_up BOOLEAN, -- quick user feedback
created_at TIMESTAMP DEFAULT NOW(),
INDEX idx_feature_date (feature_name, created_at),
INDEX idx_tenant_date (tenant_id, created_at)
);
Key Metrics by Priority
- Format failure rate — % of responses failing JSON/schema validation
- User thumbs-down rate — explicit negative feedback
- Early termination rate — user stops generation mid-way
- Average judge score — from async AI-as-judge on random sample
- p50/p90/p99 latency — track at percentiles, not average
- Cost per request — tokens × price per token
Alerting Thresholds
$alerts = [
'format_failure_rate' => 0.05, // Alert if > 5% of responses fail format
'thumbs_down_rate' => 0.15, // Alert if > 15% negative feedback
'p99_latency_ms' => 8000, // Alert if p99 latency > 8 seconds
'cost_per_request' => 0.05, // Alert if avg cost > $0.05 per request
];
Drift Detection
Drift = your AI feature is silently getting worse. Causes:
- Model API updates — providers silently update model versions
- System prompt edits — even small changes change behaviour
- User behaviour shift — users learn to write differently over time
- Data drift — RAG documents become stale
Detection
-- Weekly average quality score — watch for downward trend
SELECT
YEARWEEK(created_at) AS week,
feature_name,
AVG(judge_score) AS avg_quality,
AVG(CASE WHEN thumbs_up = FALSE THEN 1 ELSE 0 END) AS negative_rate,
AVG(latency_ms) AS avg_latency
FROM ai_quality_metrics
WHERE tenant_id = ? AND created_at > DATE_SUB(NOW(), INTERVAL 8 WEEK)
GROUP BY week, feature_name
ORDER BY week;
Act when:
- Average quality score drops > 0.5 points vs last 4-week average
- Format failure rate doubles vs baseline
- User negative feedback rate increases > 5% week-over-week
User Feedback Signals
| Signal |
Type |
Strength |
| Thumbs up / down |
Explicit |
Medium |
| Star rating |
Explicit |
Medium |
| "That's wrong" in chat |
Implicit |
High |
| User edits output |
Implicit |
Very high |
| Early generation stop |
Implicit |
Medium |
| Rephrases same question |
Implicit |
High |
| Regenerates response |
Implicit |
Medium |
Collect user edits as preference data: original output = rejected, edited version = preferred.
Evaluation Before vs After Deployment
| Phase |
What to Evaluate |
How |
| Pre-deploy |
New prompt version vs old |
A/B on golden test set |
| Pre-deploy |
New model vs old |
Same test set, compare scores |
| Post-deploy |
Production quality |
Sample 5% of requests → AI judge |
| Post-deploy |
User satisfaction |
Feedback collection |
| Ongoing |
Drift detection |
Weekly metric trend |
Never deploy a new prompt or model without running the golden test set first.
Anti-Patterns
- No golden test set — you cannot measure regression
- Only measuring average latency — track p90/p99; outliers hurt users
- Skipping evaluation to ship faster — silent quality degradation is worse than delay
- No prompt versioning — you cannot roll back a broken prompt
- Judge uses same model as evaluated — self-serving bias inflates scores
- No user feedback mechanism — your most valuable signal goes uncollected
Sources
Chip Huyen — AI Engineering (2025) Ch.3–4,10; Chip Huyen — Designing ML Systems (2022) Ch.8
Multi-Tenant Eval Harness
This skill covers evaluation concepts. The engineering of the eval harness as a control-plane service in a multi-tenant SaaS — per-tenant golden datasets, CI gate that blocks regressing prompt/model changes, judge-LLM calibration, production sampling, drift detection, and pre-promotion gates for flagship tenants — lives in ai-eval-harness.
Cross-references:
ai-eval-harness — the harness as a service.
ai-hallucination-slo-and-grounding — uses eval signals to budget hallucination.
ai-feature-rollout-and-experimentation — gates rollouts on eval.
ai-on-saas-architecture — control-plane positioning.
Consolidated Child References
- Load references/routing.md to map retired AI child skill slugs to their reference modules.
1---2name: ai-evaluation3description: Use when setting up quality assurance for AI features — defining evaluation criteria, measuring output quality, using AI-as-judge, monitoring production AI, detecting drift, and building user feedback loops4metadata:5 portable: true6 compatible_with:7 - claude-code8 - codex9---1011# AI Evaluation and Monitoring1213## Operating contract1415## Inputs1617| Input | Required | Purpose |18|---|---|---|19| Domain evidence | yes | feature contract, representative dataset, quality dimensions, baseline, thresholds, and risk class |2021## Outputs2223- Produce: evaluation plan, scored results, confidence and failure slices, release verdict, and monitoring thresholds.2425## Capability and permission boundaries2627Default to read-only analysis. Read only scoped records; redact secrets and regulated data. Writes, execution, network calls, production configuration, customer communication, billing changes, and delegation require explicit authority and an identified owner. Never widen tenant, time-window, or system scope implicitly.2829## Degraded mode3031When required telemetry, evidence, execution, network access, or write authority is unavailable, return a partial result with each unassessed item labelled, preserve the safest existing state, and state the evidence or approval needed to continue. Never convert missing evidence into a pass.3233## Decision rules3435| Condition | Action |36|---|---|37| Scope, owner, or threshold is missing | Stop the affected decision and request it |38| Evidence is incomplete but read-only analysis is safe | Produce a qualified partial result and gap list |39| A mutation exceeds authority or tenant boundary | Block it and route for approval |40| Evidence meets the stated threshold | Issue the output with provenance and owner |4142## Anti-Patterns4344- Treating absent evidence as success. Fix: mark the check unassessed and name the missing source.45- Expanding one tenant or workflow to all tenants. Fix: enforce supplied scope at every query and action.46- Performing a production write during analysis. Fix: emit a reviewed change plan until authority is explicit.47- Reporting a metric without population, window, or source. Fix: attach all three.48- Hiding a failed threshold inside an average. Fix: report failure slices and the remediation owner.4950Acknowledgement: Shared by Peter Bamuhigire, techguypeter.com, +256 784 464178.5152<!-- dual-compat-start -->53## Use When5455- Use when setting up quality assurance for AI features — defining evaluation criteria, measuring output quality, using AI-as-judge, monitoring production AI, detecting drift, and building user feedback loops5657## Evidence Produced5859| Category | Artifact | Format | Example |60|----------|----------|--------|---------|61| Correctness | AI evaluation harness configuration | Markdown doc covering eval set, scoring rubric, and acceptance thresholds | `docs/ai/eval-harness-assistant.md` |62| Correctness | Latest AI evaluation results | Markdown doc reporting pass-rate, regression deltas, and outlier examples | `docs/ai/eval-results-2026-04-16.md` |6364## References6566- Use the links and companion skills already referenced in this file when deeper context is needed.67<!-- dual-compat-end -->68## Overview6970Evaluation is the biggest bottleneck to successful AI deployment. Define evaluation criteria BEFORE building. Without evaluation, you cannot know if your AI feature is working, degrading, or harming users.7172**Core principle:** Evaluation-driven development. Like TDD for AI — define what "good" means first, then build.7374## Evaluation Contract7576Every production AI feature needs an evaluation contract before release:7778- **Task definition**: what the model must do, for whom, in which workflow.79- **Business metric**: time saved, revenue influenced, conversion lift, defect reduction, service quality, risk reduction, or cost avoided.80- **Quality metrics**: correctness, completeness, relevance, tone, actionability, citation quality, and domain compliance.81- **System metrics**: latency, cost per successful task, availability, retry rate, fallback rate, and tool failure rate.82- **Safety metrics**: PII exposure, prompt-injection resistance, harmful output, policy violations, and unauthorized action attempts.83- **Release threshold**: minimum pass rates and maximum regression allowed versus the current production baseline.84- **Rollback trigger**: metrics or incidents that require disabling the feature or reverting prompt/model/tool versions.8586---8788## Evaluation Dimensions8990| Dimension | What to Measure | Method |91|---|---|---|92| **Format** | Is output valid JSON/schema? Correct length? | Automated rules |93| **Factual accuracy** | Does output match the provided context? | AI-as-judge or RAG citation check |94| **Safety** | Toxic, harmful, or brand-risk content? | Classifier or AI-as-judge |95| **Instruction-following** | Did it follow format/tone/language rules? | Automated + AI-as-judge |96| **Relevance** | Does output address the user's question? | AI-as-judge |97| **Cost** | Tokens per request; cost per feature | Logged automatically |98| **Latency** | Time to first token; total response time | Logged automatically |99100---101102## Evaluation Workflow103104```1051. Define criteria before building1062. Create golden test set (20–50 examples with expected outputs)1073. Run automated format checks on every new model/prompt version1084. Run AI-as-judge for quality checks1095. Compare against previous version — only deploy if metrics hold or improve1106. Monitor production: track live metrics + user feedback1117. Retrain/reprompt when drift detected112```113114For features that recommend, generate, rank, automate, or trigger consequential115actions, load [references/ai-human-oversight-evaluation.md](references/ai-human-oversight-evaluation.md).116Evaluate the problem, human, system, model, inputs, and outputs separately. Do not117call a model-quality pass a product-quality pass. Require evidence for correction,118contest, undo or safe fallback, escalation, consent/notice, and the audit event.119120## Evaluation Dataset Design121122- Build separate sets for development, release gating, adversarial testing, and production monitoring.123- Include real examples, expert-created examples, edge cases, multilingual/local examples, low-resource context, and abuse attempts.124- Version each case with task, tenant/domain, source, expected behavior, rubric, and data sensitivity.125- Keep leakage out of evals: do not let the same generated examples drive both prompt tuning and final release scoring.126- Refresh cases after production incidents, new user behavior, platform changes, policy changes, or model migrations.127128## Release Gates129130| Gate | Required Evidence |131|---|---|132| Prompt/model change | Eval comparison against previous version, cost and latency delta |133| New tool/action | Permission tests, dry-run tests, approval-path tests, failure-mode tests |134| RAG/index change | Retrieval precision samples, citation checks, stale-data checks, tenant isolation checks |135| Fine-tune | Baseline comparison showing prompts/RAG were insufficient, holdout eval results, rollback plan |136| Production launch | Monitoring dashboard, alert thresholds, owner, incident playbook, user feedback channel |137138Do not ship an AI feature because a demo looked good. Ship it because it passes the evaluation contract.139140---141142## Creating a Golden Test Set143144```sql145CREATE TABLE ai_eval_cases (146 id INT AUTO_INCREMENT PRIMARY KEY,147 feature_name VARCHAR(100), -- 'invoice_analysis', 'sales_report'148 input TEXT NOT NULL, -- the user query or document149 expected_output TEXT, -- ideal output (or key elements of it)150 eval_criteria JSON, -- {"format": "json", "must_contain": ["total", "vendor"]}151 created_by INT,152 created_at TIMESTAMP DEFAULT NOW()153);154```155156Build test cases from:1571. Real production queries (once live)1582. Domain expert-crafted examples1593. Edge cases: empty input, wrong language, very long input, adversarial input160161---162163## Automated Evaluation (No LLM Cost)164165Run these on every deployment:166167```php168class AiEvaluator {169 public function evaluateFormat(string $output, array $criteria): EvalResult {170 $score = 0;171 $issues = [];172173 // JSON validity174 if (($criteria['format'] ?? null) === 'json') {175 $decoded = json_decode($output, true);176 if (json_last_error() !== JSON_ERROR_NONE) {177 $issues[] = 'Invalid JSON';178 } else {179 $score += 25;180 // Required keys181 foreach ($criteria['required_keys'] ?? [] as $key) {182 if (!array_key_exists($key, $decoded)) {183 $issues[] = "Missing key: $key";184 } else {185 $score += 10;186 }187 }188 }189 }190191 // Length constraints192 if (isset($criteria['max_words'])) {193 $wordCount = str_word_count($output);194 if ($wordCount > $criteria['max_words']) {195 $issues[] = "Too long: {$wordCount} words (max {$criteria['max_words']})";196 } else {197 $score += 15;198 }199 }200201 // Must-contain terms202 foreach ($criteria['must_contain'] ?? [] as $term) {203 if (stripos($output, $term) === false) {204 $issues[] = "Missing expected term: $term";205 } else {206 $score += 10;207 }208 }209210 return new EvalResult($score, $issues);211 }212}213```214215---216217## AI-as-Judge218219Use a strong model to evaluate your AI feature's outputs. Reliable for quality, relevance, and tone.220221```php222function judgeAiOutput(string $input, string $output, string $criteria): array {223 $judgePrompt = <<<PROMPT224You are evaluating the quality of an AI assistant's response.225226Evaluation criteria:227{$criteria}228229User input:230---231{$input}232---233234AI response to evaluate:235---236{$output}237---238239Score the response on each criterion from 1–5 (5 = excellent).240Explain your reasoning briefly, then give an overall score (1–5).241Format your response as JSON:242{243 "relevance": {"score": X, "reason": "..."},244 "accuracy": {"score": X, "reason": "..."},245 "tone": {"score": X, "reason": "..."},246 "overall": X247}248PROMPT;249250 return callLLM('gpt-4o', $judgePrompt, temperature: 0.1);251}252```253254**AI-judge best practices:**255- Use a stronger model as judge than the one being evaluated256- Ask for reasoning BEFORE score (reduces positional bias)257- Use pairwise comparison (A vs B) for relative quality rather than absolute scores258- Multiple judges + average for high-stakes decisions259- Watch for self-serving bias (GPT-4 favours GPT-4 outputs)260261---262263## Production Monitoring264265### Metrics to Track Per Feature266267```sql268CREATE TABLE ai_quality_metrics (269 id BIGINT AUTO_INCREMENT PRIMARY KEY,270 tenant_id INT NOT NULL,271 feature_name VARCHAR(100),272 prompt_version VARCHAR(10),273 model VARCHAR(50),274 format_valid BOOLEAN,275 latency_ms INT,276 tokens_in INT,277 tokens_out INT,278 judge_score DECIMAL(3,2), -- 1.00–5.00 from AI judge (async)279 user_rating TINYINT, -- 1–5 from explicit feedback280 thumbs_up BOOLEAN, -- quick user feedback281 created_at TIMESTAMP DEFAULT NOW(),282 INDEX idx_feature_date (feature_name, created_at),283 INDEX idx_tenant_date (tenant_id, created_at)284);285```286287### Key Metrics by Priority2882891. **Format failure rate** — % of responses failing JSON/schema validation2902. **User thumbs-down rate** — explicit negative feedback2913. **Early termination rate** — user stops generation mid-way2924. **Average judge score** — from async AI-as-judge on random sample2935. **p50/p90/p99 latency** — track at percentiles, not average2946. **Cost per request** — tokens × price per token295296### Alerting Thresholds297298```php299$alerts = [300 'format_failure_rate' => 0.05, // Alert if > 5% of responses fail format301 'thumbs_down_rate' => 0.15, // Alert if > 15% negative feedback302 'p99_latency_ms' => 8000, // Alert if p99 latency > 8 seconds303 'cost_per_request' => 0.05, // Alert if avg cost > $0.05 per request304];305```306307---308309## Drift Detection310311Drift = your AI feature is silently getting worse. Causes:3121. **Model API updates** — providers silently update model versions3132. **System prompt edits** — even small changes change behaviour3143. **User behaviour shift** — users learn to write differently over time3154. **Data drift** — RAG documents become stale316317### Detection318319```sql320-- Weekly average quality score — watch for downward trend321SELECT322 YEARWEEK(created_at) AS week,323 feature_name,324 AVG(judge_score) AS avg_quality,325 AVG(CASE WHEN thumbs_up = FALSE THEN 1 ELSE 0 END) AS negative_rate,326 AVG(latency_ms) AS avg_latency327FROM ai_quality_metrics328WHERE tenant_id = ? AND created_at > DATE_SUB(NOW(), INTERVAL 8 WEEK)329GROUP BY week, feature_name330ORDER BY week;331```332333**Act when:**334- Average quality score drops > 0.5 points vs last 4-week average335- Format failure rate doubles vs baseline336- User negative feedback rate increases > 5% week-over-week337338---339340## User Feedback Signals341342| Signal | Type | Strength |343|---|---|---|344| Thumbs up / down | Explicit | Medium |345| Star rating | Explicit | Medium |346| "That's wrong" in chat | Implicit | High |347| User edits output | Implicit | Very high |348| Early generation stop | Implicit | Medium |349| Rephrases same question | Implicit | High |350| Regenerates response | Implicit | Medium |351352**Collect user edits as preference data:** original output = rejected, edited version = preferred.353354---355356## Evaluation Before vs After Deployment357358| Phase | What to Evaluate | How |359|---|---|---|360| **Pre-deploy** | New prompt version vs old | A/B on golden test set |361| **Pre-deploy** | New model vs old | Same test set, compare scores |362| **Post-deploy** | Production quality | Sample 5% of requests → AI judge |363| **Post-deploy** | User satisfaction | Feedback collection |364| **Ongoing** | Drift detection | Weekly metric trend |365366**Never deploy a new prompt or model without running the golden test set first.**367368---369370## Anti-Patterns371372- **No golden test set** — you cannot measure regression373- **Only measuring average latency** — track p90/p99; outliers hurt users374- **Skipping evaluation to ship faster** — silent quality degradation is worse than delay375- **No prompt versioning** — you cannot roll back a broken prompt376- **Judge uses same model as evaluated** — self-serving bias inflates scores377- **No user feedback mechanism** — your most valuable signal goes uncollected378379---380381## Sources382Chip Huyen — *AI Engineering* (2025) Ch.3–4,10; Chip Huyen — *Designing ML Systems* (2022) Ch.8383384## Multi-Tenant Eval Harness385386This skill covers evaluation concepts. The engineering of the eval harness as a control-plane service in a multi-tenant SaaS — per-tenant golden datasets, CI gate that blocks regressing prompt/model changes, judge-LLM calibration, production sampling, drift detection, and pre-promotion gates for flagship tenants — lives in `ai-eval-harness`.387388Cross-references:389- `ai-eval-harness` — the harness as a service.390- `ai-hallucination-slo-and-grounding` — uses eval signals to budget hallucination.391- `ai-feature-rollout-and-experimentation` — gates rollouts on eval.392- `ai-on-saas-architecture` — control-plane positioning.393## Consolidated Child References394395- Load [references/routing.md](references/routing.md) to map retired AI child skill slugs to their reference modules.