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

Rare Codes Count: Mining Inter-code Relations for Long-tail Clinical Text Classification

Jiamin Chen, Xuhong Li, Junting Xi, Lei Yu, Haoyi Xiong

Abstract

Automatic International Classification of Diseases (ICD) coding is essential for healthcare administration but faces significant challenges due to the long-tail distribution of medical codes. Traditional deep learning models often fail to predict rare diseases because they treat labels as independent entities. This paper proposes a novel "relation-enhanced code encoder" that explicitly models hierarchical and co-occurrence relationships between codes. By leveraging these inter-code connections, the model significantly improves performance on rare codes while achieving state-of-the-art results on the MIMIC-III dataset.

Introduction

Assigning ICD codes to electronic medical records (EMRs) is a critical task for billing, clinical research, and public health monitoring. However, manual coding is labor-intensive and prone to errors. While automated systems have been developed, they struggle with the "long-tail" nature of medical data. In datasets like MIMIC-III, a small number of codes appear frequently, while thousands of others occur rarely. Most existing models treat these codes as independent labels, leading to poor performance on rare conditions that lack sufficient training examples. This research argues that by mining the connections between labels, models can learn rare codes by leveraging their relationships with more frequent ones.

Methodology

The proposed model utilizes a dual-encoder architecture designed to capture both the narrative context of clinical notes and the structured relationships between ICD codes.

  1. Clinical Text Encoder: A Bidirectional LSTM (Bi-LSTM) is used to process medical notes. The authors chose Bi-LSTM over Transformers because EMR vocabulary is often domain-specific and low-dimensional, and the narrative structure is dense, making the computational overhead of Transformers less beneficial.
  2. Relation-enhanced Code Encoder: This core component processes ICD code descriptions through three stages:
  3. Contextual Transformation: An LSTM and self-attention mechanism align the concise, noun-phrase style of code descriptions with the narrative style of clinical text.
  4. Code Hierarchy: The model incorporates the ICD-9 hierarchy (Level 0: specific code; Level 1: similar organs; Level 2: organ system). This allows rare codes to benefit from the semantic information of more frequent, related codes.
  5. Code Co-occurrence: Three Graph Convolutional Networks (GCNs) model the frequency with which codes appear together in documents, providing additional relational context.
Architecture of the Proposed Model
  1. Code-Text Attention Block: A "code-constrained" attention mechanism uses the learned code representations as queries to identify relevant segments within the clinical text, improving the alignment between text and labels.

Experimental Setup

The model was primarily evaluated on the MIMIC-III (Full) dataset, which contains over 52,000 discharge summaries and nearly 9,000 unique codes. Additionally, MIMIC-IV data was used to construct a robust adjacency matrix for code co-occurrences, serving as prior knowledge to boost the model's understanding of label relationships.

Key Results

The model demonstrates superior performance across standard metrics and particularly on rare codes. On the full MIMIC-III dataset, the model achieved a Macro F1 of 10.8 (using sentence permutation), surpassing previous state-of-the-art models like MSMN.

Performance comparison on the MIMIC-III dataset

The most significant gains were observed in the "long-tail" segment. For codes appearing only 2–10 times in the training set, the model achieved a Micro F1 of 6.72 (increasing to 7.15 with data augmentation). In contrast, baseline models like CAML and DR-CAML failed to predict these rare codes entirely, scoring 0.00. Qualitative analysis further revealed that the model effectively ignores administrative noise in EMRs and focuses on clinically relevant keywords when predicting rare conditions, enhancing its interpretability.

Conclusion and Future Work

By mining inter-code relations, this research addresses the critical challenge of long-tail classification in clinical text. The relation-enhanced code encoder allows the model to "borrow" knowledge from frequent codes to improve the representation of rare ones. While the model achieves state-of-the-art results without massive external knowledge bases, future work will explore optimizing the GCN architecture to reduce parameter overhead and investigating more advanced sub-word tokenization techniques to better handle complex medical terminology.

Summary updated

BibTeX
@inproceedings{chen2023rare,
  author = {Jiamin Chen and Xuhong Li and Junting Xi and Lei Yu and Haoyi Xiong},
  title = {{Rare Codes Count: Mining Inter-code Relations for Long-tail Clinical Text Classification}},
  booktitle = {ClinicalNLP @ ACL},
  year = {2023},
  doi = {10.18653/v1/2023.clinicalnlp-1.43},
}
Figure