CoolFace
Modelpublic

albertoanalytics/pediatric-support-g4

sourceHugging Faceapache-2.0updated 4mo agoView on Hugging Face
0likes11downloads
Model Card

🩺 pediatric-support-g4 β€” v0.1 Pipeline Validation

A QLoRA adapter for Gemma 4 E4B, representing the first iteration of a research initiative to build offline-capable, locally-running LLMs for pediatric clinical decision support in resource-constrained clinical environments.


⚠️ Status and Intended Use

[!IMPORTANT] This is the first iteration of the project. Its sole purpose is to validate that the training pipeline, architecture, and hyperparameter configuration are stable and ready for scaled training. This is NOT a medical device. It has not been validated for clinical use. It has not been benchmarked for diagnostic accuracy. Do not use in any patient-facing context. All outputs must be reviewed by a qualified healthcare professional. The authors accept no liability for decisions made based on model outputs.

This adapter is released for research and development purposes only. Its intended downstream use is as a foundation for a future, independently validated clinical decision support tool for tropical and endemic pediatric diseases in remote, offline clinical settings in the Americas.

Out-of-scope use:

  • β€”Clinical diagnosis or treatment decisions of any kind
  • β€”Any patient-facing application
  • β€”General medical question answering in production settings
  • β€”Use without a qualified healthcare professional reviewing all outputs

πŸš€ Quick Start

This is a LoRA adapter β€” it must be loaded alongside its base model.

Installation

bash
pip install transformers peft bitsandbytes accelerate

Loading the Model

python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

base_model_id = "unsloth/gemma-4-e4b-it-unsloth-bnb-4bit"
adapter_id    = "albertoanalytics/pediatric-support-g4-v1"

tokenizer = AutoTokenizer.from_pretrained(base_model_id)

model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    load_in_4bit=True,
    device_map="auto",
)
model = PeftModel.from_pretrained(model, adapter_id)
model.eval()

Inference Example

python
import torch

prompt = """You are a knowledgeable pediatric medicine assistant.
A 3-year-old presents with a barking cough, stridor at rest, and low-grade fever.
What is the most likely diagnosis and recommended first-line management?"""

inputs = tokenizer(prompt, return_tensors="pt").to(model.device)

with torch.no_grad():
    outputs = model.generate(
        **inputs,
        max_new_tokens=512,
        temperature=0.7,
        do_sample=True,
    )

print(tokenizer.decode(outputs[0], skip_special_tokens=True))

πŸ—οΈ Model Details

PropertyValue
Base Modelunsloth/gemma-4-e4b-it-unsloth-bnb-4bit
ArchitectureGemma 4 E4B
Adapter MethodQLoRA (Quantized Low-Rank Adaptation)
LoRA Rank16
LoRA Alpha32
LoRA Dropout0.05
Training DatasetMedMCQA β€” pediatric subjects subset
Epochs3
Total Steps375
Final Loss0.6220
Final Grad Norm0.472
Total Tokens Seen~2,587,816
Training Duration1h 30m 24s
Training FrameworkUnsloth Studio

Why Gemma 4 E4B

Gemma 4 E4B was chosen over MedGemma 1.5 4B (arXiv:2604.05081v2) for three reasons specific to this project's deployment requirements:

  • β€”Thinking mode β€” extended chain-of-thought reasoning allows the clinician to follow and evaluate the model's reasoning process, not just receive an opaque conclusion. MedGemma 1.5 4B activates thinking via a prompted system instruction appended at inference time β€” it is not natively integrated into the architecture. Gemma 4 E4B, by contrast, controls thinking via a dedicated <|think|> token built into the model from the ground up, making it a first-class architectural capability rather than a prompted behaviour.
  • β€”Mobile-first deployment β€” the E4B model is purpose-built for efficient local execution on smartphones. MedGemma 1.5 4B makes no equivalent claim about mobile optimisation, and its expanded capabilities β€” processing 3D CT/MRI volumes of up to 85 axial slices (21,760 vision tokens) and whole slide pathology images of up to 126 patches (32,256 vision tokens) per query (arXiv:2604.05081v2) β€” might not be fully leveraged on a smartphone, especially in remote and isolated field settings. Google's own recommended production deployment path for MedGemma 1.5 4B points explicitly to cloud infrastructure: Model Garden and Google Cloud Storage, with specialised server-side processing for large medical images. Gemma 4 E4B, by contrast, was explicitly designed for efficient execution on everyday devices such as smartphones.
  • β€”No meaningful head start for this clinical scope β€” MedGemma 1.5 4B's medical pre-training reflects hospital-grade diagnostics (chest X-ray, 3D radiology, whole slide pathology, dermoscopy, ophthalmology). Conditions such as cutaneous leishmaniasis, severe dengue, Chagas disease, and Oropouche fever in children are not present in that training distribution. Both models require targeted fine-tuning for this scope; given that, Gemma 4's newer architecture with native reasoning and mobile optimisation is the stronger foundation.

Training Dynamics

[image]

[image]


πŸ—ΊοΈ Roadmap

VersionScope
βœ… v0.1Pipeline validation using MedMCQA pediatric subset
v0.2Fine-tuning on Spanish-language Latin American clinical datasets (e.g. PeruMedQA as an Andean starting point) + expansion toward pan-regional tropical and endemic pediatric disease coverage + first accuracy benchmarks on smartphone inference
v0.3Expanded clinical coverage + clinical expert review of outputs
v0.4Quantized GGUF export for llama.cpp / mobile deployment
v1.0Red-teaming, safety evaluation, and independent clinical validation

πŸ“„ Full Documentation

Full technical documentation, project background, international context, and references are available in the GitHub repository:

  • β€”`TECHNICAL.md` β€” dataset rationale, architecture decision, training details, usage
  • β€”`BACKGROUND.md` β€” project vision, SDG alignment, PAHO/WHO/ICRC institutional context, full references

βš–οΈ License

Released under the Apache 2.0 License, subject to the terms of the Gemma 4 base model license.


πŸ™ Acknowledgements

  • β€”Unsloth β€” for the fine-tuning framework and Unsloth Studio
  • β€”MedMCQA β€” for the open medical QA dataset
  • β€”Google DeepMind β€” for the Gemma 4 model family