bench(iabench): implement IA-2 retrieval and IA-5 hallucination tasks - #12
Merged
Merged
Conversation
- Add expert-notes corpus: EN-001 (motor maintenance) and EN-002 (hydraulic system) in data/synthetic/expert_notes/ - Add query set for IA-2: 12 operator queries with gold qrels in benchmarks/data/ia2_queries.json - Add grounded query set for IA-5: 18 queries with expected key facts and forbidden facts in benchmarks/data/ia5_grounded_queries.json - Implement _run_task_ia2(): invokes TacitKnowledgeCuratorAgent, normalises returned source_documents to corpus IDs, computes nDCG@5 per query - Implement _run_task_ia5(): invokes TacitKnowledgeCuratorAgent then LLM-as-judge to detect hallucinations and measure recall - Add _ndcg_at_5() and _normalize_doc_id() helpers for IA-2 scoring - Add _judge_hallucination() async helper for IA-5 LLM-as-judge - Add --judge-model CLI flag to bench command; same-model limitation documented in task_ia_5.yaml and code docstring - Update task_ia_2.yaml and task_ia_5.yaml: status→implemented, reference_implementation filled in, roadmap field removed - Update industrial_agent_benchmark.md: IA-2 and IA-5 marked Implemented - Fix pre-existing ruff PT001/PT023 errors in tests/unit/ (auto-fix) - Fix pre-existing mypy unused-ignore in sparkplug_client.py - Add TestNormalizeDocId and TestNdcgAt5 unit tests in test_iabench.py Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…001) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…emove version-mismatch band-aids Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Owner
Author
|
bench(iabench): implement IA-2 retrieval and IA-5 hallucination tasks (#12) Also pins ruff to 0.15.16 across CI, pre-commit, and dev deps to resolve |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #2 (PR 2 of 5 in IABENCH-v1.0 completion sequence). Does NOT close #2 — IA-4/6/7 remain for PRs 3–4, full publication run in PR 5.
Implements IA-2 (Tacit-knowledge retrieval, nDCG@5) and IA-5 (Hallucination rate) in the IABENCH-v1.0 benchmark suite, following the scoring contracts in
benchmarks/tasks/task_ia_2.yamlandtask_ia_5.yaml.IA-2: Tacit-knowledge retrieval
SOP-MAINT-001,SOP-MAINT-002) and 2 expert-note files (EN-001,EN-002) added todata/synthetic/expert_notes/benchmarks/data/ia2_queries.json_run_task_ia2()invokesTacitKnowledgeCuratorAgent, normalises returnedsource_documentsstrings to corpus IDs via_normalize_doc_id(), and computes per-query nDCG@5 against gold qrels. Mean nDCG@5 is the aggregate metric.reliable=falseiferror_rate > 0.10;mean_ndcg==1.0flagged suspiciousIA-5: Hallucination rate
expected_key_factsandforbidden_factstraceable to the synthetic SOP/expert-note corpus, stored inbenchmarks/data/ia5_grounded_queries.json_run_task_ia5()invokesTacitKnowledgeCuratorAgentthen an LLM-as-judge to evaluate recall and detect hallucinations.hallucination_pct = queries_with_hallucination / total_non_error_queries--judge-modelCLI flag. Same-model judging limitations (sycophancy, shared blind spots) documented intask_ia_5.yamland the_judge_hallucination()docstring.hallucination_pct==0.0flagged suspicious;reliable=falseiferror_rate > 0.10Other changes
benchmarks/tasks/task_ia_2.yamlandtask_ia_5.yaml:status→implemented,reference_implementationfilled in,roadmapfield removedbenchmarks/industrial_agent_benchmark.md: IA-2 and IA-5 marked ✅ Implementedsrc/industrial_agents/cli.py:--judge-modelflag added tobenchcommandtests/unit/test_iabench.py:TestNormalizeDocIdandTestNdcgAt5unit test classes added; pre-existingruff I001import-ordering issue fixed in follow-up commitHealth-check result
Run:
OLLAMA_MODEL=llama3.2:1b industrial-agents bench --suite all --provider ollama --model llama3.2:1bdetected=falsefor all 3 anomaly samples. PR 1 baseline numerically matched (F1=0.000), though comparison is confounded by #14source_documents=[]without ChromaDB indexed (documented limitation in #13)not_implemented=trueIA-2 nDCG@5=0.0: Not flagged suspicious. All 12 per-query
retrieved_docs=[]becauseTacitKnowledgeCuratorAgenthas no ChromaDB context available during the bench run. The harness is scoring correctly; the framework's retrieval is not performing (as documented intask_ia_2.yamllimitations).IA-5 hallucination_pct=0.056: Not suspicious (not 0.0 exactly). The single hallucination (g014: "Which SOP covers bearing replacement for motor_01 and motor_02?") was detected when the agent answered with a generic replacement interval rather than citing
SOP-MAINT-001. The judge verdict listsSOP-MAINT-002as the hallucinated claim — this is a known same-model judge artefact (the judge may have inferred a claim the agent did not literally make). Documented honestly; not manually corrected.Results saved to
benchmarks/results/iabench_all_llama3.2_1b.json.Verification
Follow-up issues