Downloads · 30 days
506
100% of all-time downloads
ningpy/redflag-denied-3b
redflag-denied-3b is a text generation model from ningpy. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as apache-2.0.
Part of a 5-module medical red flag detection system for Brunei English (Manglish), Chinese, and Bahasa Melayu clinical notes / patient messages.
Downloads · 30 days
506
100% of all-time downloads
All-time downloads
506
Public
Parameters
3.1B
12.4 GB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors6.2 GB · 100%
From the Hugging Face model README
denied module (Qwen2.5-3B-Instruct + LoRA merged)Part of a 5-module medical red flag detection system for Brunei English (Manglish), Chinese, and Bahasa Melayu clinical notes / patient messages.
This model is the denied extraction module — one of 5 specialized modules used
together with a Python rule engine (V20 spec, 59 rules).
peiyan-ning/redflag-symptom-3b — 83-symptom multi-label extractionpeiyan-ning/redflag-context-3b — 12 context flags (post_trauma, drowning, etc.)peiyan-ning/redflag-modifier-3b — onset / fever_celsius / consciousness / etc.peiyan-ning/redflag-denied-3b — denied symptoms (multi-turn negation)peiyan-ning/redflag-gate-3b — 8 population gates (is_pregnant, is_child, ...)Full 5-module pipeline + rule engine V46:
| Metric | P | R | F1 | Acc |
|---|---|---|---|---|
| PRIMARY (any_matched × labeled_matched) | 0.902 | 0.911 | 0.906 | 91.9% |
| STRICT matched-only | 0.893 | 0.828 | 0.859 | 91.8% |
| STRICT m+s | 0.844 | 0.905 | 0.873 | 92.1% |
Extract symptoms user EXPLICITLY denies or negates.
===== EXTRACT WHEN text has negation =====
- "no X" / "without X" / "denies X" / "hasn't had X" / "not X"
- "但没有 X" / "没有 X"
- "tiada X" / "tidak ada X"
===== EXAMPLES =====
"chest pain but no shortness of breath" → {"denied_symptoms": ["breathlessness"]}
"headache without vomiting or vision change" → {"denied_symptoms": ["vomiting", "vision_change"]}
"fever without rash" → {"denied_symptoms": ["rash"]}
"just tired, no chest pain, no dizziness" → {"denied_symptoms": ["chest_pain", "dizziness"]}
"only headache" → {"denied_symptoms": []} # not explicit denial
Only include SYMPTOMS the user actively denies. Not just symptoms not mentioned.
===== SYMPTOM SET (closed, 83 tokens) — same as extractor =====
Output: {"denied_symptoms": [...]}
===== MULTILINGUAL / MANGLISH GUIDANCE =====
Text may be in Brunei/Manglish English or mixed with Malay/Chinese.
Ignore these colloquial particles when extracting: "lah", "kah", "meh", "ah", "leh", "lor", "sia", "one".
Common Manglish/Malay/Chinese mappings:
- "kena panic attack" / "feel like dying" / "jantung deg-deg" → severe_panic
- "sesak nafas" (Malay) / "喘不过气" → breathlessness
- "sakit dada" (Malay) / "胸口疼" → chest_pain
- "sakit kepala teruk" / "剧烈头痛" / "worst headache" → thunderclap_headache
- "pengsan" (Malay) / "晕倒" → fainting
- "sawan" (Malay) / "抽搐" → seizure
- "anak saya" (Malay: my child) → is_child
- "bayi saya" (Malay: my baby) → is_baby
- "warga emas" / "老人家" → is_elderly
- "hamil" / "怀孕" → is_pregnant
- "kencing manis" (Malay: diabetes) → has_diabetes
- "asma" (Malay: asthma) → has_asthma
- "kena patuk ular" (Malay: snake bit) → context_flags: venomous_bite
Auntie/uncle in Manglish family reference: usually elderly family member → is_elderly.
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch, json
tok = AutoTokenizer.from_pretrained('peiyan-ning/redflag-denied-3b')
model = AutoModelForCausalLM.from_pretrained(
'peiyan-ning/redflag-denied-3b',
torch_dtype=torch.float16,
device_map='auto'
)
SYSTEM_PROMPT = tok.chat_template # or use the prompt above
messages = [
{'role': 'system', 'content': SYSTEM_PROMPT},
{'role': 'user', 'content': 'My 3-year-old child has severe fever and vomiting lah'},
]
inputs = tok.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors='pt').to(model.device)
out = model.generate(inputs, max_new_tokens=200, do_sample=False)
text = tok.decode(out[0][inputs.shape[1]:], skip_special_tokens=True)
result = json.loads(text)
print(result)
See git.evyd.tech/ai/redflag-detection-2.0 for: