SMI: Ontology-Grounded Semantic IDs for Hierarchy-Aware Medical Concept Representation

Ziyang Song, Lia Shen, Yixuan Li, Qincheng Lu, Weihao Li, Haoran Xu, He Zhu, Xinyu Wang, Yue LiNeurIPS 2026

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.

Figure 1: SMI better distinguishes hierarchical relations than BioBERT on ICD 1-hop predic- tion. (a) SMI consistently improves hierarchical relation prediction across levels, with the largest gains at finer ICD granularities. (b) SMI maintains stronger and more stable performance than BioBERT across concept-frequency bins, suggesting that medical ontology structure helps mitigate representation degradation for long-tailed clinical codes.

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?

Figure 2: Overview of SMI and hierarchy-aware medical concept embedding. a. An expert-curated medical ontology organizes clinical concepts from coarse to fine levels. b. A frozen biomedical LM encodes clinical codes at each ontology level into level-specific embeddings. c. SMI represents each medical concept by its coarse-to-fine ontology path as a Semantic ID and aggregates the corresponding embeddings to form a hierarchy-aware medical concept representation.

Here is how SMI works:

  1. 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).
  2. 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).
  3. 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.
Figure 3: Visualization of ICD diagnosis embeddings across 13 major categories using UMAP. (a) BioBERT embeddings. (b) SMI embeddings. ICD codes embedded by SMI form more distinct category-level clusters that are better aligned with the medical ontology.

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

Abstract

Biomedical language models (LMs) provide strong representations for clinical tasks, but they often fail to capture the hierarchical structure among medical concepts. This limitation is especially pronounced for rare and fine-grained clinical codes in long-tailed vocabularies, where hierarchy-agnostic LM representations become less informative as concept frequency decreases. We introduce Semantic Medical Identifier (SMI), a training-free framework for constructing ontology-grounded Semantic IDs and hierarchy-aware medical concept representations. For each diagnosis, procedure, or medication concept, SMI defines its Semantic ID as the coarse-to-fine path through an expert-defined medical ontology. SMI then aggregates frozen biomedical LM embeddings across the corresponding ontology levels to form hierarchy-aware medical concept representations that preserve coarse-to-fine clinical semantics. The base SMI uses uniform aggregation across ontology levels, while a level-weighted variant selects global level weights on validation data. Our theoretical analysis shows that SMI yields more informative medical concept representations than hierarchy-agnostic LM embeddings, particularly for rare and fine-grained clinical concepts. Experiments show that SMI captures meaningful hierarchical structure and improves clinical relation prediction. On MIMIC-IV, SMI improves mortality prediction, readmission prediction, drug recommendation, and rare drug prediction. On eICU, SMI yields more robust patient representations under cross-hospital distribution shift. The code is available on https://github.com/ZiyangS/SMI.
BibTeX
@inproceedings{song2026smi,
  author = {Ziyang Song and Lia Shen and YIXUAN LI and Qincheng Lu and Weihao Li and Haoran Xu and He Zhu and Xinyu Wang and Yue Li},
  title = {{SMI: Ontology-Grounded Semantic IDs for Hierarchy-Aware Medical Concept Representation}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2026},
  url = {https://openreview.net/forum?id=AMCfPRZTPu},
}
Figure