Care operations · Research feature

EHRStruct: A Comprehensive Benchmark Framework for Evaluating Large Language Models on Structured Electronic Health Record Tasks

The study introduces EHRStruct, a benchmark framework designed to assess large language models (LLMs) on structured electronic health record tasks.

Adapted from research by Xiao Yang, Xuejiao Zhao, Zhiqi Shen.

arXiv preprint revision · 2026-04-01 · Attribution & reuse
In this article
Editorial illustration of stack of documents.

Editor’s introduction

The study introduces EHRStruct, a benchmark framework designed to assess large language models (LLMs) on structured electronic health record tasks. It includes 11 diverse clinical tasks derived from synthetic Synthea and real-world eICU datasets, with 2,200 task-specific samples. Researchers evaluated 20 LLMs—both general-purpose and medical—across four input formats and two data sources. General-purpose models consistently outperformed medical models, especially in knowledge-driven tasks, where medical models often failed to generate valid or accurate outputs. Closed-source commercial models, particularly the Gemini series, achieved the highest performance, suggesting strong generalization across synthetic structured EHR tasks. The findings highlight that current medical LLMs face significant challenges in understanding and reasoning over structured clinical data, and the study identifies input format and pretraining scope as key performance factors.

Introduction

Structured electronic health records (EHRs) store patient information in relational tables, including diagnoses, medications, and laboratory results. Each entry in records corresponds to a specific clinical event or measurement and is often timestamped to capture longitudinal patient trajectories. In contrast to traditional methods such as SQL-based querying, large language models (LLMs) offer greater flexibility, more powerful reasoning abilities, and a natural language interface, and have been increasingly adopted for structured EHR modeling.

The application of LLMs to structured EHR data has recently attracted growing attention, emerging as a promising frontier for clinical AI research. However, effectively leveraging such data remains challenging even for state-of-the-art LLMs, due to the need for tabular understanding, clinical reasoning, and alignment with user intent. Recent efforts have attempted to tackle these aspects from different angles: Yang et al. tackle tabular understanding by automating the generation of standardized summary tables from structured clinical trial data. Zhu et al. focus on clinical reasoning tasks, developing a prompting-based approach for predicting outcomes such as mortality, length of stay, and readmission from longitudinal EHR records. Kwon et al. address alignment with user intent by verifying the semantic consistency between structured EHR tables and unstructured clinical notes.

Despite promising advances, existing work lacks a unified evaluation framework for assessing LLMs on structured EHR tasks. This issue manifests in several ways. First, most studies focus on a limited set of tasks—such as disease prediction, mortality risk estimation, information extraction, and arithmetic reasoning over tabular data —while leaving many clinically important use cases underexplored, including medication recommendation and clinical named entity recognition. Second, even when addressing the same task (e.g., disease prediction), prior studies often use different datasets and evaluation protocols, limiting reproducibility and hindering fair model comparison. Third, there is no consensus on input formatting strategies or experimental setups, leading to inconsistencies in how structured data are presented to LLMs. Fourth, existing evaluation metrics provide limited interpretability, making it difficult to understand which specific reasoning capabilities contribute to model successes or failures.

Task Synthesis

Our benchmark defines six categories of tasks that reflect both emerging and established application scenarios in structured EHR modeling. Each task is initially proposed by the CS researcher through task distillation from prior work and existing modeling paradigms, then reviewed and validated by the medical expert to ensure clinical relevance. Clinical identification and Treatment planning are retained based on expert confirmation, as they are clinically important but remain underexplored in structured settings despite being common in unstructured EHR contexts. Their definitions are customized based on prior work in concept extraction and planning-based dialogue systems. The remaining four task types—Information retrieval, Data aggregation, Arithmetic computation, and Diagnostic assessment—are distilled from typical LLM applications to structured EHR data and reflect core reasoning patterns observed in prior studies. Together, these tasks are designed to cover a diverse range of real-world clinical needs in both operational and decision-support scenarios.

Task-Specific Samples Extraction

For each task, the CS researcher and the medical expert jointly screen and identify the most relevant tables based on the task definition and schema content. Once matched, we construct 100 evaluation samples per task per dataset, resulting in 2,200 annotated instances across 11 tasks. Representative data rows are selected to ensure clinical diversity, and GPT-4o is used to generate question–answer pairs conditioned on the task definition, table schema, and sampled content. All outputs undergo two-stage validation: medical reviewers assess the correctness and plausibility of answers, while technical reviewers verify that each question is faithful to the task objectives and input semantics.

