Babajaan commited on
Commit
ff80595
·
verified ·
1 Parent(s): 9cc81a7

Replace root adapter with Llama-3.1-8B v0.2 LoRA adapter

Browse files
Files changed (1) hide show
  1. README.md +160 -288
README.md CHANGED
@@ -1,335 +1,207 @@
1
  ---
2
- license: llama3.1
3
  base_model: meta-llama/Llama-3.1-8B-Instruct
4
- tags:
5
- - biomedical
6
- - genomics
7
- - variant-interpretation
8
- - lora
9
- - clinical-genomics
10
- - bioinformatics
11
- - research
12
- library_name: transformers
13
  pipeline_tag: text-generation
 
 
 
 
14
  ---
15
 
16
- # Model Card for KAU-BioMedLLM
17
 
18
- 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.
19
 
20
- 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.
21
 
22
- ## Table of Contents
23
-
24
- - [Model Details](#model-details)
25
- - [Model Description](#model-description)
26
- - [System Overview](#system-overview)
27
- - [Uses](#uses)
28
- - [Out-of-Scope Use](#out-of-scope-use)
29
- - [Training and Development Data](#training-and-development-data)
30
- - [Training Procedure](#training-procedure)
31
- - [Evaluation](#evaluation)
32
- - [Example Guarded Report](#example-guarded-report)
33
- - [Limitations](#limitations)
34
- - [How to Load the Adapter](#how-to-load-the-adapter)
35
- - [Compute Infrastructure](#compute-infrastructure)
36
- - [Ethical and Safety Considerations](#ethical-and-safety-considerations)
37
- - [Citation and Acknowledgement](#citation-and-acknowledgement)
38
 
39
  ## Model Details
40
 
41
- - **Model name:** KAU-BioMedLLM
42
- - **Repository:** `Babajaan/KAU-BioMedLLM`
43
- - **Developed by:** Babajan B, King Abdulaziz University research environment
44
- - **Model type:** Biomedical instruction-tuned LoRA adapter for report generation
45
- - **Primary base model:** `meta-llama/Llama-3.1-8B-Instruct`
46
- - **Prototype baseline:** `Qwen/Qwen2.5-1.5B-Instruct`
47
- - **Language:** English
48
- - **Domain:** Biomedical variant interpretation, clinical genomics research, bioinformatics evidence synthesis
49
- - **Release type:** Research-use adapter release
50
- - **Clinical status:** Not clinically validated; not for diagnosis, treatment, or patient-management decisions
51
-
52
- ## Model Description
53
 
54
- 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:
55
 
56
- 1. **Independent score model:** a label-free machine learning model for variant scoring and temporal benchmarking.
57
- 2. **LLM report generator:** a LoRA-adapted instruction model for structured biomedical explanation.
58
 
59
- 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.
60
 
61
- ## System Overview
 
 
 
 
 
 
62
 
63
- The broader KAU-BioMedLLM workflow uses:
64
 
65
- - ClinVar current and archived snapshots for variant labels and temporal validation.
66
- - PubMed and biomedical literature evidence for gene and phenotype context.
67
- - UniProt for protein/gene functional evidence.
68
- - AlphaFold structure information for residue-level structural context where mapping is reliable.
69
- - Ensembl/VEP-style transcript and protein residue mapping.
70
- - A guarded report pipeline that enforces JSON structure, citation support, and abstention when evidence is missing or ambiguous.
71
 
72
- 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.
 
 
73
 
74
  ## Uses
75
 
76
- ### Intended Use
77
 
78
- KAU-BioMedLLM is intended for research and development in:
79
 
80
- - biomedical variant interpretation workflows;
81
- - genomics and bioinformatics report prototyping;
82
- - source-grounded biomedical evidence synthesis;
83
- - evaluating guarded LLM reporting pipelines;
84
- - studying leakage-aware score model design and temporal validation.
85
 
86
- ### Direct Use
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
- 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.
89
 
90
- ### Downstream Use
91
 
92
- The model may be used as a starting point for research on:
93
 
94
- - citation-grounded biomedical report generation;
95
- - variant prioritization interfaces;
96
- - guarded medical LLM output;
97
- - separation of statistical score models from narrative explanation;
98
- - biomedical uncertainty and abstention behavior.
99
 
100
- ## Out-of-Scope Use
101
 
102
- KAU-BioMedLLM must not be used as:
103
 
104
- - a clinical diagnostic system;
105
- - a substitute for expert variant curation;
106
- - a medical advice generator;
107
- - a system for patient-management or treatment decisions;
108
- - a standalone pathogenicity classifier for clinical reporting;
109
- - a validated replacement for ACMG/AMP interpretation workflows.
110
 
111
- ## Training and Development Data
112
 
113
- The project used biomedical and genomics resources including:
114
 
115
- - ClinVar current and archived variant snapshots;
116
- - PubMed/literature-derived evidence examples;
117
- - UniProt protein/gene evidence;
118
- - AlphaFold structural evidence for selected proteins;
119
- - Ensembl/VEP-style transcript and residue mapping outputs;
120
- - internally generated structured instruction examples for report generation.
121
 
122
- 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.
123
 
124
- See `reports/DATA_PROVENANCE.md` for project-level data provenance and known version-recording limitations.
125
 
126
- ## Training Procedure
127
 
128
- The report-generation model was trained as a LoRA adapter rather than as a full base-model retraining run.
129
 
130
- The project developed two model stages:
131
 
132
- - **Qwen2.5-1.5B-Instruct v0.1:** lightweight prototype used to validate the basic structured-output and guarded-report pipeline.
133
- - **Llama-3.1-8B-Instruct v0.2:** stronger report-generation baseline selected for improved biomedical reasoning capacity and structured report generation.
134
 
135
- The LoRA approach keeps the released artifact compact and avoids redistributing the full base model weights.
 
 
 
 
136
 
137
  ## Evaluation
138
 
139
- The project separates score model evaluation from LLM report-generation evaluation.
140
-
141
- ### Broad First-Appearance Temporal Score Model
142
-
143
- The broad score model was evaluated using a first-appearance ClinVar temporal split:
144
-
145
- - Training snapshot: ClinVar 2023-12-26
146
- - Test snapshot: ClinVar 2025-12-21
147
- - Test set: labeled variants appearing in the 2025 snapshot and absent from the 2023 snapshot
148
-
149
- Reported benchmark:
150
-
151
- | Metric | Value |
152
- |---|---:|
153
- | Test variants | 509,974 |
154
- | AUROC | 0.99125 |
155
- | AUPRC | 0.96938 |
156
- | Brier score | 0.02903 |
157
- | ECE | 0.03428 |
158
-
159
- These metrics apply to the broad score model, not to the LLM text generator alone.
160
-
161
- ### Per-Consequence Breakdown
162
-
163
- The broad AUROC is not sufficient by itself because consequence classes differ strongly in class balance and difficulty. The table below reports the first-appearance temporal score model by consequence class. It is included to make clear that the headline broad score is partly consequence-class-driven.
164
-
165
- | Consequence | N | Pos | Neg | AUROC | AUPRC | Brier | ECE |
166
- |---|---:|---:|---:|---:|---:|---:|---:|
167
- | non-coding_transcript_variant | 34,607 | 257 | 34,350 | 0.91551 | 0.61517 | 0.00398 | 0.00219 |
168
- | 3_prime_UTR_variant | 3,861 | 24 | 3,837 | 0.89588 | 0.13295 | 0.00623 | 0.00464 |
169
- | other low-N | 534 | 336 | 198 | 0.87042 | 0.90320 | 0.13473 | 0.05293 |
170
- | unknown | 1,503 | 542 | 961 | 0.86056 | 0.75580 | 0.14478 | 0.05336 |
171
- | missense_variant | 67,847 | 12,943 | 54,904 | 0.81292 | 0.55438 | 0.18069 | 0.23174 |
172
- | splice_donor_variant | 8,438 | 8,238 | 200 | 0.81240 | 0.99205 | 0.01565 | 0.00245 |
173
- | 5_prime_UTR_variant | 6,609 | 68 | 6,541 | 0.77156 | 0.23015 | 0.00891 | 0.00739 |
174
- | inframe_deletion | 386 | 219 | 167 | 0.76963 | 0.80047 | 0.20247 | 0.08748 |
175
- | initiator_codon_variant | 713 | 615 | 98 | 0.74360 | 0.93131 | 0.09672 | 0.04770 |
176
- | intron_variant | 153,601 | 951 | 152,650 | 0.73241 | 0.03627 | 0.00619 | 0.00863 |
177
- | frameshift_variant | 38,296 | 37,947 | 349 | 0.72617 | 0.99567 | 0.00786 | 0.00094 |
178
- | nonsense | 22,375 | 22,034 | 341 | 0.70115 | 0.99182 | 0.01238 | 0.00779 |
179
- | splice_acceptor_variant | 7,209 | 7,081 | 128 | 0.70025 | 0.98999 | 0.01468 | 0.00421 |
180
- | synonymous_variant | 163,995 | 121 | 163,874 | 0.64395 | 0.00175 | 0.00074 | 0.00078 |
181
-
182
- Missense variants are materially harder than the broad all-variant benchmark. This is why the project reports missense-specific limitations separately and does not claim state-of-the-art missense prediction.
183
-
184
- ### Missense-Specific Limitation
185
-
186
- Missense-only prediction remained substantially harder:
187
-
188
- | Model / Predictor | Missense AUROC |
189
- |---|---:|
190
- | score_model v0 | 0.78497 |
191
- | missense v1 protein-feature score_model | 0.83644 |
192
- | AlphaMissense same-row comparison | 0.97214 |
193
- | REVEL same-row comparison | 0.97832 |
194
-
195
- This limitation is important: KAU-BioMedLLM should not be claimed as state-of-the-art for missense pathogenicity prediction.
196
-
197
- ### Report Guard Evaluation
198
-
199
- The guarded report layer was evaluated on a small report set:
200
-
201
- - Citation guard pass: 5/5 reports
202
- - Citation guard fail: 0/5 reports
203
- - Structure mapping available: 1/5 reports
204
- - Structure mapping abstained: 4/5 reports
205
-
206
- The abstention behavior is intentional: when evidence is missing, ambiguous, or not reliably mapped, the system should state uncertainty rather than fabricate confidence.
207
-
208
- ## Example Guarded Report
209
-
210
- The example below illustrates the intended report style: the statistical score-model field is separated from the LLM narrative, biomedical claims include source identifiers, and missing evidence triggers abstention rather than unsupported interpretation.
211
-
212
- ```json
213
- {
214
- "gene": "MC4R",
215
- "variant": "chr18:60371172:C>T",
216
- "final_interpretation": "Uncertain significance",
217
- "score_model_prediction": {
218
- "status": "abstain",
219
- "reason": "variant_not_in_existing_score_prediction_tables",
220
- "message": "No precomputed score_model prediction was available for this report input. Full arbitrary-variant scoring is deferred to v2.",
221
- "not_for_clinical_diagnosis": true
222
- },
223
- "llm_interpretation": {
224
- "source": "KAU-BioMedLLM report generator",
225
- "reasoning_summary": "The variant is represented as a missense variation in MC4R. The available source label is uncertain significance. This does not establish clinical causality without transcript-level validation, allele frequency, segregation, phenotype match, functional data, and ACMG/AMP evidence review.",
226
- "limitations": "Research record only. Not a clinical diagnosis."
227
- },
228
- "evidence_examples": {
229
- "gene_function": "MC4R functions in the leptin-melanocortin pathway and regulates energy homeostasis.",
230
- "source_ids": ["UniProt:P32245", "PMID:12646665", "PMID:32327598", "PMID:33858992"],
231
- "structure_context": "Use only when transcript, protein accession, and residue mapping can be reconciled."
232
- },
233
- "guard_status": {
234
- "citation_check": "pass",
235
- "abstention_allowed": true,
236
- "clinical_use": "not permitted"
237
- }
238
- }
239
- ```
240
-
241
- Full guarded report examples and summaries are included in the repository under `reports/full_reports/`.
242
-
243
- ## Limitations
244
-
245
- - The current evidence panel is limited and is not a genome-wide production knowledge base.
246
- - Missense prediction remains below specialist predictors such as REVEL and AlphaMissense.
247
- - Broad score model performance is partly driven by easier consequence classes.
248
- - Structure evidence is only used when transcript/protein/residue mapping can be reconciled.
249
- - Exact historical versions for some external resources require final manual verification before manuscript submission.
250
- - The model has not been prospectively validated in clinical settings.
251
- - Generated text can still contain errors and must be reviewed by domain experts.
252
- - The uploaded artifact is an adapter, not a standalone full model.
253
-
254
- ## How to Load the Adapter
255
-
256
- ```python
257
- from transformers import AutoModelForCausalLM, AutoTokenizer
258
- from peft import PeftModel
259
- import torch
260
-
261
- base_model = "meta-llama/Llama-3.1-8B-Instruct"
262
- adapter_model = "Babajaan/KAU-BioMedLLM"
263
-
264
- tokenizer = AutoTokenizer.from_pretrained(base_model)
265
- model = AutoModelForCausalLM.from_pretrained(
266
- base_model,
267
- torch_dtype=torch.float16,
268
- device_map="auto",
269
- )
270
- model = PeftModel.from_pretrained(model, adapter_model)
271
- model.eval()
272
-
273
- messages = [
274
- {
275
- "role": "user",
276
- "content": (
277
- "For research use only, generate a structured biomedical variant "
278
- "interpretation report for BRCA1 c.5096G>A p.Arg1699Gln. "
279
- "Include uncertainty and do not provide clinical advice."
280
- ),
281
- }
282
- ]
283
-
284
- prompt = tokenizer.apply_chat_template(
285
- messages,
286
- tokenize=False,
287
- add_generation_prompt=True,
288
- )
289
- inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
290
-
291
- with torch.no_grad():
292
- outputs = model.generate(
293
- **inputs,
294
- max_new_tokens=700,
295
- temperature=0.2,
296
- do_sample=True,
297
- )
298
-
299
- print(tokenizer.decode(outputs[0], skip_special_tokens=True))
300
- ```
301
-
302
- ## Compute Infrastructure
303
-
304
- 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.
305
-
306
- KAU Aziz HPC support resources:
307
-
308
- - Aziz Supercomputer Support Center: https://hpcc-kau.com/support/
309
- - PBS and GPU job support documentation are available through the Aziz HPC knowledge base.
310
-
311
- ## Ethical and Safety Considerations
312
-
313
- Biomedical LLM systems can produce fluent but incorrect explanations. KAU-BioMedLLM therefore uses a guard-first design:
314
-
315
- - numeric score and LLM narrative are separated;
316
- - citations are required for biomedical claims;
317
- - reports can abstain when evidence is insufficient;
318
- - outputs are research-use only;
319
- - no clinical decision should be made from model output.
320
-
321
- Users should treat all outputs as draft research interpretations requiring expert review.
322
-
323
- ## Citation and Acknowledgement
324
-
325
- If you use this model or the associated code/reports, please cite the forthcoming project manuscript or repository when available.
326
-
327
- Manuscript status: in preparation. A formal citation will be added after manuscript submission or publication.
328
-
329
- Suggested acknowledgement:
330
 
331
- > This work used computational resources from the King Abdulaziz University Aziz High Performance Computing environment.
332
 
333
- ## License and Base Model Notes
 
334
 
335
- 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.
 
1
  ---
 
2
  base_model: meta-llama/Llama-3.1-8B-Instruct
3
+ library_name: peft
 
 
 
 
 
 
 
 
4
  pipeline_tag: text-generation
5
+ tags:
6
+ - base_model:adapter:meta-llama/Llama-3.1-8B-Instruct
7
+ - lora
8
+ - transformers
9
  ---
10
 
11
+ # Model Card for Model ID
12
 
13
+ <!-- Provide a quick summary of what the model is/does. -->
14
 
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
  ## Model Details
18
 
19
+ ### Model Description
 
 
 
 
 
 
 
 
 
 
 
20
 
21
+ <!-- Provide a longer summary of what this model is. -->
22
 
 
 
23
 
 
24
 
25
+ - **Developed by:** [More Information Needed]
26
+ - **Funded by [optional]:** [More Information Needed]
27
+ - **Shared by [optional]:** [More Information Needed]
28
+ - **Model type:** [More Information Needed]
29
+ - **Language(s) (NLP):** [More Information Needed]
30
+ - **License:** [More Information Needed]
31
+ - **Finetuned from model [optional]:** [More Information Needed]
32
 
33
+ ### Model Sources [optional]
34
 
35
+ <!-- Provide the basic links for the model. -->
 
 
 
 
 
36
 
37
+ - **Repository:** [More Information Needed]
38
+ - **Paper [optional]:** [More Information Needed]
39
+ - **Demo [optional]:** [More Information Needed]
40
 
41
  ## Uses
42
 
43
+ <!-- Address questions around how the model is intended to be used, including the foreseeable users of the model and those affected by the model. -->
44
 
45
+ ### Direct Use
46
 
47
+ <!-- This section is for the model use without fine-tuning or plugging into a larger ecosystem/app. -->
 
 
 
 
48
 
49
+ [More Information Needed]
50
+
51
+ ### Downstream Use [optional]
52
+
53
+ <!-- This section is for the model use when fine-tuned for a task, or when plugged into a larger ecosystem/app -->
54
+
55
+ [More Information Needed]
56
+
57
+ ### Out-of-Scope Use
58
+
59
+ <!-- This section addresses misuse, malicious use, and uses that the model will not work well for. -->
60
+
61
+ [More Information Needed]
62
+
63
+ ## Bias, Risks, and Limitations
64
+
65
+ <!-- This section is meant to convey both technical and sociotechnical limitations. -->
66
+
67
+ [More Information Needed]
68
+
69
+ ### Recommendations
70
 
71
+ <!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
72
 
73
+ Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
74
 
75
+ ## How to Get Started with the Model
76
 
77
+ Use the code below to get started with the model.
 
 
 
 
78
 
79
+ [More Information Needed]
80
 
81
+ ## Training Details
82
 
83
+ ### Training Data
 
 
 
 
 
84
 
85
+ <!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
86
 
87
+ [More Information Needed]
88
 
89
+ ### Training Procedure
 
 
 
 
 
90
 
91
+ <!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
92
 
93
+ #### Preprocessing [optional]
94
 
95
+ [More Information Needed]
96
 
 
97
 
98
+ #### Training Hyperparameters
99
 
100
+ - **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
 
101
 
102
+ #### Speeds, Sizes, Times [optional]
103
+
104
+ <!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
105
+
106
+ [More Information Needed]
107
 
108
  ## Evaluation
109
 
110
+ <!-- This section describes the evaluation protocols and provides the results. -->
111
+
112
+ ### Testing Data, Factors & Metrics
113
+
114
+ #### Testing Data
115
+
116
+ <!-- This should link to a Dataset Card if possible. -->
117
+
118
+ [More Information Needed]
119
+
120
+ #### Factors
121
+
122
+ <!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
123
+
124
+ [More Information Needed]
125
+
126
+ #### Metrics
127
+
128
+ <!-- These are the evaluation metrics being used, ideally with a description of why. -->
129
+
130
+ [More Information Needed]
131
+
132
+ ### Results
133
+
134
+ [More Information Needed]
135
+
136
+ #### Summary
137
+
138
+
139
+
140
+ ## Model Examination [optional]
141
+
142
+ <!-- Relevant interpretability work for the model goes here -->
143
+
144
+ [More Information Needed]
145
+
146
+ ## Environmental Impact
147
+
148
+ <!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
149
+
150
+ Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
151
+
152
+ - **Hardware Type:** [More Information Needed]
153
+ - **Hours used:** [More Information Needed]
154
+ - **Cloud Provider:** [More Information Needed]
155
+ - **Compute Region:** [More Information Needed]
156
+ - **Carbon Emitted:** [More Information Needed]
157
+
158
+ ## Technical Specifications [optional]
159
+
160
+ ### Model Architecture and Objective
161
+
162
+ [More Information Needed]
163
+
164
+ ### Compute Infrastructure
165
+
166
+ [More Information Needed]
167
+
168
+ #### Hardware
169
+
170
+ [More Information Needed]
171
+
172
+ #### Software
173
+
174
+ [More Information Needed]
175
+
176
+ ## Citation [optional]
177
+
178
+ <!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
179
+
180
+ **BibTeX:**
181
+
182
+ [More Information Needed]
183
+
184
+ **APA:**
185
+
186
+ [More Information Needed]
187
+
188
+ ## Glossary [optional]
189
+
190
+ <!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
191
+
192
+ [More Information Needed]
193
+
194
+ ## More Information [optional]
195
+
196
+ [More Information Needed]
197
+
198
+ ## Model Card Authors [optional]
199
+
200
+ [More Information Needed]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
 
202
+ ## Model Card Contact
203
 
204
+ [More Information Needed]
205
+ ### Framework versions
206
 
207
+ - PEFT 0.19.1