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

Towards BERT-based Automatic ICD Coding: Limitations and Opportunities

Damian Pascual, Sandro Luck, Roger Wattenhofer

Abstract

While Transformer models like BERT dominate most of Natural Language Processing (NLP), they surprisingly lag behind older CNN and RNN architectures in automatic ICD coding. This paper identifies the 512-token input limit as the primary bottleneck and demonstrates that while BERT-based models can achieve competitive results using only small portions of medical notes, they struggle to aggregate information across the massive length of full clinical reports.

Introduction

International Classification of Diseases (ICD) coding is the process of assigning standardized codes to patient medical notes for billing, statistics, and clinical research. It is a "massive multi-label" task, with over 17,000 possible codes and dozens often assigned to a single note.

The primary challenge lies in the document length; clinical notes frequently span thousands of words, far exceeding BERT's 512-token limit. Consequently, state-of-the-art (SOTA) performance in this field still relies on Convolutional Neural Networks (CNNs) and Recurrent Neural Networks (RNNs) paired with label-specific attention. This research investigates why BERT has yet to claim the top spot and explores potential solutions.

Methodology

The study utilized PubMedBERT, a version of BERT pretrained on biomedical corpora, as the base encoder. To address the length constraints of the MIMIC-III-50 dataset, the researchers evaluated several strategies:

  • Input Strategies: They tested segments from the "Front" (first 512 tokens), "Back" (last 512), "Mixed" (start and end), "Paragraph" (most frequent sections), and "All" (the entire note split into chunks).
  • Decoders: Various methods were used to aggregate information from multiple chunks, including Linear layers, Multi-Layer Perceptrons (MLP), and secondary Transformer decoders.

Key Insights and Results

The Fine-Tuning Bottleneck

The most significant hurdle is the difficulty of fine-tuning BERT on long texts. When attempting to fine-tune on "all" chunks of a document, the model often fails to converge. This is likely due to the noise created when a specific 512-token chunk does not contain the evidence for a code assigned to the entire document.

Validation loss across epochs for different input strategies, showing that 'All' and 'Paragraph' segments struggle to converge.

Segment Importance and Decoder Performance

Surprisingly, the first 512 tokens ("Front") proved to be the most valuable, likely because clinicians place critical diagnostic information at the start of discharge summaries. Fine-tuning on this segment alone boosted the Macro AUC from 55.76 to 83.00.

Furthermore, adding sophisticated Transformer-based decoders to aggregate chunks did not significantly improve performance over a simple MLP. This suggests that if the encoder isn't effectively extracting features from the full text span, complex aggregation layers have little useful data to work with.

Performance comparison between the best MLP-based model (FBM-Par) and various Transformer-based decoders.

Summary of Results

  • Best BERT Model: The configuration using Front-Back-Mixed chunks with a Parallel MLP decoder (FBM-Par) achieved a Macro AUC of 84.45 and a Micro AUC of 88.65.
  • Comparison to SOTA: While these results are competitive, they still trail the current SOTA "Label Attention" model, which holds a Macro AUC of 92.1.

Conclusion and Future Work

The quadratic complexity of standard Transformer attention remains the primary obstacle for automatic ICD coding. Future research should focus on strategies to fine-tune encoders over longer text spans, better alignment between specific text segments and global labels, and improving the interpretability of BERT's attention maps for clinical use.

Summary updated

BibTeX
@inproceedings{pascual2021towards,
  author = {Damian Pascual and Sandro Luck and Roger Wattenhofer},
  title = {{Towards BERT-based Automatic ICD Coding: Limitations and Opportunities}},
  booktitle = {BioNLP @ NAACL},
  year = {2021},
  doi = {10.18653/v1/2021.bionlp-1.6},
}
Figure