Evaluation Setup

Beyond these benchmark-wide evaluations, we conduct detailed few-shot and fine-tuning experiments on the Gemini series to investigate their potential on structured EHR tasks. We also reproduce 11 existing methods for structured data reasoning—8 from other domains and 3 from clinical settings—and systematically evaluate their performance on our benchmark for comparison. Finally, we evaluate our proposed EHRMaster method on the benchmark to demonstrate its effectiveness relative to both general-purpose LLMs and existing structured-data reasoning approaches.

Task Metrics

For K-U and K-R tasks, we adopt the Area Under the ROC Curve (AUC) as the main evaluation metric. Although the model outputs are discrete class labels rather than continuous probabilities, AUC remains valid in this setting. When predictions are binary, AUC is mathematically equivalent to balanced accuracy, which measures the mean of sensitivity and specificity. We prefer AUC for K-U and K-R tasks because medical datasets often exhibit substantial class imbalance, and AUC provides a more robust evaluation of model discrimination under such conditions.

EHRMaster Overview

For example, given the task “calculate the total cost of a patient’s hospital stay”, EHRMaster generates a plan with the following steps: (1) locate the admission and discharge events; (2) retrieve billing entries linked to the hospitalization; and (3) compute the total cost. The plan is expressed in natural language and serves as a blueprint for downstream concept alignment and execution.

For example, in the hospital cost estimation task, “admission time” and “discharge time” are linked to the ADMITTIME and DISCHTIME fields in the ADMISSIONS table, while “billing entries” are mapped to the ITEM_COST field in the BILLING table.

For example, in the hospital cost estimation task, once the relevant fields have been identified, EHRMaster generate Python code to filter billing entries by admission and discharge timestamps and compute the total cost. In contrast, for tasks like assessing treatment effectiveness based on heterogeneous clinical events, EHRMaster may bypass code and instead use multi-step language reasoning grounded in the aligned data.

Overall Benchmark Results

First, general LLMs consistently outperform medical LLMs across nearly all task categories. This performance gap is particularly evident in the Knowledge-Driven scenario, where medical models frequently fail to produce valid outputs or achieve meaningful accuracy or AUC scores. Notably, none of the medical models rank among the top three performers for any task ID. In contrast, closed-source commercial models—especially the Gemini series—achieve the highest overall performance, demonstrating robust generalization across synthetic structured EHR tasks. These results suggest that general models benefit from broad pretraining on diverse text sources, which may indirectly support structured data understanding even without explicit domain-specific adaptation.

Second, model performance shows clear variation across task scenarios and levels, reflecting the different demands posed by each task category. In the Data-Driven scenario, strong general-purpose LLMs perform well on both understanding and reasoning tasks, suggesting that, when structured inputs are properly formatted, general models can interpret and reason over structured data with reasonable accuracy. In contrast, Knowledge-Driven tasks present substantially greater challenges. For the understanding task of Clinical Code Mapping (K-U1), general models achieve only moderate AUC scores (typically between 50–60%), while most medical-domain models fail to produce valid outputs. Performance drops even further on reasoning tasks such as Diagnostic Assessment (K-R1, K-R2) and Treatment Planning (K-R3), where many models struggle to generate meaningful predictions. This gap highlights the difficulty of integrating external clinical knowledge into structured data interpretation and underscores the need for models that better handle medical semantics and complex reasoning.

Finetuning Analysis

To analyze the fine-tuning performance of large language models on structured EHR tasks, we construct additional training samples specifically for fine-tuning, which are completely separate from the evaluation samples used in benchmarking. Each fine-tuning dataset contains 30 task-specific question–answer table pairs following the same instruction format as in the evaluation, ensuring consistency of task structure while preventing data leakage. We adopt two fine-tuning strategies: single-task fine-tuning trains each task separately, while multi-task fine-tuning combines all tasks into one set. All experiments are conducted on the Qwen-7B model using LoRA-based parameter-efficient fine-tuning with a 10% validation split, a learning rate of 0.0001, three training epochs, a batch size of 8, and LoRA hyperparameters set to rank 8, alpha 32, and dropout 0.05.

Conclusion

