DipaMed-1 / README.md
Destiny-Ibhate's picture
Fix usage example (correct generate call)
c223860 verified
|
Raw
History Blame Contribute Delete
5.53 kB
---
license: llama3.1
base_model: meta-llama/Llama-3.1-8B
language:
- en
pipeline_tag: text-generation
tags:
- medical
- clinical
- nigeria
- healthcare
- africa
- llama
- global-health
---
# DipaMed-1
**A language model specialised on Nigerian clinical guidelines.**
DipaMed-1 adapts Meta's Llama-3.1-8B to Nigerian medicine, grounded in Federal Ministry of Health (FMOH) and Nigeria Centre for Disease Control (NCDC) clinical guidelines. It is built to give locally-appropriate clinical guidance that reflects Nigerian disease priorities, the Nigerian Essential Medicines List, and national treatment protocols.
- **Developed by:** Destiny Ebhodaghe Ibhate (DipaHealth)
- **Base model:** meta-llama/Llama-3.1-8B
- **Language:** English
- **License:** Llama 3.1 Community License
> **Intended use:** clinical decision *support* for trained health workers. DipaMed-1 is **not** an autonomous diagnostic system and must not be used to make patient-care decisions without a qualified clinician.
## Highlights - where DipaMed-1 leads
On [NigeriaMedQA](https://huggingface.co/datasets/DipaHealth/NigeriaMedQA), DipaMed-1 **outperforms its base model on the Nigeria-specific clinical topics it was built for:**
| Topic | DipaMed-1 | Base Llama-3.1-8B | Improvement |
|---|---|---|---|
| Mental health | **95.8%** | 87.5% | **+8.3** |
| Maternal emergencies | **90.6%** | 84.4% | **+6.2** |
| Drug availability | **72.8%** | 67.0% | **+5.8** |
| Hypertension | **68.5%** | 64.8% | **+3.7** |
| Tuberculosis-HIV | **82.4%** | 79.4% | **+3.0** |
| Lassa fever | **79.5%** | 76.9% | **+2.6** |
| Sickle cell disease | **81.8%** | 80.0% | **+1.8** |
| Outbreak diseases | **62.1%** | 60.3% | **+1.8** |
These are the diseases and decisions that matter most in Nigerian practice. Across the full benchmark, DipaMed-1 performs comparably to the base model overall (76.3% vs 77.0%), while delivering these gains where Nigerian specialisation counts.
## What makes it different
General medical models are trained on North American and European data. DipaMed-1 is grounded in **Nigerian** guidelines, giving Nigeria-appropriate answers a general model cannot: correct local first-line treatments, Essential-Medicines-List-aware choices, and NCDC/FMOH-aligned protocols.
## How it was built
| Stage | Purpose | Data |
|---|---|---|
| **Continued pretraining** | Absorb Nigerian medical knowledge | 156 million words of Nigerian biomedical text (PubMed abstracts, open-access PMC full-text, clinical guidelines); approx. 254M tokens |
| **Instruction tuning** | Learn to answer clinical questions | Q&A generated from and independently verified against real Nigerian guidelines, plus cleaned expert-created sources (PubMedQA, MedQA-USMLE, WikiDoc) |
Training used QLoRA (rank 16), a learning-rate sweep with model selection on a **held-out validation set**, and completion-only loss masking. The evaluation benchmark was kept fully uncontaminated and used only once for final scoring. The pretraining corpus is not released; its construction methodology is described in the accompanying paper.
## Usage
```python
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "DipaHealth/DipaMed-1"
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="auto")
tok = AutoTokenizer.from_pretrained(model_id)
messages = [
{"role": "system", "content": "You are DipaMed-1, a clinical AI assistant grounded in Nigerian guidelines."},
{"role": "user", "content": "First-line treatment for uncomplicated malaria in a non-pregnant adult in Nigeria?"},
]
input_ids = tok.apply_chat_template(messages, add_generation_prompt=True, return_tensors="pt").to(model.device)
out = model.generate(input_ids=input_ids, max_new_tokens=256, do_sample=False, pad_token_id=tok.eos_token_id)
print(tok.decode(out[0][input_ids.shape[1]:], skip_special_tokens=True))
```
## Recommended deployment: retrieve, then answer (RAG)
For production, wrap DipaMed-1 in a retrieval-augmented (RAG) pipeline over the Nigerian guidelines: retrieve the relevant passage, give it to the model, and have it answer **from that passage with a citation**. This substantially improves factual reliability, especially for exact drug doses where all language models are unreliable from memory, and lets the system cite its source. A dedicated DipaMed RAG service is planned as a separate release.
## Limitations and responsible use
- **Exact doses:** do not rely on DipaMed-1 for precise dosing without retrieval support; language models do not reliably memorise numeric dose tables.
- **Decision support only:** it assists clinicians and must not make autonomous clinical decisions.
- **Scale:** at 8B parameters it will not match frontier models on general medicine; its strength is Nigerian domain specialisation.
- **Errors and bias:** like all language models it can produce confident but incorrect answers; verify outputs against source guidelines.
- **Scope:** English, text-only in this version. Speech and Nigerian-language support are planned.
## Citation
```bibtex
@misc{dipamed2026,
title = {DipaMed-1: A Nigerian Guideline-Specialised Clinical Language Model},
author = {Ibhate, Destiny Ebhodaghe},
year = {2026},
howpublished = {\url{https://huggingface.co/DipaHealth/DipaMed-1}}
}
```
## Acknowledgements
Built on Meta Llama-3.1-8B. Evaluated with [NigeriaMedQA](https://huggingface.co/datasets/DipaHealth/NigeriaMedQA). Grounded in FMOH and NCDC clinical guidelines.