LoRA adapter for maternal health triage in Brazilian Portuguese —
designed for riverine, quilombola, and backland communities where
traditional midwives are often the first point of care and formal
healthcare services are distant.
Fine-tuned on Llama-3.3-70B-Instruct via Adaption's
AutoScientist platform.
Covers 13 structured clinical risk signals across 3 urgency tiers
(vermelho / amarelo / verde), grounded in official Brazilian Ministry
of Health publications — all responses in PT-BR.
Evaluation results
Training Winrates
The adapted model outperforms the base model with 80% win rate vs 21%
on held-out medical evaluation — a +281% relative improvement
over the base model.
Model
Win Rate
Base (Llama-3.3-70B-Instruct)
21%
Adapted (parteirabr-adapter)
80%
Train/Eval Metrics
Metric
Value
Initial train loss
~1.59
Final validation loss
~0.42
Training steps
163
LR scheduler
cosine (warmup)
Gradient norm
spike → stable
Train loss converged steadily over 163 steps. Validation loss tracked
closely, confirming generalization without overfitting. Learning rate
followed cosine schedule with warmup. Gradient norm stabilized after
initial spike, indicating stable optimization throughout.
1,200 instruction/completion pairs across 13 clinical signals:
Tier
Signal
Examples
🔴 Vermelho
Sangramento vaginal
50
🔴 Vermelho
Dor de cabeça forte com alterações visuais
50
🔴 Vermelho
Convulsão
50
🔴 Vermelho
Diminuição ou ausência de movimentos do bebê
50
🔴 Vermelho
Perda de líquido amniótico antes do termo
50
🔴 Vermelho
Febre alta no pós-parto com mau cheiro
50
🟡 Amarelo
Inchaço súbito de rosto e mãos
100
🟡 Amarelo
Ardência ou dor para urinar
100
🟡 Amarelo
Febre baixa persistente
100
🟡 Amarelo
Ausência de acompanhamento de pré-natal
100
🟢 Verde
Enjoo e náusea no primeiro trimestre
200
🟢 Verde
Cansaço e sonolência
200
🟢 Verde
Dúvidas sobre amamentação
200
Quality controls
8-dimension rubric (16 pts max): correct referral, welcoming tone,
simple language, respect for traditional knowledge, no risk minimization,
no prescription or diagnosis, concrete referral pathway, structural
clarity. Dataset mean: 15.41/16.
3-tier safety gate: blocks home remedies for emergencies, wait-and-see
language for red signals, diagnosis, and prescription. All 1,200 examples
passed with safety_flag: ok.
Grounding
All 13 signals traced to specific pages in official MoH publications:
Caderneta Brasileira da Gestante (2026)
Estratificação de Risco Gestacional — SES-MG (2025)
Atenção ao Pré-Natal de Baixo Risco — CAB nº 32 (2012)
Saúde da Criança: Aleitamento Materno — CAB nº 23 (2015)
Manual de Gestação de Alto Risco (2022)
Safety Principle
The core constraint of this adapter: when any risk signal is present,
always refer to formal healthcare services — immediately for red signals,
within 24–48h for yellow signals.
Example
✅ Correto
"Isso é uma emergência. Procure o SAMU 192 AGORA."
❌ Bloqueado
"Tome um chá e veja se melhora até amanhã."
Usage
python
1from peft import PeftModel
2from transformers import AutoModelForCausalLM, AutoTokenizer
34BASE_MODEL ="meta-llama/Llama-3.3-70B-Instruct"5ADAPTER_PATH =(6"/kaggle/input/parteirabr-maternalhealth-adapter/"7"other/llama-3-3-70b-instruct-lora/1"8)910base_model = AutoModelForCausalLM.from_pretrained(11 BASE_MODEL,12 device_map="auto",13 torch_dtype="auto",14)1516tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)1718model = PeftModel.from_pretrained(19 base_model,20 ADAPTER_PATH,21)2223prompt ="""ParteiraBR — Guia de Orientação em Saúde Materna Tradicional
2425Você é um assistente de acolhimento e navegação em saúde materna.
26Diante de qualquer sinal de risco, encaminhe imediatamente ao serviço
27de saúde. Nunca diagnostique, prescreva ou sugira remédios caseiros
28para emergências.
2930Contexto: uma gestante de uma comunidade ribeirinha no Amazonas
31perguntou:
32Estou grávida e tive um sangramento forte agora. Estou com medo.
33O que eu faço?"""3435inputs = tokenizer(prompt, return_tensors="pt").to(model.device)3637outputs = model.generate(38**inputs,39 max_new_tokens=512,40 do_sample=True,41 temperature=0.7,42 top_p=0.9,43)4445generated_tokens = outputs[0][inputs["input_ids"].shape[1]:]46print(tokenizer.decode(generated_tokens, skip_special_tokens=True))
Experimental research artifact submitted to the AutoScientist Challenge
2026 (Healthcare category). The adapter does not replace evaluation by
a qualified healthcare professional. All clinical guidance generated by
the model must be reviewed before use in real community health settings.
Traditional midwifery knowledge is respected and valued — this adapter
is designed to complement, not replace, community health networks.