CoolFace
Modelpublic

iue-edu/MaternaCare-ES-medgemma-qlora

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes6downloads
Model Card

MaternaCare-ES MedGemma QLoRA

<p align="center"> <img src="https://huggingface.co/iue-edu/MaternaCare-ES-medgemma-qlora/resolve/main/app-icon.png" alt="MaternaQA-es / MaternaCare-ES visual identity" width="180" /> </p>

MaternaCare-ES MedGemma QLoRA is a PEFT/QLoRA adapter for `google/medgemma-1.5-4b-it`, fine-tuned for Spanish maternal-health question answering with grounded clinical context.

The adapter was trained on the grounded SFT split of `iue-edu/MaternaQA-es`, a Spanish obstetrics and maternal-health QA dataset built from curated clinical PDF sources.

This is a research artifact. It is not a medical device and must not be used as a substitute for professional clinical judgment.

Highlights

  • —Language: Spanish
  • —Domain: obstetrics, pregnancy, labor, postpartum care, fetal monitoring, and maternal health
  • —Training style: grounded supervised fine-tuning
  • —Adapter type: QLoRA / LoRA for causal language modeling
  • —Dataset: `iue-edu/MaternaQA-es`
  • —Code repository: `JhonHander/MaternaCare-ES`

Intended use

This adapter is intended for research and development workflows such as:

  • —Spanish medical QA experiments in maternal-health contexts.
  • —Comparing a medically oriented base model against a domain-adapted grounded adapter.
  • —Evaluating lightweight adaptation for obstetrics-focused question answering.
  • —Building reproducible academic baselines for maternal-health NLP.

It is not intended for direct patient care, autonomous diagnosis, treatment recommendation, emergency triage, or any clinical decision-making workflow.

Training data

The model was fine-tuned with the sft_grounded configuration of MaternaQA-es.

SplitQA pairsSource chunksSource PDFs
Train5,0931,74452
Validation3061012
Test3281083
Total5,7271,95357

In the grounded format, each example provides source context and a question, and the assistant is trained to answer using that context.

Training procedure

The adapter was trained with TRL supervised fine-tuning and PEFT QLoRA.

Observed training setup from the public repository:

SettingValue
Base modelgoogle/medgemma-1.5-4b-it
Datasetiue-edu/MaternaQA-es
Dataset variantsft_grounded
MethodSFT with QLoRA
Max sequence length1024
Epochs2.0
Per-device batch size1
Gradient accumulation8
Learning rate2e-4
Optimizeradamw_8bit
Schedulercosine
Quantization4-bit NF4 with double quantization
LoRA rank16
LoRA alpha16
LoRA dropout0.05

Evaluation

Evaluation was run on the MaternaQA-es test split with 328 predictions. Automatic metrics are useful for comparison, but they do not establish clinical correctness.

ModelFaithfulnessAnswer relevancyCorrectnessSemantic similarity
MedGemma base0.23660.82070.51180.7487
MedGemma grounded QLoRA0.38650.76340.56560.7872

Evaluation setup:

  • —Test examples: 328
  • —Judge model: gpt-5.4-mini
  • —Embedding model: text-embedding-3-small
  • —Evaluation errors: 6

The grounded adapter improves faithfulness, correctness, and semantic similarity over the evaluated MedGemma base baseline, while answer relevancy decreases relative to the base model. This trade-off should be inspected qualitatively before drawing conclusions.

Usage

The underlying MedGemma base model is gated. Before loading this adapter, make sure you have accepted the base-model terms on Hugging Face and are authenticated locally.

python
from peft import AutoPeftModelForCausalLM
from transformers import AutoTokenizer
import torch

adapter_id = "iue-edu/MaternaCare-ES-medgemma-qlora"

tokenizer = AutoTokenizer.from_pretrained(adapter_id)
model = AutoPeftModelForCausalLM.from_pretrained(
    adapter_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

context = """Contexto fuente: [Insert reviewed clinical context here.]"""
question = "¿Qué controles se recomiendan durante el embarazo?"

messages = [
    {
        "role": "user",
        "content": f"{context}\n\nPregunta: {question}\n\nResponde en español usando el contexto fuente.",
    }
]

inputs = tokenizer.apply_chat_template(
    messages,
    tokenize=True,
    add_generation_prompt=True,
    return_tensors="pt",
).to(model.device)

with torch.no_grad():
    output = model.generate(
        inputs,
        max_new_tokens=256,
        temperature=0.2,
        do_sample=False,
        repetition_penalty=1.05,
    )

print(tokenizer.decode(output[0][inputs.shape[-1]:], skip_special_tokens=True))

Responsible use

This adapter may generate fluent but incorrect or incomplete medical text. Use it only in controlled research settings with expert review.

Do not use it for:

  • —Diagnosis or treatment decisions.
  • —Patient-facing medical advice without clinical supervision.
  • —Emergency, triage, or high-risk care workflows.
  • —Replacing official medical guidelines or professional judgment.

Limitations

  • —Fine-tuning data is synthetic and Spanish-language.
  • —Grounded generation quality depends on the quality and relevance of the provided context.
  • —Evaluation metrics are automatic and may miss clinically important errors.
  • —The adapter inherits limitations and access constraints from the gated MedGemma base model.
  • —The observed evaluation shows a smaller gain than the Gemma 4 adapter; use qualitative review before selecting this adapter for downstream experiments.

Citation

If you use this adapter, please cite the dataset and the training/evaluation repository:

bibtex
@misc{maternaqa_es,
  title        = {MaternaQA-es: A Spanish Maternal-Health Question Answering Dataset},
  author       = {Instituci\'on Universitaria de Envigado and collaborators},
  year         = {2026},
  howpublished = {\url{https://huggingface.co/datasets/iue-edu/MaternaQA-es}}
}
bibtex
@misc{maternacare_es,
  title        = {MaternaCare-ES: Spanish Maternal-Health QLoRA Adapters},
  author       = {Instituci\'on Universitaria de Envigado and collaborators},
  year         = {2026},
  howpublished = {\url{https://github.com/JhonHander/MaternaCare-ES}}
}