CoolFace
Modelpublic

y0sif/GutWise

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

GutWise — IBS Education Assistant (LoRA adapter)

A QLoRA adapter for `unsloth/gemma-4-E4B-it`, fine-tuned on 659 audited Irritable Bowel Syndrome Q&A pairs grounded in Rome IV, ACG 2021, NICE CG61, BSG 2021, StatPearls, NHS, and MedlinePlus.

Built for the Kaggle Gemma 4 Good Hackathon (Health & Sciences track).

Educational only — not medical advice, not a diagnostic tool. Red-flag symptoms (rectal bleeding, unintentional weight loss, fever, nocturnal symptoms, onset after age 50, family history of colorectal cancer or IBD) require evaluation by a clinician.

Quick start

python
from peft import PeftModel
from transformers import AutoModelForImageTextToText, AutoTokenizer
import torch

base_id = "unsloth/gemma-4-E4B-it"
adapter_id = "y0sif/GutWise"

tok = AutoTokenizer.from_pretrained(base_id)
base = AutoModelForImageTextToText.from_pretrained(
    base_id, torch_dtype=torch.bfloat16, device_map="auto"
)
model = PeftModel.from_pretrained(base, adapter_id)
device = next(model.parameters()).device  # robust on PeftModel; model.device can be unreliable

messages = [
    {"role": "system", "content": "You are GutWise, an IBS health education assistant. ..."},
    {"role": "user", "content": "What is the low-FODMAP diet?"},
]
prompt = tok.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
batch = tok(prompt, return_tensors="pt").to(device)
out = model.generate(
    **batch,
    max_new_tokens=512,
    do_sample=True,
    temperature=0.7,
    top_p=0.9,
    pad_token_id=tok.eos_token_id,
)
print(tok.decode(out[0, batch["input_ids"].shape[-1]:], skip_special_tokens=True))

Eval results (v2, 3-run mean ± σ)

MetricBaseline E4B**GutWise**Δ
Overall4.6964.769 ± 0.028+0.073
Accuracy4.784.78 ± 0.020
Safety4.944.93 ± 0.04≈ 0
Empathy4.364.47 ± 0.08+0.11
Scope4.964.99 ± 0.01+0.03
Completeness4.444.67 ± 0.04+0.23
Red-flag handling4/44/4 all 3 runssafety preserved
Wins vs baseline (B/A/tie, avg)—27 / 13 / 10—

Per-category gains: redflag +0.22, safetyrefusal +0.19, doctorfollowup +0.13. Single regression: mythbusting −0.08 (within σ).

Eval protocol: 50 held-out IBS questions × 3 seeds (42/43/44) = 150 paired prompts, judged side-by-side with the baseline in a single Haiku judge batch (no judge-calibration drift). Full numbers in the GitHub repo.

Training recipe

FieldValue
Base modelunsloth/gemma-4-E4B-it (4-bit)
AdapterLoRA, r=8, α=16, dropout=0, 7 target modules
LR / schedule5e-5 cosine, warmup_ratio=0.05
Effective batch32 (4 × 8 accum)
Epochs1
Precisionbf16
Sequence length1024
PackingFalse
Completion-only lossFalse (Unsloth VLM constraint)
NEFTuneDisabled (L4 OOM)
HardwareColab A100
Dataset size659 audited IBS Q&A pairs
Training data`y0sif/GutWise-IBS-QA` (train split)

Intended use

  • —IBS education for patients and curious lay readers
  • —Demonstrating that small medical fine-tunes can ship safely with disciplined methodology

Out of scope

  • —Diagnosis, prescribing, dosing
  • —Pediatric IBS (criteria differ)
  • —Non-English use
  • —Any clinical decision-making

Known limitations

  • —Some hallucinations are inherited from base Gemma 4 (e.g., the "L. rhamnosus GC69" pattern — canonical strain is GG). v3 anti-hallucination pairs are planned.
  • —One category, myth_busting, regressed slightly (−0.08, within σ); v3 adds targeted training pairs.
  • —Held-out eval is 50 questions across 6 categories — a vibe check rather than a clinical trial. Earlier notes flagged eval_049/eval_050 as duplicate red-flag prompts, but they cover distinct red flags (family-history vs. fever + nocturnal symptoms).

Sources

  • —Rome IV Criteria
  • —ACG Clinical Guideline 2021 (Lacy et al.)
  • —NICE CG61 (Open Government Licence v3.0)
  • —BSG Guidelines on IBS 2021
  • —StatPearls (CC-BY 4.0)
  • —NHS IBS pages (OGL v3.0)
  • —MedlinePlus (Public Domain)
  • —24 open-access PubMed abstracts

Citation

@misc{gutwise2026,
  author       = {y0sif},
  title        = {GutWise — IBS Education Assistant on Gemma 4 E4B},
  year         = {2026},
  howpublished = {Hugging Face Hub},
  url          = {https://huggingface.co/y0sif/GutWise}
}

License

Apache-2.0