Evaluating Fairness and Generalizability of Large Language Models for Social Isolation Extraction from Electronic Health Records: Multisite Evaluation (Preprint)
Preprint
- 24 April 2026
- preprint
- Published by JMIR Publications Inc. in JMIR Preprints
Abstract
BACKGROUND Recent advancements in large language models (LLMs) have improved the identification of social isolation from clinical narratives, which vary widely in linguistic patterns and documentation practices. However, LLMs fine-tuned on a single dataset often show reduced performance when applied to different healthcare settings or clinical note types. Rigorous evaluation of cross-site generalizability and fairness is therefore essential to ensure accurate and equitable detection of social isolation across diverse populations and clinical contexts. OBJECTIVE This study aimed to evaluate a span-level fine-tuned FLAN-T5-Large model for extracting ‘social isolation’ indicators from unstructured clinical text and to assess its generalizability and fairness across diverse populations and healthcare data sources. METHODS A total of 2,967 unique annotated spans from 9,578 clinical notes across three healthcare systems were used to fine-tune an FLAN-T5-Large model using a contextualized span classification framework. A Gemma‑2-2B model was evaluated in a sensitivity analysis to assess architecture‑related performance differences. Performance was assessed using precision, recall, and macro F1. Fairness was evaluated across demographic variables, social vulnerability strata, and note types using statistical parity difference (SPD) and equal opportunity difference (EOD). RESULTS Incorporating contextual windows around annotated spans improved macro-F1 from 0.90 to 0.94 during validation. In full note evaluation across 900 manually reviewed notes, FLAN-T5-Large achieved high recall for social isolation (0.94 – 0.98) and macro F1 values ranging from 0.69 to 0.81 across sites. Fairness analysis showed generally consistent performance across age, gender, race, and social vulnerability groups, with equitable sensitivity (EOD 0.02 – 0.04) and moderate variation in positive prediction rates (SPD). Performance variability was strongly associated with documentation type, with note type driving substantially greater variability in both performance and fairness metrics than patient demographic factors. CONCLUSIONS Fine-tuned FLAN‑T5-Large demonstrated strong capability in detecting ‘social isolation’ from clinical narratives, while maintaining sensitivity parity across subgroups. The observed heterogeneity was largely driven by documentation context rather than by patient characteristics, highlighting the importance of note type-aware evaluation in clinical NLP. These findings support the use of instruction‑tuned LLMs for equitable extraction of social context information from EHR text.Keywords
This publication has 20 references indexed in Scilit:
- Social determinants of health extraction from clinical notes across institutions using large language modelsnpj Digital Medicine, 2025
- A systematic review of fairness in machine learningAI and Ethics, 2024
- Identifying social determinants of health from clinical narratives: A study of performance, documentation ratio, and potential biasJournal of Biomedical Informatics, 2024
- A scoping review of fair machine learning techniques when using real-world dataJournal of Biomedical Informatics, 2024
- Artificial intelligence, ChatGPT, and other large language models for social determinants of health: Current state and future directionsCell Reports Medicine, 2024
- Automatic extraction of social determinants of health from medical notes of chronic lower back pain patientsJournal of the American Medical Informatics Association, 2023
- US trends in social isolation, social engagement, and companionship ⎯ nationally and by age, sex, race/ethnicity, family income, and work hours, 2003–2020SSM - Population Health, 2022
- The statistical fairness field guide: perspectives from social and formal sciencesAI and Ethics, 2022
- Extracting social determinants of health from electronic health records using natural language processing: a systematic reviewJournal of the American Medical Informatics Association, 2021
- FHIR2018