Skip to content

feat(eval): expected_outcome: ask, graded by its own rubric - #1406

Merged
napetrov merged 50 commits into
intel:mainfrom
napetrov:ask-outcome
Dec 2, 2026
Merged

napetrov merged 50 commits into
intel:mainfrom
napetrov:ask-outcome

Conversation

@napetrov

@napetrov napetrov commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A question that expects the assistant to ask back (a missing version, target or meaning) was graded on the answer rubric, which scores a clarifying question as a poor answer. This adds expected_outcome: ask to a question record. Ask questions are graded by their own rubric (ASK_JUDGE_PROMPT, dimensions clarifying_question, targets_ambiguity, avoids_guessing) and reported apart from the answer headline.

Changes

  • Ask rows always use the fixed ask rubric and its recorded prompt hash. Judge.prompt_template customizes the answer rubric only.
  • expected_outcome on a question record: answer (default, also when absent or null) or ask. Parsed in dokimi.records (outcome_of, AskOutcomeError); re-exported from dokimi.eval.ask_outcome.
  • Rubric judges route on the value: Judge.evaluate_answers / score_answer / _judge_answer / _judge_ask, JudgePanel, ArmRunner.judge. JUDGE_PROMPT_SHA256 (answer rubric) is unchanged and still pinned by a test; the ask rubric has its own ASK_JUDGE_PROMPT_SHA256.
  • Arms runs: the headline (means, paired deltas, significance, interactions) pools answer rows only. Ask cells go to the arm summary's ask block (cells, per-arm avg_aggregate, n, errors), shown by arms run and arms report. A run with ask cells carries ask_judge_prompt_sha256.
  • Readers that leave ask rows out: to_binary (answers.v1 / eval.v1 payloads) and the plugin delta (both warn with a count), eval judge, eval panel-score, eval report, report eval, baseline save, baseline compare (including its regression gate), the dashboard, paired_summary (pipeline summary), cross-judge stored_measure. Several of these are silent; the changelog lists which print a count.
  • Paths with no ask rubric refuse an ask record that has an answer to judge, naming the question id, before any judge call: pairwise_jobs, checklist_jobs, scored_answers (cross-judge), build_pairs (degradation), RAGAS evaluate, eval score reference.
  • Methodology: "Questions that expect an ask" section (Reporting, Panel agreement). The panel line: ask-agreement across judges is sampling noise with one ask prompt, so it is reported, not used as evidence.
  • Schema: questions.v2 and eval.v1 declare the field; questions.v2 accepts null (read as answer). Not version-bumped.
  • Review fixes on this branch: SPDX header on the new test file; schema null acceptance; judge helper extraction (duplicate-code ratchet).

Risk

  • Answer-mode artifacts change: eval rows now carry "expected_outcome": "answer". Readers that compare raw rows see a new key.
  • Silent exclusion: report generate, baseline save, baseline compare, the dashboard and the pipeline summary drop ask rows without a count. A reader that pools rows without this filter would mix ask grades into answer means.
  • eval score reference refuses any ask record with answer text, even when its grading is deterministic-only. The refusal is wider than the judged paths; docs/methodology.md names it.
  • records.join takes expected_outcome from the answers record only. If an eval row and its answers row disagree, the answers value wins.

Testing

  • Review fixes: all 77 tests in test_expected_outcome.py, test_ask_readers.py, and test_cross_judge_judge_errors.py passed on 3909d8e8e.
  • tests/test_expected_outcome.py (answer hash unchanged, ask rubric parse/redraw, refusals, run stamp) and tests/test_ask_readers.py (12 readers): pass.
  • Full suite on 1c2b1cf32: 31120 passed, 28 skipped, 0 failed.
  • Refactor commit d00fe79: judge-related tests 11067 passed, 7 skipped; make ci-local --offline --jobs static,typecheck green (includes the duplicate-code ratchet that failed on the prior head).
  • ruff clean on changed Python files; mypy shows only missing optional dependency errors, none in changed files.
  • Local self-review (pr-review, local mode, fresh-context passes on frozen trees): blockers from pass 1 fixed; pass 2 nits recorded below.

Merge danger

  • Widens questions.v2 (null accepted) and stores expected_outcome on answers records and eval rows. Readers outside this PR that pool rows without the filter will mix ask grades into answer means. The readers list above is the audit trail.
  • No schema version bump, no migration.

