Repository navigation
fix(arms): the Summary prints each arm's mean over the pairs its delta is over - #1594
Conversation
…a is over (intel#1584) The `arms run` Summary (console and `--out-md` table) printed each arm's `avg_aggregate`, a mean over every question the arm scored, beside `delta_vs_baseline`, a mean over the questions both arms scored. With one baseline reply empty the issue's run printed docs 87.5 and baseline 40.0 beside a delta of +50.0. `_summarize` now also writes `paired_avg_aggregate` and `paired_n` for a treatment arm that has a delta, taken from `stats.paired_vectors` and `mean_in_range`, so they never exist without the delta they agree with. `avg_aggregate`, `n` and `errors` keep their meaning in the artifact. The new `report/arms_pairs.py` chooses the Avg and n a row shows (the pair values when present, else the old ones) and the one-line note printed when a treatment arm's pair count differs from the baseline row's n; both printers call it. The run of the issue now prints docs 90.0 over 3 pairs, baseline 40.0, delta +50.0, as `report model-compare` does. The schema gains the two optional fields and the two docs that describe the summary say what they cover. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
There was a problem hiding this comment.
🟡 Changes recommended
The report note describes displayed means as based on baseline pairs, but treatments with no complete pairs or with delta_error can show fallback averages and counts from unpaired questions. This misstates the sample basis for those rows in both printers.
1 open issue
What changed in this PR
1 finding. This PR addresses #1584 by aligning Dokimi’s treatment-arm summary means with the paired questions used for their deltas.
Changes:
- Adds optional paired means and counts while preserving existing artifact fields.
- Updates console and Markdown summaries, retaining fallback behavior for older artifacts.
- Adds regression tests, schema properties, documentation, and a changelog entry.
| File | Description |
|---|---|
dokimi/tests/test_arms_summary_paired_means.py |
Tests paired summaries, fallbacks, and notes. |
dokimi/dokimi/schemas/arms.v1.json |
Defines optional paired fields. |
dokimi/dokimi/report/arms_report.py |
Displays paired means and counts. |
dokimi/dokimi/report/arms_pairs.py |
Shares display selection and explanatory notes. |
dokimi/dokimi/eval/arm_summary.py |
Computes paired mean fields. |
dokimi/dokimi/eval/arm_runner.py |
Adds paired fields to summaries. |
dokimi/dokimi/commands/arms.py |
Updates console summary output. |
dokimi/docs/methodology.md |
Explains paired versus per-arm measures. |
dokimi/docs/benchmarking-and-comparison.md |
Documents fields and fallback behavior. |
dokimi/changelog.d/20261203_140000_arms-summary-paired-means.md |
Records the summary correction. |
Review effort: Balanced
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 10 selected item(s). CI at Review details
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1594 +/- ##
==========================================
- Coverage 96.50% 96.50% -0.01%
==========================================
Files 539 541 +2
Lines 72177 72265 +88
Branches 12445 12456 +11
==========================================
+ Hits 69655 69738 +83
- Misses 1545 1547 +2
- Partials 977 980 +3
🚀 New features to boost your workflow:
|
Mutation of changed linesAt cfe7641: 31 caught · 7 missed Each row is a small deliberate break (a mutant) of a line this PR changes that every test reaching that line still passes. Add a test that fails on it or, if it cannot change behaviour, put
Not checked:
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
…ion it scored Settles the Copilot review point on arms_pairs.py: the note said each treatment arm's Avg and n cover the questions it and the baseline both scored, but a treatment arm with no complete pair (no delta) prints its own mean and n. The note now says a treatment arm with a delta shows the pair mean and count, and the baseline row and an arm with no delta show every question each scored. A test renders the reviewer's case (q1 baseline 40 and docs 90, q2 baseline 60, q3 other 80) and checks the `other` row and the note. Signed-off-by: Anton Volkov <antonwolfy@gmail.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head cfe7641)
- Contract: changed. schema dokimi/dokimi/schemas/arms.v1.json
- Responsibility: none
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
No merge-blocking findings.
Checked complete and partial pairs, legacy artifact fields and both summaries. Ran 88 focused tests with current main. Required CI passed.

