Gemma 4 Clinical Pharmacologist & SaMD Report Summarizer (v2)

License Base Model Library Domain

An on-device, Software as a Medical Device (SaMD) aligned clinical pharmacology inference provider and diagnostic report summarizer. This model is a Parameter-Efficient Fine-Tuning (LoRA) adapter trained on top of Google Gemma-4-E2B-IT, designed to assist doctors, clinical pharmacists, and Primary Health Centre (PHC) healthcare professionals.


🏥 Key Clinical Capabilities

  1. Clinical Pharmacology & Drug-Drug Interaction (DDI) Screening:
    • Analyzes multi-drug prescription regimens for pharmacokinetic (CYP450 3A4, 2C9, 2D6, P-glycoprotein) and pharmacodynamic interactions.
    • Highlights contraindications, narrow therapeutic index (NTI) warnings, and black-box alerts.
  2. Organ Clearance & Dosage Titration:
    • Organ-specific dosing adjustments based on renal function (eGFR < 15, 15–29, 30–59, ≥ 60 mL/min/1.73m²).
    • Hepatic impairment dosing rules (Child-Pugh Class A/B/C).
    • Pediatric weight-based (mg/kg/day) and geriatric safety adjustments.
    • Pregnancy (trimester-specific) and lactation safety stratification.
  3. Diagnostic Lab Report Summarization:
    • Ingests structured or OCR text of Complete Blood Counts (CBC), Liver Function Tests (LFT), Renal Function Tests (RFT/KFT), Glycemic panels (HbA1c/BSF), and Lipid profiles.
    • Identifies critical panic values, calculates clinical patterns (e.g. hemoconcentration with thrombocytopenia in Dengue, drug-induced liver injury, NSAID + ACEI acute kidney injury), and produces structured recommendations.
  4. Primary Health Centre (PHC) Clinical Triage:
    • Rural healthcare fever protocols, anti-tubercular therapy (ATT) liver monitoring, emergency antidote dosing, and hospital referral red flags.

🚀 Quick Start & Inference

You can run inference using Hugging Face transformers and peft:

import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

base_model_id = "google/gemma-4-E2B-it"
adapter_id = "sandeshv12/gemma4pharma"

# 1. Load Tokenizer
tokenizer = AutoTokenizer.from_pretrained(adapter_id)

# 2. Load Base Model
base_model = AutoModelForCausalLM.from_pretrained(
    base_model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto"
)

# 3. Load LoRA Adapter
model = PeftModel.from_pretrained(base_model, adapter_id)
model.eval()

# 4. Formulate Clinical Query
messages = [
    {
        "role": "user",
        "content": (
            "Patient: 65-year-old male with Type 2 Diabetes and CKD Stage 4 (eGFR 22 mL/min/1.73m2).\n"
            "Prescription: Metformin 1000mg BID, Ciprofloxacin 500mg BID, Lisinopril 20mg OD.\n"
            "Task: Identify contraindications, DDI risks, and recommended renal dose adjustments."
        )
    }
]

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

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

response = tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True)
print(response)

🔬 Training Configuration

  • Base Architecture: google/gemma-4-E2B-it
  • Method: QLoRA (4-bit NormalFloat quantization with LoRA adapters)
  • LoRA Hyperparameters:
    • Rank (r): 16
    • Alpha (alpha): 32
    • Dropout: 0.05
    • Target Modules: Linear layers (linear)
  • Training Framework: Hugging Face TRL (SFTTrainer) & PEFT
  • Epochs / Steps: 120 steps with Cosine Learning Rate Schedule
  • Final Training Loss: 5.248

⚖️ Clinical Disclaimer

This model is intended for research, educational, and clinical decision support purposes only. It is not an autonomous diagnostic device. All pharmacological recommendations, dosage titrations, and clinical decisions must be reviewed and verified by a licensed healthcare professional or clinical pharmacologist.

Downloads last month
19
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for sandeshv12/gemma4pharma

Adapter
(190)
this model