HyperAIHyperAI

Command Palette

Search for a command to run...

ميدي إيفال: معيار طبي موحد للاستدلال السياقي للمريض والمعرفي في النماذج اللغوية الكبيرة

Zhan Qu Michael Färber

الملخص

تُستخدم النماذج اللغوية الكبيرة (LLMs) بشكل متزايد في الطب، إلا أن اعتمادها محدود بسبب مخاوف تتعلق بالموثوقية والسلامة. التقييمات الحالية إما تختبر المعرفة الطبية الواقعية في عزلة أو تقيم الاستدلال على مستوى المريض دون التحقق من الصحة، مما يترك فجوة حرجة. نقدم ميدي إيفال، وهو معيار يربط السجلات الصحية الإلكترونية (EHRs) من قاعدة بيانات MIMIC-IV بقاعدة معرفية موحدة مبنية من UMLS ومفردات طبية حيوية أخرى. يولّد ميدي إيفال عبارات طبية متنوعة واقعية ومضادة للوقائع ضمن سياقات مرضى حقيقية، مما يتيح تقييماً منهجياً عبر إطار رباعي الأرباع يجمع بين التأسيس المعرفي والاتساق السياقي. باستخدام هذا الإطار، نحدد أنماط فشل حرجة، بما في ذلك الدعم المهلوس وانعكاس الحقيقة، التي تُظهرها النماذج الحالية المملوكة ومفتوحة المصدر والخاصة بالمجال بشكل متكرر. لمعالجة هذه المخاطر، نقترح الضبط الدقيق المراعي للمخاطر المضادة للوقائع (CoRFu)، وهي طريقة قائمة على DPO مع عقوبة غير متماثلة تستهدف الالتباسات غير الآمنة. يحسّن CoRFu بمقدار +16.4 نقطة في ماكرو-F1 مقارنة بالنموذج الأساسي ويقضي على أخطاء انعكاس الحقيقة، مما يُظهر دقة أعلى وسلامة أكبر بشكل كبير.

One-sentence Summary

Researchers from TU Dresden and ScaDS.AI propose MediEval, a benchmark linking MIMIC-IV EHRs to a UMLS-based knowledge base to jointly assess factual and counterfactual reasoning across a 4-quadrant4\text{-quadrant}4-quadrant framework, and introduce Counterfactual Risk-Aware Finetuning (CoRFu), a DPO-based\text{DPO-based}DPO-based method with asymmetric penalties that eliminates truth inversion, improving macro-F1\text{macro-F1}macro-F1 by +16.4+16.4+16.4 points over the base model.

Key Contributions

  • Introduces MediEval, a benchmark linking MIMIC-IV electronic health records to a unified knowledge base from UMLS and other biomedical vocabularies, generating factual and counterfactual statements within real patient contexts for evaluation across a 4-quadrant framework that jointly considers knowledge grounding and contextual consistency.

  • Cross-model evaluation of proprietary, open-source, and biomedical LLMs under identical settings reveals systematic quadrant-level weaknesses and safety-critical error patterns, including hallucinated support and truth inversion, which aggregate accuracy metrics fail to capture.

  • Proposes Counterfactual Risk-Aware Fine-tuning (CoRFu), a DPO-based method with an asymmetric penalty targeting unsafe confusions, improving macro-F1 by +16.4 points over the base model and eliminating truth inversion errors, demonstrating higher accuracy and substantially greater safety.

Introduction

Large language models are increasingly applied to high-stakes clinical tasks, including summarizing electronic health records, generating discharge instructions, and providing decision support, where errors can directly translate into patient harm. However, a critical gap persists: models can recall isolated medical facts (for example, that metformin is contraindicated in severe renal impairment) yet fail to apply that knowledge when the fact appears within the noisy, heterogeneous context of an actual patient record. Prior evaluation work only partially addresses this problem. EHR-based benchmarks often reduce tasks to retrieval or serialization without verifying medical soundness, while knowledge-based evaluations test logical transformations of facts but do not connect reasoning to real patient contexts.

To close this gap, the authors introduce MediEval, a benchmark and evaluation framework that links real patient records from MIMIC-IV with a unified biomedical knowledge base built from UMLS, SNOMED CT, and RxNorm. MediEval constructs evaluation statements through graph-guided substitutions and recombinations within ontologies, with plausibility checks ensuring true cases remain clinically valid while false cases are realistic. Each statement is embedded in real patient contexts, enabling quadrant-level reasoning defined as True or False with respect to medical knowledge and Supported or Unsupported with respect to the patient record. The authors also propose two new safety-focused metrics, Hallucinated Support Rate (HSR) and Truth Inversion Rate (TIR), revealing consistent weaknesses across proprietary, open-source, and biomedical LLMs. To mitigate these risks, they introduce Counterfactual Risk-Aware Fine-tuning (CoRFu), a DPO-based method that uses quadrant-structured preference pairs and an asymmetric penalty to steer models toward True and Supported responses while penalizing safety-critical confusions such as False and Supported.

