Large-scale Generative Modeling to Improve Automated Veterinary Disease Coding

Yuhui Zhang, Allen Nie, James ZouarXiv 2018

Abstract

Automated disease coding in veterinary medicine faces significant hurdles due to the lack of labeled data and substantial variations in clinical writing styles across hospitals. This paper introduces a large-scale generative modeling approach to address these challenges. By pre-training a Transformer-based model on over one million unlabeled clinical notes and employing an auxiliary generative loss during fine-tuning, the researchers demonstrate significant improvements in cross-hospital generalization. The proposed model outperforms existing baselines, including dictionary-based methods and standard supervised learning architectures, by a wide margin on a challenging out-of-distribution dataset.

The Cross-Hospital Challenge

In human medicine, clinical notes are routinely paired with standardized codes (e.g., ICD-10) for billing and research. In contrast, veterinary clinics rarely apply such codes, leaving valuable clinical data locked in unstructured text. While some labeled datasets exist from large teaching hospitals, they often fail to generalize to local clinics due to "domain shift"—differences in case types, abbreviations, and jargon. This study aims to leverage massive amounts of unlabeled text to build a system capable of working across diverse veterinary practices.

Methodology

The core of the proposed system is a two-stage training process designed to leverage massive amounts of unlabeled text through generative sequence modeling.

  1. Generative Pre-training: An encoder (either an LSTM or a Transformer) is first trained to predict the next word in a sequence using the SAGE dataset, which contains over one million raw clinical notes. This allows the model to learn the "language" of veterinary medicine—including abbreviations and clinical context—without requiring manual labels.
  2. Supervised Fine-tuning with Auxiliary Loss: When training the model to predict disease codes, the researchers include an auxiliary generative loss alongside the classification error. This forces the model to maintain its understanding of underlying text structure while learning to map that text to specific diseases.
The model architecture includes an encoder (LSTM or Transformer) that feeds into both a generator for language modeling and a classifier for disease prediction.

Experimental Results

The models were evaluated on two primary datasets: CSU (in-distribution labeled data) and PP (out-of-distribution labeled data). The PP dataset, consisting of discharge summaries from a private practice, served as a rigorous test for cross-hospital robustness due to its distinct writing style and high use of abbreviations.

The "Transformer + Auxiliary + Pretrain" model emerged as the clear winner. On the challenging PP dataset, it achieved an F1 score of 68.0, significantly outperforming the previous state-of-the-art CAML (54.7) and the dictionary-based MetaMap baseline (51.6). Notably, the model nearly doubled the Exact Match (EM) performance of the MetaMap-MLP baseline, correctly predicting the entire set of disease codes for a record 25.2% of the time.

Quantitative comparison of model performance across CSU and PP datasets, highlighting the superior results of the Transformer-based generative approach.

Key Insights and Conclusion

This work demonstrates that large-scale generative modeling is a powerful tool for learning discriminative features in specialized domains like veterinary medicine. Unlike traditional tools that rely on medical dictionaries, the deep learning model captured rare professional terms and complex clinical combinations that dictionary-based methods missed.

By pre-training on unlabeled data, models can overcome the limitations of small labeled datasets and bridge the gap between different clinical environments. While hardware constraints and performance on rare "long-tail" diseases remain areas for future research, this approach sets a new benchmark for automated veterinary disease coding.

Summary updated

Abstract

Supervised learning is limited both by the quantity and quality of the labeled data. In the field of medical record tagging, writing styles between hospitals vary drastically. The knowledge learned from one hospital might not transfer well to another. This problem is amplified in veterinary medicine domain because veterinary clinics rarely apply medical codes to their records. We proposed and trained the first large-scale generative modeling algorithm in automated disease coding. We demonstrate that generative modeling can learn discriminative features when additionally trained with supervised fine-tuning. We systematically ablate and evaluate the effect of generative modeling on the final system's performance. We compare the performance of our model with several baselines in a challenging cross-hospital setting with substantial domain shift. We outperform competitive baselines by a large margin. In addition, we provide interpretation for what is learned by our model.
BibTeX
@misc{zhang2018large,
  author = {Yuhui Zhang and Allen Nie and James Zou},
  title = {{Large-scale Generative Modeling to Improve Automated Veterinary Disease Coding}},
  year = {2018},
  eprint = {1811.11958},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1811.11958},
}
Figure