Repository navigation
fix(pipeline): evaluate and benchmark answer and judge through ArmRunner - #1542
Conversation
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, intel#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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
intel#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 (intel#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` (intel#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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
`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, intel#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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
`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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 32 selected item(s). CI at Test notes (2)
Review details
|
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1542 +/- ##
==========================================
- Coverage 96.47% 96.47% -0.01%
==========================================
Files 564 565 +1
Lines 74672 74798 +126
Branches 12890 12903 +13
==========================================
+ Hits 72042 72163 +121
+ Misses 1610 1608 -2
- Partials 1020 1027 +7
🚀 New features to boost your workflow:
|
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head e85982e)
- Contract: changed. errors dokimi/dokimi/commands/arms.py:608; defaults dokimi/dokimi/commands/arms.py:624
- Responsibility: candidate. delegate EvaluationPipeline._evaluate_answers in dokimi/dokimi/orchestrator/pipeline.py; policy dokimi/docs/architecture.md
- Dependency: candidate (count signal only, no file:line)
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
1 new must-fix finding. The focused pipeline and adapter tests pass. A repeated question text exposes incorrect judge progress IDs.
| # | Finding | Severity | Provenance | Evidence |
|---|---|---|---|---|
| 1 | Judge progress attributes repeated question text to the last ID | must-fix | introduced | Reproduced on the head. Compared with the merge base. |
Checked the diff, input edges, and focused offline Linux tests (merged: 215 passed in 7.00s). Checked the answer and judge paths with stubbed providers.
Mutation of changed linesAt 8113a69: 66 caught · 12 missed · 2 inconclusive 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 the whole picture:
Warning only: a missed break does not fail the job. Updated on every push; the full report is in the ci run summary. |
antonwolfy
left a comment
There was a problem hiding this comment.
The merge waits for one open point from @napetrov. The rest of the change holds up: the trust-gate and diagnoser miss rules, the checkpoint handling and the adapter round trip all behave as the description says.
I agree with @napetrov's point on the judge progress IDs. New evidence: two questions q1 and q2 with the same text print [1/4] q2, [2/4] q2, [3/4] q2, [4/4] q2 through PipelineArms.eval_file. The map at arm_answering.py:124 is keyed by question text.
What I ran, on a Linux review host at e85982e:
make ci-local: 37 passed, 1 failed, 16 skipped; 33966 tests, coverage 97%. The one failure istest_a_bad_path_is_refused_as_the_quickstart_says[agent run], which needs a filler for--agentintests/cli_faults.py. The PR touches neither that test noragent run. The[repo run]case of the same test timed out under load and passes on its own.- A reproduction of the progress labels, with the LLM transport mocked.
Checked, no issues
- Commits: all 10 non-merge commits carry
Signed-off-by. - Placeholder flag:
--judge-placeholderwarns and does nothing onevaluateandbenchmark run, as the help text and changelog say. - Evaluator independence: the pipeline's eval keeps
evaluator_independence_warningthrough the adapter (arms_adapter.py:88).
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Main's intel#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 intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
@antonwolfy Thanks for the reproduction: the progress IDs are fixed in 429bf14 (see the thread on |
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
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>
antonwolfy
left a comment
There was a problem hiding this comment.
LGTM. The progress-ID point from @napetrov is fixed at 429bf14: ArmRunner.judge now reports the record's own question_id through on_score, so two questions with the same text print their own IDs. No new findings in the changes since my last review.
What I ran, on a Linux review host at 117489c:
make ci-local: 37 passed, 1 failed, 16 skipped; 34542 tests, changed-line coverage 98%. The one failed row is the pytest step:test_a_bad_path_is_refused_as_the_quickstart_says[eval tasks generate],test_1089_many_adjacent_url_links_are_read_in_linear_timeand twotest_unclosed_openers.pylinear-time tests hit the 60 s timeout or a 10 s timing assertion under load. The PR touches none of those files. Run alone, the timing tests and the quickstart case pass (127 passed). Theagent runcase from my last review is main'stests/cli_faults.py, as the author says.
Checked, no issues
- Judge progress:
on_scoreis called after the runner has turned a failed judge call into{"error": ...}, so✗ <reason>still prints for a failed call, and the lock keeps the[i/n]counter in order from worker threads. The new test pins two questions with one text. - Commits: all 12 non-merge commits carry
Signed-off-by. - Parity test: the adapter test now strips
ENVELOPE_KEYS, which covers the newdokimi_commitkey.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Summary
#228 step 4c.
evaluateandbenchmark run|batchanswered with theAnswererand judged withJudge.evaluate_answers(Stack P). On the same questions that gave different numbers thanarms run(Stack A). Now the pipeline answers each question in two arms, a baseline arm and a docs arm, throughArmRunner, and the same runner judges both answers. The new module isorchestrator/arm_answering.py. The two files keep theiranswers.v1/eval.v1shapes because they are written through the arms adapter from #1148, so the trust gate,report, the dashboard, RAGAS, grounding andbaselineread them unchanged. Refs #228.This changes numbers, so both files carry
method_version: 4.answers generateand theeval scorejudge stay on version 3 until step 6.tests/test_answering_stack_parity.py) shows it row by row; D2 and D5 are gone, D4's prompts and D9's pairs are shared:with_docsprompt isArmRunner's. The context comes first, then the question, then "using the provided context above where relevant". It used to be the question first, then "using ONLY the provided documentation". Thewithout_docsprompt isarms run's plain one.with_docsanswer, the plain prompt, and it is judged. It used to get the unjudged[FALLBACK: No relevant documentation found]placeholder, so it now enters the averages, with a delta near 0. It still recordsretrieval_hit: false.Doc i:snippets. The baseline gets "(No documentation retrieved)".empty_retrievalwhatever its delta, notdocs_helped. The diagnosis now reads a miss the way the gate does (retrieval_hit).min_questionscounts them as questions.min_with_docs_avg,min_deltaandscore_cvtake baseline-like scores for them, which pulls the delta toward 0. A run that passes the zero-score check has at most 20% misses, which bounds that pull: a hit delta of -6.25 reads -5.0 at 20% misses.terminatedblock, judges nothing and fails, as before.answers/<product>.partial.json(arms run's file, fix(arms): a crashed arms run keeps its answers in <out stem>.partial.json #1004) until the answers file is saved. If the run fails before that, the message names the file. If that file cannot be written, that run fails:benchmark batchgoes on with the next library.--context7-id, as before (D8).--retrieval-tokens.--debug-retrievalwrites the docs arm's retrieval counts asretrieval_metadata.question_model,question_providerandquestion_set_hashgo in the eval'srun_metadata, andquestion_set_hashgoes in the answers file.--judge-placeholderonevaluateandbenchmark runhas no effect now and logs a warning saying so.eval scorekeeps it for older answers files. If you would rather have a tombstone (exit 2), say so.eval scoreon a version 4 answers file keeps the file's stamp and warns that its judge is the version 3 one, so its scores are not comparable with the run's own eval.model,provider,judge_modelandjudge_providervalues that Part of #94 (F1b, model + judge) #1197's--model P/Mand--judge P/Mparse into, soevaluate --model openai/M --judge anthropic/JreachesArmRunnerand its judge as parsed; no parser line changes here.Changed output
answers/<product>.jsonandeval/<product>.json:method_version3 → 4.with_docsanswer and score; it used to have the placeholder andnull.ArmRunner's fields (metadata,harness,judge_context_sha256, ...).token_usage.context_chars,token_usage_summaryandjudge_placeholderare absent, becausearms.v1does not record them (refactor(eval): an adapter from arms.v1 runs to answers.v1/eval.v1 #1148).The console output is
ArmRunner's while answering. The judge step prints a line per judged answer, whereJudge.evaluate_answersprinted one per question:The trust gate's
zero_score_fractionon a file with judged misses (eval score --judge-placeholder, or a run from this PR). The gate test's three-row example, with one miss scored 60, reads2/3 ... (66.7%)here; before, it read1/3 ... (33.3%).Evidence
Parity table, before → after (
tests/test_answering_stack_parity.py, the pins of main run on the branch). P now matches A on:docs_prompt.first_line,.order,.guidance,plain_prompt.first_line)empty.answer_kinds("plain",)→("plain", "plain"),empty.with_docs_answerplaceholder→model_reply)judge.calls11 → 12Doc 1:snippets → whole passages)stats.delta_mean20.0 → 16.67,stats.pairs5 → 6delta.per_questionq-emptyNone→0.0context_charsTrue → Falsemethod_version3 → 4The rows left are documented as intended: P sends no answer
max_tokens, temperature or seed (the pipeline commands have no flag for them, step 5);report eval's significance test is uncorrected; andrecord.shape,cost_summaryandmethod_versiondiffer on purpose.tests/test_pipeline_arm_runner.py(new) checks:to_binaryof anarms runon the same fixture, apart from the pipeline's own fields;--debug-retrieval, the question-set hash, and the judge step's output, which names each question by its id when two questions share their text (ArmRunner.judgereports each score through its newon_scorecallback).Updated: the run-wide stop test, which now goes through ArmRunner and no longer reaches the
claudeCLI on the machine; the judge temperature and placeholder entry points; the independence flag; the method version; the adapter's golden test, where q-empty now reads alike; and the trust gate and diagnoser tests.Mutations, each failing a test and then reverted (22), in five groups:
--debug-retrievalalways on;fallback_triggeredconstant;question_modelwrong; the placeholder warning dropped;top_k; the partial truncated; each command without its checkpoint; the gate's and the diagnosis's miss rules; the batch checkpoint exiting.The one survivor was a redundant
docs.library_idassignment (ArmRunner.runpasses the same id), and it is removed.make ci-local --offline:a93a0b06: 0 failed, 27 passed, 21 skipped (network, docker, matrix), with the changed-test repeats, the changed-line coverage andmutation-diffpassing.mainmerged after Part of #94 (F1b, model + judge) #1197:--jobs static,typecheckplus the whole suite, 33623 passed, 132 skipped.scripts/check_growth.py: clean.pipeline.pyis 783 lines, down from 800.Not run: a live model or doc source.
Open questions
--judge-placeholderonevaluate/benchmark run: a warned no-op here. A tombstone is the alternative.Not in this PR
answers generateon the shared stack (step 6a). It still answers through theAnswerer(method version 3).eval score's judge,Judge.evaluate_answers, is still Stack P's (200-character snippets). It warns on version 4 files (Consolidate duplicated subsystems (stats, LLM routing, judge loop, containers, digests, writers) #229 P1-4, step 6).--max-tokens/--retrieval-tokens→--retrieval-max-tokens(step 5).cost_summaryandjudge_materialshave no place inanswers.v1/eval.v1, so the pipeline drops them; no arms file is written beside them.min_questionscounts a judged miss as a question; not changed here (see the analysis above).Revert
A plain revert brings Stack P back. Files written with
method_version: 4stay readable: every reader takes them, as the adapter's golden test shows.Checklist
pytestpasses:tests/test_pipeline_arm_runner.py(new), the parity table and the tests above; whole suite 33623 passedruff,mypy, and schema checks pass: the static and typecheck rows ofmake ci-local --offline; the files passsave_artifact's schema validation in the testsdocs/methodology.md(answer generation, trust gate),docs/architecture.md; changelog fragment underChangedAGENTS.md: the mutations above; other sites of the bug class are listed under "Not in this PR"raise/exit and test names the doc, contract or issue it traces to: Answering stack: one implementation for evaluate/benchmark/answers and arms/subjects #228 step 4c, fix(arms): a crashed arms run keeps its answers in <out stem>.partial.json #1004, refactor(eval): an adapter from arms.v1 runs to answers.v1/eval.v1 #1148 in the code and the tests