arXiv:2610.19301cs.AIOct 2026

Manuscript Offprint

arXiv:2610.19301

Beyond ICD Codes: Semantic IDs for Generative Medical Coding

Yihang Cheng, Qian Zhang, Yonghui, Huang, Baoshuo Kan, Junyi Shen

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Yihang Cheng ∗^{*}

University of Otago

Dunedin, New Zealand

yihang.cheng@postgrad.otago.ac.nz

Qian Zhang

University of Otago

Dunedin, New Zealand

qian.zhang@postgrad.otago.ac.nz

Yonghui (Andie) Huang

Massey University

Palmerston North, New Zealand

andie.huang@massey.ac.nz

Baoshuo Kan

South China Normal University

Guangzhou, China

baoshuokan@m.scnu.edu.cn

Junyi Shen

University of Otago

Dunedin, New Zealand

shjy2015@gmail.com

Abstract

Generative approaches to automatic International Classification of Diseases (ICD) coding use large language models (LLMs) to predict ICD codes from clinical documents. However, original ICD code strings are not ideal generation targets because the ICD hierarchy does not always reflect clinical relationships, and LLMs struggle to interpret and generate these codes. We introduce SemICD, a framework that trains LLMs to generate Semantic IDs (SIDs) instead. SemICD constructs SIDs by hierarchically clustering embeddings of textual code profiles, allowing semantically related codes to share prefixes while each complete SID uniquely identifies one ICD code. To align the SID tokens with clinical semantics, we employ two auxiliary tasks for bidirectional generation between textual code profiles and SIDs. Experiments on MIMIC-III and MIMIC-IV with four LLMs show that SemICD outperforms direct code generation, improving Micro-F1 by 1.34–8.00 points. Our code is available at https://github.com/youwillbethebest/SemICD.

1 Introduction

Automatic ICD coding maps clinical documents to ICD codes used for healthcare administration, reimbursement, and analysis, aiming to reduce manual coding effort. However, accurate ICD code prediction remains challenging due to the large and long-tailed label space (Mullenbach et al., 2018; Huang et al., 2022). Most prior work treats ICD coding as a multi-label classification problem, assigning a score to each code (Mullenbach et al., 2018; Vu et al., 2020; Huang et al., 2022). More recently, generative approaches have used large language models (LLMs) to predict ICD codes from clinical documents, mainly by generating diagnosis text and mapping it to codes through retrieval over code descriptions (Baksi et al., 2025; Chen et al., 2026) or by generating the codes directly (Falis et al., 2024; Yuan et al., 2025; Wang et al., 2026).

Both approaches have limitations. Mapping generated diagnosis text to codes requires a retrieval step, which can miss the correct code even when the diagnosis is correctly identified (Motzfeldt et al., 2025; Chen et al., 2026). Generating ICD codes directly avoids this step but uses the original code strings as generation targets. Although ICD codes follow a hierarchical classification organized mainly by body system and etiology, this hierarchy does not always reflect clinical relationships (National Center for Health Statistics, 2024; Luo et al., 2024a; Lu et al., 2020). As Figure 1 illustrates, causally related diseases that ICD-10-CM instructs coders to report together can be assigned codes from different chapters. Moreover, ICD code strings differ from the natural language on which LLMs are predominantly trained, and previous studies have found that LLMs struggle to interpret and generate these codes (Soroush et al., 2024; Ma et al., 2025; Yin et al., 2026; Yuan et al., 2025). These limitations motivate an alternative output representation that maintains precise code identification while aligning prediction decisions with clinical semantic relationships.

Instead of generating original ICD code strings, LLMs can be trained to generate alternative identifiers that uniquely identify each code. Semantic IDs (SIDs), widely used as generation targets in generative retrieval and recommendation (Tay et al., 2022; Rajput et al., 2023), provide such a representation by assigning items sequences of discrete tokens in which semantically related items share prefixes. This structure allows related ICD codes to share early prediction decisions while pre-

∗^{*}Corresponding author.

References (17)