Community研究&データ分析github.com

ombharatiya/ai-evals

LLMアプリ、RAGパイプライン、エージェント向けの評価(eval)を、aievals.coガイドに従って構築、レビュー、修正します。メトリクス設定前に実際のトレースを分析し、プロンプトの修正やコードチェックを優先し、各障害モードに1つの二値判定(PASS/FAIL)を使用し、人間のラベルで校正します。

ai-evals とは?

このスキルは、LLMアプリケーション、RAGパイプライン、およびエージェント向けに信頼性の高い評価(eval)を構築するための専門的なワークフローを提供します。aievals.coガイドの原則に基づき、まず実際のシステム出力(トレース)を収集・分析し、観測された障害モードを特定することから始めます。プロンプト編集や文字列マッチ、スキーマチェックなどのコードチェックで対応できる問題は優先的に修正し、それでも残る主観的な障害に対してのみLLM-as-judgeプロンプトを作成します。各判定は1つの二値(PASS/FAIL)に限定し、人間のラベルと比較してPASS再現率とFAIL再現率を個別に報告することで校正します。さらに、Wilson区間を用いた統計的信頼区間の計算、トレイン/デブ/テスト分割、回帰テストセット、CI/CDパイプラインへの統合(4段階のリリースゲート)といったエンタープライズグレードの手法を実装します。このスキルは、特定のLLM機能に評価を追加する、LLM-as-judgeプロンプトを作成・デバッグする、既存の評価の信頼性を検証する、2つのプロンプトやモデルを比較する、または評価をCIに組み込むといったタスクに理想的です。サポートされるプラットフォーム: Claude Code、Cursor、CodexなどのAIエージェント開発ツール。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ombharatiya/ai-evals-skills/tree/HEAD/skills/ai-evals

Installed? Explore more 研究&データ分析 skills: affaan-m/uspto-database, affaan-m/scholar-evaluation, affaan-m/literature-review · View all 6 →

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

AI evals

An eval is a repeatable test that measures whether an AI system does its job. This skill makes you work the way the aievals.co guide teaches: look at real outputs before you measure anything, measure the failures you actually found, check every LLM judge against human labels before you trust it, and put an interval on every number.

The guide is at https://www.aievals.co. Cite its pages when you explain a choice to the user. The reference files listed at the end carry the details and the sources.

Ground rules

Follow these in every eval task, whatever the user asked for.

  1. Look at traces before writing metrics. You can't specify failure modes of a system you haven't observed. If the user has no traces, get some first: production logs, or the system run on 100 realistic inputs. Then read them.
  2. People label; you propose. Never write ground-truth labels yourself and present them as human judgments. You may draft labels marked "provisional": true for a person to confirm. Never let a model write both the input and its gold answer, except where code computes the answer (SQL results, tests, a calculator).
  3. Code before judges. Anything a string match, parser, schema check, regex or unit test can decide is a code check. Fix what a prompt edit can fix before building any eval. Keep the LLM judge for subjective failures that remain.
  4. One binary judge per failure mode. PASS or FAIL plus a one-sentence critique. No 1-5 scales. Several quality dimensions means several binary judges, reported as a pass-all rate with a per-check breakdown.
  5. Calibrate before trusting a judge. Compare it with human labels and report PASS recall and FAIL recall separately, each with its N. Raw agreement is never the headline: a judge that always says PASS agrees 95% of the time when 5% of outputs fail.
  6. Train, dev, test. Few-shot examples come from train only. Iterate on dev. Read test once, at the end. Reading test again after more edits turns it into a second dev set.
  7. Pin the judge. Model ID, effort, rubric text, output schema and few-shot order are part of the instrument. Record them with every result, and calibrate again when any of them changes. Don't assume determinism: run dev twice and count label flips.
  8. Every number gets N and an interval. Use the Wilson interval for rates, never the normal approximation. Compare two versions on the same inputs as paired data.
  9. The regression set passes 100% of the time. It holds reproduced production bugs and policy boundaries. One failure blocks the release, and a flaky case is a process bug.
  10. Gate on the difference, not the absolute rate. Use the four bands in references/ci-and-release-gates.md.
  11. Cap spend in the runner. Judge runs cost money. Enforce a budget in code (EVAL_BUDGET_USD), not as a printed warning.
  12. Build the smallest thing that works. Assertions and about 30 labeled examples come before a judge, and a calibrated judge comes before dashboards or judge ensembles.

