Skip to content

Benchmarking and comparison guide

This guide describes how to run the supported benchmark flows and how to compare results. Run all commands from dokimi/.

Comparison modes

dokimi has four practical comparison modes:

  • Static snapshot comparison: compare documentation quality snapshots from python cli.py docs check.
  • LLM context comparison: compare one answer model's context-arm and baseline answers. Persisted JSON keeps the legacy with_docs and without_docs keys for compatibility.
  • Multi-model comparison: run multiple answer models on the same question set and compare their evaluated JSON outputs.
  • Treatment-arm comparison: compare baseline against docs, MCP, skills, profiles, or agentic tool-use arms.

Keep only one axis variable at a time. For example, a model comparison should reuse the same questions, doc source, judge setup, and retrieval configuration.

Static documentation benchmark

Use the static benchmark when the question is "did this documentation snapshot get structurally better or worse?"

python cli.py docs check \
  --root . \
  --spec benchmarks/spec.v1.yaml \
  --out baselines/current.json \
  --out-md reports/current.md

The JSON snapshot contains summary metrics such as coverage, freshness, readability, and example pass rate. The Markdown report is a human-readable view of the same run.

Compare a candidate snapshot with a saved baseline. The repository ships no committed baseline — the base is a snapshot you generated yourself and kept, so keep the first baselines/current.json you are happy with:

cp baselines/current.json baselines/baseline.json   # once, after a clean run

python cli.py docs compare \
  --baseline baselines/baseline.json \
  --candidate baselines/current.json \
  --spec benchmarks/spec.v1.yaml \
  --out reports/compare.json \
  --out-md reports/compare.md

The compare command computes candidate-minus-baseline deltas and, when --spec is passed, applies configured regression thresholds. Both snapshots must come from the same docs corpus definition, otherwise the deltas are meaningless.

Equivalent Make targets are available from the repository root; BASE defaults to baselines/baseline.json:

make benchmark-run
make benchmark-compare                       # uses baselines/baseline.json
make benchmark-compare BASE=path/to/base.json

LLM context benchmark

Use the LLM benchmark when the question is "does documentation or another context artifact improve answers?"

Default models

Every command takes its models from dokimi/defaults.py, and every surface (benchmark, answers, eval, arms, subjects, evaluate, eval questions, eval personas, novelty) uses the same three:

Role Default List price, input/output per MTok
Answer model (the model under test) openai/gpt-6.1-sol $2 / $10
Judge (also RAGAS, eval score panel, novelty extractor and retention adjudicator) anthropic/claude-sonnet-5-5 $2 / $10
Generator (personas, questions, validation, panel review, gap fill) openai/gpt-6.1-sol $2 / $10

The judge is a different family from the answerer, so the judge-independence warning stays quiet on default flags; answering with claude-sonnet-5-5 moves the novelty judge to openai/gpt-6.1-sol, and a judging run that answers with it on the default judge's provider is refused (see below). Escalation judges (--escalate-model) have no default; claude-opus-5-5 ($4 / $20) is the natural tie-break above the Sonnet judge. On --provider amazon-bedrock the bare names claude-sonnet-5-5, claude-opus-5-5 and claude-haiku-5-5 resolve to the us.anthropic.* inference profiles of the same name; outside the US, set ANTHROPIC_DEFAULT_SONNET_MODEL (or _OPUS_/_HAIKU_) to the regional profile of the same model (eu.anthropic.claude-sonnet-5-5), or pass the full profile id or ARN. A variable naming another model is ignored for these names. The novelty judge no longer follows --provider: with no judge flags it runs on anthropic, so a Bedrock-only run passes --judge-provider amazon-bedrock (and atoms/shorten --provider amazon-bedrock). --judge-provider alone takes the default judge that runs on that provider, the same on every surface: claude-sonnet-5-5 on anthropic and amazon-bedrock, opus on claude-cli (sonnet when the answerer is opus), gpt-6.1-sol on openai. When that judge is the model under measurement (gpt-6.1-sol on openai, the default answer model) a judging run exits before its first answer and asks for --judge-model; so does --model claude-sonnet-5-5 with the default --judge-provider anthropic. eval score and eval judge have no answerer and judge with gpt-6.1-sol on openai. On any other provider (google, google-vertex, openrouter) the run exits before the first call and asks for --judge-model. A matrix (arms matrix-run --matrix-cells) has one judge for all its cells; a cell whose model is that judge is warned about, not refused.

Defaults changed on 2026-10-13: results are not comparable with older baselines; re-baseline. Before, benchmark/answers/eval answered with gpt-5.5 and judged with claude-sonnet-4-5-20250929, while arms, subjects, evaluate, eval questions, eval personas and novelty answered, judged and generated with an obsolete small OpenAI model. A score, delta or cost produced with default flags before that date is not comparable with one produced after: re-run the baseline (the same question set via --questions-from, the same arms) under the new defaults, or pin the old models with --model/--judge-model to extend an old series. On the surfaces that used the small model, a default-flag run now costs roughly 13-17x more per token.

For registered libraries, prefer the one-command wrapper:

python cli.py benchmark run \
  --library onetbb \
  --model gpt-6.1-sol \
  --provider openai \
  --judge-model claude-sonnet-5-5 \
  --judge-provider anthropic \
  --out-dir results/onetbb_sol

The run writes:

  • results/onetbb_sol/personas/onetbb.json
  • results/onetbb_sol/questions/onetbb.json
  • results/onetbb_sol/answers/onetbb.json
  • results/onetbb_sol/eval/onetbb.json
  • results/onetbb_sol/reports/onetbb.md

The comparison inside one run is always:

delta = context-arm score - baseline score

