Ai Evaluation 标志

Ai Evaluation

社区
peterbamuhigire
ai-evaluation

Use when building an AI/LLM evaluation harness, golden datasets, quality metrics, judge calibration, regression gates, production monitoring, drift detection, or user-feedback loops; use ai-llm-integration for provider calls.

Add to TypingMind

概览

发布者peterbamuhigire
代码仓库chwezi-dev-engine
技能名称ai-evaluation
星标数
29
复刻数
6
附带文件
7
许可协议MIT
链接
  • Markdown 格式的指令

    模型按需加载 SKILL.md 文件,因此只有在请求确实与该技能匹配时才会消耗 Token。

  • 兼容任何大语言模型

    AI 技能采用纯 Markdown,而非特定提供商的代码,因此可搭配 GPT、Claude、Gemini、Grok 或本地模型使用。

  • 7 个附带文件

    模型执行任务时可读取的脚本、模板和参考资料。这些文件为只读文件,绝不会被执行。

  • 开源

    由 peterbamuhigire 发布于 GitHub。请在安装前查看技能的源文件。

安装

在 TypingMind 中安装 Ai Evaluation AI 技能,即可搭配任意大语言模型使用;也可以将其放入其他支持读取 SKILL.md 的智能体中。

1

安装到 TypingMind

TypingMind 可直接从 GitHub 文件夹安装技能:读取 SKILL.md,打包资源文件,并将结果保存在本地。

  1. 打开应用,前往“插件 → 技能”。
  2. 选择“从 GitHub 安装”。
  3. 粘贴下方的技能文件夹 URL 并确认。
    https://github.com/peterbamuhigire/chwezi-dev-engine/tree/main/skills/ai/ai-evaluation
  4. 请在每个需要使用该技能的聊天中启用它。
依次选择“插件 → 技能 → 添加技能 → 从 GitHub URL 导入”,然后粘贴文件夹 URL 并点击“继续”。
2

安装到其他智能体

任何支持 Agent Skills 格式的智能体都可以使用此技能,只需将文件夹复制到该智能体的技能目录中。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/peterbamuhigire/chwezi-dev-engine.git /tmp/chwezi-dev-engine
mkdir -p .claude/skills
cp -r /tmp/chwezi-dev-engine/skills/ai/ai-evaluation .claude/skills/ai-evaluation
复制后,请重启 Claude Code,以加载新技能。

在 TypingMind 中使用此技能

在任意 TypingMind 聊天中启用 Ai Evaluation,后续即可交由模型处理。技能的名称和描述会放在系统提示词中,一旦请求匹配,模型就会自动加载完整指令,无需您手动调用,且在实际使用前不会消耗 Token。

一旦请求与技能匹配,模型就会自动加载 Ai Evaluation。

兼容任何 AI 模型

AI 技能是纯 Markdown 指令,而非特定提供商的代码,因此 Ai Evaluation 不局限于最初适配的模型。只需在 TypingMind 中安装一次,即可搭配 GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 或您自行运行的本地模型使用,全程使用您自己的 API 密钥。

  • 仅在需要时加载

    系统提示词中仅包含技能名称和描述。首次遇到匹配的请求时才会加载完整指令,因此技能未使用时,这些指令不会消耗 Token。

  • 在聊天中切换模型

    技能是指令而非代码,因此切换模型不会导致技能失效,新模型会读取同一个 SKILL.md。

技能指令

这是模型会加载的 SKILL.md 内容。请在安装前阅读,因为技能就是模型将遵循的指令。

AI Evaluation and Monitoring

Operating contract

Inputs

InputRequiredPurpose
Domain evidenceyesfeature 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

ConditionAction
Scope, owner, or threshold is missingStop the affected decision and request it
Evidence is incomplete but read-only analysis is safeProduce a qualified partial result and gap list
A mutation exceeds authority or tenant boundaryBlock it and route for approval
Evidence meets the stated thresholdIssue 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

CategoryArtifactFormatExample
CorrectnessAI evaluation harness configurationMarkdown doc covering eval set, scoring rubric, and acceptance thresholdsdocs/ai/eval-harness-assistant.md
CorrectnessLatest AI evaluation resultsMarkdown doc reporting pass-rate, regression deltas, and outlier examplesdocs/ai/eval-results-2026-04-16.md

References

  • Use the links and companion skills already referenced in this file when deeper context is needed.
  • Load ai-llm-integration/references/llm-application-pattern-decision-catalogue.md (section 4) when the task is the eval-driven development loop or reusing evals as runtime guardrails.

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

DimensionWhat to MeasureMethod
FormatIs output valid JSON/schema? Correct length?Automated rules
Factual accuracyDoes output match the provided context?AI-as-judge or RAG citation check
SafetyToxic, harmful, or brand-risk content?Classifier or AI-as-judge
Instruction-followingDid it follow format/tone/language rules?Automated + AI-as-judge
RelevanceDoes output address the user's question?AI-as-judge
CostTokens per request; cost per featureLogged automatically
LatencyTime to first token; total response timeLogged automatically

Evaluation Workflow

Prompt and agent evaluation addendum

Version the prompt builder, model identifier, context assembly, tool policy, and evaluation data as one change surface. For each revision, record the objective, hard constraints, expected output, risk class, and acceptance grader. Compare against the previous version on representative, edge, adversarial, multilingual, and low-context cases; report per-slice failures, not only the aggregate score. Include a regression case for every production incident. A successful demo or syntax check is not release evidence for an AI feature.