Pick the workflow

The user wantsDoRead
Evals for a feature that has noneWorkflow Aerror-analysis, judges, datasets
An LLM-as-judge prompt written or fixedWorkflow Bjudges, templates
To know whether an existing eval can be trustedWorkflow Cjudges, statistics
To know whether version B beats version AWorkflow Dstatistics, ci-and-release-gates
Evals running in CIWorkflow Eci-and-release-gates, datasets

Workflow A: add evals to a feature

  1. Collect traces. Pull at least 100 diverse traces, or run the system on realistic inputs if it isn't live. Store them as JSONL with a stable id per row. The trace fields worth logging are in references/templates.md.
  2. Run error analysis with the user (details in references/error-analysis.md). A person reads the traces and writes a one-line note on the first thing that went wrong in each. You can build a simple viewer and cluster the notes into 4 to 7 named failure modes once the person has coded at least 30. Count each mode and rank by frequency times severity.
  3. Fix the cheap ones. Prompt and code fixes come first. Re-run and re-count.
  4. Write code checks for every remaining mode a rule can detect.
  5. Write one judge per remaining subjective mode (Workflow B).
  6. Get human labels: 100 to 200 per failure mode is the target, with 30 to 50 PASS and 30 to 50 FAIL in each of dev and test. A 40% dev split of 100 rows can't hold 30 of each class, and at a low failure rate you have to oversample failures to fill the FAIL side. Start with what you have and say how wide the intervals are.
  7. Calibrate each judge on dev, then confirm on test once.
  8. Build the regression set from reproduced failures, and wire the suite into CI (Workflow E).

Deliverables in the user's repo, unless they already have a layout:

evals/
  data/            labeled.jsonl (human labels), regression.jsonl, traces/
  rubrics/         one file per failure mode
  codebook.md      label, definition, 2 PASS and 2 FAIL examples, last kappa
  checks.*         code checks
  judge.*          the judge call, config pinned
  calibrate.*      split, score, report, disagreements
  run_eval.*       score outputs, compare with baseline, exit code for CI
  runs/            one folder per run: summary, predictions, rubric copy

Working starters in Python and TypeScript are at https://github.com/ombharatiya/ai-evals-skills/tree/main/starters. Copy one rather than writing the harness from scratch.