Dataset

The authors construct MediEval, a benchmark for clinical inference, from two primary sources: the MIMIC-IV database (v3.1) and the UMLS biomedical ontology.

  • Dataset composition and sources: MediEval integrates structured EHR data (diagnoses, procedures, medications recorded with ICD and NDC codes) with unstructured discharge summaries (each with about 22 sections). It also uses UMLS to map codes and relations across systems.

  • Construction pipeline:

    • Context extraction: For each hospital admission, a subset of discharge summary sections is selected covering diagnoses, procedures, treatments, medical history, and hospital course. This forms the evaluation context.
    • Semantic normalization: Raw medical codes (ICD, NDC) are mapped to UMLS Concept Unique Identifiers (CUIs), aligning diagnoses, procedures, and medications into a unified semantic space.
    • Ontology graph: A graph is built where vertices are CUIs and edges are UMLS relations (e.g., treated_by, has_associated_procedure, is_a). Multi-hop paths up to length 3 are allowed to capture indirect clinical associations.
    • Statement generation: For each fact (h, r, t), four quadrant samples are created: Q1 (true-supported), Q2 (true-unsupported), Q3 (false-supported), and Q4 (false-unsupported). These are generated by ontology-guided substitutions, recombinations, and plausibility checks.
  • Final dataset statistics: The dataset contains 2,015 unique hospital admissions (one admission per patient to prevent leakage), 8,350 medical statements, and 37,144 samples. Context length ranges from 340 to 2,827 tokens.

  • Usage in the paper: The dataset is split into training, validation, and test sets at an 80/10/10 ratio, balanced across the four quadrants. The authors use the training split to train LLMs on the context–statement pairs, and the test set (with 200 human-annotated samples) to evaluate factual reliability and context adherence.

Method

The authors propose MediEval, a comprehensive framework designed to evaluate the clinical inference capabilities of large language models (LLMs). The framework integrates structured Electronic Health Records (EHRs), unstructured clinical notes, and biomedical ontologies to create a unified dataset for assessing factual correctness and contextual grounding.

MediEval Framework: Data Construction

The data construction pipeline begins with the MIMIC-IV database, utilizing two distinct modalities: structured tabular data (diagnoses, procedures, and medications coded with ICD and NDC standards) and unstructured discharge summaries containing approximately 22 clinical sections. For each patient admission aaa, the framework defines a structured event set SaS_aSa​ and a discharge summary section set DSaDS_aDSa​.

The process involves several key steps to transform raw EHR data into a reasoning benchmark. First, Context Extraction selects specific discharge summary sections that best capture the patient's trajectory, such as the Brief Hospital Course and History of Present Illness, to form the evaluation context Ca\mathcal{C}_aCa​. Second, Semantic Normalization maps heterogeneous medical codes into a unified semantic space using the Unified Medical Language System (UMLS). Raw codes zzz are converted into Concept Unique Identifiers (CUIs) via a function fff, resulting in a normalized set Ua={f(z)∣z∈Sa}U_a = \{f(z) \mid z \in S_a\}Ua​={f(z)∣z∈Sa​}.

Refer to the framework diagram for an overview of the data processing pipeline.

Third, an Ontology Graph Construction step builds a semantic graph G=(V,E)G = (V, E)G=(V,E) where nodes are CUIs and edges represent relations from the UMLS Metathesaurus (e.g., treated_by, has_associated_procedure). The graph supports multi-hop inference, allowing the system to traverse paths of length at most three to capture indirect clinical associations. For concepts hhh and ttt, relations are defined as R(h,t)={r∣(h,r,t)∈G,d(h,t)≤3}R(h, t) = \{r \mid (h, r, t) \in G, d(h, t) \leq 3\}R(h,t)={r∣(h,r,t)∈G,d(h,t)≤3}.

Finally, Quadrant-based Statement Construction generates samples based on factual relations (h,r,t)(h, r, t)(h,r,t) found in the graph. The framework creates four distinct quadrants to test different failure modes:

  • Q1 (True–Supported): A fact directly attested in the patient context.
  • Q2 (True–Unsupported): A medically correct statement where an entity is replaced with a related alternative from the ontology graph that is absent from the patient context.
  • Q3 (False–Supported): A false relation created by recombining entities that are all present in the context.
  • Q4 (False–Unsupported): A statement involving a semantically distant distractor entity, making it both false and unsupported.

An example of a Q2 statement is provided below.

LLM Evaluation and Training

The evaluation task is formulated as a four-way Natural Language Inference (NLI) problem, where the model must classify a statement into one of the four quadrants. To measure clinical safety, the authors introduce Critical Error Rates, specifically the Hallucinated Support Rate (HSR) and Truth Inversion Rate (TIR), which quantify the model's tendency to hallucinate evidence for true statements or elevate false statements to valid evidence.

