NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Multimodal Medical Code Tokenizer

Xiaorui Su, Shvat Messica, Yepeng Huang, Ruth Johnson, Lukas Fesser, Shanghua Gao, Faryad Sahneh, Marinka Zitnik

Introduction

Electronic Health Records (EHRs) are the backbone of modern clinical data, relying on standardized medical codes such as ICD-10, SNOMED CT, and RxNorm to represent patient diagnoses, procedures, and medications. However, existing foundation models for EHRs often struggle with these codes. Standard tokenizers typically treat medical codes as arbitrary alphanumeric strings, which leads to two significant issues: a failure to capture the semantic meaning (the textual definition of the code) and a neglect of the relational context (how codes are linked within hierarchical medical ontologies). With over 600,000 unique codes, this approach results in vocabulary explosion and poor performance on rare codes.

Methodology: The MEDTOK Framework

To address these limitations, we present MEDTOK, a multimodal tokenizer designed to map medical codes into a unified discrete token space that preserves both textual and relational information.

The MEDTOK architecture utilizes graph and text encoders followed by cross-attention and vector quantization to produce multimodal medical tokens.

The MEDTOK pipeline consists of three primary stages:

  1. Multimodal Encoding: A language model encoder processes textual descriptions of codes, while a graph encoder captures their relational structure within a biological knowledge graph (PrimeKG).
  2. Cross-Modality Fusion: A cross-attention mechanism facilitates interaction between text and graph representations, ensuring the model understands the interplay between a code's definition and its position in a medical hierarchy.
  3. Vector Quantization & Token Packing: Continuous embeddings are converted into discrete tokens using Vector Quantization (VQ). A novel "Token Packing" strategy partitions the codebook into text-specific, graph-specific, and shared regions, preserving modality-specific nuances alongside cross-modality synergies.

Experimental Setup

The effectiveness of MEDTOK was evaluated using a comprehensive suite of medical knowledge and patient data:

  • Medical Codes: 617,490 codes spanning eight major systems (ICD-9/10, SNOMED CT, ATC, CPT, RxNorm, etc.).
  • Knowledge Graph: Relational context provided by subgraphs from PrimeKG.
  • EHR Datasets: Performance was tested on MIMIC-III, MIMIC-IV (ICU data), and EHRShot (longitudinal records).
  • Medical QA: Benchmarked on MMLU, MedDDx, and AfrimedQA to assess utility in generative tasks.

Results and Key Insights

Integrating MEDTOK into existing EHR models like BEHRT or ETHOS resulted in consistent performance improvements across various clinical tasks.

Performance comparison of MEDTOK against BERT and VQGraph tokenizers across multiple tasks and datasets shows significant AUPRC gains.

Key findings include:

  • Significant Performance Gains: MEDTOK improved AUPRC by 4.10% on MIMIC-III, 4.78% on MIMIC-IV, and 11.32% on EHRShot. The most substantial gains were observed in drug recommendation tasks, where graph-based relational data is particularly impactful.
  • Modality Complementarity: Ablation studies revealed that textual descriptions are vital for predicting readmission and operational outcomes, whereas graph data is crucial for capturing drug-disease relationships.
  • Cross-System Generalization: By mapping different coding systems into a shared semantic token space, MEDTOK enhances a model's ability to generalize across hospital systems that utilize different terminologies.
  • Enhanced Medical QA: When used as a prefix for Large Language Models (e.g., LLaMA 3.1), MEDTOK-generated tokens improved accuracy on medical exams, suggesting its potential as a unified "medical language."

Conclusion and Future Work

MEDTOK demonstrates that treating medical codes as nodes in a knowledge web, rather than isolated labels, significantly enhances clinical reasoning in AI models. While currently dependent on the coverage of knowledge graphs like PrimeKG, future iterations could expand to include other EHR modalities such as waveforms or medical imaging. Additionally, exploring dynamic codebook updates will be essential as medical knowledge and coding standards continue to evolve.

Summary updated

BibTeX
@inproceedings{su2025multimodal,
  author = {Xiaorui Su and Shvat Messica and Yepeng Huang and Ruth Johnson and Lukas Fesser and Shanghua Gao and Faryad Sahneh and Marinka Zitnik},
  title = {{Multimodal Medical Code Tokenizer}},
  booktitle = {International Conference on Machine Learning},
  year = {2025},
  url = {https://openreview.net/forum?id=UaTrcei5Ba},
}
Figure