Repository navigation
refactor(eval): an adapter from arms.v1 runs to answers.v1/eval.v1 - #1148
vlad-perevezentsev merged 23 commits into
Conversation
…eline's readers intel#228 step 4b. eval/arms_adapter.py's to_binary turns an arms run of a baseline arm and at most one other into the answers.v1 and eval.v1 payloads Stack P writes, so step 4c can hand answering and judging to ArmRunner without touching the trust gate, the reports, the dashboard, RAGAS, grounding or baseline. The baseline arm is without_docs and the other arm with_docs; a cell's context_chunks become retrieved_docs and its first source doc_source. delta, diagnosis and retrieval_hit are derived as the judge derives them. What arms.v1 does not record (retrieval_metadata, token_usage_summary, question_set_hash, judge_placeholder) stays absent, and method_version is carried only when the run has one. A run-wide stop keeps its terminated block; the partial file of an unfinished run (intel#1004) reads as a terminated block with its counts and no eval. The golden test runs both stacks on the parity fixture: on the five questions they answer alike every reader gives the same result on the adapted files as on the pipeline's own, except the pinned rows (the snippet ellipsis, the run_metadata keys); q-empty differs as parity D2 pins it. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A profile, skill or agent arm retrieves nothing, so read as with_docs every question was a retrieval miss: retrieval_hit False, diagnosis empty_retrieval, and the trust gate failed the run on its hit rate. to_binary now refuses a context arm whose cells name no arm_kind or one other than docs/mcp_doc (DocTreatment's, treatments/factory.py), and the partial-file test runs a knowledge run instead of a profile arm. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
_eval_record read rec.scores, which also holds a legacy inline arms[name].evaluation (under aggregate_score). Two such cells crashed with KeyError 'aggregate'; one gave with_docs a block that is not an eval.v1 score. records.arm_scores is the run's evaluations list only. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…eads A context_chunks of strings crashed _answer with AttributeError, and an object with KeyError 0, though records._answer had read the same cell without complaint. retrieved_docs is now what that reader keeps: the non-empty objects of a list. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 3 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 #1148 +/- ##
========================================
Coverage 96.08% 96.09%
========================================
Files 479 480 +1
Lines 63399 63507 +108
Branches 10978 10998 +20
========================================
+ Hits 60919 61028 +109
+ Misses 1529 1527 -2
- Partials 951 952 +1
🚀 New features to boost your workflow:
|
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…m answered A run-wide stop on the first question writes cells with empty metadata (arm_stop.stop_question), so the docs arm recorded no arm_kind and to_binary refused the run instead of keeping its terminated block. A context arm with no kind and no answer has nothing to misread as a retrieval miss, so it now converts (with_docs null); an arm that answered with no kind, or with a kind other than docs/mcp_doc, is still refused. The check is now a set difference, and both doc kinds are tested. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…ocs arm again feafcb5 let to_binary take a context arm with no arm_kind and no answer as with_docs, so a run stopped before a skill or agent arm answered (or the partial file of a run killed before its first question) converted as a paired docs run. The cells of a run-wide stop recorded no kind because arm_stop wrote metadata {} for every arm. stop_question and mark_not_asked now take each arm's arm_kind metadata (arm_stop.arm_kinds, from the treatments; static_arm_kind moved there from arm_runner.py, which stays under the 800-line cap), so a stopped docs cell says it is one. The adapter is strict again: the context arm must record arm_kind docs or mcp_doc. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…nd-less stopped arm b87b725 stamped each arm's arm_kind on the cells of a run-wide stop. That changes arms.v1 output and the numbers derived from it (a not_asked cell of a skill_agent arm counted in skill_selection_summary.n_failed), outside this PR's goal. arm_stop.py and arm_runner.py are back as on main. to_binary instead refuses a context arm that records no arm_kind and answered nothing, saying the run stopped before the arm ran; a run stopped after its docs arm answered still converts with its stop. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
🔍 **OpenCodeReview** found **1** issue(s) in this PR. @exai-bot Agreed on the three failing checks: they are the growth ratchet on dokimi/commands/novelty.py, which is 801 lines on main itself (since #1133/#1134); this PR does not touch it. The local run on the merged head shows the same violation from main's file. |
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…m answered 059c382 refused a run whose context arm has only the cells of a run-wide stop: they record no arm_kind (arm_stop.stop_question), so a run stopped on its first question lost its terminated block. Such an arm holds no answer, so all with_docs gets from it is null, which no reader can misread as a retrieval miss: it is taken as the docs arm again. An arm that answered with no kind, or whose cells name another kind, is still refused. The stop cells themselves stay as on main. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…topped run e0d883c converted any context arm with no arm_kind and no answer as the docs arm, also in a run that never stopped: a kind-less errored agent arm, or an arm with no cell at all, read as a paired docs run. The exception is for the stop cells of arm_stop, so it now needs a terminated or partial block. The docstring says so, wrapped at 120, and that a non-docs arm stopped before it answered converts too. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 3503c34)
- Contract: changed. defaults dokimi/dokimi/eval/arms_adapter.py:50; errors dokimi/dokimi/eval/arms_adapter.py:57
- Responsibility: candidate. policy dokimi/docs/architecture.md
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
I checked the adapter against the binary readers, paired and baseline-only runs, judge errors, stopped runs and partial files. A two-turn session can escape the documented refusal. The reader-parity test finding also remains open. Focused tests on 3503c3454: 26 passed.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
A session cell holds its last turn's answer, so a binary record would pair it with the first question; ArmRunner refuses to judge such records for that reason. Without a turn reminder a session has only the requested arms, so the arm count did not refuse it. to_binary now refuses a run with a session block or a record with session_turns. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…unts The golden test reduced RAGAS's retrieved_contexts to a count and the record docs to their last characters, so an adapter that garbled a snippet (two words swapped) still passed. It now compares the whole texts on both sides, past the pinned "..."/"…" cut mark, and a negative control swaps two words in one adapted snippet and sees exactly the doc texts and the RAGAS rows differ. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
napetrov
left a comment
There was a problem hiding this comment.
Change class: CONTRACT (head 22ea212)
- Contract: changed. defaults dokimi/dokimi/eval/arms_adapter.py:50; errors dokimi/dokimi/eval/arms_adapter.py:58
- Responsibility: candidate. policy dokimi/docs/architecture.md
- Dependency: none
- Review depth: check the changed surface: callers, docs, tests pin new behaviour
- Coverage gaps: none
The previous two-turn ArmRunner case now raises RecordError. The reader-parity regression compares the retrieved context strings, including their order. All 29 adapter tests passed locally. One documentation nit remains in the architecture overview, where “one other arm” should say “one docs arm”.
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The overview said a run of a baseline and "one other arm", but to_binary refuses a profile, skill or agent arm and a session run. It now says a single-turn run of a baseline arm and at most one docs arm. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…line arm _binary_arms checked only the context arm's kind, so a --baseline-arm docs run with an mcp arm converted as paired: without_docs held the docs arm's answers, and the readers took an mcp-vs-docs delta as docs-vs-no-docs. A baseline arm whose cells record an arm_kind other than baseline (BaselineTreatment's) is now refused; stop cells, which record none, pass. The overview no longer promises a refusal of other arms in a run stopped before that arm answered. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The bare `--arms docs` arm takes no argument (specs.py), so `docs:` read as if it were not covered. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
_binary_arms looked at the set of kinds an arm's cells record, so one answered cell with no kind passed beside a docs cell, and read as a with_docs answer (a retrieval miss when it had no chunks). Each answered cell must now record a docs kind (the context arm) or baseline (the baseline arm); only unanswered cells, such as a stop's, may record none. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
The main parity test leaves out q-empty (D2), and its own test pinned only the with-docs side and the scores, so an adapter that changed or dropped q-empty's without_docs answer passed. The test now pins the baseline answer as the record reader and the report eval Q&A read it, the same on both stacks, and a negative control changes the adapted one and sees only that row differ. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
…kind Since 51ee1a4 an answered baseline cell with no arm_kind is refused, but the Arms bullet still let the baseline arm record none. It now says for both arms that each answered cell records its kind and only an unanswered (stop) cell may record none. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
_cell_kinds decided which cells must name their kind with not is_empty_reply(cell.text), and _answers_record which cells become null with is_empty_reply(cell.text). The kind check holds only while the two agree, so both now call _answered. Refs intel#228 Signed-off-by: Vladislav Perevezentsev <vladislav.perevezentsev@intel.com>
Summary
#228 step 4b.
dokimi/eval/arms_adapter.pyaddsto_binary(arms): a pure function from anarms.v1run to theanswers.v1andeval.v1payloads that Stack P writes. With it, step 4c can hand answering and judging inevaluate/benchmarktoArmRunnerand leave the readers of those files alone. No reader changes, and no numbers change. Refs #228.baseline_armbecomeswithout_docs, and it must be a baseline arm: each of its answered cells recordsarm_kindbaseline(a--baseline-arm docsrun is refused). Its one other arm becomeswith_docs, and that arm must be a docs arm: each of its answered cells'metadata.arm_kindmust bedocsormcp_doc(DocTreatment,treatments/factory.py).arm_kind(arm_stop.py). In a stopped run (aterminatedorpartialblock), an arm that has only such cells, stopped before it answered, is taken as the docs arm: allwith_docsgets from it isnull, so nothing can be misread as a retrieval miss. A non-docs arm stopped that early cannot be told apart and converts too. In a run that never stopped, a kind-less arm is refused.with_docs: null,run_intent: knowledge.RecordError. A profile arm retrieves nothing, so read aswith_docsevery question would be a retrieval miss and the trust gate would fail the run on its hit rate.context_chunksbecomeretrieved_docs, keeping the non-empty objects of the list, which is whatrecords.Answerreads.doc_sourceis the first chunk's source, as the answerer writes it.null, and the record'serrornames it (docs: generation_failed: ...), as the answerer records a failed condition.evaluationslist only (records.arm_scores), never from a legacy inlinearms[name].evaluation.delta,diagnosisandretrieval_hitare derived from those scores and answers the way the judge derives them.error.run_metadatagetsanswer_model/answer_provider,judge_model/judge_provider,evaluator_independence_warningandrun_intent.evaluated_atis the arms run'sgenerated_at; the arms file is assembled after judging.arms.v1does not record them:retrieval_metadata, includingfallback_triggered(fix(eval): evaluate, benchmark and answers generate retrieve docs through DocTreatment #997); no reader reads ittoken_usage.context_charsandtoken_usage_summary; no reader reads themquestion_set_hash,question_model/question_providerjudge_placeholder; the arms judge has no placeholder to skipmethod_version: copied when the run has one, never stamped (see Open questions)terminatedblock in the answers file and in the eval'srun_metadata, soreport evalshows its stop note. This holds for a run stopped on its first question as well.<out stem>.partial.json, fix(arms): a crashed arms run keeps its answers in <out stem>.partial.json #1004) becomes an answers file with aterminatedblock. The block holds the partial block's counts and no reason, and there is no eval file: nothing in the partial file was judged.records.readstill refuses the arms partial file itself.report model-compareis not a reader of these files.extract_scoresneeds an arms file'sbaseline_arm, and aneval.v1file gives it no rows. It keeps reading the arms file, and the test checks that its rows match the adapted eval question for question.docs/architecture.mdgets one sentence on the module, under "Treatment-arm comparison".Changed output
None. Nothing calls
to_binaryyet; step 4c will.Evidence
Golden test (
tests/test_arms_adapter.py). Both stacks answer and judge the parity fixture (tests/answering_stack_parity.py), Stack A's run goes throughto_binary, and the results are saved withsave_artifact, which validates them against the schemas. Each reader then reads Stack P's own files and the adapted ones:records.load: shape, conditions, answers, docs,retrieval_hit, knowledge-run checkreport generate --format jsonreport eval: the markdown, past its "Generated" line, and the.qa.jsonrecordsbaseline's summarysignificance_testextract_scoresOn the five questions the stacks answer alike, every reader gives the same result, except two pinned rows:
...in the answerer and in…in the arm runner;run_metadatakeys differ: P hasquestion_model,question_providerandquestion_set_hash, the adapted eval hasrun_intent.The sixth question, q-empty, differs as parity row D2 pins it. P judges no with-docs answer (the placeholder: delta null,
empty_retrieval, dashboardunjudged_miss). A judges a plain-prompt answer (60/60, delta 0,docs_helped). Both recordretrieval_hit: false.Other tests: a failed cell and a judge failure; a knowledge run;
method_versioncarried and never stamped; the refusals (notarms.v1, a session run fromArmRunnerwith two turns, three arms, no baseline, a profile arm, an arm with noarm_kind); a legacy inline evaluation; malformedcontext_chunks; a stopped run, includingArmRunnerstopped on its first question and judged; a partial file with no record; a real partial file fromarms runcrashing on the third of four questions.Mutations, each failing a test and then reverted (16):
retrieval_hitdropped;doc_sourcedropped;retrieved_docsdroppedevaluated_at, the independence flag, the baseline-in-arms check or the knowledge intent droppedarm_scoresback torec.scores; the chunk filter loosenedcontext_scoredargument todiagnose. It is equivalent here, because the adapter never writes afallback_none/nonedoc_source.CI's mutation step (first commit): 39 of 40 killed. The survivor,
zip(..., strict=True)→strict=False, is equivalent: the two lists are built from the same records.make ci-local --offlineon the first commit:Fragment for package changes, which this PR answers withskip-changelog.arms_adapter.py: 100%.Review fix commits:
make ci-local --offline --jobs static,typecheckplus the whole suite pass (26746 passed, 81 skipped), with the same fragment row failing.scripts/check_growth.py: clean.Not run: a live model or doc source. The adapter does not call either.
Open questions
method_version.arms.v1carries nomethod_version(parity rowartifact.method_version: 3 vs None), so the adapter writes none.answers_method_versionthen reads the adapted files as legacy v1. Nothing compares versions today. Step 4c has to stamp one, in the arms output or in the pipeline; this PR does not invent it.Not in this PR
evaluate/benchmark: step 4c (A-4).answers.v1has nowhere to put it, the same as for the answerer's failed conditions.session_turns), not read turn by turn; each cell holds the last turn's answer.token_usage_summary: derivable from the cells, but no reader reads it.Checklist
pytestpasses:tests/test_arms_adapter.py(new); whole suite 26746 passedruff,mypy, and schema checks pass: the static and typecheck rows ofmake ci-local --offline; the adapted payloads passsave_artifact's schema validation in the testdocs/architecture.md, one sentenceAGENTS.md: the mutations and bad inputs aboveraise/exit and test names the doc, contract or issue it traces to: the refusals cite AGENTS.md "Persisted formats" and the docs-arm rule; the tests cite Answering stack: one implementation for evaluate/benchmark/answers and arms/subjects #228, Show a run-wide stop on the arms .md and the report eval page #895, fix(eval): evaluate, benchmark and answers generate retrieve docs through DocTreatment #997, fix(arms): a crashed arms run keeps its answers in <out stem>.partial.json #1004 anddocs/evaluating-treatments.md