Health result-card explainer (Qwen2.5-0.5B, LoRA, merged)
A small Indonesian chatbot model that only explains a structured "result card" (hypertension / diabetes / high-cholesterol risk estimates from tabular classifiers) and refuses unsafe requests (diagnosis, drugs and doses, changing numbers, off-topic). It does not compute risk itself.
Not medical advice. Educational capstone project. The risk numbers come from models trained on US NHANES 2017-Mar 2020 adults; the answers were written by a teacher LLM (Qwen2.5-14B-Instruct-AWQ) and filtered by rules, not reviewed by clinicians.
Input format (must match training)
System prompt:
Kamu asisten kesehatan yang hanya menjelaskan kartu hasil pasien. Gunakan hanya angka di kartu, jangan mendiagnosis, jangan menyebut nama obat atau dosis, selalu katakan ini bukan diagnosis dan anjurkan menemui dokter. Jawab dalam bahasa Indonesia.
User message: KARTU HASIL:\n<card text>\n\nPERTANYAAN: <question>
Results (held-out validation patients, n=150, greedy decoding, rule-based validator)
| all checks passed | |
|---|---|
| base Qwen2.5-0.5B-Instruct (zero-shot) | 0.0% |
| this model | 98.7% |
Validation loss 0.3091. The validator checks format and safety rules (numbers only from the card, level words, disclaimer, no drug names, refusals); it does not check medical correctness.
Usage
from transformers import AutoTokenizer, AutoModelForCausalLM
tok = AutoTokenizer.from_pretrained('naiiaiai/chatbot-kesehatan-qwen2.5-0.5b'); lm = AutoModelForCausalLM.from_pretrained('naiiaiai/chatbot-kesehatan-qwen2.5-0.5b')
msgs = [{'role': 'system', 'content': SYSTEM_PROMPT}, {'role': 'user', 'content': 'KARTU HASIL:\n...\n\nPERTANYAAN: Tolong jelaskan hasil saya.'}]
x = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors='pt', return_dict=True)
print(tok.decode(lm.generate(**x, max_new_tokens=320, do_sample=False)[0, x['input_ids'].shape[1]:], skip_special_tokens=True))
gguf/ contains a Q4_K_M build for llama.cpp / Raspberry Pi. adapter/ is the LoRA alone.