Instructions to use Japhari/sdt-maternal-d1 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Local Apps Settings
- Unsloth Desktop
sdt-maternal-d1 reads a maternal complaint, in English or Kiswahili, and scores 13 routing questions. Each answer comes back with a probability for every option: which complication this is, which period of care, which facility should receive her, and whether danger signs such as bleeding, shock, fever, a fit, or breathlessness are present.
This repository is a 4-bit LoRA plus the Clef decision head, fine-tuned from unsloth/gemma-4-E4B-it. The base Gemma weights are not copied here. Load this repo and Unsloth fetches the base checkpoint.
Not for patient care. On 204 held-out cases the fine-tuned head got every question right on 162. The other 42 still miss at least one draft label. Those labels are synthetic drafts (
review_status: pending_clinician). A midwife or doctor has not signed them. Do not use a score from this model to choose a facility, a referral, or a treatment.
At a glance
| Task | Route a maternal complication. Name the finding. Do not name a medicine. |
| Base model | unsloth/gemma-4-E4B-it, scored with an Unsloth Clef decision head |
| This release | LoRA rank 16 and the trained decision head. 66,928,132 of 6,335,550,244 parameters were trained (1.06%). |
| Languages | English and Kiswahili, same label either way |
| Questions | 13: complication, stage, care level, danger sign, urgency, and eight findings |
| Rows | 1,935 train, 204 test, 82 scenarios. A scenario never sits in both splits. |
| Held-out score | 97.1% of question scores match the draft (2,576 of 2,652). 162 of 204 cases are fully correct. |
The temperature on the head was fitted on these same 204 cases, so the score is a little optimistic. It is not a second, untouched holdout.
One complaint, after fine-tuning
The first held-out row. Before training, the complication bar was flat (fetal distress at 4.9%) and bleeding was called heavy at 34.1% against a draft of light.
I am about 8 weeks pregnant. Since yesterday I have light brown spotting, less than a pad. I have mild cramps, no dizziness, and I can walk. The dispensary is twenty minutes away.
The draft label is a stable threatened abortion: antenatal, dispensary (A), a danger sign, seen within 24 hours, light bleeding, and no shock, fever, or fit.
| Question | Draft label | Fine-tuned head | Top probability |
|---|---|---|---|
| stage | antenatal | antenatal | 98.8% |
| care level | A | A | 99.0% |
| danger sign | yes | no | 76.2% |
| urgency | within 24 hours | routine | 80.7% |
| complication | threatened abortion | threatened abortion | 96.3% |
| bleeding | light | light | 98.9% |
| shock | no | no | 97.6% |
| fever | no | no | 97.7% |
| convulsion | no | no | 98.1% |
| breathlessness | no | no | 90.0% |
| consciousness | alert | alert | 99.8% |
| fetal status | not stated | not stated | 93.2% |
| blood pressure | not stated | not stated | 99.1% |
Eleven of the thirteen match the draft. Danger sign and urgency do not. A high bar is not the same thing as a signed clinical label.
What it answers
| Question | Kind | Options |
|---|---|---|
complication |
choice | 21 maternal complications, or none |
stage |
choice | antenatal, labour, postnatal mother, pregnancy loss |
care_level |
choice | A dispensary, B health centre, C council or district hospital |
danger_sign |
yes / no | A maternal danger sign is present |
urgency |
score | 0 routine, 1 within 24 hours, 2 go now |
bleeding |
choice | none, light, heavy |
shock |
yes / no | Collapsed, cold, restless, or faint while bleeding continues |
fever |
yes / no | Fever, chills, or feeling feverish |
convulsion |
yes / no | A fit, or shaking of the whole body |
breathlessness |
yes / no | Breathless at rest, crossing a room, or unable to finish a sentence |
consciousness |
choice | alert, impaired |
fetal_status |
choice | reassuring, concern, not stated |
blood_pressure |
choice | not stated, raised, severe |
none is a small class on purpose: ordinary labour, and ankle swelling that is gone by morning. It stops the model from calling every pregnancy a complication.
Facility levels follow the ladder in the Standard Treatment Guidelines and National Essential Medicines List, Tanzania Mainland, 7th edition 2026, Chapter 11. A is a dispensary. B is a health centre with basic emergency obstetric care. C is a council or district hospital with comprehensive emergency obstetric care. Levels D and S are not in this label set.
The question block shipped with this repo is questions.json.
Held-out score
Same 204 situations, scored after calibration. "Always the common answer" is the score from giving every row the most common training label. That column is high for rare findings because the common answer is "no".
| This head | Always the common answer | |
|---|---|---|
| Question scores correct | 97.1% | β |
| Cases with all 13 correct | 162 / 204 | β |
| Expected calibration error | 0.006 | β |
| Loss after calibration | 0.113 | β |
Before fine-tuning, the fresh head got all 13 questions right on 0 of 204 cases, and complication accuracy was 3.9%. These numbers compare the head with unsigned draft labels. They are not a clinical evaluation.
Training
| Split | Rows | What is in it |
|---|---|---|
| train | 1,935 | Complication complaints. A situation never appears in both splits. |
| test | 204 | Held-out situations, including a fit, a ruptured ectopic, and non-severe high blood pressure. |
| provenance | 2,139 | Scenario id, language, who is speaking, and why the label was chosen. |
The rows are published as Japhari/sdt-maternal-d1-data.
82 scenarios are kept. Each one is told in English and Kiswahili, by the woman, a community health worker, or a sister. Slot wording changes the gestational age or the distance. It does not change the route.
In train, hypertensive disorder is the largest complication (351 rows) and mastitis is the smallest (24). Care level C is 1,383 of 1,935 rows, because most of these complications are hospital referrals.
Routine antenatal visits, family planning, gynecology, infertility, and newborn-only cases are not in the set.
Two sources set the labels. Chapter 11 of STG/NEMLIT 2026 names the facility that should receive her. Cutoffs used for the finding questions match the maternal rule files published with maternal-clinical-decision-support-ai: hemoglobin bands, postpartum blood loss, blood pressure with protein, a fetal heart rate outside 110β160, glucose thresholds, postpartum fever, and shock. Those files also name medicines. The gold label does not.
The state is the complaint only. Guideline text is not copied into the row.
| Method | 4-bit LoRA, rank 16, alpha 16, dropout 0, on unsloth/gemma-4-E4B-it |
| Head | Separate learning rate 1e-4. Backbone learning rate 2e-4. |
| Schedule | 3 epochs, batch 1, gradient accumulation 8, warmup 20 steps, weight decay 0.01, seed 3407 |
| Length | 4,096 tokens. The 13-question schema needs 2,239 tokens before the complaint. |
| Split | Train file and test file stay separate. No random holdout, so a paraphrase cannot leak. |
| Run | About 1 hour 22 minutes, 726 steps. Training loss 0.046. |
How to score a case
Unsloth serves the decision head. vLLM does not.
from unsloth import FastDecisionModel
import json
model, tokenizer = FastDecisionModel.from_pretrained(
"Japhari/sdt-maternal-d1",
max_seq_length=4096,
load_in_4bit=True,
)
FastDecisionModel.for_inference(model)
questions = json.load(open("questions.json"))
state = (
"I am about 8 weeks pregnant. Since yesterday I have light brown spotting, "
"less than a pad. I have mild cramps, no dizziness, and I can walk."
)
answers = FastDecisionModel.predict(
model, tokenizer, state, {"stage": questions["stage"]}
)
print(answers["stage"]["answer"], answers["stage"]["probabilities"])
Intended use
- Research on maternal routing decisions in English and Kiswahili.
- A place to review the 13-question schema before a clinician signs the labels.
- A fine-tuned baseline against those unsigned drafts.
Out of scope
- Choosing a drug, a dose, or a procedure.
- Care of a newborn, family planning, infertility, or gynecology that is not a pregnancy complication.
- Any decision about a real patient.
Limitations
- 42 of 204 held-out cases still miss at least one draft label. The spotting example above misses danger sign and urgency while sounding sure.
- The reported accuracy uses temperatures fitted on the same 204 cases.
- Level C dominates the training rows. A constant "send her to hospital" looks strong on care level and still is not a model.
- Labels are drafts. A clinician has to accept or change them before a score is treated as meaningful.
- Synthetic complaints are not clinical records. Distance does not change the gold route.
Files
| File | |
|---|---|
README.md |
This card |
banner.png |
The header image |
questions.json |
The 13 questions, their types, and the option text the head is scored against |
adapter_model.safetensors |
LoRA weights |
adapter_config.json |
LoRA config. Base checkpoint is unsloth/gemma-4-E4B-it. |
joint_head.safetensors |
Trained Clef decision head |
unsloth_decision_config.json |
Layout, max length 4096, and fitted temperatures |
License
The adapter is a fine-tune of Gemma 4 and follows the Gemma 4 license of unsloth/gemma-4-E4B-it. The question schema and the prose of this card are CC-BY-4.0. The base weights are not redistributed in this repository.
@misc{sdt_maternal_d1,
title = {sdt-maternal-d1: maternal complication routing for Tanzania},
author = {Japhari Mbaru},
year = {2026},
url = {https://huggingface.co/Japhari/sdt-maternal-d1}
}