pai1-medgemma-4b / README.md
emmafar's picture
model card
0a51d66 verified
|
Raw
History Blame Contribute Delete
6.14 kB
metadata
license: other
license_name: health-ai-developer-foundations
license_link: https://developers.google.com/health-ai-developer-foundations/terms
base_model: google/medgemma-4b-it
pipeline_tag: image-text-to-text
library_name: transformers
language:
  - th
  - en
tags:
  - medical
  - pharmacy
  - thai
  - medgemma
  - gemma3
  - lora
  - rag
extra_gated_prompt: >-
  You must read and accept the Access Agreement before downloading. This model
  is not a medical device and must be operated under the supervision of a
  licensed pharmacist. By accepting, you acknowledge that: (1) it is not for
  diagnosis or treatment and all output must be reviewed by a licensed
  pharmacist; (2) part of the drug knowledge base is AI-generated and not yet
  pharmacist-reviewed, so it may contain inaccuracies; (3) you accept the risk
  and responsibility of your own use, and the developer accepts no liability for
  resulting harm; (4) you are bound by the HAI-DEF Terms
  (https://developers.google.com/health-ai-developer-foundations/terms); (5)
  clinical use on real patients without a supervising pharmacist or physician is
  prohibited.
extra_gated_fields:
  I acknowledge this is not a medical device and requires licensed-pharmacist supervision: checkbox
  I accept the risk and the HAI-DEF Terms: checkbox
  Organization / User: text

pai1-medgemma-4b β€” Thai Pharmacy Assistant (RAG, standard tier)

⚠️ This model MUST be used with RAG + the Knowledge Base

Read before use

This model is not a self-contained drug knowledge store. If it is served on its own and queried directly without retrieved context, it will generate inaccurate drug information. For every query you must retrieve real drug facts from the knowledge base (icdevelop/thai-pharma-kb) and inject them into the prompt. See rag_example.py.

Usage Lookup (brand/route/interaction) Deliberation
Model alone (no RAG) 33.0% β€”
+ RAG (required) 55.0% 37.5%
previous release (v1.3) + RAG 52.0% 22.5%
base-4b + RAG (not usable) 40.5% β€”

What's new in this version: a +15-point jump in deliberation (22.5% β†’ 37.5%) β€” the model now reasons like a clinician (rules out a drug contraindicated for the patient, recommends a safe alternative, asks for history when information is insufficient) instead of reciting the retrieved record. Lookup+RAG also improved (52% β†’ 55%). Trade-off: standalone no-RAG recall dropped (42% β†’ 33%), acceptable because this model must always be used with RAG.

DRAFT card β€” pharmacist and legal review required before public release. The KB is not yet pharmacist-reviewed.

A Thai community-pharmacy assistant (4B) fine-tuned from google/medgemma-4b-it by I C Develop Co., Ltd. This is the small, fast, economical tier (the larger tier is pai1-medgemma-27b).

Use with RAG only β€” and for the 4B tier, use this fine-tuned model, not the base

Deterministic benchmark results (especially important for 4B):

Usage Lookup Deliberation
This model alone (no RAG) 33.0% β€”
This model + RAG 55.0% 37.5%
base-4b + RAG (reference) 40.5% β€”

Difference from the 27B tier: the base 4B is too small to read retrieved context on its own. This fine-tuned model was trained to use context (RAG-aware) and to deliberate, reaching 55% lookup / 37.5% deliberation with RAG β€” so this model must be used rather than the base 4B.

Not a medical device

  • Not a medical device. All output must be reviewed by a licensed pharmacist before real-world use.
  • Thai community-pharmacy domain only. Image input = medicine boxes / labels / prescriptions; it does not read X-rays or lab films.

How to use (RAG β€” see rag_example.py)

vllm serve icdevelop/pai1-medgemma-4b --dtype bfloat16 --max-model-len 8192 \
    --served-model-name pai --seed 0 --enforce-eager
huggingface-cli download icdevelop/thai-pharma-kb --repo-type dataset

Retrieve real drug facts from the TMT registry / KB and inject them into the prompt on every call (same format as the 27B tier β€” see rag_example.py). The reference block and question are written in Thai, since the model is purpose-built for Thai.

Data provenance & review status

Source Count Status
TMT drug registry (Thai MoPH) 31,034 products Official government data
Ingredient KB 1,918 ingredients AI-generated β€” not yet pharmacist-reviewed (534 flagged for review)

RAG knowledge cutoff (data freshness)

The knowledge available to this model is bounded by the RAG knowledge base, not the model weights.

  • Knowledge base: icdevelop/thai-pharma-kb v16 Β· knowledge cutoff: 2026-07-23
  • TMT drug registry snapshot: 2026-07-20 (Thai MoPH)
  • Ingredient KB generated: up to 2026-07-23

Drugs, brands, supplements, or regulatory changes registered after 2026-07-23 are not reflected. To advance the cutoff, re-pull the TMT registry and rebuild the KB, then update the thai-pharma-kb dataset.

Benchmark

  • thai_pharma_bench_v2 (lookup) β€” 200 held-out cases, ground truth from TMT + KB.
  • deliberation_bench_v1 β€” 120 held-out cases where the obvious/top retrieved drug is contraindicated for the patient's disclosed profile; an LLM judge scores whether the model rules it out and recommends a safe alternative (reasoning, not recitation).

Both deterministic (--enforce-eager, --seed 0).

Limitations & safety

  • Must always be used with RAG. The model alone recalls drug information poorly (33%).
  • 4B < 27B β€” use the 27B tier for tasks requiring higher accuracy.
  • Not a medical device. Requires pharmacist review. The KB is not yet reviewed and may be inaccurate.

License (HAI-DEF)

A Model Derivative of google/medgemma-4b-it under the Health AI Developer Foundations Terms. Redistribution requires: attaching the Terms + the Β§3.2 use restrictions + the NOTICE + a modification notice.

Not a medical device; not for clinical use without a licensed pharmacist. Contact: I C Develop Co., Ltd.