Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/NicolasHoyosDevss/MaternaQA-es/llms.txt

Use this file to discover all available pages before exploring further.

MaternaQA-es is an open research resource for training and evaluating language models on clinical questions about pregnancy, childbirth, postpartum care, and perinatal medicine — entirely in Spanish. Built from 63 curated clinical PDFs, every Q&A pair is traceable to its source document, pages, and text chunk.

Introduction

Learn what MaternaQA-es is, how it was built, and when to use it.

Quickstart

Load the dataset and run your first fine-tuning smoke test in minutes.

Dataset Overview

Explore the 5,727 Q&A pairs, splits, and coverage across 18 clinical topics.

Pipeline Overview

Understand the 8-step reproducible pipeline from PDFs to published dataset.

What’s inside

MaternaQA-es ships three ready-to-use dataset variants and a full reproducible pipeline.

sft_grounded

Context + question → answer. Best for RAG and evidence-grounded fine-tuning.

sft_closed_book

Question → answer only. Measures how well a model internalizes the clinical domain.

qa_flat_jsonl

Flat records with full metadata for auditing, analysis, and scientific reporting.

Get started in three steps

1

Install dependencies

Clone the repo and install the Python environment.
git clone https://github.com/NicolasHoyosDevss/MaternaQA-es.git
cd MaternaQA-es
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
2

Load a dataset variant

Use the Hugging Face datasets library to load any split locally.
from datasets import load_dataset

dataset = load_dataset(
    "json",
    data_files={
        "train": "datasets/obstetrics/qa/publication/sft_grounded/train.jsonl",
        "validation": "datasets/obstetrics/qa/publication/sft_grounded/validation.jsonl",
        "test": "datasets/obstetrics/qa/publication/sft_grounded/test.jsonl",
    },
)
3

Run a fine-tuning smoke test

Validate that training loads, runs, and saves a QLoRA adapter before committing to a full run.
python scripts/train_qlora_trl.py \
  --model-name google/gemma-4-E2B-it \
  --dataset-variant sft_grounded \
  --output-dir outputs/smoke-gemma4 \
  --max-steps 10 \
  --train-limit 64 \
  --eval-limit 32

Explore the docs

Dataset Variants

Compare sft_grounded, sft_closed_book, and qa_flat_jsonl formats and pick the right one for your task.

Dataset Schema

Field-by-field reference for every JSONL record format used in the dataset.

Quality & Evaluation

Ragas faithfulness and relevance scores, grounding statistics, and question-type distribution.

Fine-tuning Guide

Step-by-step guide to QLoRA training with Gemma 4 and MedGemma 1.5 4B.

Scripts Reference

CLI reference for every pipeline and training script with all flags documented.

Hugging Face Hub

Download the published dataset directly from Hugging Face.
MaternaQA-es is a research resource. It does not replace clinical judgment or official medical guidelines. All Q&A pairs are synthetic and must be validated by clinical experts before use in production health systems.

Build docs developers (and LLMs) love