tma1-medgemma-4b / README.md
emmafar's picture
model card: English + gated acknowledgement (Thai kept only where functional)
57a5f9d verified
|
Raw
History Blame Contribute Delete
8.15 kB
---
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
tags: [medical, thai, consumer-health, medgemma, gemma3, image-text-to-text]
language: [th, en]
pipeline_tag: image-text-to-text
extra_gated_heading: "Accept the terms before using TMA-1 (Thai Medical Assistant)"
extra_gated_prompt: |
This model is a DRAFT for internal evaluation. It has NOT been reviewed by physicians or
pharmacists, and its outputs may be inaccurate or outdated. By requesting access you agree that:
(1) You will VERIFY every output against authoritative sources or licensed professionals
(physician / pharmacist) before any real-world use.
(2) You will not use the model's outputs to diagnose, prescribe, or substitute for care by a
licensed professional.
(3) You will not present the model's outputs to others in a way that implies they are a medical
diagnosis or a physician's instruction.
(4) You understand that I C Develop Co., Ltd. accepts no liability for use that violates these
terms.
extra_gated_fields:
I accept all 4 terms above and will verify all information before using it: checkbox
Organization / intended use: text
---
# TMA-1 — Thai Medical Assistant (MedGemma 4B) · v2 (SFT)
A consumer-facing Thai health assistant fine-tuned from `google/medgemma-4b-it`.
Designed to **educate, triage, and refer** — it does not diagnose and never presents itself as a
physician.
> ⚠️ **DRAFT — not yet reviewed by physicians/pharmacists.** For evaluation only.
> Every output must be verified against authoritative sources or licensed professionals before use.
## In scope (what it was trained for)
- General health education, common symptoms, self-care — in natural Thai
- OTC drugs sold in Thailand: deliberating a safe choice for the user's disclosed profile
(pregnancy, current medications, chronic conditions), asking for history before recommending
- Vitamins / dietary supplements: label-level information, and correcting exaggerated claims
(supplements are not disease treatments)
- Home medical devices (blood-pressure monitors, glucose meters, etc.): selection, correct use,
basic reading interpretation
- Safety behaviour: recognizing red flags → refer to hospital / **1669** (Thai emergency line)
immediately · mental-health crisis → hotline **1323**
## Out of scope (the model is trained to decline)
Diagnosis of any kind · prescribing or dosing prescription-only drugs · interpreting labs /
medical images · in-depth mental-health crisis counselling (refers to 1323) · advice that
contradicts a physician's ongoing treatment
## How to use
The model is **image-text-to-text** (Gemma-3 multimodal, same interface as the MedGemma base).
Fine-tuning froze the vision tower and trained text behaviour only — image inputs work through the
base model's capability but were **not evaluated** in this line; do not rely on them for medical
decisions.
**Important: always use the TMA system prompt** — all safety behaviour is anchored to this
persona. The prompt is in Thai by design (the model's operating language):
```
คุณคือผู้ช่วยสุขภาพ AI สำหรับประชาชนในประเทศไทย ให้ความรู้เรื่องสุขภาพทั่วไป ยา วิตามิน อาหารเสริม
และอุปกรณ์การแพทย์ที่ใช้ในบ้าน ตอบเป็นภาษาไทยที่สุภาพ เข้าใจง่าย และถูกต้องตามหลักการแพทย์
คุณไม่ใช่แพทย์ ไม่วินิจฉัยโรค และไม่สั่งหรือปรับขนาดยาที่ต้องมีใบสั่งแพทย์ ซักถามข้อมูลเพิ่มเมื่อจำเป็น
แนะนำให้พบแพทย์หรือเภสัชกรเมื่อควร หากพบสัญญาณอันตรายให้แนะนำไปโรงพยาบาลหรือโทร 1669 ทันที
ปัญหาสุขภาพจิตรุนแรงให้แนะนำสายด่วนสุขภาพจิต 1323 อาหารเสริมและวิตามินไม่ใช่ยารักษาโรค —
ห้ามกล่าวอ้างสรรพคุณเกินจริง และห้ามแนะนำให้หยุดยาที่แพทย์สั่งเอง
```
### vLLM (recommended — same settings used for evaluation)
```bash
vllm serve icdevelop/tma1-medgemma-4b --dtype auto --max-model-len 8192 \
--served-model-name tma --seed 0
```
```python
import openai
client = openai.OpenAI(base_url="http://localhost:8000/v1", api_key="-")
r = client.chat.completions.create(model="tma", temperature=0.0, max_tokens=1024,
messages=[{"role": "system", "content": SYSTEM_PROMPT}, # the Thai prompt above
{"role": "user", "content": "ปวดหัว มีไข้ต่ำๆ กินยาอะไรได้บ้างคะ ตอนนี้ท้อง 4 เดือน"}])
print(r.choices[0].message.content)
```
### Using with RAG (the intended production setting)
The model is designed to work with a retrieval KB (Thai TMT drug registry + curated fact
sheets) — product facts should come from retrieved context, not from the weights. The exact
format used during training and evaluation (markers are Thai by design):
```
[ข้อมูลอ้างอิงจากคลังข้อมูลสุขภาพ — ใช้ข้อมูลนี้เท่านั้น ห้ามเดา]
<retrieved facts>
[คำถาม]
<user question>
```
Without RAG, drug-fact accuracy is poor (see the evaluation table — no-RAG ≈ 45%).
## Precautions (read before use)
1. **Always verify** — every output must be checked against authoritative sources or a licensed
professional before acting on it or passing it on.
2. **Not a diagnostic or treatment tool**, and not a substitute for a physician or pharmacist.
3. **In an emergency do not wait for a model reply** — call **1669** (Thai EMS); mental-health
crisis → **1323**.
4. **Knowledge cutoff July 2026** (a property of the KB); drug registrations and products change.
5. Measured open gaps: multi-candidate drug deliberation (39.2%) and drug–drug interactions
(≤27%) — **do not use it to answer drug-interaction questions without pharmacist review**.
6. Supplement/device fact sheets are curated content, not official Thai FDA registry data yet.
## Evaluation (pass = LLM judge + deterministic hard checks; vLLM seed 0, enforce-eager)
| Axis | Cases | base 4B | **TMA-1 v2 (SFT)** |
|---|---|---|---|
| knowledge (no RAG) | 200 | 38.5% | 45.0% |
| knowledge + RAG (production setting) | 200 | 83.5% | 83.5% |
| deliberation (safe choice for the user's profile) | 120 | 2.5% | 39.2% |
| safety/referral (red flags · no diagnosis · Rx boundary · crisis · over-claims) | 120 | 75.8% | 96.7% |
Full methodology and campaign log (including two negative DPO results) live in the internal
`training-tools` repo (`model-assets/tma/tma1/`).
## Training
SFT (LoRA) from `google/medgemma-4b-it` on ~11.8k Thai behaviour dialogues: consumer
deliberation (take history → rule out contraindicated options with reasons → recommend a safe
one), safety/referral (red flags, crisis → 1323, Rx boundary, over-claim correction), home
medical devices (fact-sheet grounded), supplements, and a general-medical anti-forgetting mix.
Every set passed a behaviour verifier and was decontaminated against all benchmarks
(token overlap ≥ 0.55).
## License / developer
Base: MedGemma — Health AI Developer Foundations terms. Fine-tuned by I C Develop Co., Ltd.
Questions / issues: HF discussions on this repo.