Semantic ids improve automatic medical code prediction accuracy

Beyond ICD Codes: Semantic IDs for Generative Medical Coding

Artificial Intelligence

Summary

Automatically assigning medical diagnosis codes from patient records is hard because the codes are complicated and don’t always match how doctors think. The authors created a new way to rewrite these codes into simpler meaningful ID strings that reflect their relationships. Using these new semantic IDs helps large language models understand and predict the correct codes better than using the original codes. This approach improves accuracy in coding real hospital data.

What this means in practice

  • For hospital data teams: Improve automated assignment of diagnosis codes from clinical notes for better billing and record keeping.
  • For healthcare software developers: Integrate semantic ID-based ICD coding into electronic health record systems to enhance code prediction accuracy.
  • For health insurance claims processors: Improve accuracy of automatically generated diagnosis codes for claims processing by using hierarchical semantic IDs.$Commercial implications: Enables development of accurate automated coding tools sold to insurers to reduce claim errors and processing costs.

Authors

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

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.