Workflow B: write or fix an LLM judge

  1. Confirm the failure mode came from error analysis and that a code check can't catch it.
  2. Write the prompt in four parts (template in references/templates.md): role and exact definitions; binary criteria ("PASS if X. FAIL if Y, even if the rest of the response is correct. When in doubt, FAIL and say why."); 2 or 3 few-shot examples from train, including one FAIL that looks like a pass; and a strict output schema, {"label": "PASS" | "FAIL", "critique": "..."}, enforced by structured output where the API supports it. The parser must fail loudly on malformed output.
  3. Calibrate: run on dev, compute PASS recall, FAIL recall and Cohen's kappa, and read every disagreement. Read false passes and false fails separately. If the human label is wrong, fix the label, not the rubric.
  4. Change one thing per iteration, in this order of typical impact: rubric specificity, few-shot examples, output schema, and model swap last.
  5. Expect a plateau around the second or third iteration. Then add few-shots for the edge cases: two PASS examples that look like FAIL on a careless read and two FAIL examples that look like PASS. If FAIL recall still doesn't move, the judge model may be the ceiling: try a stronger one before changing the rubric again, and treat the new model as a new instrument to calibrate from scratch.
  6. Stop when PASS and FAIL recall both reach the bar on dev (this guide's default is 0.90; set it from the cost of a missed failure versus a false alarm), then read test once.

Workflow C: audit an existing eval

Check each item and report what fails, with file and line:

  • The metrics trace back to failure modes someone observed in real traces.
  • Code checks cover what code can decide; judges are binary, one per failure mode.
  • Each judge has a calibration record: PASS and FAIL recall with N and intervals, on a test split the judge never saw. Agreement alone doesn't count.
  • Few-shot examples don't appear in dev or test.
  • The judge config (model, effort, rubric, schema, few-shots) is pinned and matches the config that was calibrated.
  • Every reported rate has N and an interval; comparisons are paired.
  • A regression set exists, runs on every PR, and passes 100%.
  • Release decisions read the paired delta and its interval, not an absolute threshold.
  • The dataset is versioned (content hash) and the results name the hash.
  • A suite that has sat at 100% for months isn't testing anything. The regression set is the one exception.

Workflow D: compare two versions

Run both versions on the same inputs. Report each pass rate with its Wilson interval and the paired difference with its interval: McNemar's test or a paired bootstrap for binary outcomes. Decide the smallest difference worth detecting first, then the sample size (references/statistics.md). Slice by segment when it matters, and correct for multiple comparisons when you slice many ways. "No significant difference" from an underpowered run is not evidence of no difference: say how large a change the run could have detected.

Workflow E: evals in CI

Three tiers: a smoke tier of 10 to 50 deterministic assertions on every push (no judge), a full tier with the calibrated judge on PRs that change prompts or models, and a nightly tier with the expanded regression and robustness sets. Post a baseline-versus-candidate table on the PR with the delta, its 95% interval and a ship, hold, investigate or block verdict. Fail the job on investigate, block, a regression-set failure or a broken measurement (rows with no verdict, rows missing on either side, a judge that isn't the calibrated one), and report a hold for a named person to read: a hold means the interval can't tell the change from no change. Size the indifference window from an A/A run of the unchanged system, not from the zero-noise floor. No silent overrides: an override needs a named person and a written reason. Fork PRs get no API secrets. Details in references/ci-and-release-gates.md.

How to report results

Report a table, not a sentence:

MetricValue95% CINJudgeDataset
FAIL recall, refund-policy judge (test)0.92[0.80, 0.97]48claude-opus-5-5, medium, rubric a1b2c3labeled.jsonl @ 9f8e7d

Say what the numbers can't support. Write "the interval is wide; label more FAIL examples" rather than rounding a weak result into a claim. Name the positive class when you say TPR or TNR: some writing, Hamel Husain's FAQ among it, treats FAIL as positive, so its TPR is the share of real failures caught. Plain "PASS recall" and "FAIL recall" avoid the confusion.

Defaults

Use these unless the user's situation calls for others. "Site default" means aievals.co's own working number, not a published standard.

DecisionDefaultSource
First error-analysis pass100+ traces, first failure only (Hamel and Shankar FAQ); 15 to 45 seconds eachFAQ, and aievals.co for the pace
Failure-mode categories4 to 7 after axial codingaievals.co open-coding guide
Labels per failure mode100 to 200Hamel and Shankar FAQ
Split15% train, 40% dev, 45% test, stratified (the starters split by a hash of each id instead, so a row never changes split; ratios then match only on average)aievals.co calibration recipe
Per class in dev and in test30 to 50 PASS and 30 to 50 FAILHamel and Shankar FAQ
Judge recall barPASS and FAIL recall at least 0.90 on dev, confirmed on testsite default
Human agreement before automatingkappa at least 0.6 to proceed, 0.8 for a gold set or gateteam policy, per the guide
Interval for a rateWilson, 95%aievals.co statistics chapter
Release-gate windows1-point indifference window; 2-point minor-regression window on the primary metricaievals.co release-gates chapter
Regression set100% pass on every PRaievals.co regression-sets chapter

References

Load the file that matches the task:

関連スキル