Positive delta means the context helped on that judged question. Negative delta means either retrieval hurt the answer, the model already knew enough without context, or the retrieved chunks were irrelevant.

For stability-sensitive claims, run the same configuration several times:

python cli.py benchmark run \
  --library onetbb \
  --model gpt-6.1-sol \
  --judge-model claude-sonnet-5-5 \
  --judge-provider anthropic \
  --reps 3 \
  --out-dir results/onetbb_sol

Multi-run mode creates numbered run directories and prints the mean and standard deviation of the context-arm average.

Fair multi-model comparison

A fair model comparison must use the same questions for every model. First create or choose a seed run:

python cli.py benchmark run \
  --library onedal \
  --model gpt-6.1-sol \
  --judge-model claude-sonnet-5-5 \
  --judge-provider anthropic \
  --out-dir results/onedal_seed

Then reuse that question set for each model:

python cli.py benchmark run \
  --library onedal \
  --questions-from results/onedal_seed \
  --model gpt-6-astra \
  --provider openai \
  --judge-model claude-sonnet-5-5 \
  --judge-provider anthropic \
  --out-dir results/onedal_astra

python cli.py benchmark run \
  --library onedal \
  --questions-from results/onedal_seed \
  --model claude-opus-5-5 \
  --provider anthropic \
  --judge-model claude-sonnet-5-5 \
  --judge-provider anthropic \
  --out-dir results/onedal_opus55

Interpret model comparisons using two separate signals:

  • Absolute quality: the context-arm average from each run.
  • Context benefit: the average delta from each run.

Do not rank models by delta alone. A strong model can have a small delta because its baseline score is already high.

Generate a cross-run dashboard when you have multiple eval files:

python cli.py dashboard generate \
  --results-dir results \
  --out-dir reports

The dashboard reads evaluation artifacts and writes reports/DASHBOARD.md and reports/dashboard.json. A directory under --results-dir that cannot be listed is an input error (exit 2): the command names it and writes nothing, rather than leaving out the result files below it.

Standalone pipeline commands

Use the lower-level commands when you need explicit control over each artifact:

python cli.py answers generate \
  --product oneTBB \
  --questions <content-checkout>/questions/onetbb_golden.json \
  --out results/onetbb_golden/answers/onetbb.json \
  --model gpt-6.1-sol \
  --provider openai \
  --debug-retrieval

python cli.py eval score pointwise \
  --product oneTBB \
  --answers results/onetbb_golden/answers/onetbb.json \
  --out results/onetbb_golden/eval/onetbb.json \
  --judge-model claude-sonnet-5-5 \
  --judge-provider anthropic

python cli.py report eval \
  --product oneTBB \
  --eval results/onetbb_golden/eval/onetbb.json \
  --out results/onetbb_golden/reports/oneTBB_full.md

Use report generate instead of report eval when you also want the questions file included in the report generator:

python cli.py report generate \
  --product oneTBB \
  --eval results/onetbb_golden/eval/onetbb.json \
  --questions <content-checkout>/questions/onetbb_golden.json \
  --out results/onetbb_golden/reports/oneTBB.md \
  --format markdown

Treatment-arm comparison

Use treatment arms when comparing context artifacts rather than models:

python cli.py arms run \
  --product oneTBB \
  --questions <content-checkout>/questions/onetbb_golden.json \
  --arm "baseline,docs,skill:<content-checkout>/skills/onetbb-quickstart" \
  --judge \
  --out results/arms/onetbb_skill.json \
  --out-md results/arms/onetbb_skill.md

The baseline arm is the control. Every other arm is compared against it. Keep the answer model and judge fixed when comparing arms.

Skill arms in repository mode

repo run arms take the same + composition. Besides guidance:none, guidance:raw, guidance:bridge and guidance:overlay, an arm can install Claude Code skills into the task workspace at .claude/skills/<dir name>/ before the agent starts:

  • skill:<path>: one skill directory (holding SKILL.md);
  • skill-catalog:<dir>: every subdirectory of <dir> with a SKILL.md, so the agent has to pick the right one.

A relative path is relative to the manifest's eval_dir. An arm without a guidance part keeps the repository's guidance (guidance:raw).

dokimi repo run <repo>@<rev> --model <m1> --model <m2> --name skills \
  --arm guidance:raw,guidance:raw+skill:skills/lint,guidance:none+skill-catalog:skills
dokimi eval check <repo>@<rev> --arm skill-catalog:skills   # paths exist, catalog has expected_skill

