Upload README.md
Browse files
README.md
CHANGED
|
@@ -1,58 +1,178 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
tags:
|
| 6 |
-
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# Model
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
|
| 17 |
-
## Quick start
|
| 18 |
|
| 19 |
-
|
| 20 |
-
from transformers import pipeline
|
| 21 |
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
```
|
| 27 |
|
| 28 |
-
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
|
| 36 |
-
##
|
| 37 |
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
- Tokenizers: 0.22.2
|
| 43 |
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
|
|
|
|
| 46 |
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
```bibtex
|
| 51 |
-
@software{vonwerra2020trl,
|
| 52 |
-
title = {{TRL: Transformers Reinforcement Learning}},
|
| 53 |
-
author = {von Werra, Leandro and Belkada, Younes and Tunstall, Lewis and Beeching, Edward and Thrush, Tristan and Lambert, Nathan and Huang, Shengyi and Rasul, Kashif and Gallouédec, Quentin},
|
| 54 |
-
license = {Apache-2.0},
|
| 55 |
-
url = {https://github.com/huggingface/trl},
|
| 56 |
-
year = {2020}
|
| 57 |
-
}
|
| 58 |
-
```
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: cc-by-nc-4.0
|
| 5 |
tags:
|
| 6 |
+
- pharmacovigilance
|
| 7 |
+
- medical
|
| 8 |
+
- mistral
|
| 9 |
+
- qlora
|
| 10 |
+
- faers
|
| 11 |
+
- drug-safety
|
| 12 |
+
- adverse-events
|
| 13 |
+
base_model: mistralai/Mistral-7B-Instruct-v0.3
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# pv-biomistral-7b
|
| 17 |
+
|
| 18 |
+
A pharmacovigilance-specialised language model fine-tuned from
|
| 19 |
+
[Mistral-7B-Instruct-v0.3](https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3)
|
| 20 |
+
on 100,000 FAERS-derived training examples across five structured PV tasks.
|
| 21 |
+
|
| 22 |
+
This is the community testing release. It contains only the Q4_K_M quantized
|
| 23 |
+
GGUF for local inference via Ollama or llama-cpp-python.
|
| 24 |
+
|
| 25 |
+
---
|
| 26 |
+
|
| 27 |
+
## ⚠️ Important Disclaimer
|
| 28 |
+
|
| 29 |
+
This model is a **research prototype** intended for pharmacovigilance
|
| 30 |
+
professionals to evaluate and provide feedback on. It is **not a validated
|
| 31 |
+
system** and must not be used for:
|
| 32 |
+
|
| 33 |
+
- Autonomous pharmacovigilance decision-making
|
| 34 |
+
- Generating or contributing to regulatory submissions
|
| 35 |
+
- Replacing qualified pharmacovigilance assessor judgment
|
| 36 |
+
- Clinical or safety-critical decisions of any kind
|
| 37 |
+
|
| 38 |
+
All model outputs require review by a qualified pharmacovigilance professional.
|
| 39 |
+
This tool is for exploratory and research purposes only.
|
| 40 |
+
|
| 41 |
---
|
| 42 |
|
| 43 |
+
## Model Details
|
| 44 |
|
| 45 |
+
| Property | Value |
|
| 46 |
+
|---|---|
|
| 47 |
+
| Base model | mistralai/Mistral-7B-Instruct-v0.3 |
|
| 48 |
+
| Fine-tuning method | QLoRA (4-bit NF4, LoRA r=16) |
|
| 49 |
+
| Training records | 100,000 |
|
| 50 |
+
| Training epochs | 3 |
|
| 51 |
+
| Data source | FAERS public database (FDA) |
|
| 52 |
+
| Quantization | Q4_K_M (GGUF) |
|
| 53 |
+
| Model size | 4.37 GB |
|
| 54 |
+
| Context window | 8192 tokens |
|
| 55 |
+
| Framework | TRL 1.0.0, Transformers, PEFT |
|
| 56 |
|
|
|
|
| 57 |
|
| 58 |
+
## Setup — Ollama (Recommended)
|
|
|
|
| 59 |
|
| 60 |
+
### Requirements
|
| 61 |
+
- [Ollama](https://ollama.com/download) installed
|
| 62 |
+
- ~5 GB free disk space
|
| 63 |
+
- 8 GB RAM minimum, 16 GB recommended
|
| 64 |
+
- GPU optional but recommended for faster inference
|
| 65 |
+
|
| 66 |
+
### Installation
|
| 67 |
+
|
| 68 |
+
**Step 1 — Download both files from this repository:**
|
| 69 |
+
- `pv-biomistral-7b-Q4_K_M.gguf` (4.37 GB)
|
| 70 |
+
- `Modelfile`
|
| 71 |
+
|
| 72 |
+
Place both in the same folder.
|
| 73 |
+
|
| 74 |
+
**Step 2 — Create the Ollama model**
|
| 75 |
+
```bash
|
| 76 |
+
cd /path/to/downloaded/files
|
| 77 |
+
ollama create pv-mistral-v2 -f Modelfile
|
| 78 |
+
```
|
| 79 |
+
|
| 80 |
+
**Step 3 — Run**
|
| 81 |
+
```bash
|
| 82 |
+
ollama run pv-mistral-v2
|
| 83 |
```
|
| 84 |
|
| 85 |
+
**Windows users:** Use the full path e.g. `cd C:\Users\YourName\Downloads\pv-model\`
|
| 86 |
|
| 87 |
+
---
|
| 88 |
+
|
| 89 |
+
## Setup — llama-cpp-python (Alternative)
|
| 90 |
+
|
| 91 |
+
```bash
|
| 92 |
+
pip install llama-cpp-python[server]
|
| 93 |
|
| 94 |
+
python -m llama_cpp.server \
|
| 95 |
+
--model pv-biomistral-7b-Q4_K_M.gguf \
|
| 96 |
+
--chat_format mistral-instruct \
|
| 97 |
+
--n_gpu_layers -1 \
|
| 98 |
+
--n_ctx 8192
|
| 99 |
+
```
|
| 100 |
|
| 101 |
+
Then open `http://localhost:8000/docs` for the Swagger UI.
|
| 102 |
|
| 103 |
+
---
|
| 104 |
|
| 105 |
+
## Setup — Jan App (Windows/Mac)
|
| 106 |
|
| 107 |
+
1. Download [Jan](https://jan.ai)
|
| 108 |
+
2. Import Model → select the GGUF file
|
| 109 |
+
3. Set temperature to 0.1 in chat settings
|
| 110 |
+
4. Add system prompt from the Modelfile SYSTEM field
|
|
|
|
| 111 |
|
| 112 |
+
---
|
| 113 |
+
|
| 114 |
+
## Expected Performance by Hardware
|
| 115 |
+
|
| 116 |
+
| Hardware | Speed | Response Time |
|
| 117 |
+
|---|---|---|
|
| 118 |
+
| Mac Mini M4 / Apple Silicon | 25-35 tokens/sec | 2-5 sec/case |
|
| 119 |
+
| Windows + NVIDIA GPU (8GB+ VRAM) | 25-40 tokens/sec | 2-4 sec/case |
|
| 120 |
+
| Snapdragon X Elite (16GB) | 8-15 tokens/sec | 5-12 sec/case |
|
| 121 |
+
| Windows CPU only (16-24GB RAM) | 3-6 tokens/sec | 15-30 sec/case |
|
| 122 |
+
|
| 123 |
+
---
|
| 124 |
+
|
| 125 |
+
## Known Limitations
|
| 126 |
+
|
| 127 |
+
- **Probable causality underrepresented:** Training data contained only 70 Probable
|
| 128 |
+
causality examples out of 100,000 records, reflecting real-world FAERS spontaneous
|
| 129 |
+
reporting patterns. The model may default to Possible even for cases with confirmed
|
| 130 |
+
positive dechallenge and no confounders.
|
| 131 |
+
|
| 132 |
+
- **Spontaneous reports only:** Trained exclusively on FAERS spontaneous adverse
|
| 133 |
+
event reports. Performance on clinical trial safety data, EHR-derived cases,
|
| 134 |
+
or non-English source material is untested.
|
| 135 |
+
|
| 136 |
+
- **Not formally validated:** The model has not been validated against any regulatory
|
| 137 |
+
standard including ICH E2D, ICH E2A, or WHO-UMC guidelines.
|
| 138 |
+
|
| 139 |
+
- **Short context optimised:** Designed for single-case inputs under 512 tokens.
|
| 140 |
+
|
| 141 |
+
---
|
| 142 |
+
|
| 143 |
+
## CIOMS WG XIV Alignment
|
| 144 |
+
|
| 145 |
+
This model is designed to operate within a Human-in-the-Loop (HITL) framework
|
| 146 |
+
consistent with CIOMS Working Group XIV recommendations for AI in drug safety.
|
| 147 |
+
All outputs are decision-support signals requiring human adjudication by a
|
| 148 |
+
qualified pharmacovigilance professional.
|
| 149 |
+
|
| 150 |
+
---
|
| 151 |
+
|
| 152 |
+
## Feedback
|
| 153 |
+
|
| 154 |
+
This is a community testing release. Please evaluate the model on real cases
|
| 155 |
+
from your practice area and share findings. Particular interest in:
|
| 156 |
+
|
| 157 |
+
- Causality outputs where you would classify Probable
|
| 158 |
+
- Cases with unusual drug combinations or rare reactions
|
| 159 |
+
- Narrative quality from a safety database entry perspective
|
| 160 |
+
- Therapeutic areas where performance appears weaker
|
| 161 |
+
|
| 162 |
+
---
|
| 163 |
+
|
| 164 |
+
## Training Data
|
| 165 |
+
|
| 166 |
+
Trained on 10,000 cases from the FDA Adverse Event Reporting System (FAERS),
|
| 167 |
+
accessed via public database export. No proprietary, confidential, or
|
| 168 |
+
patient-identifiable data beyond what is publicly available in FAERS was used.
|
| 169 |
+
|
| 170 |
+
---
|
| 171 |
|
| 172 |
+
## License
|
| 173 |
|
| 174 |
+
Base model (Mistral-7B-Instruct-v0.3): Apache 2.0
|
| 175 |
+
Fine-tuned weights: CC BY-NC 4.0 (non-commercial research use only)
|
| 176 |
|
| 177 |
+
By downloading this model you agree to use it for research purposes only
|
| 178 |
+
and not for any commercial application or regulatory submission.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|