Babajaan commited on
Commit
f9c777e
·
verified ·
1 Parent(s): dc0b8ee

Expand KAU-BioMedLLM model card and HPC acknowledgement

Browse files
Files changed (1) hide show
  1. README.md +243 -38
README.md CHANGED
@@ -8,65 +8,270 @@ tags:
8
  - genomics
9
  - variant-interpretation
10
  - lora
 
 
11
  - research
12
  library_name: transformers
13
  pipeline_tag: text-generation
14
  ---
15
 
16
- # KAUBioMED-LLM
17
 
18
- KAUBioMED-LLM is a research prototype for guarded biomedical variant interpretation plus leakage-aware temporal variant scoring.
19
 
20
- ## Components
21
 
22
- - Qwen2.5-1.5B-Instruct v0.1: lightweight prototype report generator.
23
- - Llama-3.1-8B-Instruct v0.2: stronger guarded report-generation baseline.
24
- - score_model: scikit-learn HistGradientBoostingClassifier with isotonic calibration, using label-free broad variant features.
25
 
26
- ## Intended Use
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- Research use only. Not for clinical diagnosis, treatment decisions, or patient management.
29
 
30
- ## Data and Provenance
 
 
 
 
 
 
 
 
 
31
 
32
- See `reports/DATA_PROVENANCE.md`.
33
 
34
- ## Key Results
35
 
36
- First-appearance temporal broad score_model test:
 
37
 
38
- - AUROC: 0.99125
39
- - AUPRC: 0.96938
40
- - Brier: 0.02903
41
- - ECE 10-bin: 0.03428
42
 
43
- Missense-only limitation:
44
 
45
- - score_model v0 missense AUROC: 0.78497
46
- - missense v1 protein-feature AUROC: 0.83644
47
- - AlphaMissense same-row AUROC: 0.97214
48
- - REVEL same-row AUROC: 0.97832
49
 
50
- ## Known Limitations
 
 
 
 
 
51
 
52
- - Broad AUROC is driven partly by easy consequence classes; see `reports/score_model/per_consequence_breakdown.md`.
53
- - Missense performance remains below REVEL and AlphaMissense.
54
- - Evidence panel is limited to 20 genes and is not genome-wide.
55
- - Calibration is measured on a first-appearance ClinVar temporal split, not prospective clinical data.
56
- - Not validated for clinical deployment.
57
 
58
- ## Base Model Attribution and License Notes
59
 
60
- Llama-derived artifacts are subject to the Meta Llama 3.1 Community License and Acceptable Use Policy. Qwen-derived prototype artifacts are subject to Qwen2.5 license terms. Verify license terms before public release.
61
 
62
- ## Reproducibility Commands
63
 
