bioai-evidence-validator 0.7.0__tar.gz → 0.9.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. bioai_evidence_validator-0.9.0/.gitignore +29 -0
  2. bioai_evidence_validator-0.9.0/PKG-INFO +430 -0
  3. bioai_evidence_validator-0.9.0/README.md +391 -0
  4. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/pyproject.toml +20 -1
  5. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/__init__.py +1 -1
  6. bioai_evidence_validator-0.9.0/src/bioevidence_validator/audit.py +216 -0
  7. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/cli.py +132 -2
  8. bioai_evidence_validator-0.9.0/src/bioevidence_validator/crosscheck.py +92 -0
  9. bioai_evidence_validator-0.9.0/src/bioevidence_validator/definitions.py +124 -0
  10. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/engine.py +97 -10
  11. bioai_evidence_validator-0.9.0/src/bioevidence_validator/evidence_library.py +243 -0
  12. bioai_evidence_validator-0.9.0/src/bioevidence_validator/evidence_mcp.py +330 -0
  13. bioai_evidence_validator-0.9.0/src/bioevidence_validator/feedback.py +144 -0
  14. bioai_evidence_validator-0.9.0/src/bioevidence_validator/grounding.py +107 -0
  15. bioai_evidence_validator-0.9.0/src/bioevidence_validator/identifiers.py +418 -0
  16. bioai_evidence_validator-0.9.0/src/bioevidence_validator/literature.py +393 -0
  17. bioai_evidence_validator-0.9.0/src/bioevidence_validator/semantic.py +66 -0
  18. bioai_evidence_validator-0.9.0/src/bioevidence_validator/semantic_support.py +335 -0
  19. bioai_evidence_validator-0.9.0/src/bioevidence_validator/tables.py +118 -0
  20. bioai_evidence_validator-0.7.0/.gitattributes +0 -2
  21. bioai_evidence_validator-0.7.0/.github/ISSUE_TEMPLATE/bug_report.yml +0 -53
  22. bioai_evidence_validator-0.7.0/.github/ISSUE_TEMPLATE/config.yml +0 -8
  23. bioai_evidence_validator-0.7.0/.github/ISSUE_TEMPLATE/feature_request.yml +0 -28
  24. bioai_evidence_validator-0.7.0/.github/ISSUE_TEMPLATE/profile_proposal.yml +0 -42
  25. bioai_evidence_validator-0.7.0/.github/pull_request_template.md +0 -18
  26. bioai_evidence_validator-0.7.0/.github/workflows/ci.yml +0 -90
  27. bioai_evidence_validator-0.7.0/.github/workflows/docs.yml +0 -43
  28. bioai_evidence_validator-0.7.0/.github/workflows/release.yml +0 -74
  29. bioai_evidence_validator-0.7.0/.gitignore +0 -13
  30. bioai_evidence_validator-0.7.0/CHANGELOG.md +0 -89
  31. bioai_evidence_validator-0.7.0/CITATION.cff +0 -21
  32. bioai_evidence_validator-0.7.0/CODE_OF_CONDUCT.md +0 -16
  33. bioai_evidence_validator-0.7.0/CONTRIBUTING.md +0 -76
  34. bioai_evidence_validator-0.7.0/PKG-INFO +0 -351
  35. bioai_evidence_validator-0.7.0/README.md +0 -315
  36. bioai_evidence_validator-0.7.0/SECURITY.md +0 -35
  37. bioai_evidence_validator-0.7.0/action.yml +0 -57
  38. bioai_evidence_validator-0.7.0/community/profiles/README.md +0 -37
  39. bioai_evidence_validator-0.7.0/community/profiles/_template/README.md +0 -18
  40. bioai_evidence_validator-0.7.0/community/profiles/_template/cases/curated_assay.yaml +0 -14
  41. bioai_evidence_validator-0.7.0/community/profiles/_template/cases/llm_only.yaml +0 -14
  42. bioai_evidence_validator-0.7.0/community/profiles/_template/cases/network_without_review.yaml +0 -14
  43. bioai_evidence_validator-0.7.0/community/profiles/_template/cases/synthetic_study.txt +0 -2
  44. bioai_evidence_validator-0.7.0/community/profiles/_template/expected.yaml +0 -14
  45. bioai_evidence_validator-0.7.0/community/profiles/_template/profile.yaml +0 -19
  46. bioai_evidence_validator-0.7.0/docs/ADR-001-canine-breed-first.md +0 -41
  47. bioai_evidence_validator-0.7.0/docs/ADR-002-domain-neutral-main.md +0 -30
  48. bioai_evidence_validator-0.7.0/docs/CASE_STUDY.md +0 -50
  49. bioai_evidence_validator-0.7.0/docs/DRAFTS.md +0 -99
  50. bioai_evidence_validator-0.7.0/docs/ENGINEERING.md +0 -115
  51. bioai_evidence_validator-0.7.0/docs/GOLD_STANDARD.md +0 -118
  52. bioai_evidence_validator-0.7.0/docs/MIGRATION-0.4.md +0 -32
  53. bioai_evidence_validator-0.7.0/docs/PROFILES.md +0 -97
  54. bioai_evidence_validator-0.7.0/docs/STANDARDS.md +0 -79
  55. bioai_evidence_validator-0.7.0/docs/assets/clinvar_germline_benchmark.svg +0 -4101
  56. bioai_evidence_validator-0.7.0/docs/assets/vbo_canine_benchmark.svg +0 -2769
  57. bioai_evidence_validator-0.7.0/docs/index.md +0 -58
  58. bioai_evidence_validator-0.7.0/evaluation/clinvar_review/README.md +0 -125
  59. bioai_evidence_validator-0.7.0/evaluation/clinvar_review/RUBRIC.md +0 -74
  60. bioai_evidence_validator-0.7.0/evaluation/clinvar_review/import_sheets.py +0 -126
  61. bioai_evidence_validator-0.7.0/evaluation/clinvar_review/prepare_packets.py +0 -221
  62. bioai_evidence_validator-0.7.0/evaluation/gold_standard/README.md +0 -37
  63. bioai_evidence_validator-0.7.0/evaluation/gold_standard/adjudications.template.csv +0 -1
  64. bioai_evidence_validator-0.7.0/evaluation/gold_standard/annotations.template.csv +0 -1
  65. bioai_evidence_validator-0.7.0/evaluation/gold_standard/manifest.template.json +0 -17
  66. bioai_evidence_validator-0.7.0/examples/clinvar_germline/README.md +0 -178
  67. bioai_evidence_validator-0.7.0/examples/clinvar_germline/pipeline.py +0 -231
  68. bioai_evidence_validator-0.7.0/examples/clinvar_germline/plot.py +0 -135
  69. bioai_evidence_validator-0.7.0/examples/clinvar_germline/prepare_source.py +0 -200
  70. bioai_evidence_validator-0.7.0/examples/clinvar_germline/profile.yaml +0 -24
  71. bioai_evidence_validator-0.7.0/examples/clinvar_germline/results/divergences.csv +0 -246
  72. bioai_evidence_validator-0.7.0/examples/clinvar_germline/results/summary.json +0 -556
  73. bioai_evidence_validator-0.7.0/examples/clinvar_germline/results/summary.md +0 -48
  74. bioai_evidence_validator-0.7.0/examples/clinvar_germline/run.py +0 -179
  75. bioai_evidence_validator-0.7.0/examples/clinvar_germline/sources/README.md +0 -33
  76. bioai_evidence_validator-0.7.0/examples/clinvar_germline/sources/clinvar-sample.jsonl.gz +0 -0
  77. bioai_evidence_validator-0.7.0/examples/clinvar_germline/sources/manifest.json +0 -39
  78. bioai_evidence_validator-0.7.0/examples/clinvar_germline/sources/population_outcomes.json +0 -121
  79. bioai_evidence_validator-0.7.0/examples/custom_profile/assay.yaml +0 -16
  80. bioai_evidence_validator-0.7.0/examples/custom_profile/assay_record.json +0 -61
  81. bioai_evidence_validator-0.7.0/examples/dataset_label/curated_sample_label.json +0 -88
  82. bioai_evidence_validator-0.7.0/examples/dataset_label/missing_sample_link.json +0 -76
  83. bioai_evidence_validator-0.7.0/examples/drafts/llm_claim.yaml +0 -28
  84. bioai_evidence_validator-0.7.0/examples/drafts/reviewed_claim.yaml +0 -35
  85. bioai_evidence_validator-0.7.0/examples/drafts/synthetic_paper.txt +0 -2
  86. bioai_evidence_validator-0.7.0/examples/general/curated_assertion.json +0 -61
  87. bioai_evidence_validator-0.7.0/examples/literature_claim/curated_association.json +0 -61
  88. bioai_evidence_validator-0.7.0/examples/literature_claim/llm_only.json +0 -61
  89. bioai_evidence_validator-0.7.0/examples/quickstart.ipynb +0 -255
  90. bioai_evidence_validator-0.7.0/examples/vbo_canine/README.md +0 -138
  91. bioai_evidence_validator-0.7.0/examples/vbo_canine/pipeline.py +0 -157
  92. bioai_evidence_validator-0.7.0/examples/vbo_canine/prepare_source.py +0 -79
  93. bioai_evidence_validator-0.7.0/examples/vbo_canine/profile.yaml +0 -12
  94. bioai_evidence_validator-0.7.0/examples/vbo_canine/reference_cases.json +0 -750
  95. bioai_evidence_validator-0.7.0/examples/vbo_canine/results/decisions.jsonl +0 -248
  96. bioai_evidence_validator-0.7.0/examples/vbo_canine/results/review_queue.csv +0 -25
  97. bioai_evidence_validator-0.7.0/examples/vbo_canine/results/summary.json +0 -151
  98. bioai_evidence_validator-0.7.0/examples/vbo_canine/results/summary.md +0 -19
  99. bioai_evidence_validator-0.7.0/examples/vbo_canine/run.py +0 -86
  100. bioai_evidence_validator-0.7.0/examples/vbo_canine/sources/README.md +0 -21
  101. bioai_evidence_validator-0.7.0/examples/vbo_canine/sources/manifest.json +0 -17
  102. bioai_evidence_validator-0.7.0/examples/vbo_canine/sources/vbo-dogs.json +0 -20069
  103. bioai_evidence_validator-0.7.0/mkdocs.yml +0 -62
  104. bioai_evidence_validator-0.7.0/tests/test_cli.py +0 -147
  105. bioai_evidence_validator-0.7.0/tests/test_clinvar_case.py +0 -121
  106. bioai_evidence_validator-0.7.0/tests/test_clinvar_review_kit.py +0 -138
  107. bioai_evidence_validator-0.7.0/tests/test_community_profiles.py +0 -39
  108. bioai_evidence_validator-0.7.0/tests/test_draft.py +0 -174
  109. bioai_evidence_validator-0.7.0/tests/test_engine.py +0 -178
  110. bioai_evidence_validator-0.7.0/tests/test_evidence_quality.py +0 -52
  111. bioai_evidence_validator-0.7.0/tests/test_fail_closed.py +0 -106
  112. bioai_evidence_validator-0.7.0/tests/test_github_action.py +0 -43
  113. bioai_evidence_validator-0.7.0/tests/test_profiles.py +0 -78
  114. bioai_evidence_validator-0.7.0/tests/test_repository_files.py +0 -21
  115. bioai_evidence_validator-0.7.0/tests/test_review.py +0 -230
  116. bioai_evidence_validator-0.7.0/tests/test_standards.py +0 -34
  117. bioai_evidence_validator-0.7.0/tests/test_vbo_case.py +0 -66
  118. bioai_evidence_validator-0.7.0/tools/check_distribution.py +0 -76
  119. bioai_evidence_validator-0.7.0/tools/github_action.py +0 -91
  120. bioai_evidence_validator-0.7.0/tools/mkdocs_hooks.py +0 -73
  121. bioai_evidence_validator-0.7.0/uv.lock +0 -2296
  122. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/LICENSE +0 -0
  123. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/config.py +0 -0
  124. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/draft.py +0 -0
  125. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/profiles/dataset-label.yaml +0 -0
  126. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/profiles/general.yaml +0 -0
  127. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/profiles/literature-claim.yaml +0 -0
  128. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/review.py +0 -0
  129. {bioai_evidence_validator-0.7.0 → bioai_evidence_validator-0.9.0}/src/bioevidence_validator/schema/bioevidence_core.yaml +0 -0