In summary, we present EHRStruct, a benchmark for evaluating LLMs on structured EHR tasks, enabling systematic comparison across diverse scenarios. EHRStruct addresses the key challenges in applying LLMs to structured EHR data by providing a novel dataset, defining clear task specifications, and establishing a standardized evaluation framework. First, we construct a novel dataset containing 2,200 structured EHR tables, generated synthetically using Synthea and extracted from the real-world eICU database. This dataset spans a wide range of clinical scenarios to ensure robust evaluation. Second, we define 11 tasks across 6 categories, organized into Data-Driven and Knowledge-Driven scenarios, covering a broad spectrum of structured EHR applications, from data extraction to clinical decision support. Finally, we establish a standardized evaluation process, testing LLMs under various settings such as zero-shot, few-shot, and fine-tuning, and analyzing the impact of different input formats. This framework enables consistent and comprehensive assessment of LLM performance on structured EHR tasks. We also reproduce 11 state-of-the-art (SOTA) LLM-based enhancement methods for structured data processing and evaluate them using our benchmark. Through this evaluation, we identified the limitations of current methods and proposed EHRMaster, a novel code-augmented framework, to address these challenges and achieve superior performance.

Task Definitions

We define 6 task categories in our benchmark to evaluate different capabilities of large language models over structured EHR data. Each category corresponds to a specific functional objective commonly encountered in clinical workflows, and is grounded in either data-centric retrieval or knowledge-informed reasoning.

Together, these 6 categories span a diverse range of clinically relevant task types, from factual retrieval to complex reasoning. They provide a comprehensive testbed for evaluating both the information extraction and decision-making capabilities of LLMs over structured healthcare data.

Task Instructions

We provide the complete set of prompt instructions used in our benchmark, organized by task ID. Each instruction follows a standardized format that includes the input table, task description, and output requirements. These instructions are used both for prompting large language models and for evaluating their consistency across diverse clinical scenarios. Appendix shows a single instruction example for each task, while the actual benchmark contains multiple samples, each paired with its own context-specific instruction.

Solution Planning

This stage generates a high-level reasoning plan based on the input question. The goal is to decompose the problem into a sequence of logical steps that guide the model toward the final answer. The output is a natural language plan describing which information to retrieve, compare, compute, or reason about. This plan serves as an intermediate representation that bridges the user query and structured data alignment.

Adaptive Execution

Depending on the nature of the task and the logic formulation, the system decides whether to generate executable code (e.g., Python or SQL) or to perform reasoning directly over the aligned logic. For example, arithmetic computation tasks may be best handled via code execution, while simpler boolean checks may be performed through direct language-based reasoning.

We design two distinct execution instructions accordingly. If code execution is selected, the model generates Python code based on the aligned logic, which is then executed by a Python interpreter to compute the final answer from the structured input. If direct reasoning is selected, the model performs the logic in natural language and outputs the final answer directly.

General-purpose LLMs consistently outperform medical-domain models

On the Synthea dataset, Gemini-2.5 achieves the highest accuracy in all seven Data-Driven tasks. It scores 98 on D-U1, 58 on D-U2, 92 on D-R1, 82 on D-R2, 83 on D-R3, and achieves perfect accuracy on D-R4 and D-R5. It is also among the top-3 models in Knowledge-Driven tasks, achieving 58.7 AUC on K-R1 (1st) and 54.1 on K-R2 (3rd). However, it fails to produce valid outputs on K-U1 and K-R3. GPT-4.1 ranks 2nd on D-U1 (79), D-U2 (51), D-R1 (52), D-R2 (56) and D-R3 (48). It also produces the best AUC on K-U1 (55) and valid results across all Knowledge-Driven tasks, with AUCs of 55.6 (K-R1), 53.2 (K-R2), and 51 (K-R3).

On the eICU dataset, Gemini-2.5 ranks 1st on five of the seven Data-Driven tasks: D-U1 (95), D-U2 (84), D-R1 (95), D-R3 (36), and D-R5 (53). It ranks 4th on D-R2 (47, behind GPT-4.1, Gemini-1.5 and Gemini-2.0). It also achieves the best AUCs across all three Knowledge-Driven reasoning tasks: 53.2 on K-U1, 60.3 on K-R2, and 62.1 on K-R3, and places 2nd on K-R1 with 61.1. GPT-4.1 ranks 2nd on four Data-Driven tasks in eICU: D-U2 (52), D-R1 (52), D-R2 (67), and D-R4 (96). It ranks 1st on D-R3 (36), but drops to 11 on D-R5. It achieves the best AUC on K-R1 (63.3), slightly outperforming Gemini-2.5, and also produces valid outputs on K-U1 (50.7), K-R2 (56), and K-R3 (61.4).