When a cell installs skills, its result.json gets a skills object: skills_used (the skills the agent called with the Skill tool, or whose SKILL.md it read), skill_invoked, and skill_selected_correct (the task's optional expected_skill was the first skill it used). repo report counts both per row. Every cell also records cache_read_tokens and cache_write_tokens with the input and output tokens, and repo report --json gives their means.

Guidance formats and packaging

Two guidance arms answer "does the same content work better in another shape?" The model stays the same, so run them per model (one --model each) and compare the cells the way the skill arms are compared above.

  • guidance:format=xml: every guidance file of the base, rendered as XML tags. Each Markdown heading becomes <section level="N" title="...">, closed before the next heading of its level or above; <guidance> wraps the file. No other line changes. The rendering is checked before it is written: it must restore to the original file exactly, so a file with a line that looks like one of these tags (or a heading the restore cannot rebuild) fails the cell's preparation rather than measuring altered content. A heading inside a code fence is body text. A heading line that is not #…######, one space, then the title, with no carriage return, is body text too: a file with CRLF line endings has no sections at all, only the wrapper. guidance:format=md is guidance:raw and is refused as a second name for it. POML is not offered yet: its documented components (role, task, example, ...) have no heading tag, so a POML arm needs a decision about which element a heading maps to.
  • guidance:as-skill: the guidance files are removed (as guidance:none removes them, the AGENTS.<agent>.md overlays too, which are not packaged) and their text goes into .claude/skills/<repo id>-guidance/SKILL.md, each file under a ## File: <path> line with its text verbatim (a missing final newline is added); a symlink to another guidance file (CLAUDE.md to AGENTS.md) is packaged once under that file, and a symlink to any other file fails the cell. The frontmatter description is one fixed sentence for every repository, so the skill is selected on its description alone. Nested guidance files lose the directory they applied to; the skill's name, path and sha256 are recorded in meta.json under guidance_skill. Its usage is recorded separately in result.json as guidance_skill_loaded (null if the trace is unreadable), and is not currently aggregated by repo report.

Reading the two together: guidance:format=xml against guidance:raw isolates the markup, and guidance:as-skill against guidance:raw isolates the packaging (always in context, or loaded on demand), with the fixed description a known confound of the second. The arms do not rewrite the content, so a difference comes from the format or the packaging, not from edited guidance.

Reading the significance tables

Arms are compared paired per question against the one shared baseline sample: a question contributes a pair only when both arms produced an aggregate, so the delta varies by treatment rather than by a re-drawn control.

Because one run tests several arms at once, p-values are corrected for multiplicity — with several arms, the chance that at least one clears 0.05 by luck is well above 0.05. --correction picks the method:

python cli.py arms run ... --correction bh
  • holm (default) — Holm-Bonferroni, controls the family-wise error rate. The honest choice with one baseline and a handful of arms.
  • bh — Benjamini-Hochberg, controls the false discovery rate. Use it when screening many arms and some false positives are acceptable.

Arm contrasts and factorial-interaction contrasts are corrected as separate families — pooling them would inflate the multiplier on both — and each row records its correction_family, family_size (every member), and family_tested (the members whose p can reach 0.05: the multiplier).

Each row's p is one two-sided sign-flip test on the per-question deltas: under the null each delta's sign is a fair coin, and p is the share of sign patterns whose |sum| reaches the observed one (exact up to 16 changed pairs, Monte Carlo with a fixed seed above). The sums are exact, not float sums: a delta of 1e17 does not hide five deltas of 1, and a pattern whose sum falls short of the observed one by no more than the rounding slack of the deltas (at most 1e-9) still reaches it (0.1 + 0.2 against 0.3). A delta within 1e-9 of 0 is a tie and carries no sign, unless the values of its pair are below 1: float noise in a delta scales with the values subtracted, so a pair whose larger value is m below 1 ties within 1e-9 times m (a score of 0.3 against 0.1 + 0.2 is a tie; 1e-12 against 0 is a change, as 1e-3 against 0 is). Each pair keeps its own width whatever the other deltas are, except a pair of zeros, which takes the width of the largest value among all the pairs (at most 1). So over k changed pairs (n_changed) p cannot go below 2/2^k: at 5 or fewer no data whatsoever reaches 0.05. The test runs from 2 pairs and its p is printed. An arm under that floor can never be significant, so it stays out of the multiplier, as a repo compare row does: it counts in family_size but not in family_tested, and its p_adjusted is null. The other arms are corrected as if it were not there, so a verdict near 0.05 can move toward significant where a floor-bound arm shares the family. The 5% family-wise rate holds when whether an arm can reach 0.05 follows from the magnitudes of the deltas alone (which are ties), as under the sign-flip null, where the signs are fair coins given the magnitudes. It can be exceeded if one arm's ties are set by another arm's signs: in a constructed case, 6.9% against 4.6% with the arm kept in the family.

The Sig. column follows the adjusted p-value, not the raw one. Three values are possible:

Sig. Meaning
yes adjusted p < 0.05
no the test ran, a verdict was possible, and the adjusted p did not clear 0.05
— no p (every pair tied), or the floor 2/2^k over the k changed pairs is not below 0.05

A — is not a null result. A constant shift is not a —: eight pairs that all gain +20 have p = 2/2^8 = 0.0078 and the interval [+20, +20]. Cohen's d_z is descriptive (no verdict reads it) and renders — there, where it is unbounded rather than negligible; it is 0.0 when every delta is 0. "Constant" is judged at the deltas' own scale (spread under 1e-9 of the larger of the mean and the sd), so deltas of 1e-12 that differ get a d_z.

The 95% CI inverts the same sign-flip test: it is every shift theta at which the test on the deltas minus theta does not reject at 5%, so it excludes zero exactly when the raw p < 0.05. It is uncorrected: an arm whose interval excludes zero can still read no once Holm lifts its p past 0.05. Under a shift the tied pairs count again, so both ends are open (null, printed -inf / +inf) at 5 or fewer pairs and bounded from 6 on. Six or more pairs that all tie get the interval [0, 0] with no p and a —: nothing speaks against 0, and every other shift moves all the pairs to one side, which the test rejects, as it does every shift but +20 for eight +20 pairs. An end of deltas near 1.8e308 that the search puts past the float maximum is the maximum, never inf. ci_method is sign_flip_inversion; an arms.json written before this method holds student_t, percentile_bootstrap or degenerate there, and p_ttest (with p_wilcoxon, n_wilcoxon) instead of p, and the report still renders it.

The verdicts moved when the arms took this test. The rule before it, adjusted t-test p < 0.05 and Wilcoxon < 0.05, was conservative: on simulated judge deltas its false-positive rate was about 3% at a nominal 5%, against the sign-flip test's 5%, and its t interval contradicted its own verdict in up to 11% of runs. Verdicts near 0.05 move, almost always toward significant: of 418 changed verdicts in that simulation, 2 went the other way (#421).

The judged artifact carries the whole block at summary.per_arm.<arm>.significance, so the table above is renderable from the JSON alone.

When arm names form a a, b, a+b triple (see CombinedTreatment), the artifact also gets summary.interactions: the contrast AB − A − B + baseline computed per question against one shared baseline, which is what tells you whether combining two treatments beats the sum of their separate effects. Running the arms separately and subtracting run averages does not answer that question — the baselines drift between runs. The tie rule above applies to the contrast with the largest of the question's four scores as its value (AB = 1e-300 with A, B and baseline all zero is a change), and to each arm delta with the larger score of its pair.

Scores whose paired difference or interaction contrast leaves the float range are refused by the statistics. The run is still saved: summary.significance_error or summary.interactions_error holds the refusal, the section it names is absent, and the report prints it in place of the table. An arm whose own paired differences leave the range has a null delta_vs_baseline and says why in per_arm.<arm>.delta_error, which the report prints as an arm-labelled note under the significance table (or its heading, when no arm has a row); the significance of the other arms stays when the family test itself succeeds. A mean of finite scores or of finite paired differences whose sum would pass the float range is computed exactly (statistics.mean), so the per-arm avg_aggregate and delta_vs_baseline are refused only when a single difference leaves the range. A significance row computes the mean, the sd and the sign-flip p of such differences too, and is refused only when its sd leaves the range; an interaction row is also refused when the sum of its two arm deltas (its additive expectation) does. The console summary of arms run prints (delta not computed: <the refusal>) for such an arm.

Everything above assumes the judge's continuous 0–100 score. The execution-verified task track (cli.py tasks run) has a binary outcome per task and uses McNemar's exact test instead — see coding-harnesses.md.

Pinning sampling

Answer generation and grading are both sampled calls, so two identical runs differ. These flags pin them, and every value is recorded in the artifact so a pinned run cannot be mistaken for a free-sampling one:

# models that still accept a temperature (Claude Haiku 4.5, gpt-oss, Qwen3, ...)
python cli.py arms run ... --temperature 0 --judge --judge-temperature 0

Current reasoning models accept only temperature=1 (litellm refuses any other value before the request is sent): Claude Opus 4.7 and later, the 5.x Claude models (claude-haiku-5-5, claude-sonnet-5-5, claude-opus-5-5, claude-fable-5-1, on Anthropic and on Bedrock), and OpenAI gpt-5, gpt-5.5, gpt-6.1-sol and gpt-6-luna (gpt-5.1 and gpt-5.2 accept a temperature unless a reasoning effort is set, which dokimi does not do). The static sampling check rejects values that litellm’s rules disallow before any answer is generated, so on these models leave --temperature and --judge-temperature unset. Their sampling cannot be pinned, only measured: run the same configuration several times (benchmark run --reps N; for arms run, repeat the run into separate --out files) and quote the spread.

  • --temperature, --seed: sampling for answer generation, recorded in run_config. Omitted from the request when unset.
  • --judge-temperature: sampling for the judge, recorded as judge_temperature. Applies to a single judge and to every role of a panel. eval judge validate --judge-temperature certifies the judge under the same setting, and records it in the validity report. eval score pointwise, eval score panel (every panel judge) and evaluate take the same flag and record it as judge_temperature in their output. So do eval score pairwise (and its escalation judge), eval score checklist, eval judge wording, eval judge agreement (every --judges entry) and eval judge validate --mode pairwise; each probes every judge model with the setting first, before any judgement: a judge the provider table refuses exits 2 with no call made, and a probe call that the judge rejects exits 1, as arms run does.
  • --judge-panel technical_expert,developer_advocate,doc_reviewer: grade with several judge roles and record their spread and agreement. An unknown role is rejected when the command line is parsed.

Before generating answers, arms run checks each model’s requested sampling options against litellm’s capability table and route-specific value rules. A refused temperature, such as temperature=0 on a model that accepts only 1, stops the run without a model call. When an API route such as Bedrock refuses a seed, Dokimi warns once per route, omits the seed from requests, and records the requested value as unsupported. CLI providers still reject a seed. After the static checks, each answer and judge model with sampling options gets one short probe call. The probe catches refusals that litellm’s local rules do not describe.

The judge re-draws a reply it cannot parse, up to three attempts. At a pinned judge temperature the same prompt tends to return the same malformed reply, so each re-draw then appends a short format reminder to the prompt; the first attempt is unchanged. judge_metrics.redrawn_judgements counts the judgements that needed a re-draw.

temperature=0 is not a determinism guarantee. It picks the highest-scoring token, but some endpoints compute slightly different scores from one call to the next, so reproducibility has to be measured per endpoint.

Multi-turn sessions

A single answer does not show what an arm costs once the conversation grows. --session-turns N asks each question as its own text followed by the first N-1 entries of its follow_ups list (a list of strings in the question record), keeps the history, and records each turn's usage:

python cli.py arms run ... --arm baseline,skill:/path/to/skill --session-turns 4
python cli.py arms run ... --arm baseline,skill:/path/to/skill --session-turns 4 \
  --turn-reminder "Answer tersely."   # also runs each arm as <arm>+reminder

Every turn is recorded under the arm's session.turns, with metrics for that call (prompt, completion, cache read and write tokens, cost). The arm's token_usage and metrics are the sums over turns, so cost_summary reads them like any other run. A question with fewer than N-1 follow-ups fails the run before any answer is generated. Agentic arms (mcp:, skill-agent:, skill-catalog:) are refused per arm, and a session cannot be judged: --judge is refused with --session-turns, and every eval judge command refuses a session artifact, because the judge would score the last answer against the first question. The reminder is appended to every user turn in a <system-reminder> block; the assistant turns are not changed.

A session that fails part-way (a turn raises, or a turn comes back empty and the session stops) is an errored arm: error is generation_failed: turn N: ... or empty_reply: turn N (turns count from 0), and answer is None. The turns already paid for stay in session.turns, and the arm's token_usage and metrics cover them, so the cost rollup counts what was spent. The artifact's run_config records session_turns and turn_reminder. plugin-delta refuses to pair a session run with a single-turn run or one with different session settings, and the matrix rollup does not pair them.

Trusting the judge

A significance table says the delta is unlikely under this judge's noise. It does not say another judge would agree, and on the perf golden set it did not: the same skill-vs-baseline answers scored +1.7 under the stored judge and −3.4 under Haiku 4.5 (both significant). Four commands make that visible.

1. Gate the judge first. eval judge validate checks that the judge orders answers whose order is known (an answer above its own damaged copy). --sequential adds bases until each degradation is decided instead of stopping at a fixed 20, which is usually inconclusive: across five seeds the fixed gate said PASS once and FAIL four times, all inconclusive; the sequential gate said FAIL five times.

The sequential test separates accuracy gate - 0.08 from gate + 0.08 at 5% error each way (the default 0.80 gate tests 0.72 against 0.88). Above a gate of 0.91 the band narrows so the upper hypothesis stays at 0.99 (gate 0.95 tests 0.91 against 0.99), and --sequential exits 2 for a gate outside 0.03 to 0.97, where no feasible number of pairs decides; the report prints the pair it used. Near the top of that range the cap matters: a judge at 0.99 ends inconclusive in about 7% of runs at gate 0.96 and 29% at gate 0.97 with the default --max-bases 120, and about 5% at gate 0.97 with 240. A sequential FAIL on one degradation settles the run (conclusive is true) even while another is still undecided; inconclusive_variants still names it.

--concurrency (default 5) runs judge calls in parallel; before it the check was serial. The verdict does not depend on it: each intact answer is scored once, a failed intact score is retried up to three times before its variants are scored, and rows keep pair order. A throttled call that still fails becomes an errored pair, which counts as a miss, so lower it when the summary shows errors.

python cli.py eval judge validate --answers run.json --sequential \
  --judge-provider amazon-bedrock --judge-model openai.gpt-oss-120b-1:0 \
  --mode pairwise --out validity_pairwise.json

The report gives, per degradation, the pairs scored, the gate accuracy with its 95% CI and PASS or FAIL; --sequential adds a mode line and marks a degradation still undecided at the stop continue, with the reason under INCONCLUSIVE (cap reached, or the answer pool exhausted). An undecided result prints RESULT: INCONCLUSIVE when it is above the gate and RESULT: FAIL (INCONCLUSIVE, see above) when it is below, never PASS. Exit policy: a below-threshold point estimate exits 1; an above-threshold inconclusive result warns and exits 3 by default, or 1 with --strict. A settled PASS exits 0. JSON retains passed (the point-estimate check) and conclusive; promotion requires both to be true. A malformed input, such as a record that would be judged with no question text, exits 2, so it never reads as a failed gate.

--mode pairwise shows the judge both answers, in both orders, and asks which is better. On the perf gate gpt-oss-120b pairwise passed every degradation (pooled 0.96, $0.47 measured) where absolute gpt-oss, Haiku 4.5 and Opus 5.5 each failed one; absolute Opus 4.6 also passed, at about 26× the cost per pair. --escalate-model re-asks the pairs the cheap judge answered inconsistently across the two orders with a stronger one (0.99 pooled, 38 of 355 pairs escalated). A gate pass is a floor, not a guarantee: gpt-oss was order-consistent on 95% of gate pairs but on only 44% of real skill-vs-baseline comparisons, which are much closer calls.

2. Compare arms the same way. eval score pairwise puts each arm's answer next to the baseline's; --escalate-model is the same cheap-then-expensive cascade.

3. Check the verdict across judges. eval judge agreement re-scores an arms run under several judges (absolute, and with --grounded against each question's expected_topics), takes eval score pairwise and eval score checklist reports as more measures, and labels each arm CONSISTENT ±, LEANING ±, JUDGE-DEPENDENT or NO DETECTABLE EFFECT, on Holm-adjusted p over the measures that vote, or NOT MEASURED when no voting measure compared a single question (every call errored, or every judge was gated out); --strict exits 3 on that, and 4 on a JUDGE-DEPENDENT arm. A --judges judge that leaves answers unscored prints how many and its first error, which the report keeps under unscored; one that scored none of its answers exits 1 once the report is written, with or without --strict, as eval score pairwise does when every comparison fails (a run failure, not bad input). With --validity reports, a judge that failed its gate is shown but does not vote (its grounded and checklist measures included, in any context); --require-validated leaves only judges that passed. The stored measure is named provider/model (stored) from the file's judge_provider/judge_model, and a validity report names provider/model. A PASS validates only measures of the same context: a --context stored report for measures scored with material, a --context none report (or one without context) for the rest. A stored file whose scores all fell back to snippets counts as none; one that mixes stored and snippet scores counts as mixed, which no PASS validates (a FAIL still reaches it). Re-scoring resolves each arm's context the way the arms run does, from the file's judge_materials, so a --judges judge sees what the stored judge saw. A file written before judge_materials has only the report snippets; with stored scores on such material, --judges refuses (exit 2), and --pairwise or --checklist always do, since those judges see only the answers. --no-stored compares those judges with each other. The gate itself passes no context by default (eval score pairwise and eval score checklist never pass one), so it validates a judge in the no-context setting; eval judge validate --context stored on an arms artifact gates it with each arm's stored material instead. That run exits 2 with a typed scorer or --mode pairwise, on a file with no non-empty verified material, when an arm loses all its bases, has only padding pairs or gets none sampled by --bases, when a --sequential run would pass with none of an arm's bases scored, or when no pair is usable. A label whose significant measures all rest on one judge says (one judge); an escalated pairwise measure counts as its cheap judge's. Gate a judge on answers from the same answer model it will judge: eval judge agreement warns when the validity report was measured on another model's answers.

python cli.py eval judge agreement --answers run.json --questions golden.json --grounded --both \
  --judges amazon-bedrock/us.anthropic.claude-haiku-5-5,amazon-bedrock/openai.gpt-oss-120b-1:0 \
  --pairwise run_pairwise.json --validity validity_haiku.json --validity validity_pairwise.json

4. When changing the judge prompt, eval judge wording re-runs the gate under meaning-preserving rewrites of it and flags a degradation FRAGILE when a rewrite moves it on the same pairs: a paired sign test against the original prompt, Holm-adjusted over every rewrite and variant. Re-draws of the original are shown as a noise floor but do not decide the flag. A condition with no scored pair (every call errored) is reported NOT MEASURED, not as "no rewrite moves anything", and --strict exits 1 on it. Use at least 30 bases; at 20 bases only a large wording effect is detectable.

eval score checklist asks, per expected topic and in both polarities, whether the answer covers it. Its sign was stable across judges, but it is the weakest of the measures (p ≈ 0.05 where pairwise reached 0.002) and costs about 2.7× an absolute judgement (Haiku, measured: $0.015 vs $0.0055 per answer); its value is the list of points an arm added or lost.

Multi-model comparison

Use report model-compare to compare judged treatment-arm JSON files from multiple models.

The intended input is one judged arms JSON file per model for regular questions and/or golden questions. The report extracts the baseline_arm score as the baseline and the treatment arm as the context arm, then computes:

  • overall context-arm, baseline, and delta per run, all three over the questions scored in both arms (a run that scored one arm only shows that arm's mean); the context mean and delta of each difficulty row follow the same rule,
  • statistical significance of context-arm minus baseline (the arms' sign-flip test and Cohen's d_z, eval.stats.paired_test), corrected across the compared runs \u2014 every run tests the same "did the treatment help?" question, so they form one family; --correction holm|bh selects the method and the table shows the raw p, the adjusted p and the changed pairs. A run with 2 or more pairs gets a p; its verdict is N/A when every pair tied or the floor 2/2^k over its k changed pairs is not below 0.05 (see Reading the significance tables above, which also says how verdicts near 0.05 moved with this test),
  • difficulty breakdown on common question IDs,
  • head-to-head winners on common question IDs,
  • ranking by absolute context-arm score and by delta.

All summary, significance, difficulty, and head-to-head metrics use only the common question set (intersection of question IDs across all runs).

python cli.py report model-compare \
  --regular-runs results/arms/dpnp_regular_sonnet46.json results/arms/dpnp_regular_opus48.json \
  --golden-runs  results/arms/dpnp_golden_sonnet46.json  results/arms/dpnp_golden_opus48.json \
  --run-ids sonnet46,opus48 \
  --out results/dpnp_compare.md

Regular and golden options may be used independently:

# Regular questions only
python cli.py report model-compare \
  --regular-runs results/arms/dpnp_regular_sonnet46.json results/arms/dpnp_regular_opus48.json \
  --run-ids sonnet46,opus48 \
  --out results/dpnp_regular_compare.md

# Golden questions only
python cli.py report model-compare \
  --golden-runs results/arms/dpnp_golden_sonnet46.json results/arms/dpnp_golden_opus48.json \
  --run-ids sonnet46,opus48 \
  --out results/dpnp_golden_compare.md

When a run contains more than one non-baseline arm, specify which one to score:

python cli.py report model-compare \
  --regular-runs run_a.json run_b.json \
  --run-ids a,b \
  --treatment-arm with-skill \
  --out compare.md

Consistency is validated before the report is written:

  • Different baseline_arm values across runs in the same group abort with an error.
  • Different treatment arms across runs abort with an error: each run's delta would measure a different treatment (one run's profile: arm beside another's skill: arm is confounded, not a model comparison). Pin the shared arm with --treatment-arm to override — it makes the choice explicit, and a run missing that arm then fails on its own.
  • One arm name carrying two different prompt digests aborts with an error. A profile: arm is named after the profile's frontmatter id, so editing a profile in place leaves old and new cells sharing a name while measuring different prompts; pooling them averages two treatments. Artifacts written before provenance stamping carry no digest and are not affected.
  • Diverging question_set_hash values (when present) produce a warning on stderr.
  • Runs that share one configuration (model, provider, judge, judge prompt and temperature, run_config except the seed value (seed, or seed_requested when the route dropped it), harness, plugin set, cell and arm list) are replicates: an error, unless --pool-replicates averages them per question into one row. A question is kept only if every replicate scored both arms; the report says how many were dropped.

The report names the arm it scored rather than calling everything "Context arm": "Models Compared" gains a Treatment arm column (per run, or — (baseline only)), and the summary, ranking, and benefit headers read the arm name — e.g. ### By absolute quality (profile:concise_expert). The generic label survives only when the runs disagree or no arm was scored. The name is taken from the extracted score records, not the artifact header, so the label cannot disagree with the numbers beside it.

For programmatic use, import from the package directly:

from dokimi.report.model_compare import (
    check_run_consistency,
    generate_combined_report,
    load_run,
    non_baseline_arms,   # the arm names in one artifact other than its baseline
    prompt_digests,      # the profile_prompt_sha256 values stamped for one arm
)

Caching

Two independent caches sit behind the LLM chokepoint (dokimi/caching.py). Both are about cost, not about results: the text the model sees is byte-identical whether they are on or off.

Provider prompt caching

Providers charge a fraction of the input price for a request prefix they have already seen. Anthropic-family models need an explicit breakpoint (cache_control); OpenAI and Gemini cache long prefixes on their own.

Two conditions must hold, and the second used to fail silently here:

  1. The breakpoint has to be set — done automatically, on prefixes of at least 12000 characters (MIN_CACHEABLE_PREFIX_CHARS). Below the provider's minimum the prefix is ignored and the write surcharge is pure loss; the minimum is 1024 tokens for most Anthropic models and 2048 for the small ones, so at ~4 characters per token 12000 is the first round figure that clears the higher floor with margin.
  2. The reused text has to be an actual prefix. The answer prompt now puts the injected context before the question for exactly this reason. Earlier versions asked the question first, so a 12k-character skill document could never be a reusable prefix and cache_hit_ratio was always 0.0%.

This reorder changes model output. Scores from runs made before it are not directly comparable with scores made after.

Only question-independent context is offered for caching. A skill body is the same for every question (context_is_static=True); docs retrieval is reranked per query, so annotating it would pay the write surcharge on every call and never hit. A combined arm is cacheable only when every context-bearing part is.

The judge rubric is deliberately not cached: at ~1–2k characters it is far below the provider minimum.

DOKIMI_PROMPT_CACHE=0 turns the breakpoints off (default: on). The Cache hit column in the arms report reads cache_hit_ratio from cost_summary, which is cache_read_tokens / prompt_tokens as the provider reported them — so the column is now a real measurement rather than a constant zero.

Response caching

Off unless DOKIMI_RESPONSE_CACHE names a directory:

DOKIMI_RESPONSE_CACHE=.cache/responses python cli.py arms run ...

A byte-identical request (same model, message text, streaming flag, max_tokens, and temperature/seed when set) replays the stored completion instead of calling the provider. Entries the judge, the persona and question generators and the validator stored on Bedrock, Vertex or OpenRouter before they moved to dokimi.llm were keyed without the streaming flag, so they are not hit: those calls are paid once more. It pays off mainly for the baseline arm, which is identical across treatment runs, and for re-running a pipeline after changing only the reporting code. The judge is covered on every provider. A judge call the cache replays was not paid for by this run: judge_metrics counts it in replayed_calls and adds no tokens and no cost_usd for it.

A request can also carry a draw index, for when a caller wants a second, independent sample of the same prompt: the judge's retry after an unparseable reply asks for a new draw, so the retry is a real second attempt rather than the same cached reply read again. Draw 0 adds nothing to the key, so entries written before draws existed still hit. A judge reply that does not parse is neither stored nor, if an older run stored it, replayed; otherwise a question whose three attempts all failed once would fail on every later run without calling the model. A cold cache is therefore not needed for the retry to be real. A rerun of an answer the judge (single or panel) already scored makes no provider call even when the score came from a retry: the judge looks up the stored entry of every attempt before it asks the model, so the unparseable first reply, which was never stored, is not asked again.

The cache is not judge-only. It applies to every caller of dokimi.llm, which includes question generation (questions/llm_gen.py), persona generation (personas/generator.py) and the question validator (questions/validator.py), on every provider. With the variable set, regenerating questions or personas from the same inputs returns the previous set. Unset it (or point it at an empty directory) when you want new ones.

The key is computed over the message text, not the request structure, which is what keeps the two caches independent: a prompt-cache breakpoint splits one string into two text blocks without changing a character of what the model reads, so hashing the raw structure would make DOKIMI_PROMPT_CACHE=0 discard every entry already paid for. max_tokens is in the key — a truncated completion is a different answer.

DOKIMI_RESPONSE_CACHE accepts the same off values as the prompt-cache switch (0, false, no, off, empty), so disabling one the way you disable the other does not create a cache directory named 0. Pointing it at an existing file is a configuration error and raises, rather than presenting as a cache that never hits.

A replayed entry reports the stored usage record — tokens, cost and latency as measured when the call was really made, not $0/0s, so cost stays comparable across runs. The run's cost totals (skill novelty analyze, novelty routing --model) are what this run spent, so they leave replayed records out of the token and usd sums and count them in replayed_calls; llm_calls still counts them. The flip side: latency from a cached run is a recording, not a measurement. That is why this cache is opt-in, and why it should stay off for any run whose latency numbers you intend to quote.

Baselines

Save meaningful eval outputs as named baselines:

python cli.py baseline save \
  --from-eval results/onetbb_sol/eval/onetbb.json \
  --name onetbb-gpt55-docs

Compare a future eval against a saved baseline:

python cli.py baseline compare \
  --baseline onetbb-gpt55-docs \
  --eval results/onetbb_candidate/eval/onetbb.json

When the answer or judge model recorded in the baseline differs from the current eval's, compare prints a warning naming both before the table: the score changes then mix the model change with the content change. With --strict it exits 4 instead. Two records name one model when they have the same id and snapshot: a Bedrock alias and its inference profile, a regional profile, a -vN:M revision or the same model behind another route count as the same model; two different dated snapshots, or the same name under another organization, are two models. A custom dotted name (alice.model) is not a vendor prefix, and a huggingface/ route keeps its organization. A dated snapshot and its undated alias are neither, and so is a Claude CLI alias (sonnet, opus[1m]) and any full id of its family (claude-sonnet-4-5, claude-3-5-sonnet-20240620): the alias does not record which snapshot answered, so the role is named on stderr as not verified, and --strict exits 4 on it. A baseline saved before a default-model change is such a baseline. A panel artifact (eval score panel) is compared by its judge models: the panels must have the same number of judges and the same models, and a judge that matches the other panel's only through such an alias makes the role not verified. A role either side does not record (an older artifact, or answers with no model) is named on stderr as not compared, and --strict exits 4 on it as well, since it cannot vouch for that role. A malformed record in either file (no question_id) exits 2, naming the record on stderr, so it never reads as a failed --strict check. baseline compare also exits 2 on an eval file, saved baseline or manifest.json that is not valid JSON, not a JSON object, or cannot be read. baseline save exits 2 on a bad eval file or manifest.json, and baseline list exits 2 on a bad manifest.json. A manifest.json whose baselines is not a list, or whose entries lack a string name and path or have a summary that is not an object, is rejected the same way.

Regression promotion is opt-in and separate from identity-only --strict:

python cli.py baseline compare --baseline onetbb-gpt55-docs \
  --eval results/onetbb_candidate/eval/onetbb.json \
  --max-context-drop 1 --max-lift-drop 0.5 --min-matched 20

--max-context-drop limits the mean saved-minus-current context score. --max-lift-drop limits the mean saved-minus-current paired lift, where lift is context score minus the no-context score for the same question. Both use unrounded per-question aggregates, not stored rounded deltas or manifest means. Thresholds are finite, non-negative score points; equality passes. Either flag enables the gate; when both are supplied both must pass. --min-matched defaults to 1 and needs a threshold flag (alone it exits 2). The gate exits 1 on a regression and exits 4 on an unknown or mismatched answer/judge identity. Insufficient evidence exits 2, since the input can be fixed: every question in both artifacts must match uniquely and have finite scores in both conditions, and at least --min-matched must match. Unmatched questions, duplicates, errors and partial scoring cannot promote a candidate. Invalid thresholds and malformed records exit 2. Issue #94 moves these thresholds to gate.

Use baselines for release-to-release tracking. Use --questions-from for model-to-model fairness.

What to commit

Commit curated inputs under data/ when the framework itself needs them:

  • data/skills/fastcontext/SKILL.md
  • data/agent_profiles/*.md
  • data/explore_tasks/*.yaml

Question sets and product skills are evaluation content: commit them to the content repository and pass them in with --questions / --questions-root and skill:<path>.

Answer runs, judge scores and static-benchmark snapshots are outputs, not fixtures: keep them under results/, reports/, answers/, eval/ or baselines/, which are git-ignored. Their schemas are locked by dokimi/schemas/*.json and tests/test_artifacts.py; the only committed artifacts are the one-per-schema fixtures in tests/fixtures/artifacts/, which every later edit of that schema version must still accept. Producers write a registered kind only through dokimi.artifacts.save_artifact, which validates before an atomic write, so an invalid run fails on its first incremental save. A reader's test builds its input with tests/artifact_fixtures.py, which also rejects keys the schema does not declare: the schema lists every record key its producers write, so a fixture cannot invent one.

A schema version only widens in place; a narrowing is a new version. Writers always stamp the current version (SCHEMA_VERSIONS in dokimi/artifacts.py), and superseded versions (SUPERSEDED_VERSIONS) keep loading: a file is validated against the version it declares, and an unstamped file against the newest version it matches. Question sets are written as questions.v2 and questions.v1 is still read — v2 renamed the record's text field from text to question (see methodology.md).

The run envelope

An artifact of a registered run kind carries the run's envelope right after its schema_version (#277):

{"schema_version": "arms.v1", "run_id": "20261104T153012Z-1a2b3c4d", "dokimi_version": "0.1.0", ...}
  • run_id is made once per process, when it is first needed (a CLI command makes it at start), from the UTC time and 8 random hex digits. So every artifact one process writes that carries the run envelope shares it: a pipeline's answers and eval, or a catalog run's catalog.json, plan.json and result.json (report.md beside them is a Markdown summary and carries no run_id). runs list lists the artifacts of one run together, and runs show RUN_ID lists one run (runs.md).
  • DOKIMI_RUN_ID gives several commands one id, for example the steps of a CI job. It is 1-128 letters, digits, ., _ or - and starts with a letter or a digit, so it can name a directory. Any other value exits 2 before a command runs (--help and --version still work). A dokimi process started by another (scripts/reach_conformance.py runs repo reach per fixture) makes its own id unless DOKIMI_RUN_ID is set; that script passes it through.
  • A file saved again records the process that saved it, and so does an artifact built from a loaded one (repo reach --from).
  • The --name flag of answers generate, eval score pointwise and report eval names the output directory only; the envelope's run_id is the process's. The run_id of each effective_instructions receipt is that receipt's own, not the envelope.
  • The input kinds carry no envelope: questions, dokimi_config, repo_ledger and need_graph are what a run is given, and cli_routes describes the CLI. A question set is reused across runs (--questions-from, a curated set, the pipeline's cache), and a subject scorecard's question_set_hash digests its bytes, so a run_id in it would change that hash with every process that saved it. harness_profile, repo_manifest and tool_preference_groups are inputs too, validated but never saved.
  • A plan is a run's product and carries the envelope, so it shares the run_id of the result written with it. The completeness check compares its digest with the result's plan_digest, so plan_digest leaves out the envelope as it leaves out generated_at.
  • Run outputs that are not a registered kind (a repo run's grade.json and batch files) carry no envelope.
  • A file saved before the envelope has neither key and stays valid; so do the superseded versions (questions.v1, subject_scorecard.v1), which declare no envelope.
  • The --json output of repo scan, repo inspect, repo budget, eval inspect and eval graph is the cli_output.v1 envelope with the document their --out writes under data.
  • repo hits judge, skill routing and eval graph fill the envelope's cost. The other commands use a default cost of zero. cost is a field of the cli_output.v1 document a leaf prints with --json: read it from stdout, since the saved artifacts (catalog.json, plan.json, result.json) have no top-level cost.