Severity-Aware Weighted Loss for Arabic Medical Text Generation
Organizations: October University for Modern Sciences & Arts, Egypt
Abstract
Large language models have shown strong potential for Arabic medical text generation; however, traditional fine-tuning objectives treat all medical cases uniformly, ignoring differences in clinical severity. This limitation is particularly critical in healthcare settings, where errors in severe cases contain higher clinical risk. In this work, we propose a severity-aware weighted loss for fine-tuning Arabic language models on medical complaint-response data. The method depends on soft severity probabilities to dynamically scale token-level loss contributions during optimization, thereby prioritizing clinically critical interactions without modifying model architectures. Experiments are conducted using the MAQA dataset, which provides Arabic medical complaints and trusted human responses. Severity labels and probabilistic scores are automatically derived using a fine-tuned AraBERT-based classifier and incorporated exclusively at the loss level. The proposed approach is evaluated across ten Arabic large language models of varying architectures and parameter scales. While standard cross-entropy fine-tuning yields only modest improvements, severity-aware optimization consistently achieves larger gains. Using a balanced weighting configuration, performance improves from 54.04% to 66.14% for AraGPT2-Base, from 59.16% to 67.18% for AraGPT2-Medium, and from 57.83% to 66.86% for Qwen2.5-0.5B, with peak performance reaching 67.18%. Overall, severity-aware fine-tuning delivers improvements of up to 12.10% over non-fine-tuned baselines, demonstrating robust and architecture-consistent gains.
Figures & tables
| Question | Answer | Severity | Non-Critical | Neutral | Critical |
|---|---|---|---|---|---|
| ورم في الرقبة كيف أتعامل معه هل يستدعي جراحة | على حسب مكانه ونوعه، راجع طبيب أورام | حرج | 32% | 32% | 36% |
| A neck lump, how should I deal with it? Does it require surgery? | It depends on its location and type; consult an oncologist. | Critical | 32% | 32% | 36% |
| أعاني من انتفاخ الخد نتيجة تورم اللثة بسبب تسوس الأسنان الأمامية | يحتاج الأمر إلى مضاد حيوي وعلاج عصب | غير حرج | 37% | 35% | 28% |
| I suffer from cheek swelling due to gum inflammation caused by front tooth decay. | The condition requires antibiotic treatment and a root canal procedure. | Non-Critical | 37% | 35% | 28% |
| هل الكركم يساهم في ارتفاع ضغط الدم وما هي فوائده وكيفية استعماله | على العكس، كما هو معروف، يساعد على خفض الضغط | متوسط | 35% | 36% | 29% |
| Does turmeric contribute to high blood pressure? What are its benefits and how is it used? | On the contrary, it helps lower blood pressure. | Neutral | 35% | 36% | 29% |
| Model | Base | Cross-Entropy | SA (Mild) | SA (Strong) | SA (Balanced) |
|---|---|---|---|---|---|
| AraGPT2-Base | 54.04% | 59.71% | 59.75% | 65.91% | 66.14% |
| AraGPT2-Medium | 59.16% | 60.14% | 60.48% | 60.55% | 67.18% |
| Bloomz-560M | 63.59% | 63.65% | 63.91% | 63.79% | 65.52% |
| Al-Atlas-0.5B | 61.03% | 61.52% | 62.03% | 65.02% | 66.83% |
| GPT2-Small-Arabic | 56.40% | 58.88% | 62.01% | 60.92% | 63.06% |
| LFM2-350M | 63.34% | 63.72% | 65.24% | 64.08% | 66.60% |
Medical LLMs
Medical large language models are AI systems adapted to clinical and biomedical data for health reasoning, information extraction, and communication.
See all 384 papers