arXiv:2610.18672cs.CLOct 2026

Manuscript Offprint

arXiv:2610.18672

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 Li

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.

1 Introduction

The widespread adoption of electronic health record (EHR) systems has produced large-scale clinical data, enabling broad applications of language models (LMs) in healthcare. Biomedical LMs learn generalizable clinical representations for downstream tasks such as diagnosis prediction, drug recommendation, and patient risk stratification [Song et al., 2024, 2025, Wang et al., 2026]. However, most biomedical LMs remain predominantly data-driven and struggle to capture the hierarchical structure among medical concepts. Clinical coding systems such as the International Classification of Diseases (ICD) and the Anatomical Therapeutic Chemical (ATC) organize diagnoses, procedures, and medications into multi-level taxonomies, ranging from broad categories to fine-grained codes [Steindel, 2010, Chen et al., 2012]. Without explicitly modeling these medical ontologies, hierarchy-agnostic LMs encode each medical concept largely from its single-level textual description [Gao et al., 2019], limiting their ability to preserve coarse-to-fine clinical semantics.

40th Conference on Neural Information Processing Systems (NeurIPS 2026).

a. Hierarchical Relation Prediction Across Levels

Figure

b. Hierarchical Relation Prediction Across Concept Frequency

Figure 1: SMI better distinguishes hierarchical relations than BioBERT on ICD 1-hop prediction. (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.

To demonstrate this limitation, we evaluated ICD 1-hop prediction using BioBERT, a common medical LM pre-trained on PubMed abstracts and PMC articles [Lee et al., 2020], and our Semantic Medical Identifier (SMI). This task evaluates whether a child concept is embedded closer to its true parent than to unrelated concepts. As shown in Fig. 1a, BioBERT performs reasonably well at the coarsest levels (85.1%), but its accuracy deteriorates rapidly as the hierarchy becomes finer, dropping to 58.6% at the finest level. The drop is most severe for fine-grained concepts, which are far more numerous and rarer in EHR data, making their embeddings harder to learn reliably (Fig. 7). To further examine this long-tail effect, we stratified fine-grained ICD concepts by frequency and evaluated 1-hop prediction. As shown in Fig. 1b, BioBERT accuracy decreases as concept frequency decreases, indicating that hierarchy-agnostic LM embeddings are vulnerable to long-tailed clinical code distributions. In contrast, SMI maintains strong and stable accuracy across frequency bins, suggesting that medical ontology structure can help mitigate representation degradation for infrequent fine-grained concepts. These observations motivate leveraging expert-defined medical ontologies to improve representations of long-tailed clinical codes under data scarcity.

Prior structure-aware approaches for medical concept representation broadly fall into two categories. The first learns structure-aware concept embeddings by incorporating curated biomedical resources such as UMLS [Liu et al., 2021], knowledge graphs [Sakhovskiy et al., 2024], and ontologies [He et al., 2024], but usually requires additional structure-aware training. The second develops task-specific prediction models that use ontology structure [Choi et al., 2017, Shang et al., 2019, Tan et al., 2025], but these methods are optimized for specific tasks rather than general-purpose concept representation across clinical applications. These limitations leave a gap for a hierarchy-aware framework that directly constructs concept representations without training an explicit ontology encoder or making representation construction dependent on a particular downstream task. SMI addresses this gap by directly aggregating frozen, level-specific LM embeddings along expert-defined medical ontology paths to construct hierarchy-aware medical concept representations without additional training.

In this study, we introduce SMI, a training-free framework for constructing ontology-grounded Semantic IDs and hierarchy-aware medical concept representations. SMI derives Semantic IDs from expert-defined medical ontologies. Diagnosis and procedure concepts are represented using coarse-to-fine ICD taxonomy, while medication concepts follow the ATC taxonomy. SMI then aggregates frozen biomedical LM embeddings along each Semantic ID to form a hierarchy-aware medical concept representation that preserves coarse-to-fine clinical semantics. The base SMI assigns equal importance to all hierarchy levels, while a level-weighted variant accounts for their different contributions by selecting a global weight for each level on validation data. Theoretically, we show that SMI yields more informative medical concept representations than hierarchy-agnostic LM embeddings, particularly for rare and fine-grained clinical concepts. Empirically, clinical relation prediction experiments show that SMI produces concept representations that better align with medical ontology structure, improving relation prediction within ICD and ATC as well as cross-ontology ICD-to-ATC prediction. On the MIMIC-IV dataset, SMI improves mortality prediction, readmission prediction, and drug recommendation, with particularly strong gains in rare drug prediction. On the eICU dataset, SMI shows significantly smaller cross-hospital distribution shifts than BioBERT, indicating improved cross-site robustness.

(a). Expert-defined Medical Ontology

(b). Clinical Code Encoding

(c). SMI for Hierarchy-Aware Embedding

Figure

ICD diagnostic hierarchy

Level-specific embedding codebook

Hierarchy-aware SMI embedding

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.