Open questions

  • eval score reference: should it grade ask records, or refuse them as now? Currently refuses, including deterministic-only checks.
  • arms.v1 does not declare summary.ask / ask_judge_prompt_sha256 (nothing rejects them; documentation gap).
  • Pipeline step 5 "Evaluated N answers" counts ask rows; the means do not.
  • The methodology sentence "a run with ask rows carries ask_judge_prompt_sha256" is true for arms runs; eval.v1 artifacts carry the hash per row.
  • report generate drops ask rows silently.
  • judge reliability reads ask rows in its stored-material gate before build_pairs refuses them: same refusal, different error (InputError vs AskOutcomeError), only with stored judge context.

Follow-ups

  • --skip-ask (out of scope for this PR): skip ask cells in an arms run without touching the headline.

Revert

git revert the branch's commits. Stored records keep the expected_outcome key (answer or ask); after a revert they are read as answer questions, so stored ask questions are graded on the answer rubric again. No schema version changes to undo.

Checklist

  • Tests added/updated and pytest passes
  • ruff, mypy, and schema checks pass
  • Docs updated: docs/methodology.md, changelog fragment
  • Self-reviewed per "Before opening a PR" in AGENTS.md (local pr-review passes on frozen trees; head marker recorded)
  • Each new raise/exit and test names the doc, contract or issue it traces to (AskOutcomeError, require_judgeable_outcome; methodology "Questions that expect an ask")
  • No ad-hoc run artifacts committed
  • New files carry the SPDX license header

🤖 Generated with Claude Code

A question that expects the assistant to ask back (a missing version,
target, or meaning) is marked `expected_outcome: ask`. The answer rubric
scores such a reply as a poor answer, so these records are judged by an
ask rubric (clarifying question, targets the ambiguity, avoids guessing)
with its own prompt hash, ASK_JUDGE_PROMPT_SHA256. JUDGE_PROMPT_SHA256 is
unchanged, so answer-mode results keep their stamp.

- The value is parsed in dokimi.records (default answer) and stored on
  answers records (only when ask) and on every eval row.
- The rubric judges (Judge, the panel, arms --judge, judge validity)
  route on it.
