TL;DR
Biomedical language models struggle to represent rare, hyper-specific medical codes because they treat clinical concepts as isolated text strings rather than branches on a larger tree of medical knowledge. This paper introduces Semantic Medical Identifier (SMI), a training-free method that builds hierarchy-aware embeddings by simply summing frozen language model representations along a concept's coarse-to-fine clinical ontology path. It requires zero extra model training, rescues rare clinical concepts from noisy embeddings, and improves downstream clinical predictions and cross-hospital robustness.
What Problem Does This Paper Address?
Medicine is inherently hierarchical. A diagnosis like Type 2 diabetes mellitus with kidney complications (E11.2) isn't an isolated fact; it sits nested inside Type 2 diabetes (E11), which sits inside Diabetes mellitus, all the way up to Endocrine disease. Standard coding systems like ICD (for diagnoses/procedures) and ATC (for medications) map out these exact trees.
Yet, when we feed electronic health records (EHRs) into biomedical language models like BioBERT, we usually just hand the model the text description of the leaf node. For common, broad conditions, this works fine. However, clinical data is notoriously long-tailed—specific codes at the tips of the tree appear rarely in training corpora. Because data-driven embeddings degrade when word frequency drops, the model's representations for rare, fine-grained codes collapse into noise.
Previous fixes either require expensive, specialized pre-training on knowledge graphs or lock the hierarchy inside a task-specific supervised model. What's been missing is a lightweight, plug-and-play way to inject clinical tree structures directly into general-purpose embeddings.
Methods
If you've worked with recommender systems lately, you might recognize the term Semantic ID—representing an item as a sequence of discrete tokens from coarse to fine, usually learned via a quantization model (like RQ-VAE). The authors flip this idea on its head: why train a neural network to guess a hierarchy when doctors have spent decades curating exact medical taxonomies?
Here is how SMI works:
- Ontology Path as Semantic ID: Diagnoses, procedures, and medications are mapped onto expert-curated, five-level hierarchies (built using CCS, ICD, and ATC taxonomies). A code’s Semantic ID is simply its ordered path of ancestors from Level 1 (broadest) to Level 5 (most specific).
- Frozen Encoding: A standard, frozen BioBERT encoder generates an embedding for the text description of every node at every level (using mean-pooling over token embeddings).
- Aggregation: To get the final SMI embedding for a specific code, you just sum the embeddings of all five nodes along its Semantic ID path. No new trainable parameters required.
The authors also introduce SMI-W, a level-weighted variant that assigns a global scalar weight to each of the five hierarchy levels (selected via grid search on validation data) so that more informative levels can contribute more heavily to the sum.
Datasets
Because SMI is training-free, datasets are used strictly for evaluation and downstream linear probing:
- Medical Ontologies (ICD, CCS, ATC): Used to construct the five-level trees and evaluate within-ontology (ICD→ICD, ATC→ATC) and cross-ontology (ICD→ATC) clinical relation prediction.
- MIMIC-IV: EHR data from 123,488 patients used to test downstream clinical tasks: 90-day mortality prediction, 15-day readmission, general drug recommendation, and rare drug prediction (targeting 98 ATC codes occurring only 10–20 times).
- eICU: Multi-center EHR data spanning 24,179 patients across the 10 largest hospitals, used to measure how well patient representations hold up under cross-hospital distribution shift.
Key Insights and Ideas
- Rare embeddings live in a "noise shell": The authors model LM embeddings mathematically as a true semantic vector plus zero-mean noise whose variance scales inversely with corpus frequency. As frequency drops, the pairwise signal-to-noise ratio (SNR) vanishes—meaning rare diseases become geometrically indistinguishable from one another in standard LM space.
- Ancestors act as variance-reducing anchors: Inspired by classic word2vec compositionality, a child concept can be viewed as its parent's vector plus a specific offset (e.g., Diabetes + kidney complication). Because ancestor concepts appear much more frequently in text, their embeddings have much lower noise variance. Summing along the path anchors the noisy leaf node to stable, high-SNR parent representations.
- Untangling the embedding space: When you project standard BioBERT diagnosis codes into 2D space, major disease categories clump together in a messy hairball. Adding ancestor vectors pulls those representations apart into clean, clinically coherent islands.
Key Results
- Clinical Relation Prediction: SMI-W achieves the highest F-scores across the board: 71.5% on ICD (vs. 44.2% for BioBERT and 67.1% for SapBERT), 77.5% on ATC, and 57.6% on cross-ontology ICD→ATC prediction (beating the strongest baseline, HiTs, at 53.2%).
- Clustering Quality: On K-means clustering of ICD categories, SMI jumps Normalized Mutual Information (NMI) from BioBERT's 0.39 to 0.77, and Silhouette score from 0.04 to 0.52.
- Downstream EHR Tasks (MIMIC-IV): Using simple mean-pooled patient representations and linear heads, SMI-W outperforms specialized graph and language models on mortality (45.1% AUPRC, 88.0% AUROC) and drug recommendation (77.6% AUPRC, 65.3% F-score). Its biggest shine is on rare drug prediction, hitting 44.2% Recall@15 compared to 37.6% for BioBERT and 40.7% for G-BERT.
- Cross-Hospital Robustness (eICU): Evaluating out-of-domain log-likelihood gaps via hospital-specific VAEs, SMI cuts cross-site distribution shift down to 50.77 compared to BioBERT's 74.06 ($p = 1.97 \times 10^{-5}$), because hospitals that code differently at fine levels still share common ground at higher ontology levels.
Limitations and Future Work
SMI relies entirely on clean, expert-curated trees like ICD and ATC. If a hospital uses regional standards (such as Canada's ICD-10-CA or Drug Identification Numbers), or when newly approved drugs and emerging diseases appear, SMI requires manual ontology validation and code mapping before deployment. Looking ahead, the authors plan to explore harmonizing multiple coding systems into a unified SMI framework, discovering missing ontology links, and integrating broader biomedical knowledge graphs.
Summary updated