64
- ```bash
65
- cd /ddn/data/generic/bbabajan/KAUBioMED_LLM
66
- /ddn/data/generic/bbabajan/envs/kaubiomed-llm/bin/python pipeline/build_label_free_features.py
67
- /ddn/data/generic/bbabajan/envs/kaubiomed-llm/bin/python pipeline/train_label_free_score_model.py
68
- /ddn/data/generic/bbabajan/envs/kaubiomed-llm/bin/python pipeline/evaluate_first_appearance_temporal.py
69
- /ddn/data/generic/bbabajan/envs/kaubiomed-llm/bin/python pipeline/compare_external_predictors_first_appearance.py
70
- /ddn/data/generic/bbabajan/envs/kaubiomed-llm/bin/python pipeline/kaubiomed_full_report.py
71
- /ddn/data/generic/bbabajan/envs/kaubiomed-llm/bin/python pipeline/apply_report_guards.py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  - genomics
9
  - variant-interpretation
10
  - lora
11
+ - clinical-genomics
12
+ - bioinformatics
13
  - research
14
  library_name: transformers
15
  pipeline_tag: text-generation
16
  ---
17
 
18
+ # Model Card for KAU-BioMedLLM
19
 
20
+ KAU-BioMedLLM is a research prototype for source-grounded biomedical variant interpretation. The current public release contains the LoRA adapter and documentation for a guarded report-generation system built around biomedical evidence retrieval, label-free variant scoring, citation enforcement, and abstention when evidence is insufficient.
21
 
22
+ This repository does **not** redistribute the full Meta Llama-3.1-8B-Instruct base model. Users must separately have access to the base model according to the Meta Llama 3.1 license terms.
23
 
24
+ ## Table of Contents
 
 
25
 
26
+ - [Model Details](#model-details)
27
+ - [Model Description](#model-description)
28
+ - [System Overview](#system-overview)
29
+ - [Uses](#uses)
30
+ - [Out-of-Scope Use](#out-of-scope-use)
31
+ - [Training and Development Data](#training-and-development-data)
32
+ - [Training Procedure](#training-procedure)
33
+ - [Evaluation](#evaluation)
34
+ - [Limitations](#limitations)
35
+ - [How to Load the Adapter](#how-to-load-the-adapter)
36
+ - [Compute Infrastructure](#compute-infrastructure)
37
+ - [Ethical and Safety Considerations](#ethical-and-safety-considerations)
38
+ - [Citation and Acknowledgement](#citation-and-acknowledgement)
39
 
40
+ ## Model Details
41
 
42
+ - **Model name:** KAU-BioMedLLM
43
+ - **Repository:** `Babajaan/KAU-BioMedLLM`
44
+ - **Developed by:** Babajan B, King Abdulaziz University research environment
45
+ - **Model type:** Biomedical instruction-tuned LoRA adapter for report generation
46
+ - **Primary base model:** `meta-llama/Llama-3.1-8B-Instruct`
47
+ - **Prototype baseline:** `Qwen/Qwen2.5-1.5B-Instruct`
48
+ - **Language:** English
49
+ - **Domain:** Biomedical variant interpretation, clinical genomics research, bioinformatics evidence synthesis
50
+ - **Release type:** Research-use adapter release
51
+ - **Clinical status:** Not clinically validated; not for diagnosis, treatment, or patient-management decisions
52
 
53
+ ## Model Description
54
 
55
+ KAU-BioMedLLM was developed as part of a broader biomedical AI project to generate structured, source-grounded variant interpretation reports. The system combines two deliberately separated components:
56
 
57
+ 1. **Independent score model:** a label-free machine learning model for variant scoring and temporal benchmarking.
58
+ 2. **LLM report generator:** a LoRA-adapted instruction model for structured biomedical explanation.
59
 
60
+ The central design choice is to avoid treating LLM-generated prose as a calibrated pathogenicity score. The numeric score and the narrative interpretation are separated, and the report-generation layer is guarded by schema validation, citation checks, and abstention rules.
 
 
 
61
 
62
+ ## System Overview
63
 
64
+ The broader KAU-BioMedLLM workflow uses:
 
 
 
65
 
66
+ - ClinVar current and archived snapshots for variant labels and temporal validation.
67
+ - PubMed and biomedical literature evidence for gene and phenotype context.
68
+ - UniProt for protein/gene functional evidence.
69
+ - AlphaFold structure information for residue-level structural context where mapping is reliable.
70
+ - Ensembl/VEP-style transcript and protein residue mapping.
71
+ - A guarded report pipeline that enforces JSON structure, citation support, and abstention when evidence is missing or ambiguous.
72
 
73
+ The uploaded model artifact is the LoRA adapter used for the report-generation component. The repository also includes data provenance notes, evaluation summaries, manuscript tables, and inference instructions.
 
 
 
 
74
 
75
+ ## Uses
76
 
77
+ ### Intended Use
78
 
79
+ KAU-BioMedLLM is intended for research and development in:
80
 
81
+ - biomedical variant interpretation workflows;
82
+ - genomics and bioinformatics report prototyping;
83
+ - source-grounded biomedical evidence synthesis;
84
+ - evaluating guarded LLM reporting pipelines;
85
+ - studying leakage-aware score model design and temporal validation.
86
+
87
+ ### Direct Use
88
+
89
+ The adapter can be loaded with `meta-llama/Llama-3.1-8B-Instruct` using PEFT. It can generate structured research reports when provided with variant and evidence context.
90
+
91
+ ### Downstream Use
92
+
93
+ The model may be used as a starting point for research on:
94
+
95
+ - citation-grounded biomedical report generation;
96
+ - variant prioritization interfaces;
97
+ - guarded medical LLM output;
98
+ - separation of statistical score models from narrative explanation;
99
+ - biomedical uncertainty and abstention behavior.
100
+
101
+ ## Out-of-Scope Use
102
+
103
+ KAU-BioMedLLM must not be used as:
104
+
105
+ - a clinical diagnostic system;
106
+ - a substitute for expert variant curation;
107
+ - a medical advice generator;
108
+ - a system for patient-management or treatment decisions;
109
+ - a standalone pathogenicity classifier for clinical reporting;
110
+ - a validated replacement for ACMG/AMP interpretation workflows.
111
+
112
+ ## Training and Development Data
113
+
114
+ The project used biomedical and genomics resources including:
115
+
116
+ - ClinVar current and archived variant snapshots;
117
+ - PubMed/literature-derived evidence examples;
118
+ - UniProt protein/gene evidence;
119
+ - AlphaFold structural evidence for selected proteins;
120
+ - Ensembl/VEP-style transcript and residue mapping outputs;
121
+ - internally generated structured instruction examples for report generation.
122
+
123
+ The score model was intentionally designed around label-free features and excludes direct ClinVar significance text, review-star strength, gene identity, and external predictor scores such as REVEL, AlphaMissense, and CADD as training inputs.
124
+
125
+ See `reports/DATA_PROVENANCE.md` for project-level data provenance and known version-recording limitations.
126
+
127
+ ## Training Procedure
128
+
129
+ The report-generation model was trained as a LoRA adapter rather than as a full base-model retraining run.
130
+
131
+ The project developed two model stages:
132
+
133
+ - **Qwen2.5-1.5B-Instruct v0.1:** lightweight prototype used to validate the basic structured-output and guarded-report pipeline.
134
+ - **Llama-3.1-8B-Instruct v0.2:** stronger report-generation baseline selected for improved biomedical reasoning capacity and structured report generation.
135
+
136
+ The LoRA approach keeps the released artifact compact and avoids redistributing the full base model weights.
137
+
138
+ ## Evaluation
139
+
140
+ The project separates score model evaluation from LLM report-generation evaluation.
141
+
142
+ ### Broad First-Appearance Temporal Score Model
143
+
144
+ The broad score model was evaluated using a first-appearance ClinVar temporal split:
145
+
146
+ - Training snapshot: ClinVar 2023-12-26
147
+ - Test snapshot: ClinVar 2025-12-21
148
+ - Test set: labeled variants appearing in the 2025 snapshot and absent from the 2023 snapshot
149
+
150
+ Reported benchmark:
151
+
152
+ | Metric | Value |
153
+ |---|---:|
154
+ | Test variants | 509,974 |
155
+ | AUROC | 0.99125 |
156
+ | AUPRC | 0.96938 |
157
+ | Brier score | 0.02903 |
158
+ | ECE | 0.03428 |
159
+
160
+ These metrics apply to the broad score model, not to the LLM text generator alone.
161
+
162
+ ### Missense-Specific Limitation
163
+
164
+ Missense-only prediction remained substantially harder:
165
+
166
+ | Model / Predictor | Missense AUROC |
167
+ |---|---:|
168
+ | score_model v0 | 0.78497 |
169
+ | missense v1 protein-feature score_model | 0.83644 |
170
+ | AlphaMissense same-row comparison | 0.97214 |
171
+ | REVEL same-row comparison | 0.97832 |
172
+
173
+ This limitation is important: KAU-BioMedLLM should not be claimed as state-of-the-art for missense pathogenicity prediction.
174
+
175
+ ### Report Guard Evaluation
176
+
177
+ The guarded report layer was evaluated on a small report set:
178
+
179
+ - Citation guard pass: 5/5 reports
180
+ - Citation guard fail: 0/5 reports
181
+ - Structure mapping available: 1/5 reports
182
+ - Structure mapping abstained: 4/5 reports
183
+
184
+ The abstention behavior is intentional: when evidence is missing, ambiguous, or not reliably mapped, the system should state uncertainty rather than fabricate confidence.
185
+
186
+ ## Limitations
187
+
188
+ - The current evidence panel is limited and is not a genome-wide production knowledge base.
189
+ - Missense prediction remains below specialist predictors such as REVEL and AlphaMissense.
190
+ - Broad score model performance is partly driven by easier consequence classes.
191
+ - Structure evidence is only used when transcript/protein/residue mapping can be reconciled.
192
+ - Exact historical versions for some external resources require final manual verification before manuscript submission.
193
+ - The model has not been prospectively validated in clinical settings.
194
+ - Generated text can still contain errors and must be reviewed by domain experts.
195
+ - The uploaded artifact is an adapter, not a standalone full model.
196
+
197
+ ## How to Load the Adapter
198
+
199
+ ```python
200
+ from transformers import AutoModelForCausalLM, AutoTokenizer
201
+ from peft import PeftModel
202
+ import torch
203
+
204
+ base_model = "meta-llama/Llama-3.1-8B-Instruct"
205
+ adapter_model = "Babajaan/KAU-BioMedLLM"
206
+
207
+ tokenizer = AutoTokenizer.from_pretrained(base_model)
208
+ model = AutoModelForCausalLM.from_pretrained(
209
+ base_model,
210
+ torch_dtype=torch.float16,
211
+ device_map="auto",
212
+ )
213
+ model = PeftModel.from_pretrained(model, adapter_model)
214
+ model.eval()
215
+
216
+ messages = [
217
+ {
218
+ "role": "user",
219
+ "content": (
220
+ "For research use only, generate a structured biomedical variant "
221
+ "interpretation report for BRCA1 c.5096G>A p.Arg1699Gln. "
222
+ "Include uncertainty and do not provide clinical advice."
223
+ ),
224
+ }
225
+ ]
226
+
227
+ prompt = tokenizer.apply_chat_template(
228
+ messages,
229
+ tokenize=False,
230
+ add_generation_prompt=True,
231
+ )
232
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
233
+
234
+ with torch.no_grad():
235
+ outputs = model.generate(
236
+ **inputs,
237
+ max_new_tokens=700,
238
+ temperature=0.2,
239
+ do_sample=True,
240
+ )
241
+
242
+ print(tokenizer.decode(outputs[0], skip_special_tokens=True))
243
  ```
244
+
245
+ ## Compute Infrastructure
246
+
247
+ The project was developed and evaluated using the King Abdulaziz University Aziz High Performance Computing environment. The workflow used the Aziz HPC software environment, PBS job scheduling, and GPU resources including A100 GPU jobs where available.
248
+
249
+ KAU Aziz HPC support resources:
250
+
251
+ - Aziz Supercomputer Support Center: https://hpcc-kau.com/support/
252
+ - PBS and GPU job support documentation are available through the Aziz HPC knowledge base.
253
+
254
+ ## Ethical and Safety Considerations
255
+
256
+ Biomedical LLM systems can produce fluent but incorrect explanations. KAU-BioMedLLM therefore uses a guard-first design:
257
+
258
+ - numeric score and LLM narrative are separated;
259
+ - citations are required for biomedical claims;
260
+ - reports can abstain when evidence is insufficient;
261
+ - outputs are research-use only;
262
+ - no clinical decision should be made from model output.
263
+
264
+ Users should treat all outputs as draft research interpretations requiring expert review.
265
+
266
+ ## Citation and Acknowledgement
267
+
268
+ If you use this model or the associated code/reports, please cite the forthcoming project manuscript or repository when available.
269
+
270
+ Suggested acknowledgement:
271
+
272
+ > This work used computational resources from the King Abdulaziz University Aziz High Performance Computing environment.
273
+
274
+ ## License and Base Model Notes
275
+
276
+ This repository contains a LoRA adapter and project documentation. It does not redistribute the full Llama base model. Use of the adapter with `meta-llama/Llama-3.1-8B-Instruct` is subject to the Meta Llama 3.1 Community License and Acceptable Use Policy. Qwen-derived prototype artifacts are subject to Qwen license terms. Users are responsible for verifying license compatibility for their own use case.
277
+