In contrast, most medical-domain LLMs fail to produce valid outputs in the Knowledge-Driven setting. On the Synthea dataset, models such as Huatuo, HEAL, Meditron-7B, and PMC_LLaMA_13B yield no valid output on all four Knowledge-Driven tasks. Their performance in Data-Driven tasks is also low: for instance, MedAlpaca-13B scores no higher than 11 on any task, and Med42-70B reaches only 27 on D-R4. Similar patterns hold on the eICU dataset, where most medical models again fail to output any valid AUC and achieve accuracy below 25% across nearly all Data-Driven tasks. None of the medical-domain models ranks in the top-3 for any task in either dataset.

Task difficulty is shaped by both reasoning complexity and dataset characteristics

Across both the Synthea and eICU datasets, task difficulty is primarily driven by reasoning complexity: Reasoning tasks are consistently more challenging than Understanding tasks. For example, in the Data-Driven setting, top-performing models like Gemini-2.5 and GPT-4.1 achieve high accuracy on Understanding tasks such as D-U1 and D-U2—reaching 98 and 58 (Synthea), and 95 and 84 (eICU) for Gemini-2.5. In contrast, their performance drops on Reasoning tasks. On D-R3, Gemini-2.5 scores 83 in Synthea but only 36 in eICU.

While this reasoning-related gap is consistent across datasets, the absolute performance also heavily depends on the dataset. For instance, DeepSeek-V3 scores 59 on D-R5 in eICU, compared to 90 in Synthea, showing large variance even under the same task design. These results suggest that real-world data introduces additional modeling challenges beyond reasoning complexity alone.

In the Knowledge-Driven setting, all tasks—including both Understanding (K-U1) and Reasoning (K-R1 to K-R3)—are substantially more difficult. Most models fail to produce any valid outputs on these tasks, especially those in the medical domain. Among general-purpose models, only a few achieve consistent AUC above 55. For example, Gemini-2.5 reaches 58.7 on K-R1 (Synthea) and 62.1 on K-R3 (eICU); GPT-4.1 achieves 61.4 on K-R3 (eICU) and 55.6 on K-R1 (Synthea). However, their performance still fluctuates with the dataset—for instance, GPT-4.1 scores 55 on K-U1 in Synthea but only 50.7 in eICU—again reflecting the compound impact of task type and dataset characteristics.

Medical-domain LLMs remain largely non-functional in Knowledge-Driven settings

Across both the Synthea and eICU datasets, nearly all medical-domain LLMs fail to produce valid outputs on Knowledge-Driven tasks. Specifically, models such as Huatuo, HEAL, Meditron-7B, PMC_LLaMA_13B, and MedAlpaca-13B output no valid AUC on any of the four Knowledge-Driven tasks in either dataset. Even the relatively stronger medical models, such as ClinicalCamel70B and Med42-70B, produce only one or two valid outputs across all Knowledge-Driven tasks, and their AUC scores remain below 50. In contrast, general-purpose LLMs like GPT-4.1 and Gemini-2.5 not only produce valid predictions on all Knowledge-Driven tasks but also achieve AUCs consistently above 50, with top scores reaching 62.1 on K-R3 in eICU.

This performance gap is likely rooted in the pretraining data and objective differences. Most medical-domain LLMs are trained primarily on unstructured clinical text, such as biomedical literature, discharge summaries, or doctor-patient conversations. These sources emphasize natural language fluency and domain-specific terminology but provide limited exposure to structured representations like tables, field-value pairs, or code-based logic. As a result, such models lack the inductive bias needed to align and reason over structured EHR inputs. Consequently, they struggle with tasks that require multi-field alignment, code mapping, or temporal reasoning—even in domains where their medical knowledge should be advantageous.

Finetuning Analysis

Overall, these results demonstrate that even with limited data, parameter-efficient finetuning can enhance performance on structured EHR tasks—particularly when training is conducted jointly across multiple task types. The consistent advantage of multi-task training suggests that cross-task inductive transfer plays an important role in helping models generalize reasoning over structured inputs, especially when supervision is scarce.