To improve model performance on these safety-critical tasks, the authors propose CoRFu (Counterfactual Risk-Aware Fine-Tuning). Unlike standard supervised fine-tuning, CoRFu utilizes a contrastive preference learning approach. Training is performed on preference triplets (c,yw,yl)(c, y_w, y_l)(c,yw​,yl​), where ccc is the clinical context, ywy_wyw​ is a preferred (supported) statement, and yly_lyl​ is a dispreferred statement from the counterfactual quadrants.

The CoRFu loss function augments the standard Direct Preference Optimization (DPO) objective with an asymmetric penalty. Let S(c;yw,yl)S(c; y_w, y_l)S(c;yw​,yl​) be the DPO preference margin. The loss is defined as:

LCoRFu=−E[log⁡σ(S)]+λ⋅E[I(S<0)⋅S2].\mathcal{L}_{\mathrm{CoRFu}} = - \mathbb{E} \big [ \log \sigma (S) \big ] + \lambda \cdot \mathbb{E} \big [ \mathbb{I} (S < 0) \cdot S ^ {2} \big ].LCoRFu​=−E[logσ(S)]+λ⋅E[I(S<0)⋅S2].

The first term encourages the model to prefer the supported statement. The second term introduces a quadratic penalty that activates only when the model incorrectly ranks the dispreferred statement higher (S<0S < 0S<0). This scaling disproportionately punishes high-confidence mistakes, aligning the optimization pressure with clinical safety requirements.

Experiment

The MediEval framework evaluates LLMs on a four-way NLI task that jointly judges factual correctness and patient grounding, using metrics for accuracy, macro-F1, and safety-critical error rates (HSR and TIR) on a MIMIC-IV derived dataset of 37,144 samples. Benchmarking across 15 LLMs showed limited overall performance (accuracy 59.3% to 73.9%), with domain-specific models underperforming and safety metrics often diverging from aggregate F1, as Llama-3.3-70B achieved the best macro-F1 but not the lowest error rates. Contrastive preference optimization (CoRFu) consistently outperformed SFT and DPO baselines, with the Q1 vs. Q2 pairing delivering the strongest gains in accuracy, macro-F1, and reduced hallucinated support, while targeted pairings selectively mitigated specific risks. Ablations confirmed that moderate λ values balanced performance improvements with safety gains, underscoring that disentangling accuracy from safety-critical errors is essential for clinically reliable reasoning.

Overall performance on MediEval is limited, with the strongest model achieving the highest aggregate metrics while not necessarily being the safest. CoRFu improves over base and DPO models, with the supported versus unsupported truth contrastive pairing yielding the most consistent gains across backbones. Safety metrics show that higher macro F1 does not guarantee lower critical error rates, and different contrastive objectives selectively mitigate risks. Llama-3.3-70B-Instruct leads in overall accuracy and F1, but Mixtral-8x7B shows the lowest critical error rates despite lower macro F1. CoRFu with the Q1 vs. Q2 contrastive pairing achieves the largest aggregate improvements and reduces TIR to zero on Llama-3.1-8B. Contrastive pairings yield targeted per-quadrant gains, and improvements in accuracy do not automatically translate into safety-critical error reductions.

Experiments on MediEval show that the strongest model by aggregate metrics is not necessarily the safest, as higher macro F1 does not guarantee lower critical error rates. CoRFu consistently improves over base and DPO models, with the supported versus unsupported truth contrastive pairing yielding the most stable gains, while different contrastive objectives selectively mitigate specific risks. Despite Llama-3.3-70B-Instruct leading in accuracy and F1, Mixtral-8x7B achieves the lowest critical error rates, and the Q1 versus Q2 pairing on Llama-3.1-8B delivers the largest aggregate improvements while eliminating TIR. Overall, contrastive pairings produce targeted per-quadrant gains, and accuracy improvements do not automatically translate into safety-critical error reductions.


بناء الذكاء الاصطناعي بالذكاء الاصطناعي

من الفكرة إلى الإطلاق — سرّع تطوير الذكاء الاصطناعي الخاص بك مع المساعدة البرمجية المجانية بالذكاء الاصطناعي، وبيئة جاهزة للاستخدام، وأفضل أسعار لوحدات معالجة الرسومات.

البرمجة التعاونية باستخدام الذكاء الاصطناعي
وحدات GPU جاهزة للعمل
أفضل الأسعار

HyperAI Newsletters

اشترك في آخر تحديثاتنا
سنرسل لك أحدث التحديثات الأسبوعية إلى بريدك الإلكتروني في الساعة التاسعة من صباح كل يوم اثنين
مدعوم بواسطة MailChimp