Abstract
Standardization of electronic health records (EHRs) has enabled the use of clinical codes in AI. We introduce ClinVec, an embedding store that provides embeddings for 153,166 clinical codes and concepts across eight vocabularies. ClinVec embeds ClinGraph, a knowledge graph with over 2 million edges tailored to clinical vocabularies used in EHRs. We validate the embeddings using an inter-institutional clinician panel and N = 3767 clinical term pairs spanning 11 disease areas, and we find that embedding similarity reflects clinical relatedness. We use ClinVec for knowledge injection in large language model medical question answering and for unsupervised patient stratification and risk prediction. By providing a shared representation of clinical concepts, ClinVec supports knowledge-grounded AI systems for modeling patients and populations.
Subject terms: Computational biology and bioinformatics, Health care, Mathematics and computing, Medical research
Introduction
Standardized clinical vocabularies underpin electronic health record (EHR) systems. These vocabularies enable interoperability across health systems, but each typically covers a narrow domain of patient records, such as diagnoses, laboratory tests, procedures, or administrative data1,2. As a result, EHRs rely on multiple vocabularies, each tailored to a specific domain, which fragments the representation of clinical information3,4. Several initiatives standardize clinical vocabularies and medical concepts. For example, OMOP5 and FHIR6 provide common data models that harmonize vocabularies into a unified system, while the UMLS Metathesaurus7 and Disease Ontology8 organize medical concepts and link clinical vocabularies through cross-references.
Widespread EHR adoption has accelerated the use of AI in medicine9,10, with more than half of healthcare foundation AI models relying on structured clinical codes11. Clinical codes are often represented as discrete inputs, for example, using one-hot encoding or tokenization12. In transformer-based models, each EHR code is treated as a token, and its embedding is learned from patient-level data during training13–15. However, these strategies overlook information encoded in clinical vocabularies. For example, ATC is a hierarchical taxonomy organized by therapeutic and pharmacological properties that groups drugs with shared indications, such as antineoplastic agents (L01) and antihypertensives (C02)16. SNOMED CT17 and LOINC18 similarly encode parent-child and attribute relations across disorders, procedures, and laboratory tests. Ignoring this structure can separate semantically related codes and miss clinically meaningful information essential for accurate patient representation19,20.
Knowledge graphs (KGs) are a general data structure for organizing multimodal relational data21–25 and can be used to capture structure among clinical codes together with their relationships, such as is-a and part-of type relationships, medical hierarchies, and cross-terminology mappings. Graph embedding techniques generate high-dimensional vector representations of the KG by encoding graph structure and typed relationships into a continuous space, so that clinically related concepts have similar representations. Integrating these embeddings into AI models can improve performance across clinical tasks, including disease prediction26–29, drug interaction modeling30,31, and clinical trial recommendations32.
Embedding stores offer readily available embeddings of concepts across a variety of domains33, such as genes34–36, proteins37,38, and molecules39. These embeddings provide compact representations of entities that reflect their properties and relationships. They are useful when labeled data are limited, because they let models start from these representations rather than learning them from scratch40,41. When used as inputs to AI models, precomputed embeddings support transfer learning42, pre-training, and retrieval augmented systems43, and can improve performance and generalization in clinical prediction and reasoning tasks44–47. Embedding stores built from KGs can be integrated into foundation models to ground model outputs in factual and clinically vetted knowledge48–51. Existing embeddings of clinical codes leverage information from either a single or limited number of clinical vocabularies at a time, limiting the breadth of clinical knowledge represented within an embedding store. For example, snomed2vec52 leverages only SNOMEDCT codes, cui2vec focuses only on the UMLS metathesaurus, and recent work by Finch et al. utilizes hierarchy information derived only from ICD10 codes53. Because coding systems capture distinct facets of care, linking concepts across vocabularies is needed to fully capture the information contained in EHR data.
Here, we created a knowledge-graph-driven embedding store named ClinVec, which provides embeddings for 153,166 clinical codes and concepts across eight vocabularies. The underlying knowledge structure is provided by ClinGraph, a newly developed knowledge graph with more than two million edges that is tailored to clinical vocabularies used in EHRs and represents codes within their original namespaces. This preserves semantics unique to each vocabulary and avoids any mapping layer between EHR codes and ClinVec embeddings. Edges reflect equivalences and mappings across vocabularies, as well as clinical relationships between nodes. A panel of clinical experts validated a subset of relationships defined by the clinical knowledge embeddings across 3767 clinical term pairs spanning 11 disease areas. We show that integrating ClinVec into large language models improves medical question answering. Finally, we use ClinVec as a basis for phenotype risk score analyses for chronic kidney disease, chronic obstructive pulmonary disease, and heart failure, using EHR data from 4.57 million patients in Clalit Health Services.
Results
A comprehensive clinical knowledge graph for medical codes
We construct ClinGraph, a clinically broad, interoperable representation of clinical knowledge that can be leveraged by medical AI systems. ClinGraph is composed of 153,166 nodes and 2,873,025 edges and integrates eight commonly used vocabularies with EHRs and their secondary usage, ranging from diagnosis codes (ICD9CM, ICD10CM, phecodes54), laboratory tests (LOINC), medications (RxNorm55, ATC), procedures (CPT56), and other controlled clinical vocabularies (SNOMED CT, UMLS) (Fig. 1a, b). Because each vocabulary was designed for a specific purpose and organizes concepts differently..., incorporating multiple vocabularies in ClinGraphis essential. In routine care, healthcare systems use terminologies to record diagnoses, laboratory tests, procedures, and medications, so multiple vocabularies are needed to describe patient care. We therefore build ClinGraph from vocabularies that are used directly in structured EHRs, which makes it compatible with most clinical datasets.
Fig. 1. Overview of approach.

