// 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 // 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 (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, windows and // evidence — never its `verdict` (the operator's ruling, the answer). 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 = "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: `Then: what the evidence shows about the claim, in one or two plain sentences of at most ${REASON_MAX} characters.`, }, }, 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[], 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 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), 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 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.", `- 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.", "", "What the verdict will be, from your findings:", ...VERDICTS.map((v) => `- ${v}: ${VERDICT_MEANINGS[v]}`), "", `A part is at most ${PART_MAX} characters; the reason is at most ${REASON_MAX} characters.`, ].join("\n"); const stamp = (s: number) => { const t = Math.max(0, Math.floor(s)); 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}`; }; type Prompted = Pick; function render(item: Prompted, windows: BenchWindow[]): string { const lines: string[] = []; if (item.title) lines.push(`Report: ${item.title}`); if (item.section) lines.push(`Section: ${item.section}`); lines.push(`Claim: ${item.text}`, "", "Cited lines:"); const said = (q: Prompted["quotes"][number]) => [`speaker: ${q.speaker ?? q.channel}`, q.date ? `recorded: ${q.date}` : ""].filter(Boolean).join("; "); for (const q of item.quotes) { 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); const of = [`channel: ${w.channel}`, q?.date ? `recorded: ${q.date}` : ""].filter(Boolean).join("; "); lines.push("", `## ${w.label ?? `Recording ${i + 1}`}, ${stamp(w.from)} to ${stamp(w.to)} (${of})`); if (!w.cues.length) lines.push("(trimmed to fit)"); for (const c of w.cues) lines.push(`[${stamp(c.start)}] ${c.text}`); }); return lines.join("\n"); } // The distance of a cue from the nearest cited span of its window, in seconds. function distance(w: BenchWindow, c: { start: number; end: number }): number { let best = Number.POSITIVE_INFINITY; for (const s of w.cited) { const d = c.end < s.start ? s.start - c.end : c.start > s.end ? c.start - s.end : 0; best = Math.min(best, d); } return best; } export type BenchPrompt = { system: string; user: string; estimate: number; cuesShown: number; cuesTrimmed: number }; // The prompt for one item. With `capTokens` (a local model), the window is // trimmed until system + user + the schema fit under it; without, it is whole. export function benchPrompt(item: Prompted, o: { capTokens?: number } = {}): BenchPrompt { const total = item.windows.reduce((s, w) => s + w.cues.length, 0); const estimateOf = (user: string) => promptEstimate({ messages: [{ role: "system", content: VERDICT_BENCH_SYSTEM }, { role: "user", content: user }], format: VERDICT_ANSWER_SCHEMA }); const whole = render(item, item.windows); const cap = o.capTokens; if (cap === undefined || estimateOf(whole) <= cap) { return { system: VERDICT_BENCH_SYSTEM, user: whole, estimate: estimateOf(whole), cuesShown: total, cuesTrimmed: 0 }; } // Every cue, farthest from a cited span first: dropping the first k of them // is the k-trim. The fewest drops that fit, found by bisection. const order: { w: number; c: number; d: number }[] = []; item.windows.forEach((w, wi) => w.cues.forEach((c, ci) => order.push({ w: wi, c: ci, d: distance(w, c) }))); order.sort((a, b) => b.d - a.d || a.w - b.w || b.c - a.c); const keepAfter = (k: number): BenchWindow[] => { const drop = new Set(order.slice(0, k).map((e) => `${e.w}:${e.c}`)); return item.windows.map((w, wi) => ({ ...w, cues: w.cues.filter((_, ci) => !drop.has(`${wi}:${ci}`)) })); }; let lo = 0; let hi = order.length; while (lo < hi) { const mid = (lo + hi) >> 1; if (estimateOf(render(item, keepAfter(mid))) <= cap) hi = mid; else lo = mid + 1; } const user = render(item, keepAfter(lo)); return { system: VERDICT_BENCH_SYSTEM, user, estimate: estimateOf(user), cuesShown: total - lo, cuesTrimmed: lo }; } // The cap a local prompt is held to: the ollama client's (8k), less a margin // for the estimate's slack. export const LOCAL_PROMPT_CAP = PROMPT_CAP_TOKENS - 200;