Visual abstractsVisuals
ResearchJournal of the American Medical Informatics Association · May 20, 2026

Fine-tuning and evaluating large language models for patient safety tasks: classification of contributing factors in incident reports

Wang Y, Bowditch L, Molloy C, Yu Y, Hibbert P, Magrabi F
Digital Health & AIAdult
Read the full paper free at PubMed Central ↗

Abstract

Objective To evaluate and compare the performance of large language models (LLMs) in identifying contributing factors (CFs) underlying patient safety incident investigations. Materials and methods Four open-source, lightweight LLMs, including BERT, LLaMA2, GPT2, and Phi-2 were applied to classify CFs across 6 sociotechnical system-levels encompassing 12 categories (eg, person, task, and organizational factors). Reports of real-world patient safety investigations from public health systems were extracted and labelled by domain experts (n_report/CFs = 300/1338). Data were split into training (n = 852), validation (n = 98), and test sets (n = 388). Performance was evaluated using specificity, precision, recall, and F1 scores. Results The fine-tuned encoder-based BERT model achieved the highest performance, with a micro-averaged F1 score of 63.6%, outperforming all decoder-based models. Among the decoder models, Phi-2 demonstrated the strongest performance (F1 = 54.9%), exceeding both LLaMA2 and GPT2. BERT performed consistently across 6 system-levels but often misclassified "organization" as "person". Discussion LLMs hold promise for automating the extraction of CFs from complex safety narratives, particularly for frequently reported system-levels such as "person" and "tasks". Such automation may substantially reduce the manual effort required to analyse reports of patient safety investigations while supporting more consistent analysis across large incident datasets. Conclusion Applying LLMs to analyse the underlying causes of patient safety incidents depends on developing high-quality, domain-specific datasets that enhance the representation of patient safety knowledge and improve model understanding of incident causation. Improving data coverage for rare system-levels is essential to address the current limitations of LLMs in capturing nuanced patient safety concepts and domain-specific reasoning.

Topics

Large Language Models; Humans; Patient Safety; Risk Management; Medical Errors

DOI: 10.1093/jamia/ocag068 · PubMed: 42160079

Spotted a mistake? Suggest a correction

More in Digital Health & AI

ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI

ClinicalAge biomarker associated with mortality and disease risk in UK datasets

ClinicalAge, a framework for modelling ageing trajectories from longitudinal electronic health records in the UK: a model development and validation study

ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI

Facial photographs used to estimate age and predict survival in cancer patients

Foundation artificial intelligence models for health recognition by use of face photographs (FAHR-Face): a model development and validation study

ResearchLancet Digit Health · Nov 23, 2026 · Digital Health & AI

New model predicts severe fetal compromise risk at birth with 33.4% sensitivity

A prognostic model for use at labour onset to estimate the risk of severe fetal compromise at birth: a retrospective, model development and validation study

ResearchNPJ Digit Med · Nov 21, 2026 · Digital Health & AI

ECG foundation models performed well on general data but less so on athletes' data

ECG foundation models for cardiovascular screening in a cohort of young competitive athletes

ResearchJ Med Internet Res · Nov 20, 2026 · Digital Health & AI

Six large language models showed similar question-answering accuracy on medical exam questions

Medical Reasoning in Large Language Models: Development and Evaluation of the MedEvalArena Benchmark