For agentic workflows, evaluate the whole loop: context selection, plan quality, tool-argument validity, authorization/approval, side effects, recovery, final output, latency, cost, and audit trace. Keep deterministic format/schema/security checks separate from model-judged quality checks. If a grader, test set, runtime, or account model is unavailable, mark that result NOT ASSESSED rather than treating absence as a pass.

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.

When a model, score, rule set, or ranking decides or materially shapes an outcome for a person (credit, hiring, eligibility, pricing, visibility, risk flags), load references/algorithmic-decision-impact-review.md for the impact tier, proxy and feedback-loop checks, subgroup error evidence, fairness-criterion ownership, and contest path required before release.

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

GateRequired Evidence
Prompt/model changeEval comparison against previous version, cost and latency delta
New tool/actionPermission tests, dry-run tests, approval-path tests, failure-mode tests
RAG/index changeRetrieval precision samples, citation checks, stale-data checks, tenant isolation checks
Fine-tuneBaseline comparison showing prompts/RAG were insufficient, holdout eval results, rollback plan
Production launchMonitoring 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

sql
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:

  1. Real production queries (once live)
  2. Domain expert-crafted examples
  3. Edge cases: empty input, wrong language, very long input, adversarial input

Automated Evaluation (No LLM Cost)

Run these on every deployment:

php
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.

php
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

sql
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

  1. Format failure rate — % of responses failing JSON/schema validation
  2. User thumbs-down rate — explicit negative feedback
  3. Early termination rate — user stops generation mid-way
  4. Average judge score — from async AI-as-judge on random sample
  5. p50/p90/p99 latency — track at percentiles, not average
  6. Cost per request — tokens × price per token

Alerting Thresholds

php
$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:

  1. Model API updates — providers silently update model versions
  2. System prompt edits — even small changes change behaviour
  3. User behaviour shift — users learn to write differently over time
  4. Data drift — RAG documents become stale

Detection

sql
-- 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

SignalTypeStrength
Thumbs up / downExplicitMedium
Star ratingExplicitMedium
"That's wrong" in chatImplicitHigh
User edits outputImplicitVery high
Early generation stopImplicitMedium
Rephrases same questionImplicitHigh
Regenerates responseImplicitMedium

Collect user edits as preference data: original output = rejected, edited version = preferred.


Evaluation Before vs After Deployment

PhaseWhat to EvaluateHow
Pre-deployNew prompt version vs oldA/B on golden test set
Pre-deployNew model vs oldSame test set, compare scores
Post-deployProduction qualitySample 5% of requests → AI judge
Post-deployUser satisfactionFeedback collection
OngoingDrift detectionWeekly 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

附带文件

技能加载后,模型会按需读取这些文件。它们仅作为可读文件提供,绝不会被执行。

常见问题

Ai Evaluation AI 技能有什么作用?

Use when building an AI/LLM evaluation harness, golden datasets, quality metrics, judge calibration, regression gates, production monitoring, drift detection, or user-feedback loops; use ai-llm-integration for provider calls.

为什么在 TypingMind 中使用 Ai Evaluation?

因为您只需安装一次,就能搭配任何模型使用。Ai Evaluation 采用纯 Markdown 格式,而非特定提供商专用的代码,因此同一技能可用于 GPT-5、Claude、Gemini、Grok 或本地模型。您甚至可以在聊天中途切换模型,而不会影响技能的正常使用。TypingMind 使用您自己的 API 密钥,因此您直接向提供商付费,而不是按席位订阅;您的技能和聊天记录也都保留在您自己的存储空间中。

如何在 TypingMind 中安装 Ai Evaluation?

在 TypingMind 中打开“插件 → 技能 → 从 GitHub 安装”,然后粘贴 https://github.com/peterbamuhigire/chwezi-dev-engine/tree/main/skills/ai/ai-evaluation。TypingMind 会读取其中的 SKILL.md,打包相关文件,并将其安装为技能,供您在各个聊天中按需启用。

哪些 AI 模型可以使用 Ai Evaluation?

您在 TypingMind 中连接的任何模型都可以。AI 技能采用纯 Markdown 指令,而非特定提供商专用的代码,因此 GPT、Claude、Gemini、Grok 和本地模型都能在请求匹配时加载此技能。

Ai Evaluation 可以搭配多少个 AI 模型使用?

数量不限。只要模型支持技能,您就可以将它与 Ai Evaluation 搭配使用。GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llama 等模型都可以通过您自己的 API 密钥接入 TypingMind。

Ai Evaluation AI 技能免费吗?

是的。peterbamuhigire 已在 GitHub 上根据 MIT 许可证发布了该技能。您只需向自己的 AI 提供商支付所用 Token 的费用。

什么是 AI 技能?

AI 技能是一组可复用的指令,用于教会 AI 模型完成某项特定任务。它遵循开放的 Agent Skills 格式:包含名称和描述的 SKILL.md 文件,以及模型可能需要的脚本、模板或参考文件。模型仅在您的请求与技能匹配时才会读取这些指令,因此已安装的技能在使用前不会产生任何费用。

AI 技能与插件或 MCP 服务器有何不同?

插件或 MCP 服务器为模型提供可调用的新工具,也就是在某处运行并返回结果的代码。AI 技能则为模型提供知识和流程:如何处理任务、遵循哪些步骤,以及怎样的输出才算优质。技能采用纯 Markdown 格式,因此不需要服务器、API 密钥或运行时环境,并且适用于任何模型。

查看全部

立即创建您自己的 AI 工作区

订阅我们的电子简报,获取新功能和后续赠奖活动的通知 👇