a Meta-graph showing the structure of ClinGraph and the edge relationships between clinical vocabularies. b An example local neighborhood of ClinGraph. Each clinical code is represented as a node, and the color denotes the source clinical vocabulary. c ClinVec workflow for generating clinical knowledge embeddings. d Applications of ClinGraph and ClinVec. e A scatterplot showing a reduced dimension of the embedding space of diagnosis codes (phecodes), where each code is shaded by its corresponding organ system categorization. f Scatterplot of the latent space of ATC5 medication codes where each code is shaded according to the corresponding ATC-level 1 categorization.
Clinical codes are represented as nodes, and edges are drawn between codes according to EHR-vocabulary crosswalks (e.g., General Equivalence Mapping, GEM57). By connecting related clinical concepts through edges, we avoid the need for collapsing all concepts into a single coding system, which can introduce errors or information loss when mapping across terminologies. This design allows ClinGraph to capture structure shared across vocabularies while preserving the differences in how each vocabulary defines and organizes clinical concepts. To link concepts in ClinGraph beyond equivalence mappings, we add cross-vocabulary edges derived from concept-level relations in UMLS and PheMap58. PheMap knowledge base contains clinical relationships inferred through mining of biomedical literature, offering a complementary source of information to clinical ontologies. A list of sources and the distribution of nodes and edges in ClinGraph are provided in Supplementary Table S1 and Supplementary Table S2.
Although many KGs represent disease and drug entities, they generally do not represent nodes using standardized clinical vocabularies from EHRs23,24,59,60. To compare the coverage of clinical vocabularies against six popular KGs, we map all disease and drug node identifiers of each KG to ICD10CM and ATC codes (Supplementary Table S3). ClinGraph has the highest coverage of ICD10CM and ATC codes across all KGs except GAT-ETM61, which includes all codes in both vocabularies. However, GAT-ETM mostly derives edges from the hierarchical relationships within each vocabulary and is limited solely to ICD10CM and ATC. Finally, most existing KGs do not represent procedures or lab tests, whereas ClinGraph adds both through CPT and LOINC.
Learning a unified representation of clinical knowledge
Using a heterogeneous graph transformer (HGT)62, ClinVec learns a function that maps each node in ClinGraph to an embedding vector (Fig. 1c). ClinVec determines how information is shared between nodes using a multi-head attention mechanism to up-weight and down-weight different parts of ClinGraph graph topology63. We model four node types, administrative diagnosis codes, treatments, patient clinical state indicators (e.g., laboratory tests), and semantic clinical terminologies, to reflect how each vocabulary is utilized in clinical care. Modeling node types lets the embedding function learn edge type-specific patterns64–66. The embedding function is trained through self-supervised learning via contrastive edge masking67 (Methods). We note that the goal of this study is not to compare embedding techniques, as HGT is already a widely accepted approach in the field. Because the embeddings are generated without patient-level data, ClinVec embedding store can be shared without privacy risk (Fig. 1d). ClinVec embedding store comprises 153,166 clinical knowledge embeddings and is available to the research community (https://doi.org/10.7910/DVN/Z6H1A8)68. We also provide an interactive visualization platform: https://huggingface.co/spaces/mims-harvard/ClinVec.
To gain insight into the robustness of ClinGraph and resulting ClinVec embeddings, we construct two alternative versions of ClinGraph to assess the impact of noise and knowledge base selection. We construct an alternative version of ClinGraph without the use of PheMap (ClinGraph-PheMap-ablation). To assess the impact of noise, such as small amounts of incorrect or incomplete information, we shuffled 1% of the edges of the original graph (ClinGraph-noise). The omission of PheMap leads to an 85.5% reduction in the number of edges, which also drastically impacts the connectivity of the graph. The resulting largest connected component of ClinGraph-PheMap-ablation shows a 34.4% reduction in the number of nodes. It is also much less compact, with the graph diameter increasing from 17 to 34, suggesting a much more fragmented graph structure. The number of nodes and graph connectivity of ClinGraph-noise were only minimally affected, with a 5.9% reduction in the number of nodes and a 2.6% in the number of edges, and the overall graph diameter was unchanged.
To assess how these changes in graph construction affect the resulting embedding space, we trained a separate HGT for ClinGraph-PheMap-ablation and ClinGraph-noise. ICD and ATC systems are organized by organ system and therapeutic purposes, making them a practical reference point for quantifying how well the resulting embedding spaces reflect relevant clinical patterns (Supplementary Fig. S1). Across silhouette score (SS) and adjusted mutual information (AMI), ClinGraph-PheMap-ablation performance is lower than ClinGraph for the majority of measurements (Supplementary Table S4). Specifically, we see a significant reduction in AMI in ClinGraph-PheMap-ablation (AMI-ICD = 0.30, AMI-ATC = 0.03) compared to ClinGraph (AMI-ICD = 0.37, AMI-ATC = 0.26) when clustering by ICD category and a significant drop when clustering ATC codes. In contrast, metrics from ClinGraph-noise show only slight deviations from ClinGraph in both scenarios. These results suggest that small perturbations in ClinGraph construction do not significantly change the ClinVec embedding space, whereas the removal of entire knowledge bases can drastically affect the resulting embedding space.
To compare the latent space defined by ClinVec to embedding spaces defined by other biomedical knowledge graphs, we perform a similar analysis with PrimeKG and SNOMED CT KG (Methods). Visualizing the latent space of diagnostic codes, the latent space described by ClinVec broadly clusters diseases by organ system, mirroring the organization of clinical care (Fig. 1E). This observation is supported with standard clustering metrics, where disease clusters from ClinGraph (silhouette: 0.54, AMI: 0.31) produce metrics at the same value or greater than clusters produced from other KGs (PrimeKG - silhouette: 0.54, AMI: 0.02; SNOMED-CT KG - silhouette: 0.15, AMI: -1e-4) (Supplementary Fig. S2). We repeat the analysis using ATC code embeddings and observed similar results, supporting the conclusion that ClinVec broadly captures drug-class and indication structure (Fig. 1f, Supplementary Fig. S2).
Evaluating ClinVec across clinical knowledge tasks
To evaluate the quality and alignment of ClinVec with existing clinical knowledge, we evaluate the embeddings across three tasks: hierarchical clinical term relationships, drug-pair similarity, and biomedical semantic similarity. For each benchmark, we compare our approach to embeddings generated from a set of biomedical LLMs, including BioBERT69, UmlsBERT70, MedCPT71, and BioLORD72. The full task definition and dataset descriptions are detailed in Methods, and we describe our key findings below.
The preservation of hierarchical relationships among clinical terms is essential to creating a semantically meaningful embedding space. Using cosine similarity between embeddings to evaluate the degree of similarity, we assess whether parent–child codes of diagnoses are located closer in the embedding space than sibling codes. Although these diagnoses are related and should lie in a similar region of the embedding space, broader and narrower codes for the same condition should be more similar to each other than to codes for distinct conditions, mirroring how disease hierarchies are used in clinical practice. We use the phecode disease hierarchy as ground truth, where for each phecode, we select one of its mapped ICD codes as the target, sample a “positive” ICD code from its parent or child phecode, and sample two “negative” ICD codes from sibling phecodes. We measure the “hit rate” or how many times the positive code embedding has the highest similarity to the target. Stratifying results by disease area, ClinVec attains the top hit rate in 8 out of 16 disease areas with ICD9 codes and 7 out of 16 with ICD10 codes. MedCPT and BioLORD have the next highest performance, achieving the top hit rates in 4 (ICD9) and 1 (ICD10) category, and 4 (ICD9) and 7 (ICD10) categories, respectively (Supplementary Table S5, Supplementary Table S6). Across instances where ClinVec is the highest performer, there’s an average 13.2% (range 4–42%) relative improvement for ICD9 codes and 18% (range 0.5–51%) for ICD10 codes compared to the second-best performing method.
We next formulate a drug-pair similarity task where we assess whether embeddings for generic drugs align with the corresponding brand-name drug embeddings. For each generic drug with a corresponding brand name present in ClinVec, we sample one “positive sample” as a brand linked to that generic and two “negative sample” brands under three settings: (1) random negatives drawn from any other brand drugs, (2) negatives restricted to drugs in the same ATC class, and (3) negatives whose names are lexically similar to the true brand. As shown in Supplementary Table S7, across all three negative‑sampling settings, ClinVec achieves the highest hit rate with an average of 11.8% relative improvement compared to the best-performing LLM baseline (MedCPT). In the more challenging negative sampling schemes, there’s a 14.4% relative improvement for lexically similar negatives, and even in the challenging ATC‑class negative setting with pharmacologically similar distractors, where all models have a reduction in hit rate, ClinVec has the highest hit rate with a 6.2% improvement over MedCPT. These results indicate that ClinVec encodes precise generic–brand relationships, even under hard, clinically realistic negatives.
Existing reference datasets for evaluating the semantic relatedness of clinical concepts are often limited in size and based on outdated coding systems that include obsolete codes73,74. We construct a new validation dataset consisting of N = 3767 clinical term pairs graded on a 1–5 Likert scale by an inter-institutional panel of clinicians. We compute the cosine similarity between embeddings for every clinical term pair and measure its association with the corresponding clinician similarity scores using Kendall’s τ rank correlation coefficient (Fig. 2B). Grouping statistics by clinician rating reveals a positive correlation, with mean cosine similarity increasing across scores 1–5 (0.30, 0.53, 0.58, 0.63, 0.61). Across the 11 disease areas, ClinVec achieves the highest correlation in 6 specialities (circulatory, endocrine/metabolic, mental disorders, sense organs, digestive, and dermatologic), and remains competitive in the remaining 5 where MedCPT or BioLORD occasionally perform better (Table 1). We see significant gains in performance for mental disorders, where LLM-based methods struggled to capture clinically meaningful physiological manifestations, such as associating “chest tightness” with post-traumatic stress disorder or “brain tomography” with Alzheimer’s disease. We also find that ClinVec effectively captures cross–organ-system associations, such as links between ulcerative colitis and “excessive sweating” and between nonalcoholic fatty liver disease and “trouble sleeping”, both digestive diseases with well‑recognized extraintestinal manifestations. In contrast, the LLM‑based methods assigned these pairs low similarity.
Fig. 2. Concordance between ClinVec embedding similarity and clinical expert scores.

a Overview of clinical expert review process. b We report the mean cosine similarity across all disease-SNOMED CT pairs stratified by clinical expert scores 1–5. c We stratify cosine similarity scores across the four largest disease categories and show examples of SNOMED CT codes that were assigned a clinical expert score of 5.
Table 1.
Concordance between embedding similarity and clinical expert scores across ClinVec and biomedical LLMs
| BioBERT | UmlsBERT | MedCPT | BioLORD | ClinVec | |
|---|---|---|---|---|---|
| Circulatory system | 0.241 (0.039) | 0.107 (0.039) | 0.396 (0.039) | 0.329 (0.036) | 0.399 (0.037) |
| Neoplasms | 0.234 (0.032) | 0.173 (0.033) | 0.468 (0.028) | 0.379 (0.028) | 0.240 (0.032) |
| Endocrine/metabolic | 0.246 (0.039) | 0.168 (0.040) | 0.273 (0.039) | 0.409 (0.036) | 0.450 (0.038) |
| Genitourinary | 0.366 (0.071) | 0.353 (0.074) | 0.573 (0.066) | 0.524 (0.052) | 0.232 (0.078) |
| Mental disorders | 0.201 (0.075) | 0.159 (0.069) | 0.508 (0.051) | 0.450 (0.057) | 0.601 (0.040) |
| Sense organs | 0.254 (0.085) | 0.201 (0.084) | 0.540 (0.090) | 0.486 (0.093) | 0.689 (0.062) |
| Neurological | −0.054 (0.113) | −0.013 (0.100) | 0.130 (0.116) | 0.239 (0.110) | 0.172 (0.112) |
| Musculoskeletal | 0.221 (0.116) | 0.334 (0.092) | 0.475 (0.100) | 0.541 (0.086) | 0.336 (0.108) |
| Digestive | 0.232 (0.089) | 0.173 (0.081) | 0.427 (0.075) | 0.396 (0.069) | 0.441 (0.071) |
| Respiratory | 0.441 (0.089) | 0.084 (0.114) | 0.618 (0.066) | 0.495 (0.098) | 0.515 (0.096) |
| Dermatologic | −0.238 (0.143) | −0.238 (0.130) | 0.101 (0.137) | 0.208 (0.120) | 0.283 (0.122) |
Kendall rank correlation coefficient measured between clinical expert scores 1-5 and cosine similarity of clinical term pairs using biomedical LLM-based methods and ClinVec. We perform 100 bootstrap samples and report the mean and standard deviation of the correlation coefficient across each model and disease category. The highest correlation statistic across models is bolded.
Embedding space reveals clinically grounded symptom patterns
We next demonstrate that ClinVec embeddings capture complex semantic properties, reflecting clinical knowledge that extends beyond anatomy groupings. Analogous to the geometric properties of word embeddings in natural language processing, clinical embeddings can be arithmetically combined to yield new representations that align with known disease patterns75. As we sequentially sum the symptom embeddings associated with a given disease, the cosine similarity between the resulting aggregated symptom vector and the corresponding disease embedding increases with each added symptom (Fig. 3a–c).
Fig. 3. Embedding operations mirror symptomatic manifestations of clinical conditions.

a–c Line plot showing the cosine similarity across Multiple Sclerosis, Graves’ Disease, and Systemic lupus erythematosus with aggregated symptom embeddings. d, e Visualization of embedding space overlaid ICD10CM and UMLS codes shaded by cosine similarity with systematic lupus erythematosus and Marfan syndrome. The target disease embedding is denoted with a star, and the black diamonds indicate each disease’s symptom list. f We show the mean reciprocal rank and hits @ k across a set of nine chronic diseases. The value of k is computed as the per cent of the total number of possible diseases. Retrieval of chronic diseases was performed across all ICD10CM codes present in ClinVec (N = 34,842). g Retrieval of 14 rare genetic disorders across all UMLS concepts corresponding to an OMIM id, at least one HPO phenotype-association, and present in ClinVec (N = 900).
We repeat this analysis across nine chronic conditions and additionally compare the similarity of aggregated symptom embeddings to related diseases. For example, the symptoms of chronic obstructive pulmonary disease yield an aggregate embedding with high cosine similarity to the lung cancer embedding (Supplementary Fig. S3), and the symptom and disease embeddings for multiple sclerosis, Graves’ disease, and lupus cluster closely together (Supplementary Fig. S4). In contrast, these symptom sets show limited similarity to Crohn’s disease, despite its autoimmune etiology, likely due to digestive symptoms that are less relevant for the other conditions, highlighting how the precise choice of symptoms shapes semantic validity in the latent space. To assess robustness, we perform sensitivity analyses to mimic uncertainty in symptom selection, incorrect disease specification, and random noise in EHR data, and we find key results robust to these perturbations across all scenarios (Supplementary Fig. S5).
To assess this pattern more concretely, we use the prior nine common chronic diseases and an additional fourteen rare genetic disorders to construct a retrieval task. For each disease, we aggregate its associated symptom information by summing the ClinVec embeddings of all symptoms into a single “symptom vector,” and then perform zero-shot retrieval of the target disease by ranking all disease concepts according to cosine similarity with this symptom vector. Disease symptoms can span multiple organ systems and are not always localized within the embedding space, where symptom embeddings may appear unrelated because they do not have a high similarity with the target disease. For example, many symptoms for lupus are non-specific (e.g. fatigue, headache) and symptoms for Marfan syndrome span musculoskeletal, ocular, and cardiovascular systems (Fig. 3d, e).
As a comparison, we also perform this analysis with BioBERT, representing each disease’s symptoms by a single embedding derived from the concatenated symptom list and the disease itself with an embedding of its full name. Retrieval of chronic diseases was performed across all ICD10CM codes present in ClinVec (N = 34,842), and the retrieval of rare genetic disorders was performed across all OMIM diseases present in ClinVec (N = 900). We find that ClinVec embeddings achieve a higher mean reciprocal rank and hits@k compared to the other methods in both the chronic disease and rare disorder scenarios (Fig. 3f, g). We also find that ClinVec substantially outperforms BioBERT on the set of rare genetic disorders, for which BioBERT correctly retrieves only a single disease within the top 100 candidates, and ClinVec correctly retrieves 7 out of 14 diseases.
ClinVec enables knowledge-grounded LLMs
ClinVec embeddings can be incorporated into foundation models, such as LLMs, through knowledge injection76–79 (Fig. 4a). Using MMed-Llama-8B78 (MMed-Llama), we append ClinVec embeddings to the MMed-Llama’s original vocabulary and add a projector module that maps the dimension of ClinVec embeddings to the same dimension as MMed-Llama (Supplementary Fig. S6). We perform parameter-efficient fine-tuning to both MMed-Llama and the projector module. However, the ClinVec embeddings are frozen and are not updated during fine-tuning. We assess the impact of augmenting an LLM with ClinVec in medical question answering, where we evaluate the MedQA dataset80, which contains questions from the US Medical Licensing Exams (USMLE). We apply the UMLS MetaMap API81 to map question text to UMLS concepts, retrieve the corresponding ClinVec embeddings, and append them to the tokenized prompt (Supplementary Fig. S7). This process allows the incorporation of clinically grounded knowledge at inference time to guide the response without extensive retraining.
Fig. 4. Integrating ClinVec with large language models improves medical question-answering.

a Overview diagram of question-answering with knowledge injection using ClinVec. b Accuracy of N = 1247 medical questions in the MedQA dataset. The red line denotes random performance with four answer options. c Accuracy of N = 3724 multiple-choice questions from AfriMed-QA dataset. The red line denotes baseline performance with five answer options. d Line plot showing the number of ClinVec embeddings included in MedQA questions by the absolute gain in accuracy. Standard errors are estimated from bootstrapped samples. e Stratified performance across questions of different clinical specialities. The right- and left-hand markers denote performance with and without the inclusion of ClinVec, and the connecting line denotes the difference in absolute performance.
Assessing performance with a held-out test set of MedQA questions (N = 1247), we find a 10.3% increase in question-answering accuracy when incorporating ClinVec (acc = 0.64) compared to question answering without it (acc = 0.58) (Fig. 4b). We observe the largest performance gains when questions are short, likely because shorter questions have limited contextual information for the language model to leverage. Adding one or two ClinVec embeddings leads to an average improvement of 11.7%, suggesting that the relationship information encoded in these embeddings helps compensate for missing context. Performance continues to improve as more tokens are added, reaching a peak at around 9 to 10 tokens (Fig. 4d).
To assess generalizability across different clinical scenarios, we also examined the recently released AfriMed-QA dataset82, which consists of 3724 multiple-choice questions collected from healthcare settings across 16 African countries. We observe a similar magnitude of performance improvement where we observe an accuracy of 0.64 with the addition of clinical knowledge embeddings compared to 0.59 without—a 8.5% increase (Fig. 4c). We identify the specialties with the greatest performance gains, including hematology ( + 37.0%) and ophthalmology ( + 20.3%) (Fig. 4e). Hematology shows the largest gains, likely due to the distinct disease presentations encountered in African healthcare settings that are underrepresented in the training data of most large language models, such as HIV and certain infectious diseases. These findings provide an example of how anchoring model responses in ClinVec can improve the performance of medical question-answering across geographic contexts and medical specialities.
ClinVec stratifies patients by disease risk and severity
We next investigate how ClinVec can be utilized in the context of patient outcome prediction, including disease progression and disease risk. Analogous to polygenic risk score frameworks83, we compute a phenotype risk score84 by scanning a patient’s EHR and aggregating the clinical codes as features. Each feature is weighted by the cosine similarity between the corresponding clinical code embedding and target disease embedding (Methods). We validated our approach using retrospective EHR data from 4.57 million individuals at Clalit Health Services (CHS)85 and examined three clinical conditions with the largest sample sizes in the CHS chronic disease registry: chronic kidney disease (CKD), chronic obstructive pulmonary disease (COPD), and heart failure (Supplementary Fig. S8). For each disease, the codes with the highest similarity to the target disease align with established comorbidities, laboratory findings, and medication usage. For chronic kidney disease, diabetes mellitus ranks among the top features and is a recognized risk factor; proteinuria also appears and can signal early disease.
By ranking patients by their risk score percentiles, we observe the separation of patients according to disease status across all three conditions, particularly at the extreme end of the risk distribution (Fig. 5a–c). Within the group of individuals in the lower 10th percentile of the risk score distribution for CKD, there is a disease prevalence of 6.2%. For patients above the 99th percentile, the disease prevalence increases to 23.4%. We next evaluate how well the risk score percentiles capture disease severity and mortality risk. Since patients with higher risk scores reflect a greater number of EHR codes linked to the target disease, this may also indicate more severe disease presentations. To address confounding effects, we restrict the assessment to patients of the same age and sex for each disease (using the median age and the most common sex per disease). Re-calibrating score percentiles, we observe a stratification by 6-year survival rate (Fig. 5d–f). For CKD (age = 72 sex = Male), individuals within the top quintile of this score distribution for CKD had a relative 42.6% lower 6-year survival compared to those in the bottom quartile (top-quartile: 56.8% survival proportion, bottom-quartile: 76.5%).
Fig. 5. Clinical code embedding risk scores correlate with disease prevalence and severity.

a–c We provide scatter plots showing the risk score percentiles of each disease versus the disease prevalence within each bin. Dots are shaded according to disease prevalence. d–f We show the survival curve of cases that match the most common sex and age at diagnosis for each disease cohort. Lines are shaded by score percentiles, and standard error intervals are computed using 10,000 bootstrap samples. Columns are divided by diseases: COPD (Chronic Obstructive Pulmonary Disease), CKD (Chronic Kidney Disease), and Heart Failure.
Discussion
We introduce ClinGraph, a clinical knowledge graph, and ClinVec, a corresponding embedding store of 153,166 clinical vocabulary embeddings. These embeddings capture patterns among clinical codes that reflect human anatomy, disease presentation, and healthcare organization. Evaluations by inter-institutional panels of clinicians from the United States and Israel confirm that the embeddings align with clinical practice. ClinVec embeddings encode semantic relationships that support the combination and comparison of clinical concepts, creating a knowledge-grounded representation of clinical data that can be used in downstream machine learning applications. These representations are also well-suited to serve as inputs to foundation models, which can be adapted to specific tasks through fine-tuning with labeled datasets86–88. Integrating ClinVec with LLMs through knowledge injection, we demonstrate how the representations in ClinVec can improve medical question-answering accuracy. We illustrate how ClinVec embeddings enable unsupervised patient prediction across diseases. ClinVec provides an embedding store for knowledge-grounded AI models that can be shared across healthcare systems without privacy risk.
While ClinGraph and ClinVec provide a structured representation of clinical knowledge, they have several limitations. ClinGraph inherits errors and gaps from the clinical knowledge bases and ontologies on which it is built. Clinical ontologies cover specific aspects of care, disease mechanisms, or healthcare organization, which limits their coverage of the full medical domain, and KGs constructed from these ontologies reflect these biases. Some information may be outdated or missing, particularly for conditions and populations that are underrepresented in biomedical research. These limitations propagate into the learned embeddings and can lead to representations that are dominated by well-studied diseases. In addition, ontological concepts follow a long tail distribution, where sparsely connected concepts are weakly represented. To address this issue, we upsample low-degree nodes when sampling negative edges during link prediction, which increases the representation of sparsely connected concepts during graph transformer training. This approach reduces dominance by highly connected nodes and improves representations for concepts with sparse knowledge graph neighborhoods.
Linking concepts across multiple vocabularies can introduce challenges in how relationships are encoded. To maintain relationship quality, ClinGraph includes edges from curated cross-mappings, including GEM, ATC PROD, UMLS, and PheMap. We use a single edge type in ClinGraph, because modeling distinct relationship types would require harmonizing definitions across sources, a process that demands additional clinical expertise and curation. As a result, we model distinct node types but do not encode edge-specific semantics. Extending ClinGraph to support typed edges is an important direction for future work. Another limitation of this study is the scope of applications we evaluate. Our goal is to show how ClinVec can incorporate structured clinical knowledge, not to provide a full benchmark of task-specific models. For knowledge injection, we use a controlled setup to measure the contribution of ClinVec. Future work will include comparison against retrieval augmented generation techniques such as GraphRAG89 and larger language models77,90,91. For disease prediction, additional comparisons with alternative models, including established clinical risk scores and disease-specific guidelines92–94, would provide a more clinically grounded assessment of ClinVec-based representations. In the future, we want to expand the coverage of genetic and Mendelian diseases in ClinGraph and ClinVec. We plan to incorporate codes from phecodeX, an updated vocabulary that includes chromosomal anomalies, as well as resources focused on Mendelian diseases, such as the Online Mendelian Inheritance in Man (OMIM)95 and Human Phenotype Ontology (HPO)96. We also plan to integrate databases that capture biological mechanisms, including those involving genes and proteins, to improve the representation of diseases with complex or poorly defined clinical features.
Methods
Constructing ClinGraph
We use eight standardized clinical vocabularies to construct all clinical concepts in ClinGraph and ClinVec: Unified Medical Language System (UMLS)7, International Classification of Diseases (ICD)97, Anatomical Therapeutic Chemical (ATC) Classification16, RxNorm55, Systemized Nomenclature of Medicine—Clinical Terms (SNOMED CT)17, Current Procedural Terminology (CPT)56, Logical Observation Identifiers Names and Codes (LOINC)18, and phecodes98. We designate a node for each clinical concept. We define a clinical concept as an entry within a clinical vocabulary with a unique identifier.
We begin by integrating the clinical codes and relationships defined in the UMLS vocabulary. We incorporate all UMLS CUIs (concept unique identifier) with a source vocabulary in ICD10CM, SNOMED CT, LOINC, RxNorm, ATC, or CPT (N = 42,883 nodes). Next, we integrate all ICD10CM codes up to two decimal places (N = 34,842) and all ICD9CM codes. We add information from the phecode coding system, which represents clinical phenotypes as phecodes54, formed by aggregating groups of diagnostic codes (i.e., ICD codes) into clinical sub-groupings (N = 1817). Next, we add nodes representing LOINC Part codes, which are standardized attribute values used to construct the LOINC codes that specify a given laboratory test. We restrict our inclusion to only LOINC Part component codes which refer to the substance being tested (N = 14,399). We also incorporate all CPT codes (N = 4377), ATC codes (levels 3–5: N = 5179), and RxNorm drug groups (N = 10,130).
Next, we integrate a subset of SNOMED CT codes as nodes, where we restrict the inclusion to the most clinically relevant codes. We select all SNOMED CT codes from the CORE (Clinical Observations Recording and Encoding) Subset, a set of the most frequently used codes designated to maximize data interoperability across institutions99. We also include the Convergent Medical Terminology subset diagnosis list, a set of core SNOMED CT codes originally curated by Kaiser Permanente and is now used across numerous healthcare systems100.
We formally organize the clinical codes and relationships into a heterogeneous knowledge graph21 called ClinGraph. We draw an undirected edge between two clinical codes if they have a parent–child relationship or cross-reference as defined in the source vocabularies. Edges between ICD9CM and ICD10CM codes are derived from the GEM57, the official crosswalk mapping diagnoses codes to and from ICD9CM and ICD10CM. Edges between ICD10CM and SNOMED CT are derived from the official ICD10CM—SNOMED CT mapping101. To construct relationships between RxNorm and ATC codes, we use ATC PROD, a product-level mapping of RxNorm to ATC-4 classes102.
We designate edges between UMLS CUI nodes and RxNorm/ATC nodes based on the ‘may_treat’ and ‘may_prevent’ relationships defined in UMLS. This is repeated for linking UMLS CUI nodes and CPT nodes using the ‘associated_procedure_of’, ‘procedure_site_of’, and ‘pathology_of’ relationships defined in UMLS. SNOMED CT nodes are connected using the ‘cause_of’, ‘definitional_manifestation_of’, ‘associated_with’, ‘due_to’, ‘occurs_after’, and ‘occurs_before’ relationships with UMLS CUIs.
We incorporate relationships defined by the PheMap database, an existing knowledge base of biomedical knowledge derived from text mining and natural language processing of open-source biomedical literature58. This database offers relationship pairs linking phecodes and clinical codes from other medical vocabularies, including RxNorm, CPT, LOINC, and SNOMED CT. These relationships can be interpreted as a phenotype being “associated with” a given clinical concept.
Multiple edges are drawn if two nodes have a relationship defined multiple times (e.g., a relationship between a phecode and ICD9CM code derived from the phecode hierarchy and the PheMap knowledge base). The final graph comprises 153,166 nodes across four node types and 2,873,025 edges, and the distribution of nodes and edges can be found in Supplementary Tables S1 and S2.
Heterogeneous graph transformer
A heterogeneous graph, , is defined by a set of nodes and edges . We define a mapping function where each node has an assigned node type . Here, the node types represent different clinical vocabularies. For a given graph, , we denote the GNN, as a function that maps a vector of features for a node , written as , to a vector of real numbers representing the latent space:
Here, is the dimension of the input vector. This resulting mapped vector (also called an embedding) is denoted by . For convenience of notation, we assume that the input and output dimensions are equal. We provide a table with relevant notation and indicate whether they are an inferred parameter within the model (Table 2).
Table 2.
Summary of notation
| Variable | Description | Dimension | Trainable (Y/−) |
|---|---|---|---|
| Graph | - | - | |
| Set of vertices or nodes | - | - | |
| Set of edges | - | - | |
| Space of node types | - | - | |
| d | Input dimension | - | |
| L | Number of layers | - | |
| Graph neural network function | Y | ||
| Feature vector of node u | - | ||
| Embedding vector of node u | Y | ||
| Neighborhood of node u | - | - | |
| Message feature of node u | Y | ||
| Embedding of node u at the lth layer | Y | ||
| Attention vector for node u | Y | ||
| h | Number of heads | - | |
| Weight matrices | Y | ||
| Attention head vector for source node u and target node v | Y | ||
| Weight matrices for attention computation | Y | ||
| Weight matrix for attention computation | Y | ||
| Query and key vectors | Y | ||
| Hadamard product between A and B | - | - | |
| Element-wise summation | - | - | |
| ) | Row-level concatenation of the set vectors | - | - |
| Similarity scoring function | - | Y | |
| L2-norm | - | ||
| Node forming a positive edge with | - | - | |
| Node that does not form an edge with | - | - | |
| Graph with masked edges | - | - |
We provide a summary of the variables used in deriving the graph transformer network model, the dimension of each variable, and whether it is a learned or fixed parameter. Rows are sorted according to the order in which each variable is introduced.
We model the architecture of our graph neural network (GNN) after the heterogeneous graph transformer (HGT)62. In this work, we briefly describe the key model steps. The complete derivation of HGT is detailed in previous work62.
Learning involves aggregating information across the graph structure defined by . For a target node , we define its neighborhood, , as the set of nodes with a direct connection or edge with t. Information is propagated through the graph by gathering information from the neighborhood of , which is aggregated into a message feature . The embedding of t can be updated with the resulting message feature, where is the embedding of node at the l + 1 layer and UPD(·) refers to an update function that integrates messages with the current node embedding. Note that the input of the l + 1 layer is the output of the previous layer, and by stacking L layers , we represent the final HGT as a composition of these functions across all layers:
The input of the model is the set of node features, for all nodes in which is then used to initialize the layer embedding of each node . In practice, each of the node features is initialized using Xavier noise. The embedding represents the relational information learned from the knowledge graph without additional information from the node features.
The HGT uses multi-head attention, which is a key feature of the transformer architecture63. Multi-head attention utilizes multiple attention mechanisms, or heads, in parallel to tend to different parts of the input, where each head has its own set of learnable weights. Updating a node’s embedding involves aggregating messages across all heads and weighting each message by its attention score. This mechanism essentially up- and down-weights messages based on their importance so that only necessary information is propagated to the target node.
For a target node , a single attention head is a series of linear projections of the embedding from the previous layer, normalized by the embedding dimension. Here, a linear projection for an input , is defined as an affine linear transformation, where is a bias term, and is a learnable weight matrix. For convenience, we drop the bias term in the following derivations, but in practice, the parameter corresponding to the bias term is absorbed into the estimation of
The series of linear projections mirrors the standard query, key, and value vectors used in the standard transformer architecture. The attention score vector corresponding to the edge between source node s and target node t, represented as , is computed as the concatenation of each head’s output:
Here, the operator “” represents the elementwise or Hadamard product between and , and the operator “” represents the row-level concatenation of the given set of vectors .
The input vector is , and the learnable weight matrices are , and where is the input dimension divided by the number of heads. For these weight matrices, the subscripts refer to the query, key, and value elements in the transformer. The resulting query and key vectors follow as . The resulting attention vectors from each head and final multi-head attention vector are and . And to ensure the attention scores for the target node t sum to 1, a is applied across all neighbors of t.
For target node t, we first compute the message vectors across all heads for each neighbor of t. This message is calculated as a linear projection of the embedding for source node s from the prior layer multiplied by a weight matrix (). Each head maintains its own linear projection matrix, but is shared across all attention heads.
The final message passed from is a concatenation of messages produced from each of the h heads. This resulting message vector is then multiplied by the multi-head attention vector. The final updated embedding () is computed by aggregating across all neighbors of the node through an elementwise sum. This is followed by a linear projection (), which creates a separate projection for each node type. This is then followed by a residual connection and passed through an activation function:
The learnable weight matrices are , , and . The message vector is . The operator represents the elementwise summation. Training the final model involves optimizing the set of learnable weight matrices, across h heads and finding that minimizes the loss function .
Self-supervised learning
For a given node , our goal is to generate an embedding that quantifies the topological information of the graph w.r.t . The learning objective can be framed as a link prediction problem, where given two nodes and , we want to train a function to predict whether an edge exists between these two nodes. This function can be described by,
where and represents the trained GNN function that provides the node embeddings. Note that because edges are undirected and the scoring function is symmetric,
Optimizing this above scoring functions means solving for the parameters of . This can be performed using contrastive learning. We mask a random subset of edges to create a modified version of the graph, . Then, given a source node , we define a node where represents a target node that forms an edge with in the original graph . We denote as a node that does not form an edge with in and denote the set of these negative examples as .
The function is trained on to estimate whether a source node forms an edge with target node in the original graph We can quantify the probability of an edge existing between and with negative edges as the probability,
Given a dataset of N source nodes, each with a corresponding set of candidate nodes as described above, the negative log-likelihood over the dataset is equivalent to the cross-entropy loss where the true “class” always corresponds to the positive node . This type of contrastive loss function is well established67,103–105 and is formulated as follows:
where and .
Learning ClinVec embeddings from ClinGraph
Using the heterogeneous graph transformer framework, we model four distinct node types in ClinGraph to reflect how each vocabulary is utilized in clinical care: administrative diagnosis codes (ICD9CM, ICD10CM, phecodes), treatments (ATC, RxNorm), patient clinical state indicators (LNC, CPT), and semantic clinical terminologies (SNOMED CT, UMLS). Modeling distinct edge types would require harmonizing relationship definitions across databases, a process that would require additional resources and clinical expertise. For this reason, we only model distinct node types and leave the implementation of edge-type-specific embeddings as future work.
The contrastive learning requires specifying positive and negative edges during training, where a positive edge is defined as a pair of nodes with an existing edge in ClinGraph, and a negative edge is a pair of nodes that are not connected by an edge. To generate a training tuple comprised of a single positive edge and a set of corresponding negative edges, we randomly sample an existing edge within ClinGraph denoted as and is the node type of target node . To create a negative sample, we select a node such that and
We use node neighbor sampling to select only a subset of nodes to include at each layer when computing a node’s message vector due to the large size of the KG. Specifically, we take a sample n of neighbors at each k-hop neighborhood at each gradient descent step when computing messages during optimization. Node types with a smaller set of nodes in ClinGraph are upweighted to ensure they are represented in the sampling. The number of samples at each layer is a hyperparameter selected through hyperparameter tuning. The final training was performed on an H100 GPU for ten epochs, during which we trained on all 2,873,025 edges of the KG.
We perform hyperparameter tuning in two steps: first for the model architecture and then for the parameters involved in the contrastive learning objective. We select a random subset of 500,000 edges for training and 100,000 for validation from ClinGraph. We perform hyperparameter tuning using Raytune where we fix the learning rate (1e-4), number of negative samples (10), batch size (100), and sampling neighborhood (10) and vary the following parameters: number of layers (2, 3, 4), input feature dimension (128, 256, 512), output embedding dimension (128, 256, 512), head dimension (128, 256, 512), number of heads (2, 3, 4), and dropout (0, 0.1, 0.2). The optimal set of GNN parameters is 4 layers, 128 input dimensions, 128 output embedding dimensions, 512-dimension head size, three heads, and a dropout of 0.0.
We repeat the hyperparameter selection process by fixing the parameters selected above and vary the following: learning rate (1e-3, 1e-4, 1e-5), neighborhood sampling (5, 10, 20), and number of negative samples (3, 5, 10). The final hyperparameter set selected is a learning rate of 1e-5, neighborhood sampling of 20 nodes, and three negative samples. All experiments were performed using the Ray Tune software (https://docs.ray.io/en/latest/tune/index.html).
After training a heterogeneous graph transformer on ClinGraph (“Methods: Stochastic mini-batch training with neighbor sampling”), we freeze all model parameters and compute a single embedding vector for every node via a full‑graph inference pass. Each node embedding is computed with a batch size of 1. The input node features are set using Xavier initialization and then are passed through the trained four-layer GNN. At inference time, we disable neighbor sampling and aggregate messages from all available neighbors. We take the final‑layer hidden state as that node’s ClinVec representation (dim = 128).
Analyzing the ClinVec embedding space
To visualize the entire ClinVec embedding space, we perform UMAP dimensionality reduction106 (n_neighbors=35, min_dist=0.97, metric = ‘cosine’) directly on the embedding vectors and plot the first two dimensions. Phecode embeddings are shaded according to organ-level classification, and ATC5 embeddings are shaded according to ATC-level 1 categorizations.
We construct an alternative version of ClinGraph without the use of PheMap, an empirically constructed knowledge base derived from the biomedical literature. We refer to this specific graph construction as ‘ClinGraph-PheMap-ablation’. To assess the impact of noise, such as small amounts of incorrect or incomplete information, we shuffled 1% of edges such that the source node was connected to a randomly selected destination node (of the same node type) and refer to this as ‘ClinGraph-noise’.
We generate embeddings for PrimeKG and SNOMED-CT KG using the same HGT architecture and hyperparameters as ClinGraph. Because neither KG has ICD or ATC codes, we mapped the nodes as follows. For SNOMED-CT KG, we mapped each SNOMED CT code to its UMLS CUI and then to its corresponding ICD10CM code if present. If a UMLS CUI does not have a corresponding source ICD10CM code, we remove the node embedding from the cluster calculation. To map SNOMED CT to ATC, we first mapped SNOMED CT codes to their UMLS CUI. We then used UMLS to identify UMLS CUI codes with ‘ingredient-of’ relationships that describe the active ingredient (represented as ATC) present in each UMLS CUI drug. SNOMED CT codes that did not have a mapped ATC ingredient were removed from the clustering calculation. PrimeKG represents diseases and symptoms as MONDO and HPO codes. These were mapped to ICD10CM codes using mappings provided by MONDO107 (https://github.com/monarch-initiative/mondo/tree/master/src/ontology/mappings). PrimeKG represents drugs as DrugBank IDs; we map each ID to ATC5 codes using the DrugBank database. For PrimeKG, we modeled 10 node types as defined by the KG. For SNOMED-CT KG, we only used a single node type (i.e., homogenous graph) since all nodes represent SNOMED CT codes. Clustering metrics, including silhouette score and adjusted mutual information, were computed according to ATC-level 1 and phecode organ category.
Measuring hierarchical consistency of disease diagnoses with phecodes
We evaluate whether ClinVec and baseline models preserve clinically meaningful hierarchical relationships by testing whether embeddings place parent–child codes closer together than sibling codes. Although all of these diagnoses are related and should lie in a similar region of the embedding space, broader or narrower representations of the same condition ought to be more similar to each other than to distinct conditions, mirroring how disease hierarchies are used in clinical practice. We use the phecode disease hierarchy as ground truth. While phecodes from version 1.2 were used to construct ClinGraph, we derive the ground truth hierarchy from the latest version, PhecodeX108. For each phecode, we select one of its mapped ICD codes as the target, sample a “positive” ICD code from its parent or child phecode, and sample two “negative” ICD codes from sibling phecodes (sharing the same phecode parent but representing distinct diagnoses). In total, 3284 phecodes are evaluated, covering N = 11,422 ICD9 codes and N = 53,010 ICD10 codes.
We use the corresponding ICD9 and ICD10 embeddings from ClinVec, and for each LLM baseline, we embed the ICD9/10 code description. For each triplet (target, positive, two negatives), we compute the cosine similarities between the target and candidate ICD codes and record whether the positive code receives the highest similarity score. We refer to this metric as the “hit rate”. Model performance is summarized as the hit rate computed over all triplets for both ICD9 and ICD10. We repeat this process 100 times and report the mean and standard deviation of the hit rate stratified by disease category.
Generic-brand drug matching task
We assess whether embeddings for generic drugs align with the corresponding brand-name drug embeddings. Specifically, we connect the generic drug ingredient or clinical drug and its corresponding branded drug name; for example, the branded drug Tylenol has the generic form acetaminophen. In total, N = 440 (360 generic, 379 brand name) generic-brand pairs are present in ClinVec. The majority of drugs represented in ClinVec are on the ingredient level, but a subset of the most commonly used brand-name drugs is also included in ClinGraph (specifically through the PheMap database), leading to a reduced sample size for evaluation. Generic drugs are represented as RxNorm concepts, and ground‑truth brand names are identified via RxNorm using the “tradename of” relationship. This information was not used when constructing ClinGraph and ClinVec.
For each generic drug with a corresponding brand name present in ClinVec, we sample one “positive sample” as a brand linked to that generic and two “negative sample” brands under three settings: (1) random negatives drawn from any other brand drugs, (2) negatives restricted to drugs in the same ATC class, and (3) negatives whose names are lexically similar to the true brand (fuzzy matching ratio >60). The two negative samples will always be sampled from the same sampling scheme. For LLM baselines, we obtain an embedding by encoding the drug name, and ClinVec uses RxNorm code embeddings for generic drugs and UMLS concepts for brand-name drugs. For each triplet (generic, positive brand, two negatives), we compute cosine similarities between the generic drug embedding and each brand drug embedding and record how many times the true brand has the highest similarity. We refer to this metric as the “hit rate”. For every model and negative‑sampling setting, we perform 100 resampling iterations and report the mean and standard deviation of the hit rate.
Clinical evaluation study
We perform an evaluation with groups of clinical experts from Brigham and Women's Hospital (N = 1), Massachusetts General Hospital (N = 1), Boston Children’s Hospital (N = 1), and Clalit Health Services (N = 3). The panel was provided a scoring rubric where they were asked to evaluate each clinical concept according to how clinically relevant each code is to the given disease phenotype. We utilize a Likert scale109 based on scores 1–5: ‘unrelated’ (1) and ‘ highly related’ (5). If a code is too broad or non-specific (e.g., ‘Clinical evaluation’), these are excluded from the performance metric calculations. ClinVec has embedding representations for SNOMED CT codes corresponding to the clinical terms. For LLM-based baselines, we obtain an embedding for each clinical term by encoding its human‑readable label (e.g., “cardiovascular disease”). In total, there are N = 3767 clinical term pairs spanning 11 disease areas.
For each model, we compute the cosine similarity between embeddings for every clinical term pair and measure its association with the corresponding clinician similarity scores using Kendall’s τ rank correlation coefficient, which we selected due to its handling of ties in ordinal ratings. We perform 100 bootstrap samples and report the mean and standard deviation of the correlation coefficient across each model and disease category.
Disease embedding arithmetic
We selected nine common chronic diseases, including common WHO-listed noncommunicable diseases and a set of chronic autoimmune conditions. We specifically included autoimmune conditions because their symptoms often span multiple organ systems, allowing us to assess the resulting aggregated embedding even when symptoms appear unrelated. We derived disease-symptom lists from Mayo Clinic clinical descriptions, which provide disease symptoms as an itemized list. To align symptoms with concepts in ClinVec, a clinician annotated each target disease and symptom set with the corresponding ICD10CM codes.
The target disease name, corresponding ICD10CM code, link to the Mayo Clinic description, and the number of symptoms per disease are in Supplementary Table S8. For each disease symptom, we provide the symptom name extracted from the Mayo Clinic clinical description and clinician-mapped ICD10CM in Supplementary Table S9.
We added a set of 14 diseases with disease-phenotype associations curated from OMIM. We selected the same set of rare genetic disorders as described in Morley et al110. and utilized HPO phenotype annotations as “gold standard” symptom sets. To align diseases and symptoms with concepts in ClinVec, we converted OMIM disease ids and HPO codes to UMLS concept ids. The target disease name, OMIM id, corresponding UMLS concept id, link to the HPO annotations, and the number of phenotype associations per disease are in Supplementary Table S10.
For each disease, we aggregate its associated symptom information by summing the ClinVec embeddings of all symptoms into a single “symptom vector” and then perform zero-shot retrieval of the target disease by ranking all disease concepts according to cosine similarity with this symptom vector. We apply this procedure to nine common chronic diseases and record the rank of the true disease for each case. As a comparison, we repeat the analysis with BioBERT, representing each disease’s symptoms by a single embedding derived from the concatenated symptom list and the disease itself with an embedding of its full name. Retrieval was performed across all ICD10CM codes present in ClinVec, excluding those in categories ‘S’, ‘T’, ‘U’, ‘V’, and ‘Z’ since these code external causes of injury and contact with health services (N = 42,883). For the rare disorders, retrieval was performed across all UMLS concepts corresponding to an OMIM ID, had at least one phenotype-association annotated in HPO, and present in ClinVec (N = 900).
We perform the same analysis above while perturbing different variables in the framework. To model real-world noise and uncertainty, we vary the ICD10CM code used to represent each symptom. We select a candidate set of ICD10CM codes for each symptom by taking the original ICD10CM from the clinician review and selecting all ICD10CM codes with the same parent code. For example, for code ‘786.2’ (Cough), the candidate set would include ‘786.1’ (Stridor), ‘786.0’ (Dyspnea and respiratory abnormalities), etc. Then, when selecting each symptom embedding for aggregation, a random code from the candidate set is selected. This process is repeated 10 times, yielding similarity curves constructed from 10 sets of disease symptoms.
To simulate when the disease of interest is mis-specified, we compare the aggregated symptoms to a set of diseases similar to the target disease. This was determined as the set of ICD10CM codes sharing the same parent code with the original disease. When computing the similarity between the aggregated symptoms and the target disease embedding, the embedding of each alternative embedding was instead used. To simulate situations where incorrect information is included in the symptom list, we randomly selected an ICD10CM from the symptom list and replaced it with a randomly chosen ICD10CM code. We place the random symptom at the beginning of the aggregation procedure and repeat the process 10 times for each set of symptoms.
Integrating ClinVec with LLMs
Fine-tuning was performed on the training English subset of multiple-choice questions from the MedQA dataset (https://huggingface.co/datasets/VodLM/medqa). We also perform a validation study on the AfriMed-QA82 dataset (https://huggingface.co/datasets/intronhealth/afrimedqa_v2). We restricted ourselves to only multiple-choice questions and removed questions that had more than one assigned correct answer. This dataset also provides clinical subspecialty information for each question.
We annotate each multiple-choice question using the MetaMap111 tool, which annotates natural language text with UMLS CUI codes. For each question, we concatenated the text from the question with the answer options and submitted the text to the MetaMapLite REST API. We limit the choice of UMLS CUI codes to the following semantic types: “Sign or Symptom”, “Disease or Syndrome”, “Pharmacological Substance”, “Mental or Behavioral Dysfunction”, “Chemical”, “Anatomical Structure”. In the tokenization process, we append a token corresponding to the selected ClinVec embedding.
We base our analysis on a pre-trained biomedical LLM, specifically MMed-Llama-8B, an 8-billion-parameter open-source medical foundation model that already incorporates domain-specific knowledge through pre-training. We downloaded both the pre-trained model and tokenizer from Hugging Face: https://huggingface.co/Henrychur/MMed-Llama-3-8B. While our experiments focus on this specific model, the proposed knowledge-injection framework is, in principle, applicable to other LLM architectures.
We augment the base MMed-Llama model with 42,883 ClinVec embeddings corresponding to the UMLS concepts present in ClinGraph. We limit our analysis to this subset of concepts since the specific annotations produced by MetaMap only provide UMLS concepts. In principle, the entire set of ClinVec embeddings can be integrated into this knowledge-injection framework. We extend the tokenizer by adding a special token for each UMLS concept (e.g. ‘<C0001080 > ’) and maintain a separate embedding matrix for these ClinVec tokens. Specifically, the original embedding matrix in MMed-Llama remains unchanged, and the ClinVec embeddings are frozen at this stage. During preprocessing, we annotate each input question with UMLS concepts and append the corresponding ClinVec tokens to the original token sequence. An overview of our framework is in Supplementary Fig. S6.
To align the ClinVec embeddings with the MMed-Llama’s embedding space, we add a four-layer multilayer perceptron projector module with layers consisting of sizes 128 → 512 → 1024 → 4096. This projector module maps the 128-dimension ClinVec embedding to a 4096-dimension vector, which is consistent with the dimension of MMed-Llama’s embeddings. When a ClinVec token is encountered, its frozen embedding is retrieved from the ClinVec embedding matrix and passed through the projector; tokens from MMed-Llama’s original vocabulary bypass the projector because they are already 4096‑dimensional. The projected ClinVec embeddings and the original MMed-Llama token embeddings are then combined into a single sequence embedding matrix, which is fed into the MMed-Llama decoder for downstream processing.
We adapt the official MMed-Llama pipeline for medical question answering and use LoRA (Low-Rank Adaptation) for parameter‑efficient fine‑tuning: https://github.com/MAGIC-AI4Med/MMedLM/tree/main. Specifically, we apply LoRA (rank r = 16, as in the original MMed-Llama study) to the ClinVec projector and to the ‘q_proj’, ‘k_proj’, and ‘v_proj’ modules in the MMed-Llama decoder. All other parameters in the base model and all ClinVec embeddings remain frozen. Using the MedQA training data split and prompts provided in the MMed-Llama pipeline, training samples are constructed from a prompt, question and answer options, and ClinVec annotations. The resulting output is evaluated using standard next‑token cross‑entropy. We refer to the fine‑tuned model with the ClinVec projector as Baseline+ClinVec and to the otherwise identical model without this module as Baseline (Supplementary Fig. S6). The full training pipeline is publicly available at our repository: https://github.com/mims-harvard/ClinVec/tree/main/tutorials/060_medqa.
Phenotype risk scoring
We first selected all patients with at least one ICD9CM code from the list of case inclusion codes (CHS encodes their EHR using ICD9CM) and filtered to patients listed in the CHS chronic registry to confirm they have received a disease diagnosis. Because patients are not guaranteed to be added to the chronic registry when they are first diagnosed, we treat the first occurrence of the inclusion ICD9CM code as the date of diagnosis. For each patient, we set the index date as January 1 of the year of diagnosis, where only information occurring before the index date will be included in the risk score computation. For prediction, we select all EHRs recorded within the past 5 years of the index date.
To define controls, we begin with the phecode exclusion criteria provided by the phecode mapping v1.2. For each phecode, the mapping provides a list of exclusion phecodes that are typically similar conditions or overlap with the target disease. We begin by selecting all individuals who have never received any exclusion diagnoses at any point in their EHR. We also remove individuals from the chronic disease registry for the specified disease. We select a matched control from this set of candidate control patients for each case. Matching is based on the following criteria: 1) same sex, 2) year of birth ±2 years, and 3) number of recorded diagnoses in the EHR (with at least one diagnosis in the EHR). The complete case-control process is illustrated in Supplementary Fig. S5 and a summary of patient cohorts in Supplementary Table S11.
For each disease, we compute a risk score as a cosine-weighted sum over clinical codes, where each weight is the cosine similarity between the code embedding and the disease embedding. We restricted the set of potential features to laboratory tests, medications, and ICD9CM codes with at least a 0.1% prevalence within the CHS patient population. The CHS EHR did not have SNOMED CT or CPT codes for analysis. To determine the clinical codes related to each disease, we compute the cosine similarity between all clinical codes within the latent space and the target disease embedding, represented by a phecode. The final set of features is the top k codes, where k = 20, and the feature weights are the cosine similarity scores. In practice, the choice of k can be treated as a hyperparameter and optimized with a validation dataset. Patient risk scores are computed as a weighted sum where the associated weight is added to the sum if the patient has the given code in their EHR and given a 0 otherwise. Features are counted once in the score computation, even if a patient receives the codes multiple times.
For each disease, we computed the most common age at diagnosis and the sex with the highest disease prevalence. We restricted the survival analysis to patients meeting these age/sex criteria and those with a diagnosis date from 2016 or earlier. We re-computed risk score quantiles based only on this restricted set of patients. We looked at the 6 years of EHR after each patient’s index date and denoted a patient as deceased if they had a non-null death date. Patients were stratified into risk score quartiles based on the risk score computed at the index date. Confidence intervals for the survival curves were computed using 10,000 bootstrapped samples.
Ethics approval
Parts of this study that relate to the use of CHS data (for evaluating the predictive ability of the KG-derived concept embeddings) were approved by the Clalit Health Services Institutional Review Board (Helsinki) committee under approval number COM1-0161-19. This study was exempt from requiring written informed consent due to its retrospective nature of the study.
Supplementary information
Acknowledgements
R.J., B.Y.R., R.D.B., N.D. and M.Z. are supported by the Berkowitz Family Living Laboratory at Harvard Medical School and the Clalit Research Institute. R.J. and M.Z. gratefully acknowledge the support of NSF CAREER 2339524, US DoD FA8702-15-D-0001, awards from Harvard Data Science Initiative, Amazon Faculty Research, Google Research Scholar Program, AstraZeneca Research, Roche Alliance with Distinguished Scientists, Sanofi iDEA-iTECH, Pfizer Research, Chan Zuckerberg Initiative, John and Virginia Kaneb Fellowship at Harvard Medical School, Biswas Computational Biology Initiative in partnership with the Milken Institute, Harvard Medical School Dean’s Innovation Fund for the Use of Artificial Intelligence, and Kempner Institute for the Study of Natural and Artificial Intelligence at Harvard University. Any opinions, findings, conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the funders. We gratefully acknowledge the resources provided by the Clalit Research Institute. We thank Michelle M. Li, Ayush Noori, Intae Moon, and Shvat Messica for contributing to the model development and analyses.
Author contributions
R.J. developed a unified knowledge graph representation of clinical concepts and designed, implemented, and benchmarked heterogeneous graph transformer models. U.G. implemented the approach and conducted detailed analyses using CHS individual-level data. X.S. assisted in writing code and planning the medical question answering analyses. L.H., J.W., S.D., C.R.G., P.H. and R.S. formed an inter-institutional panel of clinicians that evaluated the alignment of clinical concept representations with established clinical knowledge across 90 diseases and 3000 clinical codes. B.Y.R., R.B. and G.S. provided feedback on the methodology and evaluated the clinical concept embeddings through large-scale phenotype risk scoring and alignment with expert clinical knowledge. R.J., N.D. and M.Z. conceptualized and designed the study. All authors contributed to writing the manuscript.
Data availability
Data and clinical concept embeddings, as well as the ClinGraph knowledge graph, are available via Harvard Dataverse https://doi.org/10.7910/DVN/Z6H1A8. An interactive visualization platform is available at https://huggingface.co/spaces/mims-harvard/ClinVec. Due to national and organizational data privacy regulations, CHS individual-level data from this study cannot be shared publicly.
Code availability
The Python implementation of the heterogeneous graph transformer and the associated codebase for model training, (non-individual-level) analyses, and embedding evaluations are available at https://github.com/mims-harvard/ClinVec. The project website is at https://zitniklab.hms.harvard.edu/projects/ClinVec.
Competing interests
The authors declare no competing interests.
Footnotes
Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Contributor Information
Noa Dagan, Email: noada@clalit.org.il.
Marinka Zitnik, Email: marinka@hms.harvard.edu.
Supplementary information
The online version contains supplementary material available at https://doi.org/10.1038/s41746-026-02664-9.
References
- 1.Vuokko, R., Vakkuri, A. & Palojoki, S. Systematized nomenclature of medicine–clinical terminology (SNOMED CT) clinical use cases in the context of electronic health record systems: systematic literature review. JMIR Med. Inform.11, e43750 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 2.Schwab, J. D. et al. The necessity of interoperability to uncover the full potential of digital health devices. JMIR Med. Inform.11, e49301 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 3.Kotecha, D. et al. CODE-EHR best-practice framework for the use of structured electronic health-care records in clinical research. Lancet Digit. Health4, e757–e764 (2022). [DOI] [PubMed] [Google Scholar]
- 4.Poulos, J., Zhu, L. & Shah, A. D. Data gaps in electronic health record (EHR) systems: an audit of problem list completeness during the COVID-19 pandemic. Int. J. Med. Inf.150, 104452 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 5.OMOP Common Data Model. https://ohdsi.github.io/CommonDataModel/index.html.
- 6.Index - FHIR v5.0.0. https://www.hl7.org/fhir/index.html.
- 7.Bodenreider, O. The Unified Medical Language System (UMLS): integrating biomedical terminology. Nucleic Acids Res.32, D267–D270 (2004). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 8.Schriml, L. M. et al. Human Disease Ontology 2018 update: classification, content and workflow expansion. Nucleic Acids Res47, D955–D962 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 9.Hulsen, T. et al. From big data to precision medicine. Front. Med.6, 34 (2019). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 10.Topol, E. J. High-performance medicine: the convergence of human and artificial intelligence. Nat. Med.25, 44–56 (2019). [DOI] [PubMed] [Google Scholar]
- 11.The Shaky Foundations of Foundation Models in Healthcare. https://hai.stanford.edu/news/shaky-foundations-foundation-models-healthcare (2023).
- 12.Miotto, R., Li, L., Kidd, B. A. & Dudley, J. T. Deep patient: an unsupervised representation to predict the future of patients from the electronic health records. Sci. Rep.6, 26094 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 13.Yang, Z., Mitra, A., Liu, W., Berlowitz, D. & Yu, H. TransformEHR: transformer-based encoder-decoder generative model to enhance prediction of disease outcomes using electronic health records. Nat. Commun.14, 7857 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 14.Fallahpour, A. et al. EHRMamba: towards generalizable and scalable foundation models for electronic health records. Preprint at 10.48550/arXiv.2405.14567 (2024). [DOI]
- 15.Wornow, M., Thapa, R., Steinberg, E., Fries, J. A. & Shah, N. H. EHRSHOT: an EHR benchmark for few-shot evaluation of foundation models. In Proc. 37th International Conference on Neural Information Processing Systems 67125–67137 (Curran Associates Inc. Red Hook, NY, USA, 2024).
- 16.ATCDDD - Structure and principles. https://atcddd.fhi.no/atc/structure_and_principles/.
- 17.SNOMED CT. https://www.nlm.nih.gov/healthit/snomedct/index.html.
- 18.Forrey, A. W. et al. Logical observation identifier names and codes (LOINC) database: a public use set of codes and names for electronic reporting of clinical laboratory test results. Clin. Chem.42, 81–90 (1996). [PubMed] [Google Scholar]
- 19.Singh, A., Nadkarni, G., Guttag, J. & Bottinger, E. Leveraging hierarchy in medical codes for predictive modeling. In Proc. 5th ACM Conference on Bioinformatics, Computational Biology, and Health Informatics 96–103 10.1145/2649387.2649407 (Association for Computing Machinery, 2014). [DOI]
- 20.Choi, E., Xiao, C., Stewart, W. F. & Sun, J. MiME: multilevel medical embedding of electronic health records for predictive healthcare. In Proc. 32nd International Conference on Neural Information Processing Systems 4552–4562 (Curran Associates Inc., Red Hook, NY, USA, 2018).
- 21.Wilcke, X., Bloem, P. & de Boer, V. The knowledge graph as the default data model for learning on heterogeneous knowledge. Data Sci.1, 39–57 (2017). [Google Scholar]
- 22.Nicholson, D. N. & Greene, C. S. Constructing knowledge graphs and their biomedical applications. Comput. Struct. Biotechnol. J.18, 1414–1428 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 23.Chandak, P., Huang, K. & Zitnik, M. Building a knowledge graph to enable precision medicine. Sci. Data10, 67 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 24.Santos, A. et al. A knowledge graph to interpret clinical proteomics data. Nat. Biotechnol.40, 692–702 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 25.Stear, B. J. et al. Petagraph: a large-scale unifying knowledge graph framework for integrating biomolecular and biomedical data. Sci. Data11, 1338 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 26.Tang, A. S. et al. Leveraging electronic health records and knowledge networks for Alzheimer’s disease prediction and sex-specific biological insights. Nat. Aging4, 379–395 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 27.Jiang, P., Xiao, C., Cross, A. & Sun, J. GraphCare: enhancing healthcare predictions with personalized knowledge graphs. Preprint at 10.48550/arXiv.2305.12788 (2024). [DOI]
- 28.Gao, Y. et al. Leveraging medical knowledge graphs into large language models for diagnosis prediction: design and application study. JMIR AI4, e58670 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 29.Alsentzer, E. et al. Few shot learning for phenotype-driven diagnosis of patients with rare genetic diseases. Npj Digit. Med.8, 380 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 30.Wang, Y., Yang, Z. & Yao, Q. Accurate and interpretable drug-drug interaction prediction enabled by knowledge subgraph learning. Commun. Med.4, 59 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 31.Karim, M. R. et al. Drug-drug interaction prediction based on knowledge graph embeddings and convolutional-LSTM network. In Proc. 10th ACM International Conference on Bioinformatics, Computational Biology and Health Informatics 415–423 https://dl.acm.org/doi/10.1145/3307339.3342161 (ACM, 2019).
- 32.Devarakonda, M. V., Mohanty, S., Sunkishala, R. R., Mallampalli, N. & Liu, X. Clinical trial recommendations using Semantics-Based inductive inference and knowledge graph embeddings. J. Biomed. Inform.154, 104627 (2024). [DOI] [PubMed] [Google Scholar]
- 33.Orr, L., Sanyal, A., Ling, X., Goel, K. & Leszczynski, M. Managing ML pipelines: feature stores and the coming wave of embedding ecosystems. Proc. VLDB Endow.14, 3178–3181 (2021). [Google Scholar]
- 34.Chen, H. et al. Drug target prediction through deep learning functional representation of gene signatures. Nat. Commun.15, 1853 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 35.Istrate, A.-M., Li, D. & Karaletsos, T. scGenePT: is language all you need for modeling single-cell perturbations? Preprint at 10.1101/2024.10.23.619972 (2024). [DOI]
- 36.Chen, H., Nguyen, N. D., Ruffalo, M. & Bar-Joseph, Z. A unified analysis of atlas single-cell data. Genome Res.35, 1219–1233 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 37.Yang, K. K., Wu, Z., Bedbrook, C. N. & Arnold, F. H. Learned protein embeddings for machine learning. Bioinformatics34, 2642–2648 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 38.Dallago, C. et al. Learned embeddings from deep learning to visualize and predict protein sets. Curr. Protoc.1, e113 (2021). [DOI] [PubMed] [Google Scholar]
- 39.St.Morris, P., Clair, R., Hahn, W. E. & Barenholtz, E. Predicting binding from screening assays with transformer network embeddings. J. Chem. Inf. Model.60, 4191–4199 (2020). [DOI] [PubMed] [Google Scholar]
- 40.Qi, Y., Sachan, D., Felix, M., Padmanabhan, S. & Neubig, G. When and Why Are Pre-Trained Word Embeddings Useful for Neural Machine Translation? In Proc. 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies Vol. 2, 529–535 10.18653/v1/N18-2084 (Association for Computational Linguistics, 2018). [DOI]
- 41.Di Gangi, M. A. & Federico, M. Monolingual Embeddings for Low Resourced Neural Machine Translation. In Proc. 14th International Conference on Spoken Language Translation (eds Sakti, S. & Utiyama, M.) 97–104 (International Workshop on Spoken Language Translation, 2017).
- 42.Weiss, K., Khoshgoftaar, T. M. & Wang, D. A survey of transfer learning. J. Big Data3, 9 (2016). [Google Scholar]
- 43.Wang, Y. & Qu, W. A tutorial on the pretrain-finetune paradigm for natural language processing. Preprint at 10.48550/arXiv.2403.02504 (2024). [DOI]
- 44.Arora, S., May, A., Zhang, J. & Ré, C. Contextual embeddings: when are they worth it? In Proc. 58th Annual Meeting of the Association for Computational Linguistics (eds. Jurafsky, D., Chai, J., Schluter, N. & Tetreault, J.) 2650–2663 10.18653/v1/2020.acl-main.236 (Association for Computational Linguistics, 2020). [DOI]
- 45.Chang, W.-C., Yu, F. X., Chang, Y.-W., Yang, Y. & Kumar, S. Pre-training tasks for embedding-based large-scale retrieval. Preprint at 10.48550/arXiv.2002.03932 (2020). [DOI]
- 46.Schwaller, P., Hoover, B., Reymond, J.-L., Strobelt, H. & Laino, T. Extraction of organic chemistry grammar from unsupervised learning of chemical reactions. Sci. Adv.7, eabe4166 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 47.Theodoris, C. V. et al. Transfer learning enables predictions in network biology. Nature618, 616–624 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 48.Zhang, Z. et al. Plug-and-play knowledge injection for pre-trained language models. Preprint at 10.48550/arXiv.2305.17691 (2023). [DOI]
- 49.Coppolillo, E. Injecting knowledge graphs into large language models. https://arxiv.org/html/2505.07554v1 (2025).
- 50.Zhang, Y. et al. Question-guided Knowledge Graph Re-scoring and Injection for Knowledge Graph Question Answering. In Findings of the Association for Computational Linguistics: EMNLP 2024 (eds. Al-Onaizan, Y., Bansal, M. & Chen, Y.-N.) 8972–8985 10.18653/v1/2024.findings-emnlp.524 (Association for Computational Linguistics, 2024). [DOI]
- 51.Su, X. et al. Multimodal medical code tokenizer. Preprint at 10.48550/arXiv.2502.04397 (2025). [DOI]
- 52.Agarwal, K. et al. Snomed2Vec: random walk and poincaré embeddings of a clinical knowledge base for healthcare analytics. Preprint at 10.48550/arXiv.1907.08650 (2019). [DOI]
- 53.Finch, A. et al. Exploiting hierarchy in medical concept embedding*. JAMIA Open4, ooab022 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 54.Bastarache, L. Using phecodes for research with the electronic health record: from PheWAS to PheRS. Annu. Rev. Biomed. Data Sci.4, 1–19 (2021). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 55.RxNorm. https://www.nlm.nih.gov/research/umls/rxnorm/index.html.
- 56.CPT® overview and code approval. American Medical Associationhttps://www.ama-assn.org/practice-management/cpt/cpt-overview-and-code-approval (2024).
- 57.ICD-10 General Equivalence Mapping. Guidance Portal. https://www.hhs.gov/guidance/document/icd-10-general-equivalence-mapping (2024).
- 58.Zheng, N. S. et al. PheMap: a multi-resource knowledge base for high-throughput phenotyping within electronic health records. J. Am. Med. Inform. Assoc.27, 1675–1687 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 59.Morris, J. H. et al. The scalable precision medicine open knowledge engine (SPOKE): a massive knowledge graph of biomedical information. Bioinformatics39, btad080 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 60.Himmelstein, D. S. et al. Systematic integration of biomedical knowledge prioritizes drugs for repurposing. eLife6, e26726 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 61.Zou, Y. et al. Modeling electronic health record data using an end-to-end knowledge-graph-informed topic model. Sci. Rep.12, 17868 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 62.Hu, Z., Dong, Y., Wang, K. & Sun, Y. Heterogeneous graph transformer. Preprint at 10.48550/arXiv.2003.01332 (2020). [DOI]
- 63.Vaswani, A. et al. Attention is all you need. Preprint at 10.48550/arXiv.1706.03762 (2023). [DOI]
- 64.Ma, A. et al. Single-cell biological network inference using a heterogeneous graph transformer. Nat. Commun.14, 964 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 65.Gharizadeh, A., Abbasi, K., Ghareyazi, A., Mofrad, M. R. K. & Rabiee, H. R. HGTDR: advancing drug repurposing with heterogeneous graph transformers. Bioinformatics40, btae349 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 66.Jiang, Y. et al. Pharmacophoric-constrained heterogeneous graph transformer model for molecular property prediction. Commun. Chem.6, 60 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 67.Oord, A. van den, Li, Y. & Vinyals, O. Representation learning with contrastive predictive coding. Preprint at 10.48550/arXiv.1807.03748 (2019). [DOI]
- 68.Johnson, R. Clinical A. I. knowledge graph embeddings. Harvard Dataverse 10.7910/DVN/Z6H1A8 (2025). [DOI]
- 69.Lee, J. et al. BioBERT: a pre-trained biomedical language representation model for biomedical text mining. Bioinformatics36, 1234–1240 (2020). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 70.Michalopoulos, G., Wang, Y., Kaka, H., Chen, H. & Wong, A. UmlsBERT: clinical domain knowledge augmentation of contextual embeddings using the unified medical language system metathesaurus. Preprint at 10.48550/arXiv.2010.10391 (2021). [DOI]
- 71.Jin, Q. et al. MedCPT: contrastive pre-trained transformers with large-scale PubMed search logs for zero-shot biomedical information retrieval. Bioinformatics39, btad651 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 72.Remy, F. et al. BioLORD-2023: semantic textual representations fusing large language models and clinical knowledge graph insights. J. Am. Med. Inform. Assoc.31, 1844–1854 (2024). [DOI] [PMC free article] [PubMed]
- 73.Pakhomov, S. et al. Semantic similarity and relatedness between clinical terms: an experimental study. Amia. Annu. Symp. Proc.2010, 572–576 (2010). [PMC free article] [PubMed] [Google Scholar]
- 74.Pakhomov, S. Semantic relatedness and similarity reference standards for medical terms. Data Repository for the University of Minnesota 10.13020/D6CX04 (2018). [DOI]
- 75.Mikolov, T., Yih, S. W. & Zweig, G. Linguistic regularities in continuous space word representations. In Proc. 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies 746–751 (Association for Computational Linguistics, 2013).
- 76.Singhal, K. et al. Toward expert-level medical question answering with large language models. Nat. Med.31, 943–950 (2025). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 77.Singhal, K. et al. Large language models encode clinical knowledge. Nature620, 172–180 (2023). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 78.Qiu, P. et al. Towards building multilingual language model for medicine. Preprint at 10.48550/arXiv.2402.13963 (2024). [DOI] [PMC free article] [PubMed]
- 79.Maharjan, J. et al. OpenMedLM: prompt engineering can out-perform fine-tuning in medical question-answering with open-source large language models. Sci. Rep.14, 14156 (2024). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 80.Jin, D. et al. What disease does this patient have? A large-scale open domain question answering dataset from medical exams. Preprint at 10.48550/arXiv.2009.13081 (2020). [DOI]
- 81.Demner-Fushman, D., Rogers, W. J. & Aronson, A. R. MetaMap lite: an evaluation of a new Java implementation of MetaMap. J. Am. Med. Inform. Assoc.24, 841–844 (2017). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 82.Olatunji, T. et al. AfriMed-QA: a pan-African, multi-specialty, medical question-answering benchmark dataset. Preprint at 10.48550/arXiv.2411.15640 (2025). [DOI]
- 83.Dudbridge, F. Power and predictive accuracy of polygenic risk scores. PLoS Genet.9, e1003348 (2013). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 84.Bastarache, L. et al. Phenotype risk scores identify patients with unrecognized Mendelian disease patterns. Science359, 1233–1239 (2018). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 85.Balicer, R. D. & Afek, A. Digital health nation: Israel’s global big data innovation hub. Lancet389, 2451–2453 (2017). [DOI] [PubMed] [Google Scholar]
- 86.Bommasani, R. et al. On the opportunities and risks of foundation models. Preprint at 10.48550/arXiv.2108.07258 (2022). [DOI]
- 87.Touvron, H. et al. LLaMA: open and efficient foundation language models. Preprint at 10.48550/arXiv.2302.13971 (2023). [DOI]
- 88.DeepSeek-AI et al. DeepSeek-V3 technical report. Preprint at 10.48550/arXiv.2412.19437 (2025). [DOI]
- 89.Han, H. et al. Retrieval-augmented generation with graphs (GraphRAG). Preprint at 10.48550/arXiv.2501.00309 (2025). [DOI]
- 90.Yang, X. et al. A large language model for electronic health records. NPJ Digit. Med.5, 194 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 91.Sellergren, A. et al. MedGemma technical report. Preprint at 10.48550/arXiv.2507.05201 (2025). [DOI]
- 92.Tangri, N. et al. Multinational assessment of accuracy of equations for predicting risk of kidney failure: a meta-analysis. JAMA315, 164–174 (2016). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 93.Yourman, L. C., Lee, S. J., Schonberg, M. A., Widera, E. W. & Smith, A. K. Prognostic indices for older adults: a systematic review. JAMA307, 182–192 (2012). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 94.Anstey, K. J. et al. Dementia risk scores and their role in the implementation of risk reduction guidelines. Front. Neurol.12, 765454 (2022). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 95.Amberger, J. S., Bocchini, C. A., Schiettecatte, F., Scott, A. F. & Hamosh, A. OMIM.org: online mendelian Inheritance in Man (OMIM®), an online catalog of human genes and genetic disorders. Nucleic Acids Res.43, D789–D798 (2015). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 96.Robinson, P. N. et al. The human phenotype ontology: a tool for annotating and analyzing human hereditary disease. Am. J. Hum. Genet.83, 610–615 (2008). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 97.International Classification of Diseases (ICD). https://www.who.int/standards/classifications/classification-of-diseases.
- 98.Denny, J. C. et al. PheWAS: demonstrating the feasibility of a phenome-wide scan to discover gene-disease associations. Bioinformatics26, 1205–1210 (2010). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 99.The CORE Problem List Subset of SNOMED CT®. https://www.nlm.nih.gov/research/umls/Snomed/core_subset.html.
- 100.Convergent Medical Terminology (CMT) Release Files. https://www.nlm.nih.gov/research/umls/Snomed/cmt.html.
- 101.SNOMED CT to ICD-10-CM Map. https://www.nlm.nih.gov/research/umls/mapping_projects/snomedct_to_icd10cm.html.
- 102.National Library of Medicine. ATCPROD, a product-level mapping of RxNorm to ATC1-4 classes. RxNav Newshttps://lhncbc.nlm.nih.gov/RxNav/news/ATCPROD-202307.html (2023).
- 103.Radford, A. et al. Learning transferable visual models from natural language supervision. Preprint at 10.48550/arXiv.2103.00020 (2021). [DOI]
- 104.Sohn, K. Improved Deep Metric Learning with Multi-class N-pair Loss Objective. In Adv. Neural Inf. Process. Syst. Vol. 29 (Curran Associates, Inc., 2016).
- 105.Chen, T., Kornblith, S., Norouzi, M. & Hinton, G. A simple framework for contrastive learning of visual representations. In Proc. 37th International Conference on Machine Learning Vol. 119, 1597–1607 (JMLR.org, 2020).
- 106.McInnes, L., Healy, J. & Melville, J. UMAP: uniform manifold approximation and projection for dimension reduction. Preprint at 10.48550/arXiv.1802.03426 (2018). [DOI]
- 107.Vasilevsky, N. A. et al. Mondo: integrating disease terminology across communities. Genetics232, iyaf215 (2026). [DOI] [PMC free article] [PubMed] [Google Scholar]
- 108.Shuey, M. M. et al. Next-generation phenotyping: introducing phecodeX for enhanced discovery research in medical phenomics. Bioinformatics39, btad655 (2023). [DOI] [PMC free article] [PubMed]
- 109.Likert, R. A technique for the measurement of attitudes. Arch. Psychol.22 140, 55–55 (1932). [Google Scholar]
- 110.Morley, T. J. Phenotypic signatures in clinical data enable systematic identification of patients for genetic testing. Nat. Med. 27, 1097–1104 (2021). [DOI] [PMC free article] [PubMed]
- 111.AAronson, A. R. Effective mapping of biomedical text to the UMLS Metathesaurus: the MetaMap program. Proc. AMIA Symp. 17–21 (2001). [PMC free article] [PubMed]
Associated Data
This section collects any data citations, data availability statements, or supplementary materials included in this article.
Supplementary Materials
Data Availability Statement
Data and clinical concept embeddings, as well as the ClinGraph knowledge graph, are available via Harvard Dataverse https://doi.org/10.7910/DVN/Z6H1A8. An interactive visualization platform is available at https://huggingface.co/spaces/mims-harvard/ClinVec. Due to national and organizational data privacy regulations, CHS individual-level data from this study cannot be shared publicly.
The Python implementation of the heterogeneous graph transformer and the associated codebase for model training, (non-individual-level) analyses, and embedding evaluations are available at https://github.com/mims-harvard/ClinVec. The project website is at https://zitniklab.hms.harvard.edu/projects/ClinVec.