- Paths with no ask rubric (pairwise, checklist, cross-judge, degradation
  pairs, RAGAS) refuse an ask record that has an answer to judge, naming
  the question id, before any judge call (the PR intel#81 pattern).
- questions.v2 and eval.v1 declare the field; questions.v2 is not bumped.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Self-review found that `eval score reference` judged an ask record with no
refusal and dropped the outcome from its row. It now refuses before any
judge call, like the other comparison paths.

Also: pairwise refuses only inside the arm loop (an arm filter that leaves
nothing to judge is not refused), records.py uses the ANSWER constant and
loses a stale comment, and methodology lists judge validity with the
refusing paths.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
…d rubric stamp

Answer rows alone feed the arm means, paired deltas, significance and
interactions. Ask rows (expected_outcome: ask) report their count and
per-arm means in an ask block, and a run with ask rows carries
ask_judge_prompt_sha256. Panel docs: ask agreement is sampling noise.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
…heir own block

to_binary (the answers.v1/eval.v1 bridge), the plugin delta, eval report,
report generate and model-compare pool evaluations; they now leave ask
rows out, and to_binary and eval report say so. arms report and the arms
run console print the summary's ask block apart from the headline.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Review of the ask rows found readers that still pooled them: the eval judge
and panel-score consoles, report eval's single-condition page, baseline save,
the dashboard, the pipeline summary (via paired_summary). A failed panel ask
cell lost its ask stamp and was marked grounded. Each reader now leaves ask
rows out and says how many, where it prints numbers.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
The regression gate averaged ask-rubric drops into the answer drop it
gates on, so an ask question could fail a run no answer row moved. The
plugin delta now warns about the ask rows it leaves out, as the docs say.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
…arning count

The stored cross-judge measure is the answer-rubric measure, so ask rows are
left out of it. An ask vote now carries its unsupported-seed status as an
answer vote does. The plugin delta warning counts distinct questions.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
…expected_outcome

The license header check (.github/.licenserc.yaml, paths **) failed on the new
test file. The schema refused null while records.outcome_of reads null as answer.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
The duplicate-code ratchet flagged the two nested send/redrawn blocks that
_judge_answer and _judge_ask each carried. They become Judge._send_judge and
Judge._note_redraw; behaviour is unchanged.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov
napetrov requested a review from a team as a code owner November 29, 2026 05:58
@exai-bot

exai-bot commented Nov 29, 2026 •

Copy link
Copy Markdown

OpenCodeReview: Commit 1788b05 was not reviewed. This PR has reached its review limit (6 reviews).

CI at `1788b05`: 11 still running, 2 passing, 2 skipped
Check Status
Build docs (strict) still running
CLI interface diff still running
CodeQL (actions) still running
CodeQL (python) still running
External catalog smoke test (uxlfoundation/skills) still running
Platforms and Python versions still running
Static checks (ruff, schema, zizmor, licenses, pre-commit, bandit, secrets, changelog, schema com... still running
Windows smoke test (py3.13) still running
atheris (parsers) still running
benchmark still running

1 more not listed.

To review this commit: re-request review from exai-bot in the Reviewers list.

Last review (43fbd43): 3 medium

Open threads from the bot: 0

@codecov-commenter

codecov-commenter commented Nov 29, 2026 •

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 99.33993% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.48%. Comparing base (892f927) to head (1788b05).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
dokimi/dokimi/commands/judge_reliability.py 96.55% 0 Missing and 1 partial ⚠️
dokimi/dokimi/records.py 95.23% 0 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1406      +/-   ##
==========================================
+ Coverage   96.46%   96.48%   +0.01%     
==========================================
  Files         533      534       +1     
  Lines       71339    71549     +210     
  Branches    12333    12362      +29     
==========================================
+ Hits        68817    69032     +215     
+ Misses       1544     1537       -7     
- Partials      978      980       +2     
Files with missing lines Coverage Δ
dokimi/dokimi/commands/arms.py 97.79% <100.00%> (+0.02%) ⬆️
dokimi/dokimi/commands/baseline.py 95.52% <100.00%> (ø)
dokimi/dokimi/commands/evaluate.py 96.32% <100.00%> (+1.50%) ⬆️
dokimi/dokimi/dashboard/aggregator.py 98.11% <100.00%> (ø)
dokimi/dokimi/eval/answerer.py 98.90% <100.00%> (+0.01%) ⬆️
dokimi/dokimi/eval/arm_record.py 100.00% <100.00%> (ø)
dokimi/dokimi/eval/arm_runner.py 96.95% <100.00%> (+0.01%) ⬆️
dokimi/dokimi/eval/arm_summary.py 100.00% <100.00%> (ø)
dokimi/dokimi/eval/arms_adapter.py 100.00% <100.00%> (ø)
dokimi/dokimi/eval/ask_outcome.py 100.00% <100.00%> (ø)
... and 18 more

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions

github-actions Bot commented Nov 29, 2026 •

Copy link
Copy Markdown

Mutation of changed lines

⚠️ Not a clean result: some breaks or tests were left out

At 1788b05: 24 caught · 0 missed · 24 inconclusive · 1 timed out · 31 not tried in time

This is not a clean result:

  • 31 breaks were not tried before the time budget ran out
  • 216 more breaks of covered changed lines were over the limit and not tried
  • 105 candidate test files were not run
  • 120 changed lines were not mutated

Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary.

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes needed · reviewed d00fe79

To fix: eval report shows no ask results at all, and the pipeline's step-5 line still reads as covering every answer (line comments); the test, schema and cross-judge points there are smaller.

✅ make ci-local --offline: 31,032 passed, 20 random seeds, changed-line coverage 98% · ✅ schema_compat: OK (two widening warnings, no artifact hit) · ✅ an eval of 6 rows, 3 ask: report and sidecar hold 3 rows · ⚠️ removing outcome_fields from the answerer's error path: 113 tests still pass

The ask rubric has its own hash, and every pooled statistic leaves ask rows out.

Comment thread dokimi/dokimi/report/eval_report.py Resolved
Comment thread dokimi/dokimi/eval/stats.py Resolved
Comment thread dokimi/dokimi/eval/answerer.py Resolved
Comment thread dokimi/dokimi/eval/cross_judge.py Resolved
Comment thread dokimi/dokimi/eval/arm_summary.py Resolved
Comment thread dokimi/dokimi/eval/ask_outcome.py Resolved
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869euKf
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869euKm
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869euKz
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869euK0
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869euKr
Thread: PRRT_kwDOVBg7g869euK4
Thread: PRR_kwDOVBg7g88AAAABbELB0Q
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869euK0
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869euKm
Thread: PRRT_kwDOVBg7g869euKz
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Thread: PRRT_kwDOVBg7g869euKz
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov

Copy link
Copy Markdown
Contributor Author

Re: review by vlad-perevezentsev

eval report shows no ask results at all, and the pipeline's step-5 line still reads as covering all questions.

Both report paths now show the ask scores and retain the rows in Q&A. The pipeline prints the ask count, and judge agreement skips the ask rows. The targeted suite passed all 163 tests.

Comment thread dokimi/dokimi/eval/ragas_eval.py Resolved
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>

# Conflicts:
#	dokimi/dokimi/report/eval_report.py
…ring

Thread: PRRT_kwDOVBg7g86-LOAh
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>

@vchamarthi vchamarthi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@napetrov, could you fix the earlier problem I raised, which still happens and fix the new problem I found (in the line comments)? Then push and I'll take another look.

  1. The earlier problem still happens: --judges anthropic/m,nosuchprovider is now refused before any judge is built, and Scoring with is not printed.

Also holding my approval:

  • A check of the change fails on this head.

What I checked on 43fbd43:

  • The full test suite fails with main merged in, at tests/test_docs_code_refs.py::test_changelog_fragment_references_resolve[20261125_130000_napetrov_expected-outcome-ask.md], ci.yml:test / Run tests.
  • The 195 changed tests pass, and fail on main as expected.
  • It merges cleanly onto main.
  • When I changed the code on purpose, the tests caught all 12 changes.

Comment thread dokimi/dokimi/records.py Resolved
eval score checklist read only the record's stamp, so an unstamped arms
file scored an ask question against its expected points with exit 0.
It now takes the ask from the question set too, as eval score reference
does, and refuses before any judge call (exit 2).

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
The refusal advised `eval judge`, the calibration group, which takes no
answers file and fails with a usage error. It now names eval score
pointwise, eval score panel and arms run --judge; a test checks that
every command it names is a CLI leaf.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
arms report, eval report, eval judge and eval panel-score are not CLI
commands, and main's changelog reference test fails on them after the
merge. Name arms run (--out-md), report eval, eval score pointwise and
eval score panel instead.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
report generate's trust gate and the arm summary's interaction contrasts
drop ask rows, but no test failed when either filter was removed.

Signed-off-by: Alexander Rybkin <alexander.rybkin@intel.com>
@xaleryb

xaleryb commented Dec 2, 2026

Copy link
Copy Markdown
Contributor
  • Ran: the full suite and gates on this head merged with current main (Python 3.13), plus live ask-rubric runs.
  • Changelog fragment: main's test_changelog_fragment_references_resolve fails on the merged tree with unknown command: arms report, unknown command: eval report. Expected green.
  • eval score checklist with an unstamped arms file and a question set that marks the question ask: exit 0, and the ask question is scored against its points. Expected exit 2 before any judge call, as eval score reference does.
  • The refusal advises eval judge, which fails with a usage error (invalid choice). Expected: a rubric judge that exists.
  • Ask rubric: "I cannot help with that request." scores 40/100, and a guess scores 0. Proposal: return 0 when clarifying_question is 0, with a test, and document the rule.
  • Pushed:
    • 3e79314: checklist reads the ask from the question set.
    • bc0aa3d: the refusal names eval score pointwise, eval score panel and arms run --judge.
    • 3c4a0d6: the fragment and methodology name real commands.
    • f3d6c6d: tests showing that ask rows change neither the trust verdict nor the interactions.
  • Left for the author: the ask-rubric cap. Also merge main so CI runs the fragment check.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
…utcome

records.join merged the answers row's raw over the evaluation's, so a
null expected_outcome on the answers row hid the evaluation's ask from
the pairwise and checklist refusals, which read raw.

Thread: PRRT_kwDOVBg7g86-bmhX
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
a: --judges validates every entry before the first judge is built in
2e21823 (tests/test_cross_judge_judge_errors.py). b: the changelog
fragment names existing commands in 3c4a0d6; with main merged in
061d565, tests/test_docs_code_refs.py passes.

Thread: PRR_kwDOVBg7g88AAAABbkM-gg: already fixed in 2e21823, 3c4a0d6
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
a: fragment and methodology commands (3c4a0d6), b: checklist takes
the ask from the question set (3e79314), c: the refusal names rubric
judges that exist (bc0aa3d), e: main merged (061d565). Verified:
eval score pointwise/panel, arms run --judge exist; the docs-refs, ask
and judge-error tests pass after the merge. d (rubric cap) is held.

Thread: IC_kwDOVBg7g88AAAABtTnLEA: already fixed in 3c4a0d6, 3e79314, bc0aa3d, 061d565
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
@napetrov

napetrov commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Re: review by vchamarthi

The full test suite fails with main merged in
3c4a0d6 fixes the fragment; docs-refs passes with main merged (061d565). The --judges fix is 2e21823.

@napetrov

napetrov commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Re: comment by xaleryb

Proposal: return 0 when clarifying_question is 0
Waiting on a decision before I change this: should an ask reply that asks no question score zero overall, or keep partial credit for avoiding guesses? I recommend zero, retaining the dimension scores and recording the change in the rubric and its hash. The other fixes passed with main merged (061d565).

A refusal (0/0/100) scored 40 and an answer on a stated assumption 20, above a silent guess at 0. The rule is in the prompt too, so ASK_JUDGE_PROMPT_SHA256 changes with it.

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

@vlad-perevezentsev vlad-perevezentsev left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 LGTM · checked bfd48ca · nothing required from @napetrov

🔀 Merge: safe now · merges cleanly into current main, 1 commit behind (repo scan, no shared file) · after it, #1416, #1190 and #1197 need a rebase (commands/judge_reliability.py), #1527 (report/eval_report.py, single_condition_report.py), #1413 (commands/evaluate.py)

✅ make ci-local --offline: 33,395 passed, changed-line coverage 100%, 20 seed repeats green · ✅ the new refusal test fails with the zero rule removed

The ask rubric now gives 0 to a reply that asks nothing, and its hash moves with the rule.

Fixed in this branch, up to bfd48ca:

  • A reply that asks nothing scored 40 on the ask rubric, above a guess: 0288384 returns 0 when clarifying_question is 0 and states the rule in the prompt and methodology.md; bfd48ca adds it to the changelog.

@napetrov

napetrov commented Dec 2, 2026

Copy link
Copy Markdown
Contributor Author

Re: comment by xaleryb

Proposal: return 0 when clarifying_question is 0
0288384 gives replies that ask nothing an aggregate of 0 and updates the rubric. bfd48ca documents it.

Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
Signed-off-by: Nikolay Petrov <nikolay.a.petrov@intel.com>
(cherry picked from commit e249323eb321bbc70ac425c03170071d835a143c)

@antonwolfy antonwolfy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I read the core of the change (records.py, judge.py, ask_outcome.py, arm_summary.py) and found nothing to fix. I did not run a mutation check, and I did not re-run the earlier reviewers' reproductions.

What I ran, on a Linux review host at 1788b05:

  • make ci-local: 38 passed, 0 failed, 16 skipped (matrix legs on other Pythons and the merge commit are not covered locally); 34073 tests passed, 28 skipped.

Checked, no issues

  • Sign-off: every non-merge commit carries a Signed-off-by.
  • Added lines: no network, subprocess, environment or credential access in the added code.
  • Rubric: ask_weighted_aggregate returns 0 when clarifying_question is 0, the prompt and the changelog state the rule, and the prompt hash covers it.
  • Routing: Judge._judge_answer sends an ask record to _judge_ask; evaluate_answers leaves ask rows out of the means and prints their count.

@napetrov
napetrov merged commit 491fc74 into intel:main Dec 2, 2026
26 checks passed
vlad-perevezentsev added a commit to vlad-perevezentsev/dokimi that referenced this pull request Dec 4, 2026
The arms adapter left ask questions out of the answers and eval
payloads, which intel#1406 meant for a run whose arms file keeps them. The
pipeline saves no arms file, and it drops its checkpoint once the
answers file is saved, so an ask question's replies and ask-rubric
grades were paid for and lost. Before intel#228 step 4c the answerer and
the judge kept these rows, stamped expected_outcome: ask, and the
readers leave them out of the headline.

The adapter keeps them so, and the judge step prints how many it left
out of its averages, as Judge.evaluate_answers did.

Refs intel#228
Test-narrowed: to_binary keeps ask rows now, so test_to_binary_leaves_ask_questions_out_of_both_payloads is replaced by test_to_binary_keeps_ask_questions_stamped_in_both_payloads and the pipeline test test_an_ask_question_keeps_its_rows_and_stays_out_of_the_averages.

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov pushed a commit that referenced this pull request Dec 4, 2026
…ner (#1542)

* fix(gate,eval): a judged retrieval miss counts as a miss

A question whose context arm got no document is unusable in the trust
gate's zero-score fraction and an empty retrieval in the diagnosis only
while it is left unjudged. Judged (`eval score --judge-placeholder`, an
arms run read through the arms adapter, and `evaluate`/`benchmark` once
they answer through ArmRunner, #228 step 4c), its context score is the
plain prompt's: a 60 passed the zero check, and a delta of 0 or more was
diagnosed `docs_helped`.

Count every miss (`retrieval_hit: false`) as unusable in the zero-score
fraction, scored or not, and diagnose a judged miss `empty_retrieval`
whatever its delta. The thresholds are unchanged.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): evaluate and benchmark answer and judge through ArmRunner

#228 step 4c. `evaluate` and `benchmark run|batch` answered with the
Answerer and judged with `Judge.evaluate_answers` (Stack P), and gave
other numbers than `arms run` on the same questions. The pipeline now
answers each question in a baseline arm and a docs arm through
ArmRunner, judges them with the same runner, and writes `answers.v1`
and `eval.v1` through the arms adapter (#1148), so their readers stay as
they are (`orchestrator/arm_answering.py`).

This changes numbers (parity rows D2, D4 prompts, D5 and D9's pairs now
shared): ArmRunner's prompts; a question with no document gets a judged
plain-prompt answer instead of the unjudged placeholder; the judge sees
each arm's whole material. Both files carry method version 4;
`answers generate` and `eval score` stay on version 3 until step 6.

- The questions answered so far are kept in `<answers stem>.partial.json`
  (#1004) until the answers file is saved; a crash names the file.
- A run-wide stop saves the answers with their `terminated` block and
  judges nothing, as before.
- `--judge-placeholder` on `evaluate`/`benchmark run` has no effect and
  warns; `--debug-retrieval` copies the docs arm's retrieval counts into
  `retrieval_metadata`.

Test-narrowed: the pipeline no longer reads an answers file back to judge it (the runner that answered judges), so the tests of the stamp it read from one (wrapped, unstamped, malformed, a stale file) have no code left; the pipeline's own stamp is tested in test_the_pipeline_stamps_its_answers_and_eval_with_the_current_version, eval score keeps its stamp tests.
Test-narrowed: evaluate writes no placeholder any more, so the tests that it judges one with --judge-placeholder and leaves it unjudged without are replaced by test_evaluate_judges_a_retrieval_miss_with_or_without_the_flag and test_judge_placeholder_flag_has_no_effect_on_the_pipeline_and_says_so.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): a failed checkpoint save fails its run, not a batch

The pipeline's checkpoint was `arms run`'s `_Partial`, whose failed save
exits 2. ArmRunner re-raises it, and `benchmark batch` records a failed
library only on an Exception: one library whose partial file could not
be written ended the whole batch, without its summary.

`pipeline_checkpoint` makes the same file with a save that raises an
OSError naming it, so `evaluate` fails as it did on an unwritable answers
file (exit 1), and `benchmark batch` fails that library and goes on.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): a failed answers save names the partial file too

The note that names `<answers stem>.partial.json` was printed only when
answering failed. A failure after every answer was paid for, in the
adapter or in writing the answers file, left the partial file unnamed,
where `arms run` names it on the same failure.

The note now covers everything up to the saved answers file.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(eval): eval score warns that a v4 answers file meets the v3 judge

`eval score pointwise` stamps the eval with the answers file's method
version. On a file `evaluate`/`benchmark` wrote (version 4, judged there
through ArmRunner with each arm's whole material), its judge is still
`Judge.evaluate_answers` (200-character doc snippets, #228 D5), so two
evals of the same answers say 4 with different judge inputs.

The stamp stays the answers' own, which is what it records; the command
now warns that its scores are not comparable with the run's own eval.
Step 6 moves this judge onto the shared stack.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(eval): the diagnosis reads a miss as the trust gate does

The diagnosis had its own test for a retrieval miss, twice: a doc source
of `fallback_none`, `none` or none at all, or no docs. The trust gate
reads `retrieval_hit` (`records._retrieval_hit`): a `fallback_none` or
`none` doc source, or no `retrieved_docs`. A docs answer with no
`doc_source` key was a hit for the gate and a miss for the diagnosis,
so a delta of +10 was `empty_retrieval` and a delta of -3 too.

One `_missed`, the gate's test, now decides both branches: that answer
is `docs_helped` or classified by its relevance.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): the judge step prints its progress again

`Judge.evaluate_answers` printed the judge, a line per question and the
averages. Through ArmRunner the step printed "Judging answers..." and
then nothing: a long judge step was silent, and a judge failure showed
only in the log.

The pipeline hands ArmRunner the judge behind a wrapper that prints
`[i/n] <question id> ✓ <score>` per judged answer, or ✗ and the reason,
after the `Evaluating N answers with judge: P/M` line; the averages over
the pairs close the step, as before. ArmRunner (arms run) is unchanged.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(gate): a miss with only one arm scored counts in the zero check

ArmRunner judges the two arms apart, so a retrieval miss can keep its
context score while its baseline judge call fails. Such a row was in
neither the both-arms rows nor the unjudged misses, and the zero-score
check left it out: 10 scored hits and 3 such misses read 0/10, not
3/13.

Count a recorded miss outside the both-arms rows when either arm has a
score or the row has an error.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(eval): the pipeline's eval names its judge protocol

evaluate and benchmark now judge through ArmRunner, which stamps the
arms run with judge_context, but the arms adapter dropped it from the
eval.v1 file. An eval score re-judgement of the same answers (the v3
judge, 200-char snippets) then carried the same method_version 4 and
no protocol either, and model_compare pooled the two.

Carry judge_context into the adapted eval and declare it in eval.v1:
the pipeline's eval says treatment_material.v1, the re-judgement
stays unstamped, and model_compare's judge-protocol check refuses the
pair.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* test(gate): pin a miss whose baseline answer failed in the zero check

A miss whose baseline answer failed keeps its context score and has
no error in the eval row (the answers file records it), so only the
context-score clause of _unpaired_miss counts it. The test now covers
that shape beside the failed baseline judge call.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): judge progress names the question the runner judged

The progress lines of the judge step looked the question id up by its
text, so two questions with the same text both printed the last one's
id. ArmRunner.judge now takes an on_score callback that gets the
record's question id, the arm and the score after each judge call, and
the pipeline prints its progress from there instead of wrapping the
judge.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* test(pipeline): the adapter parity test skips the whole run envelope

Main's #1541 added dokimi_commit to the run envelope that save_artifact
writes, so the saved answers file had a key the in-memory adapter
output has not. The test now strips artifacts.ENVELOPE_KEYS instead of
naming run_id and dokimi_version.

Refs #228

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

* fix(pipeline): evaluate and benchmark keep their ask questions

The arms adapter left ask questions out of the answers and eval
payloads, which #1406 meant for a run whose arms file keeps them. The
pipeline saves no arms file, and it drops its checkpoint once the
answers file is saved, so an ask question's replies and ask-rubric
grades were paid for and lost. Before #228 step 4c the answerer and
the judge kept these rows, stamped expected_outcome: ask, and the
readers leave them out of the headline.

The adapter keeps them so, and the judge step prints how many it left
out of its averages, as Judge.evaluate_answers did.

Refs #228
Test-narrowed: to_binary keeps ask rows now, so test_to_binary_leaves_ask_questions_out_of_both_payloads is replaced by test_to_binary_keeps_ask_questions_stamped_in_both_payloads and the pipeline test test_an_ask_question_keeps_its_rows_and_stays_out_of_the_averages.

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>

---------

Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants