wikieval
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSkill: wikieval
Skill: wikieval
Turn wiki goldens into a CI gate: cheap deterministic asserts decide most goldens, a
committed baseline catches regressions, and the one expensive thing (an LLM judge) is
quarantined behind a single adapter file.
将 wiki goldens 转换为 CI gate:低成本的确定性 asserts 判定大多数 goldens,已提交的 baseline 捕获回归,而唯一昂贵的能力(LLM judge)被隔离在单个 adapter 文件之后。
WHAT
内容
Purpose và context
目的与上下文
- Purpose: make wiki golden pages a regression suite checked in pure code (no model), with a committed baseline and a CI exit code that fires only when a metric drops below it.
- Trigger (when to use):
- You want wiki pages to act as a regression suite an agent (or PR) cannot silently break.
- You have golden input→expected pairs and want them checked in pure code, no model needed.
- You need a CI step that exits non-zero only when a metric drops below a committed baseline.
- User says "wikieval", "eval suite for the wiki", "regression gate for goldens", "assertion cascade", "block CI on eval drop", or (model-invocation disabled — user invokes).
/wikieval
- Non-goals: never calls an LLM (tier 3 is reported , not judged); does not generate candidate outputs (they come from
needs-judge); does not author goldens' content for you.--outputs
- **目的:**将 wiki golden 页面构建成通过纯代码检查(无需模型)的回归套件,并配备已提交的 baseline 和 CI exit code,仅在某个 metric 低于基线时触发。
- 触发条件(何时使用):
- 你希望 wiki 页面充当回归套件,使 agent(或 PR)无法在无感知的情况下将其破坏。
- 你有 golden input→expected 对,希望通过纯代码检查,无需模型。
- 你需要一个 CI step,只有当某个 metric 低于已提交的 baseline 时才以非零状态退出。
- 用户说出 "wikieval"、"eval suite for the wiki"、"regression gate for goldens"、"assertion cascade"、"block CI on eval drop" 或 (model invocation 已禁用——由用户调用)。
/wikieval
- **非目标:**绝不调用 LLM(tier 3 会被报告为 ,而不会实际评判);不生成候选输出(它们来自
needs-judge);不会替你编写 goldens 的内容。--outputs
Mental model
心智模型
golden (input · expected · rubric? · asserts?) + candidate output → cascade: tier 1 asserts → [tier 2 similarity] → [tier 3 needs-judge] → per-golden pass+score → baseline (write) | regression diff (check)golden (input · expected · rubric? · asserts?) + candidate output → cascade:tier 1 asserts → [tier 2 similarity] → [tier 3 needs-judge] → 每个 golden 的 pass+score → baseline(写入) | regression diff(检查)Input và output contract
输入与输出契约
| Field | Required? | Ý nghĩa | |
|---|---|---|---|
| In | goldens | có | YAML frontmatter |
| In | | có | candidate outputs per golden — makes the suite runnable without any model |
| In | mode | không | none = report; |
| In | | không | adapter config ( |
| Out | report | có | per-golden pass/fail/score/ |
| Out | | với | committed per-golden pass + score |
| Out | exit code | với | 0 = no regression; 2 = a metric dropped below baseline (+ regression diff) |
| 字段 | 是否必需 | 含义 | |
|---|---|---|---|
| 输入 | goldens | 是 | YAML frontmatter: |
| 输入 | | 是 | 每个 golden 的候选输出,使整个套件无需任何模型即可运行 |
| 输入 | mode | 否 | none = report; |
| 输入 | | 否 | adapter 配置( |
| 输出 | report | 是 | 每个 golden 的 pass/fail/score/ |
| 输出 | | 使用 | 已提交的每个 golden 的 pass + score |
| 输出 | exit code | 使用 | 0 = 无回归;2 = 某个 metric 低于 baseline(附 regression diff) |
Rules và capabilities
规则与能力
- RULE-01 (MUST): If a golden declares , tier 1 alone decides pass/fail. Unknown ops fail closed.
asserts - RULE-02 (MUST): tier 2 similarity is only reached when a golden has no asserts; skipped + noted unless is set (
embedding.backend= stdlib lexical, offline; a real model id stays skipped until the adapter is wired).difflib - RULE-03 (MUST): the stub is NEVER called in deterministic mode; escalated goldens are reported
judge(output, rubric) -> {score, reason}.needs-judge - RULE-04 (MUST): is a deterministic diff against the committed baseline; exit 2 only on a drop.
--check - RULE-05 (MUST): the adapter boundary is one file — finalizing the judge changes +
harness/wikieval.config.yamlonly; the rest of WikiEval does not change.judge() - Capabilities: read goldens + candidate outputs + adapter config; write baseline file; no network, no model.
- RULE-01 (MUST):若 golden 声明了 ,则仅由 tier 1 决定 pass/fail。未知 ops 按 fail closed 处理。
asserts - RULE-02 (MUST):只有在 golden 没有 asserts 时才会进入 tier 2 similarity;除非设置了 ,否则会 skipped + noted(
embedding.backend= stdlib lexical、offline;真实 model id 在 adapter 接线完成前仍保持 skipped)。difflib - RULE-03 (MUST):stub 在 deterministic mode 下绝不会被调用;升级的 goldens 会被报告为
judge(output, rubric) -> {score, reason}。needs-judge - RULE-04 (MUST):是与已提交 baseline 进行的 deterministic diff;仅在指标下降时返回 exit 2。
--check - RULE-05 (MUST):adapter boundary 只有一个文件——完成 judge 接入时只需更改 +
harness/wikieval.config.yaml;WikiEval 的其余部分不变。judge() - 能力:读取 goldens + candidate outputs + adapter 配置;写入 baseline 文件;无网络访问、无模型调用。
Failure boundaries
失败边界
- An assert fails → golden failed (report); with , drop vs baseline → exit 2 + regression diff.
--check - Unknown assert op → failed closed (not skipped).
- Golden without asserts and no → tier 2 skipped + noted; rubric escalation →
embedding.backend(not a pass, not a fail).needs-judge - Missing/invalid file → blocked: cannot run without candidates.
--outputs
- assert 失败 → golden failed(写入报告);使用 时,与 baseline 相比出现下降 → exit 2 + regression diff。
--check - 未知 assert op → failed closed(不会 skipped)。
- Golden 没有 asserts 且未设置 → tier 2 skipped + noted;rubric escalation →
embedding.backend(既不是 pass,也不是 fail)。needs-judge - 缺失或无效的 文件 → blocked:没有候选输出就无法运行。
--outputs
HOW
使用方法
Main workflow
主要工作流
| Step | Type | Inputs | Action | Outputs/exit | Failure/next |
|---|---|---|---|---|---|
| W01 | deterministic | goldens, | Load goldens + candidate outputs | pairs per golden | missing outputs → blocked |
| W02 | deterministic | pair, | Tier 1 deterministic asserts | pass/fail if asserts declared | unknown op → fail closed |
| W03 | deterministic | pair, config | Tier 2 similarity (only if no asserts) | score or "skipped + noted" | backend unset → skip |
| W04 | deterministic | rubric | Tier 3 → report | | — |
| W05 | deterministic | results, mode | Report / | report, baseline file, exit 0/2 | drop → exit 2 |
Chi tiết từng bước (nguồn chân lý cho W01–W05):
| 步骤 | 类型 | 输入 | 操作 | 输出/退出 | 失败/后续 |
|---|---|---|---|---|---|
| W01 | deterministic | goldens、 | 加载 goldens + candidate outputs | 每个 golden 的 pair | outputs 缺失 → blocked |
| W02 | deterministic | pair、 | Tier 1 deterministic asserts | 声明 asserts 时返回 pass/fail | 未知 op → fail closed |
| W03 | deterministic | pair、config | Tier 2 similarity(仅在没有 asserts 时) | score 或“skipped + noted” | backend 未设置 → skip |
| W04 | deterministic | rubric | Tier 3 → 报告 | | — |
| W05 | deterministic | results、mode | Report / | report、baseline 文件、exit 0/2 | 下降 → exit 2 |
各步骤的详细信息(W01–W05 的唯一事实来源):
The assertion cascade (cheap → expensive, short-circuits)
Assertion cascade(低成本 → 高成本,短路执行)
- tier 1 — deterministic asserts (build-now core): /
equals/contains/icontains/not-contains/regex/is-jsonrun on the candidate output. If a golden declaresis-sql-ish, tier 1 alone decides pass/fail. Unknown ops fail closed.asserts - tier 2 — similarity (OPTIONAL): only reached when a golden has no asserts. Skipped + noted
unless is set in the config (
embedding.backend= stdlib lexical, offline; a real model id stays skipped until the adapter is wired).difflib - tier 3 — LLM-rubric judge = THE ADAPTER (). The stub
verified: falseis NEVER called in deterministic mode; escalated goldens are reportedjudge(output, rubric) -> {score, reason}.needs-judge
- tier 1 — deterministic asserts(build-now 核心):对 candidate output 执行 /
equals/contains/icontains/not-contains/regex/is-json。若 golden 声明了 asserts,则仅由 tier 1 决定 pass/fail。未知 ops 按 fail closed 处理。is-sql-ish - tier 2 — similarity(OPTIONAL):只有在 golden 没有 asserts 时才会进入。除非在配置中设置了 ,否则会 skipped + noted(
embedding.backend= stdlib lexical、offline;真实 model id 在 adapter 接线完成前仍保持 skipped)。difflib - tier 3 — LLM-rubric judge = THE ADAPTER()。
verified: falsestub 在 deterministic mode 下绝不会被调用;升级的 goldens 会被报告为judge(output, rubric) -> {score, reason}。needs-judge
Goldens
Goldens
Markdown under with YAML frontmatter: , ,
optional , optional (quote each: , ,
, , ). Optional (defaults to filename stem).
Each golden also obeys R9 (frontmatter ) and R2 ().
llmwiki/wiki/sources/evals/inputexpectedrubricasserts'contains:foo''regex:^...$''is-json''equals:bar''is-sql-ish'idtype## Originllmwiki/wiki/sources/evals/inputexpectedrubricasserts'contains:foo''regex:^...$''is-json''equals:bar''is-sql-ish'idtype## OriginRun it (no model required)
运行(无需模型)
sh
undefinedsh
undefinedrun the cascade with a fixed candidate set, print a report
run the cascade with a fixed candidate set, print a report
python3 harness/scripts/wikieval.py --outputs harness/evals/wikieval-outputs.example.json
python3 harness/scripts/wikieval.py --outputs harness/evals/wikieval-outputs.example.json
write / refresh the committed baseline (per-golden pass + score)
write / refresh the committed baseline (per-golden pass + score)
python3 harness/scripts/wikieval.py --outputs <outputs.json> --write-baseline
python3 harness/scripts/wikieval.py --outputs <outputs.json> --write-baseline
CI gate: re-run and exit 2 if any metric dropped below baseline (deterministic diff)
CI gate: re-run and exit 2 if any metric dropped below baseline (deterministic diff)
python3 harness/scripts/wikieval.py --outputs <outputs.json> --check
Baseline: `harness/metrics/eval-baseline.json`. Adapter config: `harness/wikieval.config.yaml`.python3 harness/scripts/wikieval.py --outputs <outputs.json> --check
Baseline:`harness/metrics/eval-baseline.json`。Adapter 配置:`harness/wikieval.config.yaml`。Branches
分支
| ID | Kind | Guard | Hành vi | Skip / failure | Rejoin |
|---|---|---|---|---|---|
| B01 | capability_optional | golden has no | tier 2 similarity ( | backend unset or real model id not wired → skipped + noted | W04 |
| B02 | user_optional | | write/refresh | — | end |
| B03 | user_optional | | deterministic diff vs baseline, exit 2 on drop | no baseline → run | end |
| ID | 种类 | 条件 | 行为 | 跳过/失败 | 汇合点 |
|---|---|---|---|---|---|
| B01 | capability_optional | golden 没有 | Tier 2 similarity( | backend 未设置,或真实 model id 尚未接线 → skipped + noted | W04 |
| B02 | user_optional | | 写入/刷新 | — | end |
| B03 | user_optional | | 与 baseline 进行 deterministic diff,下降时 exit 2 | 没有 baseline → 先运行 | end |
Validation và stopping
验证与停止条件
Everything is code-checked: asserts, cascade, baseline diff and exit code are deterministic. Only tier 3 needs review () and stays out of the pass/fail decision until the adapter is finalized.
needs-judge所有内容都通过代码检查:asserts、cascade、baseline diff 和 exit code 都是 deterministic。只有 tier 3 需要审查(),在 adapter 完成前不参与 pass/fail 决策。
needs-judgeSelf-test (build-now slice)
Self-test(build-now slice)
sh
OUT=harness/evals/wikieval-outputs.example.json
python3 harness/scripts/wikieval.py --outputs $OUT --write-baseline # both goldens PASS
python3 harness/scripts/wikieval.py --outputs $OUT --check # exit 0 — no regressionsh
OUT=harness/evals/wikieval-outputs.example.json
python3 harness/scripts/wikieval.py --outputs $OUT --write-baseline # both goldens PASS
python3 harness/scripts/wikieval.py --outputs $OUT --check # exit 0 — no regressionflip one output to break an assert, then:
flip one output to break an assert, then:
python3 harness/scripts/wikieval.py --outputs <broken.json> --check # exit 2 + regression diff
undefinedpython3 harness/scripts/wikieval.py --outputs <broken.json> --check # exit 2 + regression diff
undefinedExamples
示例
- Positive: after writing baseline → both goldens PASS → exit 0.
python3 harness/scripts/wikieval.py --outputs harness/evals/wikieval-outputs.example.json --check - Boundary/failure: flip one candidate so no longer matches →
'contains:foo'exits 2 with the regression diff naming that golden.--check - Boundary: golden with only , no asserts, no
rubric→ tier 2 skipped + noted, reportedembedding.backend; judge not called.needs-judge
- **正向:**写入 baseline 后运行 → 两个 goldens 均 PASS → exit 0。
python3 harness/scripts/wikieval.py --outputs harness/evals/wikieval-outputs.example.json --check - **边界/失败:**翻转一个 candidate,使 不再匹配 →
'contains:foo'返回 exit 2,并提供指出对应 golden 的 regression diff。--check - **边界:**golden 只有 ,没有 asserts,也没有
rubric→ tier 2 skipped + noted,并报告为embedding.backend;不调用 judge。needs-judge
Reference — Adapter boundary (build-now-adapt-later)
参考——Adapter boundary(build-now-adapt-later)
- Built + tested now: tier-1 asserts, the cascade, baseline write + regression diff.
--check - Quarantined ():
verified: false(judge model + rubric prompt, embedding backend — each a flaggedharness/wikieval.config.yaml) and the# ASSUMPTIONstub.judge() - Finalize: wire to the configured model, run the self-test, flip
judge(). One file changes; the rest of WikiEval does not.verified: true
- **当前已构建并经过测试:**tier-1 asserts、cascade、baseline 写入 + regression diff。
--check - 已隔离():
verified: false(judge model + rubric prompt、embedding backend——每项均以带标记的harness/wikieval.config.yaml呈现)和# ASSUMPTIONstub。judge() - **完成接入:**将 接到配置的 model,运行 self-test,并将
judge()改为verified。只有一个文件会发生变化;WikiEval 的其余部分不变。true
Reference — Files
参考——文件
- — the eval engine.
harness/scripts/wikieval.py - — the one adapter (
harness/wikieval.config.yaml).verified: false - — committed regression baseline (generated).
harness/metrics/eval-baseline.json - — goldens.
llmwiki/wiki/sources/evals/*.md - — self-test candidate outputs.
harness/evals/wikieval-outputs.example.json
- — eval 引擎。
harness/scripts/wikieval.py - — 唯一的 adapter(
harness/wikieval.config.yaml)。verified: false - — 已提交的 regression baseline(生成文件)。
harness/metrics/eval-baseline.json - — goldens。
llmwiki/wiki/sources/evals/*.md - — self-test candidate outputs。
harness/evals/wikieval-outputs.example.json