ClinVec: Unified Embeddings of Clinical Codes Enable Knowledge-Grounded AI in Medicine

Ruth Johnson, Uri Gottlieb, Galit Shaham, Lihi Eisen, Jacob Waxman, Stav Devons-Sberro, Curtis R. Ginder, Peter Hong, Raheel Sayeed, Ben Y. Reis, Ran D. Balicer, Noa Dagan, Marinka ŽitnikmedRxiv 2024 · DOI

TL;DR

Researchers have developed a massive "map" of medical knowledge by converting 67,124 clinical codes into high-dimensional embeddings. By training a graph transformer on a network of 1.3 million clinical relationships (PheKG), they’ve created a tool that allows AI to understand the biological reality behind administrative billing codes, enabling more accurate and generalizable precision medicine.

What Problem Does This Paper Address?

In modern healthcare, Artificial Intelligence (AI) primarily learns from Electronic Health Records (EHRs). However, EHRs are messy. The medical codes they contain (like ICD-9 for diagnoses or RxNorm for drugs) are often optimized for insurance billing and hospital operations rather than clinical logic. This creates a "misalignment" where an AI might pick up on administrative patterns unique to one hospital—like how a specific doctor prefers to code a cough—rather than the underlying disease biology.

This lack of a standardized, "knowledge-grounded" representation makes it difficult for AI models to generalize across different hospitals or countries. Furthermore, existing medical AI often struggles with rare codes or the complex, multi-layered relationships between a lab test, a symptom, and a final diagnosis.

Methods

The authors constructed a resource of unified clinical embeddings using a three-stage pipeline:

  1. Knowledge Graph Construction (PheKG): They built a massive network called PheKG by integrating seven standardized medical vocabularies (ICD-9, SNOMED CT, RxNorm, LOINC, CPT, ATC, and Phecodes). Crucially, this graph was built using established medical ontologies and literature-mined relationships (via PheMap), not patient data. This ensures the model learns "textbook" medical knowledge rather than local billing quirks.
  2. Graph Transformer Architecture: To process this graph, they used a Heterogeneous Graph Transformer (HGT). This neural network uses "mutual attention" to learn how different types of nodes (e.g., a drug vs. a procedure) relate to one another.
  3. Self-Supervised Learning: The model was trained to predict missing links in the graph. By learning which codes "belong" together in the network, the model generates a 128-dimensional vector (embedding) for every code. Codes with similar clinical meanings end up close to each other in this mathematical space.

Datasets

  • Knowledge Sources: PheMap (a literature-derived knowledge base), UMLS (Unified Medical Language System), and various standard ontologies.
  • Validation Dataset: A massive retrospective cohort of 4.57 million patients from Clalit Healthcare Services (CHS) in Israel.
  • Evaluation Panels: Expert clinician panels from the United States (Brigham and Women’s, Mass General, Boston Children’s) and Israel (CHS) were used to manually grade the relevance of the embeddings.

Key Insights and Ideas

  • Medical "Word2Vec": Much like how "King - Man + Woman = Queen" works in natural language processing, these embeddings support clinical arithmetic. Adding the embedding for Diabetes to Kidney Disease results in a vector very close to Diabetic Nephropathy.
  • Anatomical Organization: When visualized, the embeddings naturally cluster by organ system (e.g., digestive, nervous, circulatory) and clinical subspecialty, despite the model never being explicitly told about human anatomy.
  • Zero-Shot Portability: Because the embeddings are built on universal medical knowledge rather than specific patient records, they are "privacy-preserving" and can be shared across institutions without any risk of leaking sensitive patient data.
  • Accumulating Evidence: The authors found that as a patient "accumulates" symptoms in the embedding space, the pooled representation of those symptoms moves closer and closer to the actual disease diagnosis, mirroring the diagnostic process of a human physician.

Key Results

  • Survival Stratification: Using the embeddings to calculate a "phenotype risk score," the researchers could stratify patients by severity. For Chronic Kidney Disease (CKD), patients in the top risk quartile had a 28% lower 6-year survival rate compared to the bottom quartile.
  • Clinician Consensus: In a "blind" test, clinicians rated the top-ranked codes identified by the embeddings as "relevant" or "very relevant" 58.9% of the time, compared to only 9% for randomly selected codes.
  • International Consistency: There was a remarkably high correlation between how doctors in Boston and doctors in Israel perceived the relationships captured by the embeddings, proving the resource captures "universal" clinical truths.

Limitations and Future Work

  • Uncertainty: The current model treats all clinical relationships as equal; it doesn't yet account for varying levels of evidence or "uncertainty" in medical literature.
  • Demographic Context: The embeddings do not currently account for age or sex differences in disease presentation (e.g., how a heart attack looks different in men vs. women).
  • Rare Diseases: While the resource covers common and chronic conditions well, it has limited coverage of rare genetic and Mendelian disorders.
  • Future Directions: The authors plan to integrate "PhecodeX" (a more granular coding system) and incorporate biological mechanism data, such as protein-protein interaction networks, to deepen the AI’s understanding of disease pathways.

Summary updated

Abstract

Integrating structured clinical knowledge into artificial intelligence (AI) models remains a major challenge. Medical codes primarily reflect administrative workflows rather than clinical reasoning, limiting AI models' ability to capture true clinical relationships and undermining their generalizability. To address this, we introduce <i>ClinGraph</i>, a clinical knowledge graph that integrates eight EHR-based vocabularies, and <i>ClinVec</i>, a set of 153,166 clinical code embeddings derived from <i>ClinGraph</i> using a graph transformer neural network. <i>ClinVec</i> provides a machine-readable representation of clinical knowledge that captures semantic relationships among diagnoses, medications, laboratory tests, and procedures. Panels of clinicians from multiple institutions evaluated the embeddings across 96 diseases and more than 3,000 clinical codes, confirming their alignment with expert knowledge. In a retrospective analysis of 4.57 million patients from Clalit Health Services, we show that <i>ClinVec</i> supports phenotype risk scoring and stratifies individuals by survival outcomes. We further demonstrate that injecting <i>ClinVec</i> into large language models improves performance on medical question answering, including for region-specific clinical scenarios. <i>ClinVec</i> enables structured clinical knowledge to be injected into predictive and generative AI models, bridging the gap between EHR codes and clinical reasoning.
BibTeX
@misc{johnson2024clinvec,
  author = {Ruth Johnson and Uri Gottlieb and Galit Shaham and Lihi Eisen and Jacob Waxman and Stav Devons-Sberro and Curtis R. Ginder and Peter Hong and Raheel Sayeed and Ben Y. Reis and Ran D. Balicer and Noa Dagan and Marinka Žitnik and Marinka Zitnik},
  title = {{ClinVec: Unified Embeddings of Clinical Codes Enable Knowledge-Grounded AI in Medicine}},
  year = {2024},
  doi = {10.1101/2024.12.03.24318322},
  howpublished = {medRxiv},
}
Figure