vioBERT-v3: an Arabic medical BERT encoder
vioBERT-v3 is MARBERTv2 further pre-trained on about 1.12M Arabic medical documents with whole-word masking (domain-adaptive pre-training, DAPT). It is intended as a starting point for Arabic medical NLP tasks such as specialty routing of patient questions, medical entity extraction, and semantic search over health text.
It accompanies the paper "From Tweets to Treatment: When Does Medical Knowledge Injection through Domain-Adaptive Pre-Training Help Arabic Language Encoders?" (Zaghloul and Khaled, 2026; under review).
Key results
All fine-tuning results are means over 3 seeds; p values are from Welch's t-test against the base model (MARBERTv2).
| Evaluation | MARBERTv2 | vioBERT-v3 | Change | p |
|---|---|---|---|---|
| Medical pseudo-perplexity (lower is better) | 24.34 | 4.21 | −82.7% | – |
| Fill-mask top-5 accuracy | 70.4% | 85.9% | +15.5 pts | – |
| Specialty routing, 5 classes (macro-F1) | 63.56 | 64.53 | +0.97 | 0.08 |
| Specialty routing, 39 classes (macro-F1) | 35.99 | 37.61 | +1.62 | 0.02 |
| Biomedical NER, ABioNER (entity F1) | 95.70 | 96.63 | +0.93 | 0.29 |
| MedAraBench medical exam MCQ (accuracy) | 45.05 | 44.84 | −0.21 | 0.85 |
How to read these results:
- DAPT injects a large amount of medical knowledge into MARBERTv2 (perplexity and fill-mask).
- After fine-tuning, the clearest gain is on fine-grained (39-class) specialty routing. The NER gain is positive but not statistically significant, and medical exam accuracy is unchanged.
- vioBERT-v3 recovers most of MARBERTv2's gap to the MSA-oriented AraBERT v02, but does not outperform AraBERT v02 on 39-class routing (38.30 vs 37.61) or NER (97.46 vs 96.63).
When to use vioBERT-v3
- Use it instead of MARBERTv2 when your Arabic medical text is informal, dialectal or patient-written.
- Use it when you have few labelled examples, or when you use the encoder frozen (embeddings, retrieval, feature extraction).
- Consider AraBERT v02 for formal MSA medical text with large labelled datasets; in our experiments it performs as well as or better than vioBERT-v3 there.
- Do not use an encoder like this for medical exam question answering or clinical reasoning. Larger generative models (e.g. Hakeem-7B) or retrieval-based methods are more suitable.
Usage
from transformers import pipeline
fill_mask = pipeline("fill-mask", model="Vionex-digital/vioBERT-v3")
fill_mask("المريض يعاني من [MASK] في الصدر")
For fine-tuning on a classification task:
from transformers import AutoTokenizer, AutoModelForSequenceClassification
tokenizer = AutoTokenizer.from_pretrained("Vionex-digital/vioBERT-v3")
model = AutoModelForSequenceClassification.from_pretrained(
"Vionex-digital/vioBERT-v3", num_labels=5
)
Pre-training details
| Setting | Value |
|---|---|
| Base model | UBC-NLP/MARBERTv2 (BERT-base, 12 layers, hidden size 768, 100K vocabulary, ~163M parameters) |
| Objective | Masked language modelling with whole-word masking (15% of words) |
| Sequence length | 512 |
| Effective batch size | 32 |
| Optimiser | AdamW, peak learning rate 5e-5, 10% linear warm-up then linear decay, weight decay 0.01 |
| Steps | 22,000 (checkpoint selected on held-out pseudo-perplexity and fill-mask accuracy; ≈360M tokens) |
| Hardware | 1 × NVIDIA L4 (24 GB) |
Hamza variants were not normalised, because the MARBERTv2 tokenizer keeps them distinct.
Training data
The pre-training corpus combines four public sources (about 1.12M documents after deduplication and filtering, 189 tokens on average). Vionex did not create these datasets; they belong to their authors and were used under their licences. We do not redistribute the combined corpus.
| Source | Size | Origin and licence |
|---|---|---|
| AHD: Arabic Healthcare Dataset (Gawbah, 2024) | 808K Q&A pairs | Altibbi; Mendeley Data, DOI 10.17632/mgj29ndgrk.5, CC BY 4.0 |
| Shifaa Arabic Medical Consultations (Selem, 2025) | 84,422 consultations | Islam Web; Hugging Face, Apache-2.0 |
| Arabic Wikipedia (medical categories) | ~5K articles | CC BY-SA |
| WHO Arabic health material and public-domain texts | small | public / WHO terms |
The validation and test splits of the classification benchmark were removed from the pre-training corpus. Regular-expression sweeps were applied to remove personal identifiers.
Evaluation data
- Specialty routing: deduplicated Shifaa consultations (55,210 documents) grouped into 5 and 39 classes; split 44,168 / 5,521 / 5,521.
- NER: the Arabic biomedical NER data of ABioNER (Boudjellal et al., 2021), disease and treatment entities.
- Medical MCQ: MedAraBench (Abu-Daoud et al., 2026), five-option exam questions over five difficulty levels.
Limitations
- Results use 3 seeds; several differences (including NER) are not statistically significant.
- The corpus is mostly consumer health consultations. Clinical notes and electronic health records are absent, so performance on clinical documentation may be lower.
- Coverage skews toward MSA and Mashriqi dialects; Maghrebi medical Arabic is under-represented.
- The labelled data over-represent some specialties (OB/GYN is 16.3%).
Ethical considerations
vioBERT-v3 is a research model. It is not a medical device and must not be used for diagnosis, treatment decisions, or patient-facing advice without clinical validation and regulatory approval. Only publicly available text was used; no patient records, electronic health records, or protected health information. Audit the model for biases across specialties, dialects and demographic groups before any deployment.
Citation
@misc{zaghloul2026viobert,
title = {From Tweets to Treatment: When Does Medical Knowledge Injection through
Domain-Adaptive Pre-Training Help Arabic Language Encoders?},
author = {Zaghloul, Yousef and Khaled, Abdallah},
year = {2026},
note = {Manuscript under review},
url = {https://huggingface.co/Vionex-digital/vioBERT-v3}
}
Please also cite the datasets used for pre-training (AHD, Shifaa) and the base model (Abdul-Mageed et al., 2021, ARBERT & MARBERT: Deep Bidirectional Transformers for Arabic).
Contact
Vionex Digital Solutions: vio@vionex.digital