@@ -0,0 +1,29 @@
1
+ .venv/
2
+ __pycache__/
3
+ *.py[cod]
4
+ .pytest_cache/
5
+ *.egg-info/
6
+ dist/
7
+ build/
8
+ artifacts/
9
+ validation_report.json
10
+ _site/
11
+ site/
12
+ .coverage
13
+ htmlcov/
14
+
15
+ # Machine-owned evidence and MCP configuration
16
+ data/
17
+ # Public, authored inputs for the offline ACMG example.
18
+ !/examples/acmg_triage/src/acmg_triage/data/
19
+ /examples/acmg_triage/src/acmg_triage/data/*
20
+ !/examples/acmg_triage/src/acmg_triage/data/benchmark.yaml
21
+ !/examples/acmg_triage/src/acmg_triage/data/passages.yaml
22
+ !/examples/acmg_triage/src/acmg_triage/data/triage-profile.yaml
23
+ /evaluation/biocuration_bench/.cache/
24
+ .mcp.json
25
+ local-mcp.json
26
+ .env
27
+ /project.json
28
+ /evidence/
29
+ validation-report.json
@@ -0,0 +1,430 @@
1
+ Metadata-Version: 2.5
2
+ Name: bioai-evidence-validator
3
+ Version: 0.9.0
4
+ Summary: Standards-aligned evidence policy validation for AI-assisted biological curation
5
+ Project-URL: Homepage, https://github.com/NingyuSUN/bioai-evidence-validator
6
+ Project-URL: Documentation, https://ningyusun.github.io/bioai-evidence-validator/
7
+ Project-URL: Changelog, https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/NingyuSUN/bioai-evidence-validator/issues
9
+ Author: Ningyu Sun
10
+ License: Apache-2.0
11
+ License-File: LICENSE
12
+ Keywords: ai-safety,biocuration,bioinformatics,evidence,knowledge-graph,linkml,llm,ontology,provenance,validation
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Operating System :: OS Independent
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: jsonschema<5,>=4.23
26
+ Requires-Dist: linkml<2,>=1.8
27
+ Requires-Dist: pyyaml<7,>=6.0
28
+ Provides-Extra: dev
29
+ Requires-Dist: mypy<3,>=2.3; extra == 'dev'
30
+ Requires-Dist: openpyxl<4,>=3.1; extra == 'dev'
31
+ Requires-Dist: pytest-cov<8,>=7; extra == 'dev'
32
+ Requires-Dist: pytest<9,>=8; extra == 'dev'
33
+ Requires-Dist: ruff<0.17,>=0.16; extra == 'dev'
34
+ Requires-Dist: types-jsonschema; extra == 'dev'
35
+ Requires-Dist: types-pyyaml; extra == 'dev'
36
+ Provides-Extra: mcp
37
+ Requires-Dist: mcp==2.3.0; extra == 'mcp'
38
+ Description-Content-Type: text/markdown
39
+
40
+ <h1 align="center">BioAI Evidence Validator</h1>
41
+
42
+ <p align="center">
43
+ <b>A validation layer for AI-assisted biological curation.</b><br>
44
+ Let models do the routine work, and send experts only the records that need them.
45
+ </p>
46
+
47
+ <p align="center">
48
+ <a href="https://github.com/NingyuSUN/bioai-evidence-validator/actions/workflows/ci.yml"><img src="https://github.com/NingyuSUN/bioai-evidence-validator/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
49
+ <a href="https://pypi.org/project/bioai-evidence-validator/"><img src="https://img.shields.io/pypi/v/bioai-evidence-validator" alt="PyPI"></a>
50
+ <a href="https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/pyproject.toml"><img src="https://img.shields.io/badge/python-3.11%2B-blue" alt="Python 3.11+"></a>
51
+ <a href="https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-blue" alt="License: Apache-2.0"></a>
52
+ <a href="https://colab.research.google.com/github/NingyuSUN/bioai-evidence-validator/blob/main/examples/quickstart.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open in Colab"></a>
53
+ <a href="https://ningyusun.github.io/bioai-evidence-validator/"><img src="https://img.shields.io/badge/docs-site-blue" alt="Docs"></a>
54
+ </p>
55
+
56
+ <p align="center">
57
+ <a href="#quickstart">Quickstart</a> ·
58
+ <a href="#results-at-a-glance">Results</a> ·
59
+ <a href="#offline-showcases">Offline showcases</a> ·
60
+ <a href="#how-it-works">How it works</a> ·
61
+ <a href="#real-data-cases">Cases</a> ·
62
+ <a href="#works-with-evidport">EvidPort</a> ·
63
+ <a href="https://ningyusun.github.io/bioai-evidence-validator/">Docs</a> ·
64
+ <a href="#limits">Limits</a>
65
+ </p>
66
+
67
+ ---
68
+
69
+ LLMs and agents now extract claims from papers, cite the literature and annotate single-cell clusters.
70
+ Their output looks right, and it often is not. Some typical errors:
71
+ - a Cell Ontology ID that names a different cell type;
72
+ - a real PMID that belongs to an unrelated paper;
73
+ - a quote that appears nowhere in the paper.
74
+
75
+ Bioevidence checks every AI-produced record against pinned sources and reference releases, and decides,
76
+ for each intended use, whether it is **admitted**, needs **review**, or is **rejected**. Errors the model
77
+ can fix go back to it with the exact correction; findings that need judgment go to a person. The
78
+ real-data experiments include six models from Anthropic, OpenAI and Google.
79
+
80
+ ![AI validation results: in single-cell annotation of held-out clusters, the feedback loop raises answers compatible with the authors' term from 176 to 205 of 276 while sending 21 to a person; across four experiments, models alone produced invalid identifiers or citations in 10–76% of answers, and bioevidence admitted none](https://raw.githubusercontent.com/NingyuSUN/bioai-evidence-validator/main/docs/assets/ai_validation_results.svg)
81
+
82
+ **Review the project:** [methods, measured results, contributions and reproducibility](docs/PROJECT_EVIDENCE.md).
83
+ This project compares model-only output, a validation gate and a feedback loop,
84
+ including a failed external test. Independent human evaluation remains open.
85
+
86
+ ## Offline showcases
87
+
88
+ | Showcase | Result on authored synthetic cases |
89
+ |---|---|
90
+ | [BioCuration-Bench](evaluation/biocuration_bench/README.md) tests quote provenance, semantic support and curation policy on 90 SHA-256-sealed items. | `full_trust_stack` held 43 of 45 defects and admitted 44 of 45 clean controls. Across the three tracks, Youden’s J was **0.933**, recall **95.6%**, specificity **97.8%** and hallucination leakage **4.8%**, compared with **100%** leakage for `naive_accept`. [Static leaderboard](https://ningyusun.github.io/bioai-evidence-validator/leaderboard/) |
91
+ | [ACMG/AMP Evidence-Grounded Clinical Variant Triage](examples/acmg_triage/README.md) applies 15 rules, reports Richards classifications and Tavtigian-derived Bayesian points, and exports a clinician-readable evidence card. | Across 28 vignettes, five-class agreement with the authored labels rose from **22/28 to 28/28**. EvidPort quote checks, BEV027 semantic review and study eligibility checks quarantined seven invalid claims. False pathogenic or likely pathogenic calls fell from **6/6 to 0/6** on the adversarial cases. |
92
+
93
+ Both run from this checkout. The triage benchmark measures replay of synthetic cases for research and education.
94
+
95
+ ## Quickstart
96
+
97
+ ```bash
98
+ pip install bioai-evidence-validator
99
+ bioevidence validate examples/literature_claim/llm_only.json --profile literature-claim # exit 2: review required
100
+ ```
101
+
102
+ From version 0.8.0 the package also includes the literature, ontology, gene, variant, table and
103
+ reference grounders, and the feedback loop. For example, to check a cell-type annotation against a pinned
104
+ Cell Ontology release and the HGNC gene set:
105
+
106
+ ```bash
107
+ bioevidence validate record.json --ontology cl.obo --term-root cell_type=CL:0000000 --genes hgnc_complete_set.txt
108
+ ```
109
+
110
+ Wrap a model in the feedback loop:
111
+
112
+ ```python
113
+ from pathlib import Path
114
+
115
+ from bioevidence_validator.engine import RecordValidator
116
+ from bioevidence_validator.feedback import revise
117
+ from bioevidence_validator.identifiers import GeneGrounder, Genes, Ontology, OntologyGrounder
118
+
119
+ validator = RecordValidator(profile="general", grounders=[
120
+ OntologyGrounder([Ontology.from_obo(Path("cl.obo").read_bytes())], roots={"cell_type": ["CL:0000000"]}),
121
+ GeneGrounder(Genes.from_hgnc(Path("hgnc_complete_set.txt").read_bytes())),
122
+ ])
123
+
124
+ def propose(feedback: list[str]) -> dict | None:
125
+ """Ask your model for a record; on later rounds, include the feedback in the prompt."""
126
+ ...
127
+
128
+ attempts = revise(propose, validator, rounds=3)
129
+ print(attempts[-1].report["overall_status"]) # admitted, review_required or rejected
130
+ ```
131
+
132
+ Exit codes: **0** admitted, **1** rejected, **2** review required, **3** input or configuration error.
133
+
134
+ To check records in a pull request, use the GitHub Action:
135
+
136
+ ```yaml
137
+ - uses: NingyuSUN/bioai-evidence-validator@v0.9.0
138
+ with:
139
+ files: records/**/*.yaml
140
+ format: draft
141
+ profile: literature-claim
142
+ fail-on: review
143
+ ```
144
+
145
+ More: [draft format](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/DRAFTS.md) (state each fact once, build the full record) ·
146
+ [create a profile](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/PROFILES.md) ·
147
+ [engineering contract and rule codes](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/ENGINEERING.md) ·
148
+ [documentation site](https://ningyusun.github.io/bioai-evidence-validator/).
149
+
150
+ ## Results at a glance
151
+
152
+ | Experiment | The model alone | With bioevidence |
153
+ |---|---|---|
154
+ | **Single-cell cell-type annotation**: 6 models × 46 held-out clusters, protocol frozen before the run | 62 of 276 answers (22%) carry a Cell Ontology ID that does not match its label, e.g. "Paneth cell" filed under the ID of a pigment cell | No such answer admitted. In the feedback loop, answers compatible with the authors' term rise from **176 to 205**, wrong or invalid fall from 36% of answers to 20% of those admitted, and 8% go to a person |
155
+ | **Claim extraction from full papers**: 6 models × 40 openly licensed papers, no claim given in advance, protocol frozen before the run | 198 of 714 extracted claims (28%) carry a wrong identifier, name or quote: from 3% for Claude Opus 5.5 to 48% for Claude Haiku 4.5 | None admitted. With feedback, **663** claims are admitted instead of 489, covering 77 of the 87 items CIViC curated from these papers |
156
+ | **Literature claims without a source**: 6 models × 18 CIViC claims | 38 of 50 answers cite an invalid paper or quote; 28 of 66 citations are real PMIDs of unrelated papers | 3 answers admitted, all with verified citations and the right decision |
157
+ | **Literature agent with PubMed tools**: 108 episodes | 8 of 77 first answers misquote their papers | 0 of 73 admitted answers carry an invalid citation; feedback rescues answers a plain gate would lose |
158
+ | **ClinVar germline classifications**: 5,026 variants, 2023 → 2026 | Schema-only checks admit 160 of 160 injected faults | 0 of 160 admitted; variants held back for a dissenting submission were 4–5× more likely to be reclassified three years later |
159
+
160
+ What it cannot do, also measured:
161
+ - **Semantic errors with valid identifiers and real evidence still get through.** Examples are a memory T
162
+ cell called naive, or an ILC3 called a Th17 cell: 20% of admitted single-cell annotations disagree with
163
+ the authors' term, part of it label noise.
164
+ - **One check failed external validation.** A check built from Cell Ontology marker definitions, with
165
+ thresholds set on development data, flagged errors no better than chance on six new studies. Fed back to
166
+ the models, it turned 15 correct answers into wrong ones. The check is kept as experimental, and the
167
+ cause (protein definitions that do not hold for transcripts) is documented.
168
+
169
+ Full protocols and numbers: [LLM benchmark](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/evaluation/llm_benchmark/README.md) ·
170
+ [single-cell case](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/singlecell_celltype/README.md) ·
171
+ [extraction case](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/civic_extraction/README.md) ·
172
+ [ClinVar case](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/clinvar_germline/README.md).
173
+
174
+ ## How it works
175
+
176
+ ```mermaid
177
+ flowchart LR
178
+ A["AI output<br/>(LLM or agent)"] --> R["Evidence record<br/>claim + sources + evidence"]
179
+ R --> P["Profile rules<br/>per intended use"]
180
+ R --> G["Grounders<br/>check against pinned sources"]
181
+ P --> D{"Decision<br/>per use"}
182
+ G --> D
183
+ D -->|admitted| K["Knowledge base /<br/>training set"]
184
+ D -->|fixable error| F["Feedback to the model<br/>with the exact correction"]
185
+ F --> A
186
+ D -->|needs judgment| H["Expert review"]
187
+ D --> L["Audit report<br/>findings, versions, hashes"]
188
+ ```
189
+
190
+ - **Records:** a claim (subject, predicate, object, scope) with the sources it rests on and typed evidence
191
+ items. They are validated against a LinkML schema.
192
+ - **Profiles:** each profile states, per use, which evidence a claim needs before it is admitted. For
193
+ example, LLM-extracted evidence may be enough for a research summary, while a knowledge base requires a
194
+ human's acceptance. Profiles are YAML, so a new domain needs no engine changes.
195
+ - **Grounders:** they recompute what a record only asserts from pinned, content-addressed snapshots:
196
+
197
+ | Grounder | Checks |
198
+ |---|---|
199
+ | Literature | PMID/DOI resolution, retraction, title, and every quote against open full text or the abstract |
200
+ | Ontology | the term exists, is current, matches its label and is of the right kind (e.g. a cell type) |
201
+ | Genes / variants | HGNC approved symbols, previous symbols and aliases; HGVS form, RefSeq version, genome build |
202
+ | Tables | a cited data row exists with the values claimed (e.g. a marker gene of this cluster) |
203
+ | Reference resources | a curated reference contradicts the claim (review only) |
204
+ | Ontology definitions | measurements contradict a marker the claimed term is defined by (experimental) |
205
+
206
+ - **Feedback loop:** `feedback.revise` wraps any model or agent.
207
+ - Fixable findings go back as precise reasons.
208
+ - Conflicts and policy decisions go to a person unchanged.
209
+ - Verified evidence cannot be withdrawn in a revision, so an agent cannot drop the evidence against
210
+ its own answer.
211
+ - **Audit:** every report records the input, schema and profile hashes and versions. The
212
+ [engineering contract](docs/ENGINEERING.md) lists each rule code and its severity, including BEV027 for semantic review.
213
+
214
+ ## End to end: LLM → tool calling → structured output → evaluation → failure handling
215
+
216
+ The [agent benchmark](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/evaluation/llm_benchmark/agent_loop.py)
217
+ runs the whole chain with every model:
218
+ - the harness, not the model's CLI, executes the tools, so each step is logged;
219
+ - each model reply must match a JSON Schema;
220
+ - each submission is validated by bioevidence before anything is admitted.
221
+
222
+ ```mermaid
223
+ sequenceDiagram
224
+ participant H as Harness
225
+ participant M as Model (Claude / GPT / Gemini CLI)
226
+ participant T as Tools (PubMed, pinned papers)
227
+ participant B as bioevidence
228
+ H->>M: claim + tool list + JSON Schema for the reply
229
+ M-->>H: {"action": "search", "query": ...}
230
+ H->>T: esearch + efetch (cached, rate-limited)
231
+ T-->>H: up to 8 hits: PMID, title, abstract snippet
232
+ M-->>H: {"action": "read", "pmid": ...}
233
+ H->>T: resolve, pin full text or abstract by SHA-256
234
+ M-->>H: {"action": "submit", "decision": ..., "citations": [{pmid, title, quote, stance}]}
235
+ H->>B: record built from the submission, validated with grounders
236
+ alt admitted
237
+ B-->>H: admitted, report with hashes
238
+ else fixable finding
239
+ B-->>H: reasons (e.g. "citation 1: The quote does not appear in the cited paper.")
240
+ H->>M: the same task, with the reasons
241
+ else needs judgment
242
+ B-->>H: to a person (conflicting evidence, policy)
243
+ end
244
+ ```
245
+
246
+ A real run from the committed results: Claude Haiku 4.5, asked whether VHL mutation predicts response to anti-VEGF
247
+ antibodies in renal cell carcinoma.
248
+
249
+ | Step | Model output (schema-validated JSON) | Harness and bioevidence |
250
+ |---|---|---|
251
+ | 1 | `search`: "VHL mutation renal cell carcinoma anti-VEGF response" | PubMed returns up to 8 hits with titles and abstract snippets |
252
+ | 2 | `read`: PMID 28103578 | The paper is resolved and pinned by SHA-256; its text is returned |
253
+ | 3 | `submit`: decision `does_not_support`, one citation with a 67-word quote | **Rejected.** BEV017: the quote does not appear in the cited paper. BEV020: no verified quote, as the profile requires. The reasons go back to the model |
254
+ | 4 | `submit`: the same decision with three shorter quotes from the same paper | All three are found in the pinned text, so the record is **admitted**. Its decision matches CIViC's |
255
+
256
+ The same loop corrects identifiers in single-cell annotation. Claude Haiku 4.5 labeled a pancreatic cluster
257
+ "pancreatic delta cell" but gave the ID `CL:0002335`, which is a brown preadipocyte. The feedback it received:
258
+
259
+ > object label: The label 'pancreatic delta cell' is not the name of CL:0002335 ('brown preadipocyte').
260
+ > 'pancreatic delta cell' is the name of CL:0000173 (pancreatic D cell).
261
+
262
+ Its second answer, `CL:0000173`, was admitted and is exactly the authors' annotation.
263
+
264
+ Across all 276 held-out annotations, stage by stage:
265
+
266
+ ![Funnel for the single-cell held-out clusters: of 276 first answers, 198 pass every check, 63 have a wrong identifier or marker and are sent back, 15 contradict themselves and go to a person; after feedback 255 are admitted and 21 go to a person; of the admitted, 205 agree with the authors' term and 50 disagree; the expert audit of admitted records is not yet run](https://raw.githubusercontent.com/NingyuSUN/bioai-evidence-validator/main/docs/assets/ai_validation_funnel.svg)
267
+
268
+ The same chain on claims that six models extracted on their own from 40 full papers ([case](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/civic_extraction/README.md)):
269
+
270
+ ![Funnel for claims extracted from 40 papers by six models: of 714 first versions, 489 pass every check, 205 go back with the reason and 20 go to a person; after feedback 663 are admitted, none with an identifier or quote error; an independent model review accepts 628 and sends 35 to a person, and 437 of the accepted match a CIViC item; expert review is not yet run](https://raw.githubusercontent.com/NingyuSUN/bioai-evidence-validator/main/docs/assets/ai_extraction_funnel.svg)
271
+
272
+ ### Failure handling
273
+
274
+ Each of these is in the code and was exercised in the runs.
275
+
276
+ <details>
277
+ <summary><b>Twelve failure modes, how each is detected and what happens next</b></summary>
278
+
279
+ | Failure | Detected by | Handling |
280
+ |---|---|---|
281
+ | Malformed reply, or one that violates the schema | JSON Schema enforced by the CLI, then `check_step` / `check_answer` | One retry; then the step is logged as failed and the episode continues |
282
+ | The CLI uses its own tools (web, shell) | Tools are disabled where the CLI allows; otherwise tool events in its output stream | The answer is discarded and the call retried; the prompt also forbids tools |
283
+ | CLI error, timeout, no structured output | Subprocess timeout and output parsers | Logged per step and kept in the results (4 of 601 steps in the agent pilot) |
284
+ | PubMed rate limits, server errors | `Library.fetch` | Exponential backoff on 429 and 5xx, a response cache, a 100 MB download cap |
285
+ | Wrong paper, retracted paper, quote not in the paper | `LiteratureGrounder` (BEV016, BEV017, BEV019) | The reason goes back to the model; at most three submissions |
286
+ | ID of another term, obsolete term, gene alias | `OntologyGrounder`, `GeneGrounder` (BEV017, BEV023, BEV024) | The reason goes back, naming the correct identifier |
287
+ | The model's own evidence contradicts its answer | BEV004 | Sent to a person; not fed back, so the model is never asked to hide it. Flagged answers were wrong 82% of the time vs 33% ([routing evidence](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/evaluation/llm_benchmark/results/risk-signals/summary.md)) |
288
+ | A revision drops evidence that was verified | `feedback.carry` | The verified evidence is carried into the revision |
289
+ | Still not admitted after the last round | `feedback.revise` | Sent to a person |
290
+ | A model's account runs out of quota | The CLI's reply ("You've hit your session limit") | That model is stopped and its episodes are left for a later run, never recorded as failures; all Claude models share one call slot |
291
+ | Admitted but wrong | A seeded random audit (`bioevidence review audit-sample`, `audit-score`) | Each route's error rate with an exact upper bound; a [dry run](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/evaluation/llm_benchmark/results/celltype-audit/summary.md) shows the held-out route misses a 5% target |
292
+ | A long batch is interrupted | One file per episode | A rerun skips finished episodes (used when a 486-episode run hit a time limit) |
293
+
294
+ </details>
295
+
296
+ ## Works with EvidPort
297
+
298
+ [EvidPort](https://github.com/NingyuSUN/evidport) is the companion evidence library: it keeps the
299
+ original PDFs, pinned extraction versions, page locations and the review ledger. With
300
+ `--evidence-library` the validator checks a quotation against that store itself: the original file
301
+ hash, the exact version and block, the quotation, and how it was admitted.
302
+
303
+ ```sh
304
+ bioevidence validate record.json --profile literature-claim --evidence-library evidence
305
+ bioevidence validate record.json --profile literature-claim --evidence-library evidence --accept-independent-reading
306
+ ```
307
+
308
+ | Quotation in the library | Default | With `--accept-independent-reading` |
309
+ |---|---|---|
310
+ | Recorded human original-page review | admitted | admitted |
311
+ | Text layer and an independent OCR reading of the page agree | review required | admitted, reported as `independent_reading` |
312
+ | Matches the text but nothing else | review required | review required |
313
+ | Not in the cited block, or a recorded rejection or revocation | not admitted | not admitted |
314
+
315
+ The second route is recomputed from the read-only library and is never labelled human review. It
316
+ settles transcription only; neither route establishes scientific support for a claim.
317
+
318
+ The optional MCP consumer retrieves a quotation from a local EvidPort server over stdio and checks
319
+ it again against the same library, so a server's claim is never taken on trust. DOI waiting lists,
320
+ free acquisition and manual PDF imports remain EvidPort operations. No full text means no quotation
321
+ to validate.
322
+
323
+ ```sh
324
+ python -m pip install -e '.[mcp]'
325
+ python -m bioevidence_validator.evidence_mcp --server-config local-mcp.json --evidence-library evidence --record record.json --profile literature-claim --output validation-report.json
326
+ ```
327
+
328
+ Guides: [evidence library integration](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/EVIDENCE_LIBRARY.md) ·
329
+ [local MCP validation](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/EVIDENCE_MCP.md). They use portable project-relative examples and
330
+ keep actual machine configuration out of Git.
331
+
332
+ ## Real-data cases
333
+
334
+ | Case | Data | What it shows |
335
+ |---|---|---|
336
+ | [Single-cell cell-type annotation](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/singlecell_celltype/README.md) | 12 CELLxGENE datasets (151 clusters), Cell Ontology, HGNC, HuBMAP ASCT+B | Identifier hallucination caught for every model; a feedback loop that improves annotations; a pre-registered external test of a new check that failed |
337
+ | [LLM literature benchmark](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/evaluation/llm_benchmark/README.md) | CIViC claims, PMC open-access papers, six models | Invented citations blocked; an agent loop with stances and a "conflicting" outcome; semantic checks |
338
+ | [CIViC literature grounding](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/civic_literature/README.md) | CC BY / CC0 full texts and retracted papers, pinned from PMC | Quotes, titles and retractions verified against pinned bytes |
339
+ | [ClinVar germline, three years later](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/clinvar_germline/README.md) | 5,026 variants from the 2023-09 release, followed to 2026-09 | The profile reproduces NCBI's review status in 98–99% of decisions; held-back variants were less stable; a closed trust boundary |
340
+ | [VBO canine name mapping](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/examples/vbo_canine/README.md) | A pinned public ontology release | 0 of 160 controlled faults and 0 of 48 forged sources admitted |
341
+
342
+ ![ClinVar benchmark: share of 2023 pathogenic classifications reclassified or conflicting by 2026, with and without a dissenting submission, and false admissions under controlled faults and the trust boundary](https://raw.githubusercontent.com/NingyuSUN/bioai-evidence-validator/main/docs/assets/clinvar_germline_benchmark.svg)
343
+
344
+ ## Reproduce every number
345
+
346
+ The [BioCuration-Bench instructions](evaluation/biocuration_bench/README.md#reproduce-locally)
347
+ rebuild its leaderboard. The [ACMG/AMP example](examples/acmg_triage/README.md#run-the-example)
348
+ replays the triage benchmark and exports a case report.
349
+
350
+ ```bash
351
+ uv run --frozen --with matplotlib==3.11.2 python tools/reproduce.py
352
+ ```
353
+
354
+ This command regenerates the real-data benchmark tables, summaries and figures offline in about three minutes,
355
+ and compares each with the repository byte for byte (text files with line endings normalised). It runs 22 steps,
356
+ also run in CI on every change:
357
+ - the three real-data cases;
358
+ - twelve LLM-benchmark result sets;
359
+ - the routing evidence and the audit dry run;
360
+ - the task files and the error taxonomy;
361
+ - the figures.
362
+
363
+ Model calls, agent runs and downloads are not repeated. What they produced is committed and pinned by
364
+ SHA-256: model answers, agent episodes, the verification of cited papers, and source snapshots. `--write` updates the
365
+ committed files and `--list` shows the steps.
366
+
367
+ ## What this project demonstrates
368
+
369
+ - **Rigorous evaluation of LLMs and agents.**
370
+ - Six models from three vendors, called through their CLIs with structured output, plus a tool-using
371
+ agent with PubMed access.
372
+ - Protocols are designed on pilot data and committed to git before the held-out and external splits are
373
+ run.
374
+ - Scoring is ontology-aware, with Wilson intervals.
375
+ - Negative results are reported, including the run where a new check made things worse.
376
+ - **Biological data engineering.**
377
+ - Single-cell marker statistics computed from raw counts (CELLxGENE).
378
+ - The Cell Ontology, including its disjointness axioms and logical definitions, HGNC, NCBI assemblies,
379
+ ClinVar submissions, CIViC evidence and PMC JATS full text.
380
+ - All sources are pinned by SHA-256, with licences and attribution.
381
+ - **Production-quality software.**
382
+ - A typed Python package on PyPI, with CLI exit codes for pipelines and a GitHub Action for CI.
383
+ - Test coverage around 98%, with CI on Linux and Windows for Python 3.11–3.14.
384
+ - A documentation site, and byte-for-byte replay of every committed benchmark table.
385
+ - **Designing for trust, not only accuracy.**
386
+ - Decisions are made per intended use, with a measured trust boundary (controlled faults and forged
387
+ sources).
388
+ - Only facts are fed back to a model; anything that needs judgment goes to a person.
389
+
390
+ ## Limits
391
+
392
+ - **Admission is not truth.** It means the record meets the selected profile: its evidence exists in the
393
+ pinned sources and satisfies the use's rules. It does not mean the biological claim is true.
394
+ - **The references are curators' and authors' labels, not independent expert labels.** A blinded
395
+ [expert-review kit](https://github.com/NingyuSUN/bioai-evidence-validator/tree/main/evaluation/clinvar_review)
396
+ is ready (#23).
397
+ - **Sample sizes are small.** The literature benchmarks are pilot-scale (18 claims). Each single-cell split
398
+ was run once.
399
+ - **Not for clinical use.**
400
+
401
+ What is and is not established, in the structure of FDA's draft AI credibility framework (question of interest,
402
+ context of use, model risk, credibility evidence, adequacy): the
403
+ [validation dossier](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/VALIDATION_DOSSIER.md).
404
+
405
+ ## Roadmap
406
+
407
+ Tracked in the [AI validation roadmap](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/AI_VALIDATION_ROADMAP.md) (#26):
408
+ - expert review of the benchmark cases (#23), including the 60-claim sample from the extraction experiment (#21);
409
+ - scoring the six models' reviews of the 190 ClinVar cases against those expert labels. The models have reviewed
410
+ them, and they often disagree with each other (#22);
411
+ - an expert audit of admitted records with `bioevidence review audit-sample` and `audit-score`, which bound
412
+ the error rate of what still gets through. The tool and a dry run are done (#24); the audit needs experts.
413
+ - the [validation dossier](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/VALIDATION_DOSSIER.md),
414
+ structured after FDA's draft AI credibility framework, states what is established and what is not (#25).
415
+
416
+ ## Contributing and citing
417
+
418
+ Bug reports, domain profiles and new benchmarks are welcome. See
419
+ [CONTRIBUTING.md](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/CONTRIBUTING.md) and
420
+ issues labelled [`good first issue`](https://github.com/NingyuSUN/bioai-evidence-validator/labels/good%20first%20issue);
421
+ report security problems as described in [SECURITY.md](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/SECURITY.md).
422
+ To cite this toolkit, use [`CITATION.cff`](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/CITATION.cff)
423
+ (GitHub's "Cite this repository" button).
424
+
425
+ Author: Ningyu Sun ([@NingyuSUN](https://github.com/NingyuSUN)) ·
426
+ [Changelog](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/CHANGELOG.md) ·
427
+ [Standards alignment](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/STANDARDS.md) ·
428
+ [Error taxonomy](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/ERROR_TAXONOMY.md) ·
429
+ [Design case study](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/docs/CASE_STUDY.md) ·
430
+ [Apache-2.0](https://github.com/NingyuSUN/bioai-evidence-validator/blob/main/LICENSE)