Clear Sky Science · en
Integration of fairness-awareness into clinical language processing models
Why this matters for real-world healthcare
Modern medicine increasingly relies on artificial intelligence built from electronic health records. Yet a basic fact about patients—their race and ethnicity—is often missing or recorded inconsistently. That gap makes it harder to uncover and address health inequities. This paper explores whether computers can reliably recover race information from doctors’ notes while also avoiding unfair treatment of different groups, and what that reveals about bias in both medical records and AI tools.

Hidden gaps in medical records
Many hospitals and clinics leave race and ethnicity fields blank or use outdated categories. These missing entries are not just clerical errors; they can distort statistics about who gets sick, who receives what care, and who benefits from new treatments. Meanwhile, the free-text portions of records—social history and risk factor notes—often do mention a patient’s background in passing. The authors asked whether those scattered clues in unstructured text could be turned into a structured, consistent record of race, providing a clearer picture of inequalities in health and healthcare use.
Teaching computers to read doctors’ notes
The team worked with a large Canadian primary care database containing records from about 400,000 patients and over 400 clinics. From this, they drew a representative sample of nearly 4,000 adult patients and painstakingly labeled sentences that clearly referred to race or ethnicity, using nine categories such as Black, East Asian, Latin American, and Indigenous, plus an “absent” category when no mention appeared. Because most notes never mention race, they used an “active learning” strategy in which an initial AI model flagged notes it was most uncertain about, so human annotators could focus on the cases most likely to contain race information.

Building fairer language models
The researchers compared several popular transformer-based language models—like BERT and its clinical variants—with a custom-built hierarchical convolutional neural network. Unlike standard models that treat a note as one long string of words, the hierarchical model mirrors how clinicians write: it processes words within sentences, then sentences within a note, and finally the patient’s notes over time. The team also experimented with “fairness-aware” training, adding terms to the loss function that penalize large differences in error rates between racial groups and adjusting how much the model “cares” about mistakes for underrepresented groups.
What worked, what did not
The hierarchical model outperformed all transformer models overall, achieving very high accuracy and more balanced performance across racial categories, even before fairness adjustments. In contrast, several transformers performed well for white patients but missed many cases among smaller groups, sometimes predicting only the majority category. Adding fairness constraints helped some models substantially, especially BERT, making their predictions both more accurate and more evenly distributed across groups. But the same constraints hurt other models, including the hierarchical one, and in one clinical transformer caused the system to collapse back toward majority predictions. The study also found persistent differences across intersections of race, sex, and age, with Indigenous, mixed-heritage, and some Asian and Latin American subgroups remaining hardest to classify.
What this reveals about bias
Because the best-performing model could reliably detect race information when it was present, the authors argue that the main problem is not a lack of signal in the notes but how models and datasets interact with long-standing structural inequities. Bias crept in through underrepresentation of certain groups, through patterns in how clinicians describe different patients, and even through the active learning process that chose which notes to label. Fairness-aware training reduced some disparities but could not fully overcome these upstream issues, and its impact depended heavily on the model’s design.
Take-home message for patients and clinicians
This work shows that it is technically possible to build language models that recover race information from clinical text with high accuracy and greater fairness, especially when architectures respect the layered structure of medical notes. However, it also makes clear that algorithms alone cannot fix inequities that originate in documentation practices and the healthcare system itself. For AI to support more just care, fairness must be built into every stage—from how data are collected and sampled to how models are trained, audited, and used—while health institutions improve how they record and act on social and demographic information.
Citation: Abulibdeh, R., Lin, Y., Ahmadi, S. et al. Integration of fairness-awareness into clinical language processing models. Commun Med 6, 178 (2026). https://doi.org/10.1038/s43856-026-01433-9
Keywords: clinical natural language processing, algorithmic fairness, electronic health records, health equity, race and ethnicity data