commit 9c18cbc8d35a0ee2a978c8032860719aba65e482
parent bfcfb20c27bb22b2b05e16af1ed98cafec8cfc27
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 15 Oct 2026 16:55:21 -0400
common, umtool: verdict bench v3 — a claim's posts and pages are its evidence, a heading naming a verdict is withheld, a repeated claim is asked once, and the model finds each part of a claim (the verdict follows in code)
The diagnosis of bench v2's disagreements (counts in the lane's record) found the
items short of what the operator read (the claim's cited posts and pages never
reached the model), half the bench a re-cut report's copies, that report's
section headings naming the answer, and the holistic verdict treating a part
the evidence does not show as no demotion where the operator rules PARTLY.
- items.ts: post and page citations become the item's `evidence` (quote, label,
speaker, date; never a page's note; at most EVIDENCE_MAX, each quote cut at
EVIDENCE_QUOTE_MAX); `sectionNamesVerdict` withholds a heading that names a
verdict; `benchItemsOf` skips a claim that repeats an earlier item (same
text, same cited spans) as "the same claim as <key>" (`dedupe`, default on);
the items hash covers the evidence only when there is some.
- prompt.ts: PROMPT_VERSION "3". The answer is {parts: [{part, finding: shown |
shown wrong | not shown}], checkable, reason}; `verdictOfParts` derives the
verdict in code and `readVerdictAnswer` holds the counts (PARTS_MAX,
PART_MAX, REASON_MAX). The user prompt quotes the cited posts and pages.
- verdicts.mjs: the meanings rewritten in parts terms; VERDICT_PARTS_RULE
replaces VERDICT_TIE_RULE (REPORT.md regenerated).
- run.ts stores each answer's parts; tasks/verdicts.ts (M8) reads its answer
through readVerdictAnswer.
- umtool /tools/bench: under each claim what the model saw (its windows' lines
and its posts and pages), under each answer the model's parts.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
15 files changed, 547 insertions(+), 112 deletions(-)
diff --git a/REPORT.md b/REPORT.md
@@ -110,13 +110,13 @@ The shared vocabulary (`common/lib/report/verdicts.mjs` — the one copy; report
| Verdict | Means | Default label | Default colour |
|---|---|---|---|
-| `CORROBORATED` | the substance of the claim is shown by the cited words. Framing, emphasis, or a detail the transcript does not show does not demote it. | Corroborated | `#3fbf7f` |
-| `PARTLY` | a part of the claim is shown by the transcript to be overstated or wrong. A part that is only not shown does not make a claim PARTLY. | Partly true | `#e3b23c` |
-| `CONTRADICTED` | the substance of the claim is shown to be wrong: the transcript shows the opposite of it, or something that cannot be true at the same time. | Contradicted | `#e5534b` |
-| `NOT_FOUND` | the claim could be checked against what was said, and its substance is not in the transcript shown: the topic may come up without what the claim says about it. | Not found | `#8b93a7` |
-| `UNTESTABLE` | the claim is an opinion, a judgement, a prediction, or anything else a transcript cannot show to be true or false. | Untestable | `#7d8fd6` |
+| `CORROBORATED` | every part of the claim is shown by the cited evidence in substance: other words, a softer phrasing or a hedge still count. | Corroborated | `#3fbf7f` |
+| `PARTLY` | some parts of the claim are shown and at least one is not: it is not in the evidence, or the evidence shows it wrong (a different number, date or person, or words put in quotation marks that are not the speaker's). | Partly true | `#e3b23c` |
+| `CONTRADICTED` | no part of the claim is shown, and the evidence shows a part wrong: the opposite of it, or something that cannot be true at the same time. | Contradicted | `#e5534b` |
+| `NOT_FOUND` | no part of the claim is shown or shown wrong by the evidence: the topic may come up without what the claim says about it. | Not found | `#8b93a7` |
+| `UNTESTABLE` | the claim is an opinion, a judgement, a prediction, or anything else a record cannot show to be true or false. | Untestable | `#7d8fd6` |
-In doubt between CORROBORATED and PARTLY: CORROBORATED, unless a part of the claim is shown overstated or wrong. The meanings are the operator's standard; the verdict bench's prompt and the verdict proposals read the same sentences.
+A claim's parts are the separate things it says were said or done: a statement, an event, a number, a date, words it puts in quotation marks as someone's. A word that only describes what was said (its tone, motive or importance) is not a part, and neither is a fact about the world outside what was said (whether a thing said is true). A part about how often something was said, or that it was never said, is shown when the evidence is consistent with it and does not show otherwise. The meanings are the operator's standard; the verdict bench's prompt and the verdict proposals read the same sentences.
## Iterations
diff --git a/common/lib/report/docs.ts b/common/lib/report/docs.ts
@@ -23,7 +23,7 @@ import {
sectionSchema,
slideSchema,
} from "./schema";
-import { VERDICT_DEFAULTS, VERDICT_LABEL_MAX, VERDICT_MEANINGS, VERDICT_TIE_RULE, VERDICTS } from "./verdicts";
+import { VERDICT_DEFAULTS, VERDICT_LABEL_MAX, VERDICT_MEANINGS, VERDICT_PARTS_RULE, VERDICTS } from "./verdicts";
export function renderReportMarkdown(): string {
const out: string[] = [];
@@ -151,7 +151,7 @@ export function renderReportMarkdown(): string {
out.push(`| \`${v}\` | ${cell(VERDICT_MEANINGS[v])} | ${cell(d.label)} | \`${d.color}\` |`);
}
out.push("");
- out.push(`${VERDICT_TIE_RULE} The meanings are the operator's standard; the verdict bench's prompt and the verdict proposals read the same sentences.`);
+ out.push(`${VERDICT_PARTS_RULE} The meanings are the operator's standard; the verdict bench's prompt and the verdict proposals read the same sentences.`);
out.push("");
out.push("## Iterations");
out.push("");
diff --git a/common/lib/report/draft/bench/bench.test.ts b/common/lib/report/draft/bench/bench.test.ts
@@ -27,11 +27,19 @@ import {
markedScore,
stratifiedLimit,
turnOf,
+ readVerdictAnswer,
+ verdictOfParts,
+ sectionNamesVerdict,
+ EVIDENCE_MAX,
+ EVIDENCE_QUOTE_MAX,
+ PARTS_MAX,
+ PART_MAX,
+ REASON_MAX,
type BenchAsk,
type BenchItem,
type BenchResult,
} from "./index";
-import { VERDICT_MEANINGS, VERDICT_TIE_RULE } from "../../verdicts";
+import { VERDICT_MEANINGS, VERDICT_PARTS_RULE } from "../../verdicts";
import { CLAIM_FIELD_DOCS } from "../../schema";
import { renderReportMarkdown } from "../../docs";
import { promptEstimate } from "../../../llm/ollama";
@@ -69,6 +77,18 @@ async function store(mutate?: (r: any) => void) {
return { dir, paths, done: () => rm(dir, { recursive: true, force: true }) };
}
+// A v3 answer (the parts and their findings) that makes verdict `v`.
+function answerOf(v: Verdict, reason: string) {
+ const parts: Record<Verdict, { part: string; finding: string }[]> = {
+ CORROBORATED: [{ part: "what she said", finding: "shown" }],
+ PARTLY: [{ part: "what she said", finding: "shown" }, { part: "the rest", finding: "not shown" }],
+ CONTRADICTED: [{ part: "what she said", finding: "shown wrong" }],
+ NOT_FOUND: [{ part: "what she said", finding: "not shown" }],
+ UNTESTABLE: [],
+ };
+ return { parts: parts[v], checkable: v !== "UNTESTABLE", reason };
+}
+
const claimOf = (user: string) => /^Claim: (.*)$/m.exec(user)?.[1] ?? "";
// The synthetic claims' texts, to answer by.
@@ -235,14 +255,14 @@ test("run: Sonnet over the fake API, qwen over the fake ollama — answers writt
for (let i = 0; i < 7; i++) {
api.push((body: any) => {
const id = texts[claimOf(userOf(body))]!;
- return toolTurn("answer", { verdict: id === "r05" ? "PARTLY" : TRUTH[id], reason: `ruled on ${id} ${"x".repeat(400)}` });
+ return toolTurn("answer", answerOf(id === "r05" ? "PARTLY" : TRUTH[id]!, `ruled on ${id} ${"x".repeat(400)}`));
});
}
// qwen: always CORROBORATED, and r03's answer is not JSON (twice: the retry too).
for (let i = 0; i < 8; i++) {
ol.push((body: any) => {
const id = texts[claimOf(body.messages[1].content)]!;
- return id === "r03" ? reply("I think it is partly true") : jsonReply({ verdict: "CORROBORATED", reason: "she says so" });
+ return id === "r03" ? reply("I think it is partly true") : jsonReply(answerOf("CORROBORATED", "she says so"));
});
}
try {
@@ -293,7 +313,7 @@ test("run: Sonnet over the fake API, qwen over the fake ollama — answers writt
test("run: the cap is checked before each API call — past it the run stops capped, with what it did", async () => {
const s = await store();
const api = await startFakeAnthropic();
- for (let i = 0; i < 7; i++) api.push(toolTurn("answer", { verdict: "CORROBORATED", reason: "ok" }));
+ for (let i = 0; i < 7; i++) api.push(toolTurn("answer", answerOf("CORROBORATED", "ok")));
try {
// One call costs about a cent at Opus 5.5's price; a two-cent cap stops early.
const out = await runVerdictBench(
@@ -324,7 +344,7 @@ test("run: a re-run with the same id resumes — answered pairs skipped, failed
const api = await startFakeAnthropic();
const llm = { anthropic: { baseUrl: api.url, env: { ANTHROPIC_API_KEY: api.key } } };
// First run: r01–r03 answered, then three 400s in a row (not retried) stop the model.
- for (let i = 0; i < 3; i++) api.push((body: any) => toolTurn("answer", { verdict: TRUTH[texts[claimOf(userOf(body))]!], reason: "ok" }));
+ for (let i = 0; i < 3; i++) api.push((body: any) => toolTurn("answer", answerOf(TRUTH[texts[claimOf(userOf(body))]!]!, "ok")));
for (let i = 0; i < 3; i++) api.push(errorTurn(400, "invalid_request_error", "a bad request"));
try {
const first = await runVerdictBench({ runId: "vb-resume", models: ["claude-sonnet-5-5"] }, { paths: s.paths, cuesOf, llm });
@@ -334,7 +354,7 @@ test("run: a re-run with the same id resumes — answered pairs skipped, failed
assert.equal(first.summary.score.models[0]!.errors, 3);
assert.equal(first.summary.score.models[0]!.asked, 6);
// The re-run asks only the four not answered (three failed, one never asked).
- for (let i = 0; i < 4; i++) api.push((body: any) => toolTurn("answer", { verdict: TRUTH[texts[claimOf(userOf(body))]!], reason: "ok" }));
+ for (let i = 0; i < 4; i++) api.push((body: any) => toolTurn("answer", answerOf(TRUTH[texts[claimOf(userOf(body))]!]!, "ok")));
const again = await runVerdictBench({ runId: "vb-resume", models: ["claude-sonnet-5-5"] }, { paths: s.paths, cuesOf, llm });
assert.equal(api.requests.length, 10);
const asked = api.requests.slice(6).map((b: any) => texts[claimOf(userOf(b))]);
@@ -392,19 +412,21 @@ function stubAsk(answers: (model: string, id: string) => unknown, texts: Record<
return { ask, asked };
}
-test("V1 prompt: the meanings are the shared module's, the tie rule is in, reason before verdict, the context shown, a version", async () => {
+test("V1/v3 prompt: the meanings are the shared module's, the parts rule is in, parts before the reason, the context shown, a version", async () => {
for (const v of VERDICTS) assert.ok(VERDICT_BENCH_SYSTEM.includes(`- ${v}: ${VERDICT_MEANINGS[v]}`), v);
- assert.ok(VERDICT_BENCH_SYSTEM.includes(VERDICT_TIE_RULE));
+ assert.ok(VERDICT_BENCH_SYSTEM.includes(VERDICT_PARTS_RULE));
assert.match(VERDICT_MEANINGS.CORROBORATED, /substance/);
- assert.match(VERDICT_MEANINGS.PARTLY, /shown .* overstated or wrong/);
+ assert.match(VERDICT_MEANINGS.PARTLY, /some parts .* at least one is not/);
assert.ok(!/example|e\.g\./i.test(VERDICT_BENCH_SYSTEM));
- assert.deepEqual(Object.keys(VERDICT_ANSWER_SCHEMA.properties), ["reason", "verdict"]);
- assert.deepEqual(VERDICT_ANSWER_SCHEMA.required, ["reason", "verdict"]);
+ assert.deepEqual(Object.keys(VERDICT_ANSWER_SCHEMA.properties), ["parts", "checkable", "reason"]);
+ assert.deepEqual(VERDICT_ANSWER_SCHEMA.required, ["parts", "checkable", "reason"]);
+ // The model names no verdict: the schema has none.
+ assert.ok(!("verdict" in VERDICT_ANSWER_SCHEMA.properties));
assert.equal(typeof PROMPT_VERSION, "string");
// The same sentences in REPORT.md and the claim's docs: nowhere else spells them out.
const md = renderReportMarkdown();
for (const v of VERDICTS) assert.ok(md.includes(VERDICT_MEANINGS[v]), `REPORT.md lacks ${v}'s meaning`);
- assert.ok(md.includes(VERDICT_TIE_RULE));
+ assert.ok(md.includes(VERDICT_PARTS_RULE));
assert.match(CLAIM_FIELD_DOCS.verdict, /what each means/);
// The context: the report's title, the section, each quote's speaker (the channel) and date.
const s = await store();
@@ -453,7 +475,7 @@ test("V1 items: the turn mode — the speaker's segments, else a pause or a >> c
assert.deepEqual(turnOf(cues, segs, { start: 5, end: 7 }, 0, 100), { from: 4, to: 13, bound: "speaker" });
const s = await store((r) => {
- // r01 cites a missing citation and a post beside its span: both dropped, the claim kept.
+ // r01 cites a missing citation (dropped) and a post beside its span (v3: its evidence), the claim kept.
r.citations.p1 = { kind: "post", channel: "synth-kitchen-posts", id: "p-1", quote: "a post" };
r.sections[0].claims[0].citations = ["q01", "p1", "gone"];
// r02's second citation is a recording with no cues: dropped.
@@ -466,11 +488,11 @@ test("V1 items: the turn mode — the speaker's segments, else a pause or a >> c
assert.deepEqual(
secs.dropped.map((d) => [d.key, d.citation, d.reason]),
[
- ["synth-ruled/r01", "p1", "not a video or audio citation"],
["synth-ruled/r01", "gone", "not in the report's citations"],
["synth-ruled/r02", "q99", "the recording has no cues"],
],
);
+ assert.deepEqual(secs.items.find((i) => i.claim === "r01")!.evidence!.map((e) => e.citation), ["p1"]);
assert.ok(secs.items.every((i) => i.windows.every((w) => w.bound === "seconds")));
// Turn mode over the synthetic cues (0.2 s apart: one long turn) is bounded by the window.
const turn = await benchItemsOf(reports, { cuesOf, windowS: 10, windowMode: "turn" });
@@ -511,7 +533,7 @@ test("V1 run: the injected ask, reason before verdict, a per-call trace; --items
const s = await store();
const texts = await claimTexts();
// Sonnet right everywhere; qwen says PARTLY on r01, right elsewhere.
- const { ask, asked } = stubAsk((model, id) => ({ reason: `on ${id}`, verdict: model === "qwen3:8b" && id === "r01" ? "PARTLY" : TRUTH[id] }), texts);
+ const { ask, asked } = stubAsk((model, id) => answerOf(model === "qwen3:8b" && id === "r01" ? "PARTLY" : TRUTH[id]!, `on ${id}`), texts);
const root = benchRootOf(s.paths);
try {
const first = await runVerdictBench({ runId: "vb-one", models: ["claude-sonnet-5-5", "qwen3:8b"] }, { paths: s.paths, cuesOf, llm: {}, ask });
@@ -520,7 +542,7 @@ test("V1 run: the injected ask, reason before verdict, a per-call trace; --items
assert.equal(first.summary.promptVersion, PROMPT_VERSION);
assert.equal(first.summary.windowMode, "seconds");
assert.match(first.summary.itemsHash!, /^[0-9a-f]{16}$/);
- assert.deepEqual(Object.keys(asked[0]!.schema.properties), ["reason", "verdict"]);
+ assert.deepEqual(Object.keys(asked[0]!.schema.properties), ["parts", "checkable", "reason"]);
// The trace: a start line and one line per call with the prompt the model saw and its answer.
const trace = (await readFile(path.join(root, "vb-one", "trace.jsonl"), "utf8")).trim().split("\n").map((l) => JSON.parse(l));
assert.equal(trace[0].t, "start");
@@ -528,7 +550,7 @@ test("V1 run: the injected ask, reason before verdict, a per-call trace; --items
const calls = trace.filter((l) => l.t === "call");
assert.equal(calls.length, 14);
assert.ok(calls[0].user.startsWith("Report: "));
- assert.deepEqual(calls[0].answer, { reason: "on r01", verdict: "CORROBORATED" });
+ assert.deepEqual(calls[0].answer, answerOf("CORROBORATED", "on r01"));
// A run from vb-one's items: the same items, the same hash; only qwen asked.
asked.length = 0;
@@ -613,3 +635,106 @@ test("V1 score: not-CORROBORATED precision and recall; two runs compared; the op
assert.notEqual(benchItemsHash([one]), benchItemsHash([{ ...one, text: "The article says otherwise." }]));
assert.notEqual(benchItemsHash([one]), benchItemsHash([{ ...one, quotes: [{ ...one.quotes[0]!, end: 3 }] }]));
});
+
+test("v3 answer: the verdict follows from the parts in code; the counts and lengths are held in code", () => {
+ const P = (...f: string[]) => f.map((finding, i) => ({ part: `p${i}`, finding: finding as "shown" }));
+ assert.equal(verdictOfParts(P("shown", "shown"), true), "CORROBORATED");
+ assert.equal(verdictOfParts(P("shown", "not shown"), true), "PARTLY");
+ assert.equal(verdictOfParts(P("shown", "shown wrong"), true), "PARTLY");
+ assert.equal(verdictOfParts(P("shown wrong", "not shown"), true), "CONTRADICTED");
+ assert.equal(verdictOfParts(P("shown wrong"), true), "CONTRADICTED");
+ assert.equal(verdictOfParts(P("not shown", "not shown"), true), "NOT_FOUND");
+ assert.equal(verdictOfParts(P("shown"), false), "UNTESTABLE");
+ assert.equal(verdictOfParts([], false), "UNTESTABLE");
+ assert.equal(verdictOfParts([], true), null);
+
+ // Too many parts, a part too long, a reason too long: cut. A part with an
+ // unknown finding is not a part.
+ const many = Array.from({ length: PARTS_MAX + 3 }, (_, i) => ({ part: `${"w".repeat(PART_MAX + 50)}${i}`, finding: "shown" }));
+ const a = readVerdictAnswer({ parts: [{ part: "x", finding: "maybe" }, ...many], checkable: true, reason: "r".repeat(REASON_MAX + 99) });
+ assert.ok(a.ok);
+ if (a.ok) {
+ assert.equal(a.parts.length, PARTS_MAX);
+ assert.ok(a.parts.every((p) => p.part.length === PART_MAX));
+ assert.equal(a.reason.length, REASON_MAX);
+ assert.equal(a.verdict, "CORROBORATED");
+ }
+ // The parts past the limit never count: a "not shown" seventh part leaves it CORROBORATED.
+ const seventh = readVerdictAnswer({ parts: [...many.slice(0, PARTS_MAX), { part: "late", finding: "not shown" }], checkable: true, reason: "ok" });
+ assert.ok(seventh.ok && seventh.verdict === "CORROBORATED");
+ // Untestable with no parts; failures named.
+ const u = readVerdictAnswer({ parts: [], checkable: false, reason: "an opinion" });
+ assert.ok(u.ok && u.verdict === "UNTESTABLE");
+ assert.deepEqual(readVerdictAnswer({ parts: [], checkable: true, reason: "x" }), { ok: false, error: "no part with a finding", reason: "x" });
+ assert.equal(readVerdictAnswer({ parts: [{ part: "a", finding: "shown" }], checkable: true, reason: " " }).ok, false);
+ assert.equal(readVerdictAnswer({ verdict: "CORROBORATED", reason: "a v2 answer" }).ok, false);
+ assert.equal(readVerdictAnswer(null).ok, false);
+});
+
+test("v3 items: a claim's posts and pages are its evidence (quoted, never a note); a heading naming a verdict withheld; a repeated claim asked once", async () => {
+ assert.equal(sectionNamesVerdict("Corroborated, with clips"), true);
+ assert.equal(sectionNamesVerdict("Only partially so"), true);
+ assert.equal(sectionNamesVerdict("Not found anywhere"), true);
+ assert.equal(sectionNamesVerdict("NOT_FOUND"), true);
+ assert.equal(sectionNamesVerdict("Found on the stream"), false);
+ assert.equal(sectionNamesVerdict("The bakery"), false);
+ assert.equal(sectionNamesVerdict(undefined), false);
+
+ const long = "y".repeat(EVIDENCE_QUOTE_MAX + 40);
+ const s = await store((r) => {
+ r.citations.p1 = { kind: "post", channel: "synth-kitchen-posts", id: "p-1", quote: "the oven ran hot all week", label: "post, 2026-01-06", speaker: "synth-kitchen", date: "2026-01-06" };
+ r.citations.g1 = { kind: "page", url: "https://example.invalid/a", title: "A page", quote: long, note: "the checker's own comment" };
+ r.citations.s1 = { kind: "source", source: "the-article", quote: "the claim's own sentence" };
+ for (let i = 0; i < EVIDENCE_MAX; i++) r.citations[`px${i}`] = { kind: "post", channel: "synth-kitchen-posts", id: `px-${i}`, quote: `post ${i}` };
+ r.sections[0].claims[1].citations = ["q02", "p1", "g1", "s1"];
+ r.sections[0].claims[2].citations = ["q03", ...Array.from({ length: EVIDENCE_MAX }, (_, i) => `px${i}`), "p1"];
+ r.sections[1].title = "Only partially so";
+ });
+ try {
+ const reports = await benchReportsOf(s.paths);
+ const { items, dropped } = await benchItemsOf(reports, { cuesOf });
+ const r02 = items.find((i) => i.claim === "r02")!;
+ assert.deepEqual(r02.evidence!.map((e) => [e.citation, e.kind]), [["p1", "post"], ["g1", "page"]]);
+ assert.equal(r02.evidence![1]!.quote.length, EVIDENCE_QUOTE_MAX);
+ assert.equal(r02.evidence![1]!.title, "A page");
+ assert.ok(!JSON.stringify(r02).includes("the checker's own comment"));
+ assert.deepEqual(dropped.filter((d) => d.key.endsWith("/r02")).map((d) => [d.citation, d.reason]), [["s1", "not a video, audio, post or page citation"]]);
+ assert.equal(items.find((i) => i.claim === "r03")!.evidence!.length, EVIDENCE_MAX);
+ assert.deepEqual(dropped.filter((d) => d.key.endsWith("/r03")).map((d) => d.citation), ["p1"]);
+ // The prompt quotes the evidence, with who and when.
+ const u = benchPrompt(r02).user;
+ assert.match(u, /^Cited posts and pages:$/m);
+ assert.match(u, /^- \[post, post, 2026-01-06\] "the oven ran hot all week" \(by: synth-kitchen; dated: 2026-01-06\)$/m);
+ assert.match(u, /^- \[page, A page\] "y+…"$/m);
+ // A heading that names a verdict is the answer: withheld. The other stays.
+ assert.equal(items.find((i) => i.claim === "r06")!.section, undefined);
+ assert.ok(!benchPrompt(items.find((i) => i.claim === "r06")!).user.includes("Section:"));
+ assert.equal(r02.section, "The bakery");
+ // The hash covers the evidence; an item without any hashes as before v3.
+ const bare = items.map(({ evidence: _e, ...rest }) => rest);
+ assert.notEqual(benchItemsHash(items), benchItemsHash(bare));
+ assert.equal(benchItemsHash(bare), benchItemsHash(bare.map((i) => ({ ...i, evidence: [] }))));
+ } finally {
+ await s.done();
+ }
+
+ // A report re-cut from another: its claims repeat the first's — asked once.
+ const t = await store();
+ try {
+ const report = JSON.parse(await readFile(RULED, "utf8"));
+ report.id = "synth-ruled-recut";
+ report.sections[0].claims[0].text = "A claim this re-cut words differently.";
+ await mkdir(path.join(t.paths.articlesDir, report.id), { recursive: true });
+ await writeFile(path.join(t.paths.articlesDir, report.id, "report.json"), JSON.stringify(report));
+ const reports = await benchReportsOf(t.paths);
+ const { items, skipped } = await benchItemsOf(reports, { cuesOf });
+ assert.equal(items.length, 8);
+ assert.deepEqual(items.filter((i) => i.report === "synth-ruled-recut").map((i) => i.claim), ["r01"]);
+ const same = skipped.filter((x) => x.reason.startsWith("the same claim as"));
+ assert.equal(same.length, 6);
+ assert.deepEqual(same[0], { key: "synth-ruled-recut/r02", report: "synth-ruled-recut", claim: "r02", reason: "the same claim as synth-ruled/r02" });
+ assert.equal((await benchItemsOf(reports, { cuesOf, dedupe: false })).items.length, 14);
+ } finally {
+ await t.done();
+ }
+});
diff --git a/common/lib/report/draft/bench/items.ts b/common/lib/report/draft/bench/items.ts
@@ -1,14 +1,25 @@
-// THE VERDICT BENCH'S ITEMS (release 28 M7; release 29 V1): one per ruled
-// fact-check claim.
+// THE VERDICT BENCH'S ITEMS (release 28 M7; release 29 V1; bench v3): one per
+// ruled fact-check claim.
//
// An item is a claim of a `kind: "factcheck"` article that carries the
// operator's `verdict` and at least one span citation (video or audio) whose
// recording has cues around the cited seconds: the claim's text, its context
// (the report's title, the claim's section heading; each quote's speaker and
-// date), the cited quotes, and the transcript WINDOW around each cited span —
-// overlapping windows of one recording merged. Every other claim is SKIPPED,
-// and every citation of a kept claim that gives no window is DROPPED, each
-// with its reason, and counted: nothing is left out silently.
+// date), the cited quotes, the transcript WINDOW around each cited span —
+// overlapping windows of one recording merged — and (v3) the claim's cited
+// POSTS and PAGES as EVIDENCE: their quoted words, label, speaker and date
+// (never a page's `note`, which is the checker's own comment). Every other
+// claim is SKIPPED, and every citation of a kept claim that gives no window
+// and is not evidence is DROPPED, each with its reason, and counted: nothing
+// is left out silently.
+//
+// v3 also, from the diagnosis of bench v2's disagreements:
+// - a section heading that NAMES A VERDICT ("Only partially so", "Corroborated,
+// with clips") is withheld from the item: it is the answer, not context
+// (`sectionNamesVerdict`);
+// - a claim that repeats an earlier item — the same text over the same cited
+// spans, as a report re-cut from another carries — is SKIPPED as the same
+// claim (`benchItemsOf`'s `dedupe`, on by default): counted once, asked once.
//
// THE WINDOW MODES (V1):
// seconds the cues within ±`windowS` of the cited span (M7's, the default)
@@ -37,7 +48,7 @@ import type { CuesOf } from "../../convertShared";
import { articleFile, listArticleDirs } from "../../registry";
import type { Claim, Report } from "../../schema";
import { parseReport } from "../../validate";
-import { isVerdict, VERDICTS, type Verdict } from "../../verdicts";
+import { isVerdict, VERDICT_DEFAULTS, VERDICTS, type Verdict } from "../../verdicts";
export const DEFAULT_WINDOW_S = 60;
@@ -81,6 +92,24 @@ export type BenchWindow = {
bound?: WindowBound;
};
+// A cited post or page (v3): what the operator read beside the transcript.
+export type BenchEvidence = {
+ citation: string;
+ kind: "post" | "page";
+ quote: string;
+ // A post's channel, a page's title.
+ channel?: string;
+ title?: string;
+ label?: string;
+ speaker?: string;
+ date?: string;
+};
+
+// The most evidence an item carries, and the longest quote of one (code, not
+// the prompt, holds both).
+export const EVIDENCE_MAX = 8;
+export const EVIDENCE_QUOTE_MAX = 600;
+
export type BenchItem = {
// `<report>/<claim>`: unique across a run.
key: string;
@@ -91,6 +120,8 @@ export type BenchItem = {
verdict: Verdict;
quotes: BenchQuote[];
windows: BenchWindow[];
+ // v3: the claim's cited posts and pages (absent: none, or an item made before v3).
+ evidence?: BenchEvidence[];
// Context for the model (V1): the report's title and the claim's section heading.
title?: string;
section?: string;
@@ -187,6 +218,29 @@ function mergeWindows(windows: BenchWindow[]): BenchWindow[] {
return out;
}
+const VERDICT_WORDS_RE = new RegExp(
+ [
+ ...VERDICTS.map((v) => v.replace(/_/g, "[ _]")),
+ ...VERDICTS.map((v) => VERDICT_DEFAULTS[v].label.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")),
+ "corroborat",
+ "contradict",
+ "partially",
+ "partly",
+ "untestable",
+ ].join("|"),
+ "i",
+);
+
+/**
+ * Whether a section heading names a verdict (its code, its default label, or
+ * a word of one: "Corroborated, with clips", "Only partially so") — the
+ * operator's grouping of claims BY their ruling, which an item must not carry.
+ * Pure.
+ */
+export function sectionNamesVerdict(title: string | undefined): boolean {
+ return !!title && VERDICT_WORDS_RE.test(title);
+}
+
const overlaps = (a: { start: number; end: number }, from: number, to: number) => a.end >= from && a.start <= to;
const changesSpeaker = (text: string) => /^\s*>>/.test(text);
@@ -238,6 +292,19 @@ export function turnOf(
return clip(sorted[a]!.start, sorted[b]!.end, "pause");
}
+function evidenceOf(id: string, c: Extract<Citation, { kind: "post" | "page" }>): BenchEvidence {
+ const quote = c.quote.length > EVIDENCE_QUOTE_MAX ? `${c.quote.slice(0, EVIDENCE_QUOTE_MAX - 1)}…` : c.quote;
+ return {
+ citation: id,
+ kind: c.kind,
+ quote,
+ ...(c.kind === "post" ? { channel: c.channel } : c.title ? { title: c.title } : {}),
+ ...(c.label ? { label: c.label } : {}),
+ ...(c.speaker ? { speaker: c.speaker } : {}),
+ ...(c.date ? { date: c.date } : {}),
+ };
+}
+
type ReadClaim = { ok: true; item: ClaimItem; dropped: BenchDropped[] } | { ok: false; reason: string };
// One claim's quotes and windows (its verdict is the caller's business).
@@ -250,10 +317,14 @@ async function readClaim(r: BenchReport, sectionTitle: string, claim: Claim, o:
const ids = claim.citations ?? [];
if (!ids.length) return { ok: false, reason: "no citation" };
const spans: (readonly [string, Citation])[] = [];
+ const evidence: BenchEvidence[] = [];
for (const id of ids) {
const c = citations[id];
if (!c) dropped.push({ key, citation: id, reason: "not in the report's citations" });
- else if (!isSpanCitation(c)) dropped.push({ key, citation: id, reason: "not a video or audio citation" });
+ else if (c.kind === "post" || c.kind === "page") {
+ if (evidence.length >= EVIDENCE_MAX) dropped.push({ key, citation: id, reason: `past the ${EVIDENCE_MAX} posts and pages an item carries` });
+ else evidence.push(evidenceOf(id, c));
+ } else if (!isSpanCitation(c)) dropped.push({ key, citation: id, reason: "not a video, audio, post or page citation" });
else spans.push([id, c]);
}
if (!spans.length) return { ok: false, reason: "no video or audio citation" };
@@ -304,8 +375,9 @@ async function readClaim(r: BenchReport, sectionTitle: string, claim: Claim, o:
text: claim.text,
quotes,
windows: mergeWindows(windows),
+ ...(evidence.length ? { evidence } : {}),
...(r.report.title ? { title: r.report.title } : {}),
- ...(sectionTitle ? { section: sectionTitle } : {}),
+ ...(sectionTitle && !sectionNamesVerdict(sectionTitle) ? { section: sectionTitle } : {}),
},
dropped,
};
@@ -417,17 +489,33 @@ export function stratifiedLimit<T extends { verdict: Verdict }>(items: readonly
return { kept: items.filter((it) => keep.has(it)), left: items.filter((it) => !keep.has(it)) };
}
-// Every item of every report, in report then claim order; `limit` keeps a
-// stratified sample (the rest are skipped, LIMIT_REASON).
-export async function benchItemsOf(reports: readonly BenchReport[], o: ItemOptions & { limit?: number }): Promise<BenchItems> {
+export const SAME_CLAIM_REASON = "the same claim as";
+
+// What makes two items the same claim: the text and the cited spans.
+const sameness = (i: Pick<BenchItem, "text" | "quotes">) =>
+ JSON.stringify([i.text.trim(), i.quotes.map((q) => [q.channel, q.id, q.start, q.end]).sort()]);
+
+// Every item of every report, in report then claim order; `dedupe` (default
+// on) skips a claim that repeats an earlier item (SAME_CLAIM_REASON and its
+// key); `limit` keeps a stratified sample (the rest are skipped, LIMIT_REASON).
+export async function benchItemsOf(reports: readonly BenchReport[], o: ItemOptions & { limit?: number; dedupe?: boolean }): Promise<BenchItems> {
const items: BenchItem[] = [];
const skipped: BenchSkipped[] = [];
const dropped: BenchDropped[] = [];
+ const seen = new Map<string, string>();
for (const r of reports) {
const got = await benchItemsOfReport(r, o);
- items.push(...got.items);
skipped.push(...got.skipped);
- dropped.push(...got.dropped);
+ for (const it of got.items) {
+ const same = o.dedupe === false ? undefined : seen.get(sameness(it));
+ if (same) {
+ skipped.push({ key: it.key, report: it.report, claim: it.claim, reason: `${SAME_CLAIM_REASON} ${same}` });
+ continue;
+ }
+ seen.set(sameness(it), it.key);
+ items.push(it);
+ dropped.push(...got.dropped.filter((d) => d.key === it.key));
+ }
}
if (o.limit === undefined || o.limit < 0 || o.limit >= items.length) return { items, skipped, dropped };
const { kept, left } = stratifiedLimit(items, o.limit);
@@ -442,11 +530,12 @@ export async function benchItemsOf(reports: readonly BenchReport[], o: ItemOptio
/**
* The identity of a run's items, so two runs can be said to be over the SAME
* items: each item's key, the claim's text, the operator's verdict, its quotes'
- * spans and its windows (recording, from, to, how many cues) — not the context
+ * spans, its windows (recording, from, to, how many cues) and (v3) its posts'
+ * and pages' quotes — not the context
* lines, which a run made from an earlier run's items may add. 16 hex
* characters of a sha256.
*/
-export function benchItemsHash(items: readonly Pick<BenchItem, "key" | "text" | "verdict" | "quotes" | "windows">[]): string {
+export function benchItemsHash(items: readonly Pick<BenchItem, "key" | "text" | "verdict" | "quotes" | "windows" | "evidence">[]): string {
const canon = items
.map((i) => ({
k: i.key,
@@ -454,6 +543,8 @@ export function benchItemsHash(items: readonly Pick<BenchItem, "key" | "text" |
v: i.verdict,
q: i.quotes.map((q) => [q.citation, q.channel, q.id, q.start, q.end, q.quote]),
w: i.windows.map((w) => [w.channel, w.id, w.from, w.to, w.cues.length]),
+ // v3's evidence, only when an item has some: an item before v3 hashes as it did.
+ ...(i.evidence?.length ? { e: i.evidence.map((e) => [e.citation, e.kind, e.quote]) } : {}),
}))
.sort((a, b) => (a.k < b.k ? -1 : a.k > b.k ? 1 : 0));
return createHash("sha256").update(JSON.stringify(canon)).digest("hex").slice(0, 16);
diff --git a/common/lib/report/draft/bench/prompt.ts b/common/lib/report/draft/bench/prompt.ts
@@ -1,66 +1,151 @@
-// THE VERDICT BENCH'S PROMPT (release 28 M7; release 29 V1): one claim per call.
+// THE VERDICT BENCH'S PROMPT (release 28 M7; release 29 V1; bench v3): one
+// claim per call.
//
// Q0: the system prompt is rules only — what each verdict means (the
// operator's standard, read from ../../verdicts.mjs VERDICT_MEANINGS and its
-// tie rule: the one copy), and that the model judges only what the window
-// shows — with no worked example. The reason's length is enforced in code
-// (./run.ts cuts it at REASON_MAX), not trusted to the prompt. The answer
-// schema puts `reason` BEFORE `verdict`: the model writes what the transcript
-// shows, then rules on it. A local model's prompt is held under its cap (8k
-// tokens) by trimming the WINDOW, the cues farthest from a cited span first;
-// the claim, its context and the cited quotes are never trimmed.
+// parts rule: the one copy), and that the model judges only what the evidence
+// shows — with no worked example. Lengths and counts are enforced in code
+// (./run.ts and `readVerdictAnswer` cut the reason at REASON_MAX, a part at
+// PART_MAX, the parts at PARTS_MAX), not trusted to the prompt. A local
+// model's prompt is held under its cap (8k tokens) by trimming the WINDOW, the
+// cues farthest from a cited span first; the claim, its context, the cited
+// quotes and the cited posts and pages are never trimmed.
+//
+// BENCH V3 — THE PARTS. The model no longer names a verdict. It splits the
+// claim into its parts (the separate things it says were said or done) and
+// gives each a finding — shown, shown wrong, not shown — plus whether the
+// claim is checkable at all; the VERDICT follows in code (`verdictOfParts`),
+// the same rule VERDICT_MEANINGS states. The diagnosis of bench v2's
+// disagreements (release 30 lane V) found the models' holistic verdict
+// treating a part the evidence does not show as no demotion (the operator
+// rules PARTLY) and an absent post as no evidence (the operator read it).
//
// The user prompt carries the claim's context (V1): the report's title, the
-// claim's section heading, each cited line's speaker (the citation's, else the
-// channel) and the recording's date.
+// claim's section heading (withheld when it names a verdict: ./items.ts),
+// each cited line's speaker (the citation's, else the channel) and the
+// recording's date; and (v3) the claim's cited posts and pages, quoted.
//
// PROMPT_VERSION names the prompt: a string, bumped BY HAND with any change to
// the system prompt, the meanings, the schema or the user prompt's shape. A run
// records it (summary.promptVersion; a run without one is M7's, "1"), and a
// run is never resumed under another version (./run.ts).
//
-// The prompt reads an item's claim text, context, quotes and windows — never
-// its `verdict` (the operator's ruling, the answer).
+// The prompt reads an item's claim text, context, quotes, windows and
+// evidence — never its `verdict` (the operator's ruling, the answer).
-import { VERDICT_MEANINGS, VERDICT_TIE_RULE, VERDICTS } from "../../verdicts";
+import { isVerdict, VERDICT_MEANINGS, VERDICT_PARTS_RULE, VERDICTS, type Verdict } from "../../verdicts";
import { PROMPT_CAP_TOKENS, promptEstimate } from "../../../llm/ollama";
import type { BenchItem, BenchWindow } from "./items";
-export const PROMPT_VERSION = "2";
+export const PROMPT_VERSION = "3";
// The version a run with no `promptVersion` was made with (release 28 M7).
export const M7_PROMPT_VERSION = "1";
export const REASON_MAX = 300;
+// The most parts a claim is split into, and the longest a part is written.
+export const PARTS_MAX = 6;
+export const PART_MAX = 160;
+
+export const PART_FINDINGS = ["shown", "shown wrong", "not shown"] as const;
+export type PartFinding = (typeof PART_FINDINGS)[number];
+export type ClaimPart = { part: string; finding: PartFinding };
+const isPartFinding = (v: unknown): v is PartFinding => typeof v === "string" && (PART_FINDINGS as readonly string[]).includes(v);
export const VERDICT_ANSWER_SCHEMA = {
type: "object",
properties: {
+ parts: {
+ type: "array",
+ description: `First: the claim's parts, at most ${PARTS_MAX}, each with what the evidence shows of it.`,
+ items: {
+ type: "object",
+ properties: {
+ part: { type: "string", description: `One thing the claim says was said or done, in a few words (at most ${PART_MAX} characters).` },
+ finding: { type: "string", enum: [...PART_FINDINGS], description: "What the evidence shows of this part." },
+ },
+ required: ["part", "finding"],
+ },
+ },
+ checkable: {
+ type: "boolean",
+ description: "false only when the claim as a whole is an opinion, a judgement or a prediction that no record could show true or false.",
+ },
reason: {
type: "string",
- description: `First: what the transcript shows about the claim, in one or two plain sentences of at most ${REASON_MAX} characters.`,
+ description: `Then: what the evidence shows about the claim, in one or two plain sentences of at most ${REASON_MAX} characters.`,
},
- verdict: { type: "string", enum: [...VERDICTS], description: "Then: the ruling that reason supports." },
},
- required: ["reason", "verdict"],
+ required: ["parts", "checkable", "reason"],
} as const;
+/**
+ * The verdict a claim's parts make — the rule VERDICT_MEANINGS states, applied
+ * in code: not checkable → UNTESTABLE; every part shown → CORROBORATED; no
+ * part shown and one shown wrong → CONTRADICTED; no part shown or shown wrong
+ * → NOT_FOUND; anything else (some shown, some not or wrong) → PARTLY. No
+ * parts on a checkable claim is no verdict (null). Pure.
+ */
+export function verdictOfParts(parts: readonly Pick<ClaimPart, "finding">[], checkable: boolean): Verdict | null {
+ if (!checkable) return "UNTESTABLE";
+ if (!parts.length) return null;
+ const shown = parts.filter((p) => p.finding === "shown").length;
+ const wrong = parts.filter((p) => p.finding === "shown wrong").length;
+ if (shown === parts.length) return "CORROBORATED";
+ if (!shown) return wrong ? "CONTRADICTED" : "NOT_FOUND";
+ return "PARTLY";
+}
+
+export type VerdictAnswer =
+ | { ok: true; verdict: Verdict; reason: string; parts: ClaimPart[]; checkable: boolean }
+ | { ok: false; error: string; reason?: string };
+
+/**
+ * A model's answer to VERDICT_ANSWER_SCHEMA read and held to the counts: the
+ * parts cut to PARTS_MAX (each part's words to PART_MAX), the reason to
+ * REASON_MAX, and the verdict derived (`verdictOfParts`). Shared by the bench
+ * (./run.ts) and the verdict proposals (../tasks/verdicts.ts).
+ */
+export function readVerdictAnswer(ans: unknown): VerdictAnswer {
+ const a = (ans && typeof ans === "object" ? ans : {}) as { parts?: unknown; checkable?: unknown; reason?: unknown };
+ const reason = typeof a.reason === "string" ? a.reason.trim().slice(0, REASON_MAX) : null;
+ const rawParts = Array.isArray(a.parts) ? a.parts : null;
+ if (!rawParts) return { ok: false, error: `no parts: ${JSON.stringify(ans ?? null).slice(0, 80)}`, ...(reason ? { reason } : {}) };
+ const parts: ClaimPart[] = [];
+ for (const p of rawParts) {
+ const o = (p && typeof p === "object" ? p : {}) as { part?: unknown; finding?: unknown };
+ if (typeof o.part !== "string" || !o.part.trim() || !isPartFinding(o.finding)) continue;
+ parts.push({ part: o.part.trim().slice(0, PART_MAX), finding: o.finding });
+ if (parts.length >= PARTS_MAX) break;
+ }
+ const checkable = a.checkable !== false;
+ const verdict = verdictOfParts(parts, checkable);
+ if (!verdict) return { ok: false, error: "no part with a finding", ...(reason ? { reason } : {}) };
+ if (!reason) return { ok: false, error: "no reason" };
+ if (!isVerdict(verdict)) return { ok: false, error: "no verdict" };
+ return { ok: true, verdict, reason, parts, checkable };
+}
+
export const VERDICT_BENCH_SYSTEM = [
- "You rule on one claim about what a person said in recordings, using only the transcript you are given.",
+ "You check one claim about what a person said or did on record, using only the evidence you are given.",
"",
- "You are shown the report the claim is from, the section it is in, the claim, the lines it cites (who says each and when the recording was made), and the transcript around each cited line (each line stamped with its time in the recording).",
+ "You are shown the report the claim is from, the section it is in, the claim, the lines it cites (who says each and when the recording was made), the transcript around each cited line (each line stamped with its time in the recording), and any posts or pages the claim cites.",
"",
"Rules:",
- "- Judge only from the transcript shown. Do not use outside knowledge, and do not assume what may have been said elsewhere or off the record.",
- "- Rule on the substance of the claim: what it says was said or done.",
- "- The cited lines are where the claim's evidence was found; read the transcript around them before ruling, since context can change their meaning.",
+ "- Judge only from the evidence shown. Do not use outside knowledge, and do not assume what may have been said elsewhere or off the record.",
+ "- The cited lines, posts and pages are where the claim's evidence was found; read the transcript around each cited line before judging, since context can change its meaning.",
"- The transcript is automatic speech recognition: forgive misspellings and missing punctuation, never a change of meaning.",
- "- Write the reason first, naming what the transcript says; then give the verdict that reason supports.",
+ `- First split the claim into its parts, at most ${PARTS_MAX}. ${VERDICT_PARTS_RULE}`,
+ "- Give each part one finding:",
+ " - shown: the evidence shows it in substance: other words, a softer phrasing or a hedge still count.",
+ " - shown wrong: the evidence shows it is wrong: the opposite, a different number, date or person, or words put in quotation marks that are not the speaker's where the speaker's own words are shown.",
+ " - not shown: the evidence does not show it; the topic may come up without it.",
+ "- Set checkable to false only when the claim as a whole is an opinion, a judgement or a prediction that no record could show true or false.",
+ "- Then write the reason: what the evidence shows about the claim.",
"",
- "The verdicts:",
+ "What the verdict will be, from your findings:",
...VERDICTS.map((v) => `- ${v}: ${VERDICT_MEANINGS[v]}`),
- `- ${VERDICT_TIE_RULE}`,
"",
- `The reason is at most ${REASON_MAX} characters.`,
+ `A part is at most ${PART_MAX} characters; the reason is at most ${REASON_MAX} characters.`,
].join("\n");
const stamp = (s: number) => {
@@ -71,7 +156,7 @@ const stamp = (s: number) => {
return h ? `${h}:${String(m).padStart(2, "0")}:${ss}` : `${m}:${ss}`;
};
-type Prompted = Pick<BenchItem, "text" | "quotes" | "windows" | "title" | "section">;
+type Prompted = Pick<BenchItem, "text" | "quotes" | "windows" | "title" | "section" | "evidence">;
function render(item: Prompted, windows: BenchWindow[]): string {
const lines: string[] = [];
@@ -83,6 +168,14 @@ function render(item: Prompted, windows: BenchWindow[]): string {
const where = [q.label, stamp(q.start)].filter(Boolean).join(", ");
lines.push(`- [${where}] "${q.quote}" (${said(q)})`);
}
+ if (item.evidence?.length) {
+ lines.push("", "Cited posts and pages:");
+ for (const e of item.evidence) {
+ const where = [e.kind, e.label ?? e.title ?? e.channel].filter(Boolean).join(", ");
+ const by = [e.speaker ? `by: ${e.speaker}` : "", e.date ? `dated: ${e.date}` : ""].filter(Boolean).join("; ");
+ lines.push(`- [${where}] "${e.quote}"${by ? ` (${by})` : ""}`);
+ }
+ }
lines.push("", "Transcript:");
windows.forEach((w, i) => {
const q = item.quotes.find((x) => x.channel === w.channel && x.id === w.id);
diff --git a/common/lib/report/draft/bench/run.ts b/common/lib/report/draft/bench/run.ts
@@ -37,7 +37,6 @@ import { Meter, priceOf, providerOf, StructuredAnswerError, structuredAnswer, ty
import { ApiKeyError } from "../../../llm/anthropic";
import { CHARS_PER_TOKEN } from "../../../llm/ollama";
import type { CuesOf } from "../../convertShared";
-import { isVerdict } from "../../verdicts";
import {
benchItemsHash,
benchItemsOf,
@@ -52,7 +51,7 @@ import {
type TurnsOf,
type WindowMode,
} from "./items";
-import { benchPrompt, LOCAL_PROMPT_CAP, M7_PROMPT_VERSION, PROMPT_VERSION, REASON_MAX, VERDICT_ANSWER_SCHEMA, VERDICT_BENCH_SYSTEM } from "./prompt";
+import { benchPrompt, LOCAL_PROMPT_CAP, M7_PROMPT_VERSION, PROMPT_VERSION, readVerdictAnswer, VERDICT_ANSWER_SCHEMA, VERDICT_BENCH_SYSTEM } from "./prompt";
import { scoreBench, type BenchResult } from "./score";
import {
appendBenchTrace,
@@ -448,16 +447,16 @@ export async function runVerdictBench(o: BenchOptions, deps: BenchDeps): Promise
let r: BenchResult;
let raw: unknown = undefined;
try {
- const ans = await ask<{ verdict?: unknown; reason?: unknown }>(prompt.system, prompt.user, VERDICT_ANSWER_SCHEMA, model);
+ const ans = await ask<unknown>(prompt.system, prompt.user, VERDICT_ANSWER_SCHEMA, model);
raw = ans;
- const verdict = isVerdict(ans?.verdict) ? ans.verdict : null;
- const reason = typeof ans?.reason === "string" ? ans.reason.trim().slice(0, REASON_MAX) : null;
+ // v3: the parts and their findings; the verdict follows in code.
+ const read = readVerdictAnswer(ans);
r = {
key: item.key,
model,
- verdict: verdict && reason !== null ? verdict : null,
- ...(reason !== null ? { reason } : {}),
- ...(verdict && reason !== null ? {} : { failure: "parse" as const, error: verdict ? "no reason" : `not a verdict: ${JSON.stringify(ans?.verdict ?? null).slice(0, 60)}` }),
+ verdict: read.ok ? read.verdict : null,
+ ...(read.reason ? { reason: read.reason } : {}),
+ ...(read.ok ? { parts: read.parts, ...(read.checkable ? {} : { checkable: false }) } : { failure: "parse" as const, error: read.error }),
ms: Date.now() - t0,
usd: 0,
inputTokens: 0,
diff --git a/common/lib/report/draft/bench/score.ts b/common/lib/report/draft/bench/score.ts
@@ -34,6 +34,11 @@ export type BenchResult = {
// The model's verdict, or null when it gave none.
verdict: Verdict | null;
reason?: string;
+ // v3: the claim's parts as the model found them (the verdict follows from
+ // them, ./prompt.ts verdictOfParts), and `checkable: false` when it judged
+ // the claim untestable.
+ parts?: { part: string; finding: "shown" | "shown wrong" | "not shown" }[];
+ checkable?: false;
// `parse`: no structured answer, or one outside the schema; `error`: the
// call failed (the API, the network, a prompt over the local cap).
failure?: "parse" | "error";
diff --git a/common/lib/report/draft/tasks/verdicts.test.ts b/common/lib/report/draft/tasks/verdicts.test.ts
@@ -60,6 +60,13 @@ function stub(answer: (claimText: string) => unknown) {
return { ask, asked };
}
+
+// A bench v3 answer (the parts; the verdict follows in code) that makes `verdict`.
+function v3(verdict: string, reason: string) {
+ const f: Record<string, string[]> = { CORROBORATED: ["shown"], PARTLY: ["shown", "not shown"], CONTRADICTED: ["shown wrong"], NOT_FOUND: ["not shown"], UNTESTABLE: [] };
+ return { parts: f[verdict]!.map((finding, i) => ({ part: `part ${i}`, finding })), checkable: verdict !== "UNTESTABLE", reason };
+}
+
test("the model: only one in verdicts.models — the asked one, else the first on the route; none, or code, refused", () => {
const gen = (models: string[], route: "api" | "local" | "code") => {
const g = sanitizeGeneration({ verdicts: { bar: { agreement: 0.6, contradictedRecall: 0.5, notFoundRecall: 0.5 }, models } });
@@ -81,7 +88,7 @@ test("the model: only one in verdicts.models — the asked one, else the first o
test("proposals: the unruled claims only, the bench's prompt, written to the sidecar — never a verdict on a claim; an unlisted model refused", async () => {
const s = await store();
const before = readFileSync(s.file, "utf8");
- const { ask, asked } = stub((text) => ({ reason: `the window shows it: ${text.slice(0, 20)}`, verdict: text.includes("oven") ? "PARTLY" : "NOT_FOUND" }));
+ const { ask, asked } = stub((text) => v3(text.includes("oven") ? "PARTLY" : "NOT_FOUND", `the window shows it: ${text.slice(0, 20)}`));
await assert.rejects(proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: [], ask }), /models is empty/);
await assert.rejects(proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: ["claude-opus-5-5"], ask }), /has not cleared the verdict bench's bar/);
assert.equal(asked.length, 0);
@@ -111,7 +118,7 @@ async function shown(paths: Parameters<typeof readVerdictProposals>[1], id: stri
test("the sidecar survives makeCurrent; approve sets the verdict through patchArticle, reject leaves the claim; a reviewed proposal is never asked again", async () => {
const s = await store();
- const { ask, asked } = stub(() => ({ reason: "shown", verdict: "CONTRADICTED" }));
+ const { ask, asked } = stub(() => v3("CONTRADICTED", "shown"));
await proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: [QWEN], ask, now: () => NOW });
// A new iteration made current replaces report.json whole: the proposals stay.
const report = JSON.parse(readFileSync(s.file, "utf8"));
@@ -156,7 +163,7 @@ test("the sidecar survives makeCurrent; approve sets the verdict through patchAr
test("review fix 1: a revision that drops a claim shifts the ids — the shifted proposal is stale (409, not waiting), and the new claim under the id is asked again", async () => {
const s = await store();
- const { ask, asked } = stub((text) => ({ reason: `on ${text.slice(0, 30)}`, verdict: "CONTRADICTED" }));
+ const { ask, asked } = stub((text) => v3("CONTRADICTED", `on ${text.slice(0, 30)}`));
await proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: [QWEN], ask, now: () => NOW });
// r02 rejected by the operator.
await reviewVerdictProposal({ article: s.id, claim: "r02", decision: "reject", ...(await shown(s.paths, s.id, "r02")) }, s.paths, NOW);
@@ -186,7 +193,7 @@ test("review fix 1: a revision that drops a claim shifts the ids — the shifted
test("review fix 2: the review is a compare-and-set — a proposal rewritten between view and click is refused; concurrent approve and reject: one wins", async () => {
const s = await store();
- const { ask } = stub(() => ({ reason: "shown", verdict: "CORROBORATED" }));
+ const { ask } = stub(() => v3("CORROBORATED", "shown"));
await proposeVerdicts({ article: s.id, model: QWEN }, { paths: s.paths, cuesOf, llm: {}, allowed: [QWEN], ask, now: () => NOW });
const seen = await shown(s.paths, s.id, "r02");
// Another run rewrites r02 to PARTLY after the operator saw CORROBORATED.
@@ -239,7 +246,7 @@ test("an API model: held to maxUsd before each call; the spend is the Meter's",
const s = await store();
const api = await startFakeAnthropic();
try {
- for (let i = 0; i < 3; i++) api.push(toolTurn("answer", { reason: "shown", verdict: "PARTLY" }));
+ for (let i = 0; i < 3; i++) api.push(toolTurn("answer", v3("PARTLY", "shown")));
const out = await proposeVerdicts(
{ article: s.id, model: "claude-opus-5-5", maxUsd: 0.015 },
{ paths: s.paths, cuesOf, llm: { anthropic: { baseUrl: api.url, env: { ANTHROPIC_API_KEY: api.key } } }, allowed: ["claude-opus-5-5"] },
diff --git a/common/lib/report/draft/tasks/verdicts.ts b/common/lib/report/draft/tasks/verdicts.ts
@@ -23,7 +23,6 @@ import { Meter, providerOf, StructuredAnswerError, structuredAnswer, type LlmCon
import type { GenerationSettings } from "../../../generationSettings";
import type { Paths } from "../../../paths";
import type { CuesOf } from "../../convertShared";
-import { isVerdict } from "../../verdicts";
import { claimFingerprint, markVerdictsJob, proposalIsCurrent, readVerdictProposals, recordVerdictProposals, VerdictProposalsError, type NewProposal } from "../../verdictProposals";
import {
benchPrompt,
@@ -32,7 +31,7 @@ import {
estimateCall,
LOCAL_PROMPT_CAP,
PROMPT_VERSION,
- REASON_MAX,
+ readVerdictAnswer,
unruledItemsOfReport,
VERDICT_ANSWER_SCHEMA,
type BenchAsk,
@@ -182,13 +181,15 @@ export async function proposeVerdicts(input: VerdictsInput, deps: VerdictsDeps):
}
const prompt = benchPrompt(item, local ? { capTokens: localCap } : {});
try {
- const ans = await ask<{ verdict?: unknown; reason?: unknown }>(prompt.system, prompt.user, VERDICT_ANSWER_SCHEMA, model);
- const reason = typeof ans?.reason === "string" ? ans.reason.trim().slice(0, REASON_MAX) : "";
- if (!isVerdict(ans?.verdict) || !reason) throw new StructuredAnswerError(`not a verdict and a reason: ${JSON.stringify(ans ?? null).slice(0, 120)}`);
- const p: NewProposal = { verdict: ans.verdict, reason, model, promptVersion: PROMPT_VERSION, at: now().toISOString(), fingerprint: fingerprints.get(item.claim) ?? "" };
+ const ans = await ask<unknown>(prompt.system, prompt.user, VERDICT_ANSWER_SCHEMA, model);
+ // The bench's reading (bench v3: the verdict follows from the parts).
+ const read = readVerdictAnswer(ans);
+ if (!read.ok) throw new StructuredAnswerError(`not a verdict and a reason (${read.error}): ${JSON.stringify(ans ?? null).slice(0, 120)}`);
+ const { verdict, reason } = read;
+ const p: NewProposal = { verdict, reason, model, promptVersion: PROMPT_VERSION, at: now().toISOString(), fingerprint: fingerprints.get(item.claim) ?? "" };
const { written, stale } = await recordVerdictProposals(article, { [item.claim]: p }, deps.paths, now());
if (written.length) proposed.push(item.claim);
- log(`${item.claim}: ${ans.verdict} — ${reason}${stale.length ? " (not kept: the claim was ruled or changed meanwhile)" : ""}`);
+ log(`${item.claim}: ${verdict} — ${reason}${stale.length ? " (not kept: the claim was ruled or changed meanwhile)" : ""}`);
} catch (err) {
// The article gone (deleted mid-run): nothing more is written for it.
if (err instanceof VerdictProposalsError && err.status === 404) throw err;
diff --git a/common/lib/report/verdicts.mjs b/common/lib/report/verdicts.mjs
@@ -21,28 +21,36 @@ export const VERDICT_DEFAULTS = Object.freeze({
});
/**
- * What each verdict MEANS — the operator's standard (release 29 V1), the one
- * copy: the verdict bench's prompt (draft/bench/prompt.ts), the verdict
- * proposals that reuse it, REPORT.md (lib/report/docs.ts) and umtool's bench
- * page read these sentences; nowhere else spells them out. A change here
- * changes the bench's prompt: bump its PROMPT_VERSION with it.
+ * What each verdict MEANS — the operator's standard, the one copy: the verdict
+ * bench's prompt (draft/bench/prompt.ts), the verdict proposals that reuse it,
+ * REPORT.md (lib/report/docs.ts) and umtool's bench page read these
+ * sentences; nowhere else spells them out. A change here changes the bench's
+ * prompt: bump its PROMPT_VERSION with it.
+ *
+ * Bench v3 (release 30) rewrote them from the operator's 147 rulings: a claim
+ * is ruled by its PARTS (the separate things it says were said or done), and
+ * the verdict follows from what the evidence shows of each part — the rule
+ * `verdictOfParts` (draft/bench/prompt.ts) applies in code.
*/
export const VERDICT_MEANINGS = Object.freeze({
CORROBORATED:
- "the substance of the claim is shown by the cited words. Framing, emphasis, or a detail the transcript does not show does not demote it.",
+ "every part of the claim is shown by the cited evidence in substance: other words, a softer phrasing or a hedge still count.",
PARTLY:
- "a part of the claim is shown by the transcript to be overstated or wrong. A part that is only not shown does not make a claim PARTLY.",
+ "some parts of the claim are shown and at least one is not: it is not in the evidence, or the evidence shows it wrong (a different number, date or person, or words put in quotation marks that are not the speaker's).",
CONTRADICTED:
- "the substance of the claim is shown to be wrong: the transcript shows the opposite of it, or something that cannot be true at the same time.",
+ "no part of the claim is shown, and the evidence shows a part wrong: the opposite of it, or something that cannot be true at the same time.",
NOT_FOUND:
- "the claim could be checked against what was said, and its substance is not in the transcript shown: the topic may come up without what the claim says about it.",
+ "no part of the claim is shown or shown wrong by the evidence: the topic may come up without what the claim says about it.",
UNTESTABLE:
- "the claim is an opinion, a judgement, a prediction, or anything else a transcript cannot show to be true or false.",
+ "the claim is an opinion, a judgement, a prediction, or anything else a record cannot show to be true or false.",
});
-/** The rule between the two verdicts a ruling most often falls between. */
-export const VERDICT_TIE_RULE =
- "In doubt between CORROBORATED and PARTLY: CORROBORATED, unless a part of the claim is shown overstated or wrong.";
+/**
+ * How a claim splits into PARTS (bench v3; it replaced release 29's
+ * CORROBORATED/PARTLY tie rule, which the rulings did not bear out).
+ */
+export const VERDICT_PARTS_RULE =
+ "A claim's parts are the separate things it says were said or done: a statement, an event, a number, a date, words it puts in quotation marks as someone's. A word that only describes what was said (its tone, motive or importance) is not a part, and neither is a fact about the world outside what was said (whether a thing said is true). A part about how often something was said, or that it was never said, is shown when the evidence is consistent with it and does not show otherwise.";
/** The longest label an override may set, in characters (trimmed). */
export const VERDICT_LABEL_MAX = 24;
diff --git a/common/lib/report/verdicts.ts b/common/lib/report/verdicts.ts
@@ -7,7 +7,7 @@ import {
VERDICT_DEFAULTS as VERDICT_DEFAULTS_JS,
VERDICT_LABEL_MAX as VERDICT_LABEL_MAX_JS,
VERDICT_MEANINGS as VERDICT_MEANINGS_JS,
- VERDICT_TIE_RULE as VERDICT_TIE_RULE_JS,
+ VERDICT_PARTS_RULE as VERDICT_PARTS_RULE_JS,
VERDICTS as VERDICTS_JS,
resolveVerdicts as resolveVerdictsJs,
verdictOverrideProblems as verdictOverrideProblemsJs,
@@ -25,11 +25,11 @@ export const VERDICT_DEFAULTS = VERDICT_DEFAULTS_JS as Readonly<Record<Verdict,
export const VERDICT_LABEL_MAX: number = VERDICT_LABEL_MAX_JS;
-// What each verdict means (the operator's standard) and the CORROBORATED/PARTLY
-// tie rule: the one copy the bench's prompt, REPORT.md and umtool read.
+// What each verdict means (the operator's standard) and how a claim splits
+// into parts: the one copy the bench's prompt, REPORT.md and umtool read.
export const VERDICT_MEANINGS = VERDICT_MEANINGS_JS as Readonly<Record<Verdict, string>>;
-export const VERDICT_TIE_RULE: string = VERDICT_TIE_RULE_JS;
+export const VERDICT_PARTS_RULE: string = VERDICT_PARTS_RULE_JS;
export const VERDICT_COLOR_RE: RegExp = VERDICT_COLOR_RE_JS;
diff --git a/umtool/app/tools/bench/page.tsx b/umtool/app/tools/bench/page.tsx
@@ -7,12 +7,13 @@ import {
BASELINE_MODEL,
VERDICTS,
VERDICT_MEANINGS,
- VERDICT_TIE_RULE,
+ VERDICT_PARTS_RULE,
filterBenchRows,
passesBar,
readBenchRuns,
readBenchView,
readVerdictsPolicy,
+ type BenchItemRow,
} from "@/lib/bench";
import type { MarkedScore, ModelScore } from "yt-dlp-transcript-common/lib/report/draft/bench/index";
import type { GenerationVerdicts } from "yt-dlp-transcript-common/lib/generationSettings";
@@ -34,6 +35,9 @@ export const dynamic = "force-dynamic";
// whose answers changed); a Right / Wrong mark on each disagreement; the
// not-CORROBORATED precision and recall beside the bar, marked and not; what
// the verdicts mean (the one copy, verdicts.mjs).
+//
+// Bench v3: under each claim, what the model saw (its windows and its cited
+// posts and pages); under each answer, the model's parts and their findings.
type Search = { run?: string; model?: string; verdict?: string; compare?: string };
@@ -187,6 +191,7 @@ function RunView({
<td className="max-w-[28rem] py-1.5 pr-2">
<div className="font-mono text-[10px] text-[var(--color-dim)]">{r.key}</div>
{r.text}
+ <Seen row={r} />
</td>
<td className="py-1.5 pr-2 font-mono">{r.verdict}</td>
{models.map((m) => {
@@ -198,6 +203,8 @@ function RunView({
) : a.verdict ? (
<>
<span className={`font-mono ${a.verdict === r.verdict ? "text-[var(--color-good)]" : "text-[var(--color-bad)]"}`}>{a.verdict}</span>
+ {a.parts && <Parts parts={a.parts} />}
+ {a.checkable === false && <div className="micro">not checkable</div>}
{a.reason && <div className="text-[var(--color-dim)]">{a.reason}</div>}
{a.verdict !== r.verdict && <MarkButtons run={s.id} model={m} item={r.key} initial={a.mark} />}
</>
@@ -224,7 +231,7 @@ function RunView({
</div>
))}
</dl>
- <p className="mt-1 text-[var(--color-dim)]">{VERDICT_TIE_RULE}</p>
+ <p className="mt-1 text-[var(--color-dim)]">{VERDICT_PARTS_RULE}</p>
</details>
{s.dropped && s.dropped.length > 0 && (
<details>
@@ -254,6 +261,64 @@ function RunView({
);
}
+const stampOf = (sec: number) => {
+ const t = Math.max(0, Math.floor(sec));
+ const h = Math.floor(t / 3600);
+ const m = Math.floor((t % 3600) / 60);
+ const ss = String(t % 60).padStart(2, "0");
+ return h ? `${h}:${String(m).padStart(2, "0")}:${ss}` : `${m}:${ss}`;
+};
+
+// What the model saw beside the claim (bench v3): the cited posts and pages,
+// and each transcript window — its span, what ended it, its cues.
+function Seen({ row }: { row: BenchItemRow }) {
+ return (
+ <details data-seen={row.key} className="mt-1">
+ <summary className="micro cursor-pointer">
+ what the model saw · {row.windows.length} window{row.windows.length === 1 ? "" : "s"}
+ {row.evidence.length ? ` · ${row.evidence.length} post${row.evidence.length === 1 ? "" : "s"} or page${row.evidence.length === 1 ? "" : "s"}` : ""}
+ </summary>
+ {row.evidence.length > 0 && (
+ <ul aria-label="posts and pages" className="mt-1 flex flex-col gap-0.5">
+ {row.evidence.map((e) => (
+ <li key={e.citation} data-evidence={e.kind}>
+ <span className="micro">{[e.kind, e.label ?? e.title ?? e.channel, e.date].filter(Boolean).join(" · ")}</span> “{e.quote}”
+ </li>
+ ))}
+ </ul>
+ )}
+ {row.windows.map((w) => (
+ <div key={`${w.channel}/${w.id}/${w.from}`} data-window={`${w.channel}/${w.id}`} className="mt-1">
+ <div className="micro">
+ {w.label ?? `${w.channel}/${w.id}`} · {stampOf(w.from)}–{stampOf(w.to)}
+ {w.bound ? ` · ended by ${w.bound}` : ""} · {w.cues.length} lines
+ </div>
+ <div className="max-h-48 overflow-y-auto font-mono text-[10px] text-[var(--color-dim)]">
+ {w.cues.map((c) => (
+ <div key={c.start}>
+ [{stampOf(c.start)}] {c.text}
+ </div>
+ ))}
+ </div>
+ </div>
+ ))}
+ </details>
+ );
+}
+
+// The model's parts and what it found of each (bench v3: the verdict follows from them).
+function Parts({ parts }: { parts: NonNullable<BenchItemRow["answers"][string]["parts"]> }) {
+ return (
+ <ul aria-label="parts" className="mt-0.5 flex flex-col">
+ {parts.map((p, i) => (
+ <li key={i} data-part-finding={p.finding}>
+ <span className="font-mono text-[10px] text-[var(--color-dim)]">{p.finding}</span> {p.part}
+ </li>
+ ))}
+ </ul>
+ );
+}
+
// "Not CORROBORATED" as the positive class — the claims a proposal would put
// in front of the operator — plain and with the operator's marks applied.
function Precision({ scores, marked }: { scores: ModelScore[]; marked: MarkedScore[] }) {
diff --git a/umtool/e2e/fixtures/bench-fixture.mjs b/umtool/e2e/fixtures/bench-fixture.mjs
@@ -23,7 +23,7 @@ const said = {
[QWEN]: ["CORROBORATED", "CORROBORATED", "CORROBORATED", null],
};
-export function makeBenchRun(root, o = {}) {
+export function makeBenchRun(root, o = { parts: true }) {
const run = o.run ?? BENCH_RUN;
const answers = o.said ?? said;
const dir = path.join(root, run);
@@ -37,7 +37,17 @@ export function makeBenchRun(root, o = {}) {
verdict,
quotes: [{ citation: `q${i}`, channel: "synth-kitchen", id: "bread-day-01", start: 10 + i * 15, end: 14 + i * 15, quote: "a line" }],
windows: [{ channel: "synth-kitchen", id: "bread-day-01", from: 0, to: 80, cited: [{ start: 10 + i * 15, end: 14 + i * 15 }], cues: [{ start: 10 + i * 15, end: 14 + i * 15, text: "a line" }] }],
+ // Bench v3: a cited post beside the transcript (c2's).
+ ...(id === "c2" ? { evidence: [{ citation: "p1", kind: "post", channel: "synth-kitchen-posts", quote: "the oven was off for a week", date: "2026-01-06" }] } : {}),
}));
+ // Bench v3: the parts a v3 answer carries, consistent with its verdict.
+ const partsOf = (v, claim) =>
+ ({
+ CORROBORATED: [{ part: `${claim}: what the article says`, finding: "shown" }],
+ PARTLY: [{ part: `${claim}: what the article says`, finding: "shown" }, { part: `${claim}: how long`, finding: "not shown" }],
+ CONTRADICTED: [{ part: `${claim}: what the article says`, finding: "shown wrong" }],
+ NOT_FOUND: [{ part: `${claim}: what the article says`, finding: "not shown" }],
+ })[v];
const results = [];
for (const [model, verdicts] of Object.entries(answers)) {
items.forEach((it, i) => {
@@ -47,6 +57,7 @@ export function makeBenchRun(root, o = {}) {
model,
verdict: v,
...(v ? { reason: `${model} read the window for ${it.claim}` } : { failure: "parse", error: "the answer is not JSON" }),
+ ...(v && o.parts && model === SONNET ? { parts: partsOf(v, it.claim) } : {}),
ms: 1200 + i * 100,
usd: model === SONNET ? 0.004 : 0,
inputTokens: 900,
diff --git a/umtool/e2e/verdict-bench.spec.ts b/umtool/e2e/verdict-bench.spec.ts
@@ -60,6 +60,14 @@ test("the run: each model's tile against the baseline, the matrix, the items wit
await expect(rows.nth(3)).toHaveAttribute("data-item", "synth-bench/c1");
await expect(rows.nth(0).locator(`[data-model="${SONNET}"]`)).toContainText("read the window for c2");
await expect(rows.nth(2).locator(`[data-model="${QWEN}"]`)).toContainText("parse: the answer is not JSON");
+ // Bench v3: what the model saw (the cited post, the window's lines), and the model's parts.
+ const c2 = rows.nth(0);
+ await expect(c2.locator('[data-seen="synth-bench/c2"] summary')).toHaveText("what the model saw · 1 window · 1 post or page");
+ await c2.locator('[data-seen="synth-bench/c2"] summary').click();
+ await expect(c2.locator('[data-evidence="post"]')).toContainText("the oven was off for a week");
+ await expect(c2.locator('[data-window="synth-kitchen/bread-day-01"]')).toContainText("[0:25] a line");
+ await expect(c2.locator(`[data-model="${SONNET}"] [data-part-finding="shown"]`)).toContainText("c2: what the article says");
+ await expect(c2.locator(`[data-model="${QWEN}"] [data-part-finding]`)).toHaveCount(0);
// By model: that model's disagreements first, its column alone.
await page.getByRole("region", { name: "items" }).getByRole("link", { name: SONNET, exact: true }).click();
await expect(rows.nth(0)).toHaveAttribute("data-item", "synth-bench/c2");
diff --git a/umtool/lib/bench.ts b/umtool/lib/bench.ts
@@ -20,7 +20,7 @@ import {
type RunCompare,
type VerdictBar,
} from "yt-dlp-transcript-common/lib/report/draft/bench/index";
-import { VERDICT_MEANINGS, VERDICT_TIE_RULE, VERDICTS, isVerdict, type Verdict } from "yt-dlp-transcript-common/lib/report/verdicts";
+import { VERDICT_MEANINGS, VERDICT_PARTS_RULE, VERDICTS, isVerdict, type Verdict } from "yt-dlp-transcript-common/lib/report/verdicts";
import { sanitizeGeneration, type GenerationVerdicts } from "yt-dlp-transcript-common/lib/generationSettings";
import { BenchMarksError, setBenchMark } from "./bench-marks.mjs";
import { askEditor, EditorError } from "@/lib/articles/generation";
@@ -33,6 +33,9 @@ import { askEditor, EditorError } from "@/lib/articles/generation";
// — read from and written through the editor's settings action, as the
// generation policy is.
//
+// Bench v3 (release 30): each item row carries what the model saw (the
+// windows and the cited posts and pages) and each answer the model's parts.
+//
// Release 29 V1: each run's prompt version and items hash (a run before V1:
// version "1", its hash computed from its items), a comparison with another
// run over the same items, the operator's Right/Wrong marks on disagreements
@@ -51,7 +54,14 @@ export type BenchItemRow = {
claim: string;
text: string;
verdict: Verdict;
- answers: Record<string, { verdict: Verdict | null; reason?: string; failure?: string; error?: string; mark?: "right" | "wrong" }>;
+ // What the model saw beside the claim (bench v3): each window's span and
+ // cues, and the cited posts and pages.
+ windows: Pick<BenchItem["windows"][number], "channel" | "id" | "label" | "from" | "to" | "bound" | "cues">[];
+ evidence: NonNullable<BenchItem["evidence"]>;
+ answers: Record<
+ string,
+ { verdict: Verdict | null; reason?: string; failure?: string; error?: string; mark?: "right" | "wrong"; parts?: BenchResult["parts"]; checkable?: false }
+ >;
// A model whose answer is not the operator's (failures included).
disagree: string[];
};
@@ -114,10 +124,22 @@ function rowsOf(items: readonly BenchItem[], results: readonly BenchResult[], mo
...(r.failure ? { failure: r.failure } : {}),
...(r.error ? { error: r.error } : {}),
...(mark ? { mark } : {}),
+ ...(r.parts?.length ? { parts: r.parts } : {}),
+ ...(r.checkable === false ? { checkable: false as const } : {}),
};
if (r.verdict !== it.verdict) disagree.push(m);
}
- return { key: it.key, report: it.report, claim: it.claim, text: it.text, verdict: it.verdict, answers, disagree };
+ return {
+ key: it.key,
+ report: it.report,
+ claim: it.claim,
+ text: it.text,
+ verdict: it.verdict,
+ windows: it.windows.map((w) => ({ channel: w.channel, id: w.id, ...(w.label ? { label: w.label } : {}), from: w.from, to: w.to, ...(w.bound ? { bound: w.bound } : {}), cues: w.cues })),
+ evidence: it.evidence ?? [],
+ answers,
+ disagree,
+ };
});
}
@@ -176,7 +198,7 @@ export async function markBenchItem(run: string, model: string, key: string, ver
return { mark: verdict };
}
-export { VERDICT_MEANINGS, VERDICT_TIE_RULE };
+export { VERDICT_MEANINGS, VERDICT_PARTS_RULE };
// The rows a filter keeps, disagreements first (then in item order).
export function filterBenchRows(rows: readonly BenchItemRow[], f: { model?: string; verdict?: string }): BenchItemRow[] {