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

Interpretable ICD Code Embeddings with Self- and Mutual-Attention Mechanisms

Dixin Luo, Hongteng Xu, Lawrence CarinarXiv 2019

Abstract

We propose a novel and interpretable embedding method to represent the international statistical classification codes of diseases and related health problems (i.e., ICD codes). This method considers a self-attention mechanism within the disease domain and a mutual-attention mechanism jointly between diseases and procedures. This framework captures the clinical relationships between the disease codes and procedures associated with hospital admissions, and it predicts procedures according to diagnosed diseases. A self-attention network is learned to fuse the embeddings of the diseases for each admission. The similarities between the fused disease embedding and the procedure embeddings indicate which procedure should potentially be recommended. Additionally, when learning the embeddings of the ICD codes, the optimal transport between the diseases and the procedures within each admission is calculated as a regularizer of the embeddings. The optimal transport provides a mutual-attention map between diseases and the procedures, which suppresses the ambiguity within their clinical relationships. The proposed method achieves clinically-interpretable embeddings of ICD codes, and outperforms state-of-the-art embedding methods in procedure recommendation.

Introduction: The Challenge of Medical Code Representation

In the world of Electronic Health Records (EHRs), the International Classification of Diseases (ICD) is the universal language. Every hospital admission is summarized by a set of disease codes (diagnoses) and procedure codes (treatments).

However, using machine learning to predict treatments from diagnoses is difficult for three primary reasons:

  1. Lack of Structure: Unlike words in a sentence, ICD codes in a record don't have a natural sequence; they are just a "bag of codes."
  2. Complex Mappings: One disease might require multiple procedures, and one procedure might treat several different diseases. This many-to-many relationship is difficult to model accurately.
  3. The "Black Box" Problem: In medicine, knowing that a procedure is recommended isn't enough; clinicians need to know which diagnosis triggered that recommendation.

Existing methods often fail to capture these nuances or offer zero transparency into their decision-making process.

Methods

The authors propose a framework that learns embeddings (mathematical vectors) for every disease and procedure code. The architecture relies on two distinct attention mechanisms to bridge the gap between diagnoses and treatments.

Overall architecture of the proposed framework, showing the flow from disease embeddings to procedure prediction via self-attention and mutual-attention regularizers.

Self-Attention (The "Significance" Filter)

Not all diagnoses in a record are equally important. The model uses a multi-head self-attention network to "fuse" the disease embeddings of a single admission. This process assigns a weight (significance) to each disease, effectively identifying the primary drivers of the hospital stay.

Mutual-Attention via Optimal Transport (The "Clinical Map")

This is the paper's most novel contribution. During training, the authors use Optimal Transport (OT) as a regularizer. OT is a mathematical framework for finding the most efficient way to move "mass" from one distribution (diseases) to another (procedures). This creates a "mutual-attention map" that explicitly links specific diseases to the procedures they likely caused, suppressing noise and ambiguity in the data.

Detailed view of (a) the multi-head self-attention mechanism and (b) the mutual-attention mechanism using optimal transport to align disease and procedure embeddings.

The final model is trained by minimizing a combination of predictive loss (how well it predicts the actual procedures) and the OT discrepancy.

Datasets

The study utilizes the MIMIC-III dataset, a massive, publicly available collection of de-identified health data. To test the model's robustness, the authors created three subsets based on code frequency:

  • Small: 247 diseases / 75 procedures (codes appearing ≥ 500 times).
  • Medium: 874 diseases / 258 procedures (codes appearing ≥ 100 times).
  • Large: 2,765 diseases / 819 procedures (codes appearing ≥ 10 times).

Key Insights and Ideas

  • OT as a Bridge: Using Optimal Transport as a regularizer enforces "clinical common sense" on the embeddings. It forces the model to learn that mass must be "transported" from a diagnosis to a treatment, creating a natural alignment between the two domains.
  • Attention is Interpretability: By looking at the attention weights, the model can produce heatmaps. For example, if a patient has "Cardiac Arrest" and "Glaucoma," the self-attention mechanism correctly identifies "Cardiac Arrest" as the high-significance disease that warrants "Cardiopulmonary Resuscitation."
  • Synergy of Mechanisms: The paper demonstrates that self-attention (within the disease domain) and mutual-attention (between diseases and procedures) are complementary. Using both consistently yields better results than using either in isolation.

Key Results

The proposed method was compared against several baselines, including Word2Vec, Bayesian Personalized Ranking (BPR), and previous Optimal Transport methods.

  • Superior Accuracy: On the "Large" dataset, the proposed method achieved a Top-10 F1-score of 29.6%, significantly outperforming Word2Vec (22.2%) and BPR (28.0%).
  • Robustness: The model remained stable across various hyperparameter settings, such as the embedding dimension and the number of attention heads.
  • Clinical Realism: Qualitative examples showed the model correctly mapping "End-stage renal disease" to "Hemodialysis" and "Acute respiratory failure" to "Continuous invasive mechanical ventilation" with high confidence.

Limitations and Future Work

  • Computational Complexity: While the authors used a proximal gradient method to speed up the Optimal Transport calculations, OT is still computationally heavier than simpler embedding methods.
  • Data Scope: The study is limited to the MIMIC-III dataset. Future work involves exploring performance on other real-world, large-scale datasets to ensure generalizability.
  • Future Directions: The team plans to design even more effective attention mechanisms and explore the representation power of these embeddings for other downstream tasks, such as mortality prediction or length-of-stay estimation.

Summary updated

BibTeX
@misc{luo2019interpretable,
  author = {Dixin Luo and Hongteng Xu and Lawrence Carin},
  title = {{Interpretable ICD Code Embeddings with Self- and Mutual-Attention Mechanisms}},
  year = {2019},
  eprint = {1906.05492},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1906.05492},
}
Figure