Editor’s introduction
The study evaluates GAME, a graph-based framework that harmonizes heterogeneous electronic health record codes by integrating institution-specific summary statistics, biomedical knowledge graphs, and semantic information from large language models. It learns a shared semantic space that aligns diverse local coding practices while preserving patient privacy. Performance gains are attributed to the combined use of co-occurrence data, ontological structures, and LLM-derived semantics. The study notes that results are consistent only when all components are jointly used, indicating a synergistic effect.
Introduction
Standardized coding systems such as the International Classification of Diseases (ICD) and the Logical Observation Identifiers Names and Codes (LOINC) for laboratory tests provide an essential foundation for constructing common datasets across healthcare systems. However, the extent of adoption of these ontologies varies substantially across institutions: while ICD is used globally, LOINC is not universally implemented. As a result, a laboratory test included in a study may be represented by a standard LOINC code at one institution, but by one or several institution-specific identifiers, referred to here as local codes, in another healthcare system. Depending on the healthcare system, the number of such local codes can range from hundreds to tens of thousands.
As artificial intelligence (AI) becomes increasingly integrated into healthcare research, recently developed algorithms often rely on high-dimensional EHR features. This growing complexity amplifies the need for scalable approaches to harmonize EHR data across healthcare systems, so that AI algorithms developed in one institution can be reliably deployed in others despite differences in local coding practices. Manual mapping is infeasible at scale, and ontology-based alignment alone cannot resolve the proliferation of local, legacy, or language-specific codes that differ across systems. These challenges underscore the need for automated, data-driven, and adaptive methods to achieve consistent and interoperable data integration at scale.
Another major challenge in multi-institutional EHR research is the need to preserve patient privacy. Traditional collaborative frameworks often require institutions to share patient-level data with a centralized site for model training, an approach that has become increasingly impractical due to regulatory, resource, and logistical constraints. Federated learning (FL) methods address this limitation by enabling model co-training without transferring individual-level data. In FL, institutions perform local computation and share intermediate parameter updates or summary statistics with a central coordinator, without exchanging individual-level data. However, standard FL protocols typically assume that participating institutions operate in comparable feature spaces, such as shared laboratory or diagnostic codes mapped to a common ontology.
In practice, institutions differ widely in vocabulary coverage, coding conventions, and data scale, and many rely heavily on local codes that are not mapped to standardized systems. These discrepancies make cross-site feature alignment a critical challenge that traditional FL methods do not address. While recent approaches introduce knowledge abstraction or filtering to mitigate heterogeneity, they remain task-specific and communication-intensive. As a result, although FL provides a scalable and privacy-preserving framework, its success in biomedical research hinges on effective feature harmonization across institutions, a problem that must be addressed prior to, or alongside, federated model training.
Discussion
While GAME utilizes a GNN framework for relational learning, its primary contribution lies in the formulation of the harmonization problem and the systematic curation of heterogeneous relational information. By systematically combining KG edges, EHR derived summary statistics, and LLM-refined semantic relations, GAME provides a general, data-centric framework for cross-institutional joint representation learning that is scalable and privacy-preserving. Importantly, this curated relational structure is not tied to a single modeling backbone. In principle, it can support alternative architectures, including PLMs or hybrid graph–text approaches, provided task-specific objectives balance textual and relational supervision. To explore this, we fine-tuned a biomedical PLM using the same curated relations (Supplementary Section S3.5). However, its performance remained below that of GAME, highlighting that standard contrastive fine-tuning does not yet fully exploit the structured, heterogeneous supervision arising from EHR statistics and KG relations. Realizing the full potential of PLMs in this context will likely require customized loss formulations and explicit relational constraints to mitigate optimization instability, which remains an important direction for future research.
In summary, GAME provides a robust and modular infrastructure for harmonizing EHR concepts across distributed healthcare systems. By unifying co-occurrence patterns, curated knowledge, and real-world semantics into a privacy-preserving architecture, it lays the groundwork for broader interoperability in biomedical research. Its emphasis on transparency and semantic consistency ensures that EHR-driven machine learning can evolve equitably, supporting scalable and interpretable models across the heterogeneous landscape of global healthcare data.
Methods
This research was conducted in accordance with all relevant ethical regulations. The study protocol was reviewed and approved by the institutional review boards (IRBs) or ethics committees of the participating institutions, including Boston Children’s Hospital (IRB-P00031305, “Large-scale computable phenotyping for pediatric cohorts”; IRB-P00037726, “Longitudinal Molecular Genetics Study of Lung Function Growth”), Mass General Brigham (IRB protocol 2018P000609, “Resource Core: Bioinformatics–Subproject for Institution #2016D008375”, active, data analysis only), Duke University (Protocol ID: Pro00110219, “Development of novel statistical and machine learning methods for predictive modeling using electronic medical records data”), University of Pittsburgh Medical Center (Protocol ID: STUDY21020153, “Integrating Electronic Health Records for Alzheimer’s Disease Research”), the U.S. Department of Veterans Affairs Central IRB (cIRB 18-38, “MVP-CHAMPION: Innovative Analytics for Big Data in the VA”), and the Centre d’Éthique et de Recherche en Santé Bordeaux (CERS; record number CER-BDX 2024–84). For institutions providing non-public electronic health record (EHR) data, the requirement for written informed consent was waived by the approving IRBs or ethics committees because this was a retrospective analysis of existing clinical data and posed minimal risk to participants, in accordance with local regulations. For the publicly available MIMIC-IV dataset, data access and use complied with the corresponding data use agreement and ethics approvals associated with the resource. No participant compensation was provided, as this study involved secondary use of existing clinical data.
The GAME algorithm is built upon the Graph Attention Network (GAT), a variant of GNNs, which serves as the core architecture for harmonizing multi-institutional EHR code embeddings. In this framework, EHR codes from multiple institutions are represented as nodes in a unified graph, with edges capturing diverse relationships derived from three sources: (i) co-occurrence statistics within EHR data, (ii) biomedical knowledge bases including UMLS and ontologies, and (iii) GPT-4-informed semantic similarity and clinical relatedness. GAT is particularly well-suited for this setting, where the strength of the relationship between a target node (e.g., a disease) and its neighboring nodes (e.g., medications, comorbidities) can vary widely. Its attention mechanism dynamically weighs the influence of neighboring nodes during message passing, allowing the model to focus on the most relevant, clinically meaningful signals. Unlike traditional GNNs that aggregate all neighbor information uniformly, GAT selectively amplifies important connections, enabling context-aware learning across heterogenous data sources.
Building on these innovations, we next describe the EHR datasets from seven institutions and their preprocessing steps, followed by the initialization of embeddings derived from EHR co-occurrence patterns and PLMs. We then detail the construction of KG edges used for supervision, present the full GAME training pipeline, and conclude with the validation strategy and the ablation study design.
Detecting similarity and relatedness between codes
We first evaluated the quality of embeddings with respect to their ability to detect semantic similarity and clinical relatedness between EHR codes. We split the known similarity and relatedness pairs from PheCode, RxNorm, LOINC, CCAM, and UMLS into training and validation sets, as detailed in Supplementary Section S1. For each relationship type, we computed cosine similarities for positive pairs and type-matched negative pairs. For example, negatives for “may treat” or “may prevent” were sampled from disease-drug pairs, and for LOINC hierarchies, from LOINC-LOINC pairs. This matching controls for confounding due to semantic type differences, ensuring that performance reflects true relational discrimination rather than trivial mismatches. Additionally, all relationships—both similar and related—were grouped by code type (e.g., “PheCode–RxNorm”, “LOINC–LOINC”) to enable clear stratified analysis and produce stable AUC estimates. Within each group, we computed the AUC using cosine similarity scores to assess the model’s ability to distinguish true positive pairs from semantically plausible but incorrect ones.
Due to variation across individual institutions, we also conducted institution-specific analyses to evaluate GAME’s performance in a more localized context, thereby enhancing the interpretability and robustness of our findings. Specifically, we identified code pairs that appeared in only one or two institutions and referred to them as institution-specific pairs. We then evaluated similarity and relatedness detection using institutional PPMI, various PLM-based embeddings, and GAME, reporting AUC scores separately for each institution. Details are provided in Supplementary Section S3.1.2.
Statistics & Reproducibility
This study is a retrospective observational analysis based on existing EHR data and a public critical care dataset (MIMIC-IV). No statistical method was used to predetermine sample size; sample sizes were determined by the availability of eligible records after applying predefined criteria. No data were excluded from the analyses beyond the predefined inclusion criteria described in the Methods. All data processing, cohort definitions, and analyses are described in the Methods and Supplementary sections. Model performance was summarized using AUC, Spearman correlation, and C-index.
Sex and/or gender information (where available) was obtained from clinical records. Sex and/or gender was not a variable of interest in the study design because the primary evaluations are code- and embedding-level rather than patient-level effects. Accordingly, sex and/or gender was used for covariate adjustment in patient-level models where applicable, but no sex- or gender-stratified or interaction analyses were performed, and sex/gender definitions are not consistently harmonized across institutions.
All data preprocessing, modeling, and statistical analyses were conducted using Python (v3.9.23) and R (v4.4.2). Graph-based models were implemented using PyTorch and PyTorch Geometric, and textual embeddings were generated using transformer-based language models implemented with the Hugging Face Transformers library. Statistical analyses and evaluation metrics were computed using standard Python and R packages, as detailed in the Reporting Summary.
S3.1.1 Detecting general similarity and relatedness relationships
From (a) to (b), the similarity AUC remains largely unchanged, while the relatedness AUC increases significantly. This is expected, as we add UMLS edges in (b), which include many useful relatedness relationships. From (b) to (c), we introduce binomial PPMI edges without GPT-4 refinement. As a result, the AUC for both similarity and relatedness drops substantially, suggesting that the added information introduces considerable noise. In contrast, from (b) to (d), where we add GPT-4–refined feature selection edges, the results remain similar. Adding code mapping edges in (e) slightly improves the similarity AUC but slightly decreases the relatedness AUC. This observation is consistent with the nature of code mapping, which contributes more to similarity than to relatedness.
Comparing (e) and (f), both of which use GPT-4-generated edges, we observe that the similarity AUC remains largely unchanged, while the relatedness AUC drops substantially. This suggests that GPT-4 alone does not capture all relevant relatedness information, and that incorporating UMLS relationships remains beneficial. We then compare (g) and GAME. The only difference is that (g) uses random negative pairs in feature selection and code mapping, as described in the Ablation studies section in the main text, whereas GAME uses hard negatives in both stages. Although the improvement from (g) to GAME is smaller than in previous comparisons, GAME still achieves higher similarity and relatedness AUCs, indicating that hard negative sampling contributes to broader relationship detection.
Next, we contrast (e) and GAME. These two variants use the same edges and loss functions but differ in the training strategy: (e) performs joint training, while GAME adopts two-step training. The relatedness AUCs are comparable, but GAME shows a clear improvement in similarity AUC. This suggests that two-step training helps prevent interference from relatedness learning, leading to more effective low-dimensional embeddings and overall better performance. Finally, when SAPBERT is replaced by BGE or CODER, GAME achieves even higher AUCs for both similarity and relatedness. This is reasonable, as BGE and CODER generally outperform SAPBERT, especially in capturing similarity relationships, which enhances semantic representation.
S3.1.2 Detecting institutional similarity and relatedness pairs
To account for heterogeneity across institutions, we conducted institution-specific analyses to evaluate the performance of GAME in more localized settings. These analyses enhance the credibility and interpretability of our findings in real-world, multi-institutional environments. Specifically, we focused on code pairs that appear in only one or two institutions, referring to them as institution-specific pairs. The rationale is that code pairs occurring in three or more institutions are more likely to be common and widely shared, and thus not reflective of institution-specific characteristics. We evaluated these pairs using AUC metrics across institutions, comparing institutional PPMI-SVD embeddings and various PLM-based embeddings, including GAME.
This stark contrast underscores the key strength of GAME’s federated learning framework: it enables institutions to benefit from shared semantic representations learned across sites, even for rare or institution-specific codes. Unlike PPMI-SVD embeddings, which rely solely on local co-occurrence statistics and struggles with data sparsity, GAME’s harmonized embedding enables robust generalization. As a result, GAME maintains strong performance across both global and local settings, making it particularly effective in federated environments where code overlap is inherently limited.
The role of GNN and federated learning in code mapping
Although GAME, which integrates both GNN and FL, outperforms all baseline methods, we further investigate whether GNN alone is sufficient for the code mapping task. To this end, we train GNN models independently within each institution and then perform cross-institutional code mapping using task-relevant embeddings and GPT-4-generated alignment pairs.
Specifically, we focus on mapping VA local lab codes to MGB LOINC codes. We first train two separate GAT models using institutional edges from MGB and VA, respectively. The input embeddings are constructed by concatenating each institution’s PPMI-SVD embeddings with SAPBERT embeddings. Within each institution, we construct graph edges and define loss functions using only hierarchical and UMLS-based relationships. This yields distinct embeddings for all codes in MGB and VA.
These results demonstrate that federated learning is crucial for achieving robust and unified embeddings across institutions. While GNNs trained within isolated institutions can capture local structure, they fall short in aligning code semantics effectively across sites. The combination of GNN and FL, as implemented in GAME, enables meaningful cross-institutional generalization and achieves superior performance in code mapping tasks.
S3.3.2 Feature selection performance evaluated by GPT-4
Ablation results show that no matter using human annotations or GPT-4 scores, configurations (g) and GAME outperform all other baselines, likely due to the benefits of two-step training, which cleanly separates similarity and relatedness signals. Notably, GAME consistently outperforms (g), suggesting that hard negative sampling contributes not only to improved code mapping but also to more accurate feature relevance ranking.
The results also offer insight into how different edge constructions affect performance. Configuration (a), which uses only hierarchical edges, yields moderate results. Adding UMLS edges in (b) leads to performance drops in diseases such as T1D, Epilepsy, and Asthma—indicating that blending similarity and relatedness without proper separation can degrade embedding quality. Configuration (c), which incorporates unrefined PPMI edges, performs poorly under GPT-4 evaluation, likely due to noise. In contrast, (d), which includes GPT-refined PPMI edges, shows substantial improvements across both evaluation criteria. Further incorporating GPT-curated code mapping edges in (e) leads to additional gains.
Configuration (f), which uses only GPT-4–curated edges, performs competitively across both evaluation schemes, highlighting GPT-4’s capacity to identify meaningful relationships. In addition, (h) also performs worse than (a) and is only comparable to (c). Both (h) and (c) incorporate more PPMI information by directly pooling PPMI instead of performing graph-alignment of PPMI and by adding additional raw PPMI pairs. This suggests that including more unfiltered PPMI information without GPT cleaning may introduce additional noise. Ultimately, GAME achieves the highest overall performance, validating the effectiveness of separating similarity and relatedness through two-step training. Furthermore, when replacing SAPBERT with BGE or CODER, performance degrades only slightly and remains comparable—further supporting the robustness and adaptability of the proposed method.


