SAHAYAK-TB โ€” Fine-tuned Gemma 4 E2B for TB Dropout Risk Assessment

What This Model Does

Takes natural-language multi-visit notes from a DOTS (Directly Observed Treatment) provider and outputs a structured JSON risk assessment for TB treatment adherence dropout.

Input: 2-4 visit notes in English, Hindi, or mixed (as DOTS providers actually write)

Output: JSON with dropout risk tier (low/moderate/high/critical), evidence-cited risk factors with published odds ratios and PMIDs, and NTEP protocol action recommendations.

Key Specs

Base model Gemma 4 E2B-it
Fine-tuning QLoRA (r=16, alpha=16, all-linear) via Unsloth
Training data 500 synthetic cases from 15 published TB adherence risk factors
Quantization Q4_K_M (3.43 GB) for CPU inference
Accuracy 90% tier accuracy with post-processing pipeline
Schema compliance 100% (constrained JSON output)
Inference CPU-only via llama-cpp-python, 24-88 seconds

Usage with llama-cpp-python

from llama_cpp import Llama

llm = Llama.from_pretrained(
    repo_id="Roopalgn/sahayak-tb-gemma4-e2b-gguf",
    filename="gemma-4-e2b-it.Q4_K_M.gguf",
    n_ctx=4096,
    n_gpu_layers=0,
)

response = llm.create_chat_completion(
    messages=[
        {"role": "system", "content": SYSTEM_PROMPT},
        {"role": "user", "content": visit_notes},
    ],
    response_format={"type": "json_object", "schema": RISK_SCHEMA},
    temperature=0.0,
)

See full system prompt and schema at: github.com/Roopalgn/gemma4good

Live Demo

huggingface.co/spaces/Roopalgn/sahayak-tb-demo

Training Details

  • Platform: Kaggle T4 GPU (free tier, $0 cost)
  • Training time: 33 minutes
  • Loss: 3.04 to 0.0115
  • Method: SFT with train_on_responses_only

Data Sources

15 risk factors with published odds ratios from Indian TB cohort studies:

  • Santha et al. 2002 (PMID 12234133)
  • Vijay et al. 2010 (PMID 20386611)
  • Kumar et al. 2024 (PMID 39067959)
  • WHO Treatment of TB Guidelines (4th ed.)

No patient-identifiable data used. Fully synthetic training data.

License

CC-BY 4.0

Built for

Gemma 4 Good Hackathon โ€” Health & Sciences track + llama.cpp Prize

Downloads last month
943
GGUF
Model size
5B params
Architecture
gemma4
Hardware compatibility
Log In to add your hardware

4-bit

16-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Space using Roopalgn/sahayak-tb-gemma4-e2b-gguf 1