Summary
#1584: the
arms runSummary (theSummary (avg aggregate):lines of the console and the## Summary (avg aggregate score, 0–100)table of--out-md) printed each arm'savg_aggregate, a mean over every question the arm scored, besidedelta_vs_baseline, a mean over the questions both arms scored. When a question is scored in one arm only, the printed delta is not the difference of the two printed means. Onmain, with four questions, a fake model and one empty baseline reply (the issue'sarms_summary.py), the table reads:baselinedocs87.5 − 40.0 = 47.5, not 50.0, and
report model-compareprints 90.0 for the same file. Option taken: the artifact keeps its means and gains the pair means, and both printers show the pair means beside the delta (the issue's other option, a line saying the means cover different questions, would leave the two commands printing different numbers for one run). Now the table has docs 90.0, delta +50.0, n 3, and the console printsdocs 90.0 (delta +50.0).Closes #1584
Changes
ArmRunner._summarize(eval/arm_runner.py, withpaired_mean_fieldsineval/arm_summary.py) writespaired_avg_aggregateandpaired_nfor a treatment arm that has adelta_vs_baseline: the arm's mean (one place,mean_in_range) and count over the pairs ofstats.paired_vectors, the same ones the delta uses. A baseline, an arm with no pair and an arm whose delta is refused (delta_error) get neither field.avg_aggregate,n,errors,delta_vs_baselineandsignificancekeep their values.report/arms_pairs.py(new) holds the shared choice:shown_meangives a treatment arm'spaired_*when present andavg_aggregate/notherwise (the baseline row always keeps its own), andpairs_notegives the one-line italic note printed under the summary when a treatment arm'spaired_ndiffers from the baseline'sn; it says a treatment arm with a delta shows the pair Avg and n, and the baseline row and an arm with no delta show every question each scored.cmd_arms_run(commands/arms.py) andrender_arms_report(report/arms_report.py) each change two reads and add the note call. The console prints no n, so the console line shows the mean only.schemas/arms.v1.json: the two optionalper_armproperties, edited in place (a widening; older artifacts still validate).docs/benchmarking-and-comparison.mdanddocs/methodology.md: one sentence each on which questionsavg_aggregate/nandpaired_avg_aggregate/paired_ncover.tests/test_arms_summary_paired_means.py; no existing test changed.Risk
An
arms runSummary whose arms scored different questions prints different numbers than before: treatment rows show the pair mean and pair count, and a note line appears when a treatment arm's pair count differs from the baseline row's n. A run in which every treatment arm has the same questions as the baseline prints exactly as before. An artifact written before this change has nopaired_*fields and renders as before. Readers ofavg_aggregateandn(subjects/evidence.py,plugin_delta, the matrix rollups,knowledge-runs) see no change.Open PRs that touch the same printers: #1560 moves the console summary loop into
_print_summaryand #1568 moves the table into_section_summary, so whichever merges second has a textual conflict in the lines that readavg_aggregate/n(a two-line edit, the logic is inarms_pairs.py); #1573 wraps arm names infmt.cell(...)in the same table rows, a conflict on the row line is possible.Testing
On Linux, at
cfe7641b(onmainbadfd39):make ci-local: 38 passed, 0 failed, 16 skipped. 34482 tests passed, 28 skipped; changed-line coverage 100%.test_arms_run_prints_the_pair_means_in_the_console_and_the_report): onmain's code the console printsdocs 87.5 (delta +50.0)and the table| docs | 87.5 | +50.0 | 4 | 0 |; here 90.0 and n 3. Onmain's code 7 of the 9 new tests fail (the two that pass are the ones pinning output that does not change).paired_*, two breaks of the note condition, the baseline row read as a treatment row, the wrong baseline key in the note, paired fields written without a delta, the console and the table printing the unpaired mean and n, and each printer dropping the note) fails the new tests. A twelfth, the note without its clause about an arm with no delta, failstest_the_note_says_an_arm_with_no_pair_shows_its_own_questionsandtest_the_note_names_the_rows_when_a_pair_count_differs_from_the_baseline_n; the first renders q1 baseline 40 and docs 90, q2 baseline 60, q3 other 80, whereotherprints Avg 80.0 and n 1 from its own question.Open questions
None.
Revert
A plain revert restores the old summary (the unpaired mean beside the paired delta). Artifacts already written keep their
paired_avg_aggregateandpaired_n, which the older reader ignores; the schema (v1, edited in place) loses the two optional properties, so a stored artifact with them still validates becauseadditionalPropertiesis not restricted.Checklist
pytestpassesruff,mypy, and schema checks passAGENTS.mdraise/exit and test names the doc, contract or issue it traces to.github/.licenserc.yaml)