LT3: Generating Medication Prescriptions with Conditional Transformer

Samuel Belkadi, Nicolo Micheletti, Lifeng Han, Warren Del-Pinto, Goran Nenadić

Abstract

Access to real-world medication prescriptions is essential for medical research and healthcare quality improvement. However, access is often limited due to the sensitive nature of the information and the high cost of manual labeling. We introduce Label-To-Text-Transformer (LT3), a task-specific model architecture tailored to generate synthetic medication prescriptions based on provided labels. Trained on data from the MIMIC-III database, LT3 produces high-quality synthetic prescriptions. We evaluate LT3 against state-of-the-art Pre-trained Language Models (PLMs) like T5, analyzing quality and diversity. Experiments show that models trained on LT3's synthetic data achieve a 96-98% F1 score in Named Entity Recognition (NER) tasks, demonstrating the value of synthetic data for safe healthcare research.

Introduction

In healthcare AI, data scarcity is a major hurdle. Privacy regulations like HIPAA restrict access to real patient records, and manual annotation is prohibitively expensive. While general-purpose Pre-trained Language Models (PLMs) like T5 are powerful, they often struggle with the specialized, structured vocabulary of medical prescriptions, sometimes introducing irrelevant information from their broad training sets. There is a critical need for models that can generate realistic, diverse, and privacy-preserving clinical text.

Methodology

The researchers developed LT3 (Label-To-Text-Transformer), a Transformer-based encoder-decoder architecture specifically designed for label-to-text generation in the medical domain.

LT3 Encoder-Decoder Architecture

Core Innovations

  1. B2SD (Beam Search Decoding with Backtracking): Unlike standard greedy beam search, LT3 employs a backtracking strategy. This allows the model to explore more of the search tree; if a promising path hits a low-probability "dead end," the model can backtrack to find a globally optimal sequence.
  2. Customized Tokenization: The model utilizes the BERT word-piece tokenizer, which handles unseen medical terms by breaking them into known sub-units—a crucial feature for pharmacological vocabulary.
  3. Uni-gram Repeat Penalty: To avoid infinite loops while allowing legitimate repetitions (e.g., dosage parentheses), a specialized penalty is applied to tokens within a short window.
  4. Task-Specific Training: LT3 is trained from scratch on clinical labels, allowing it to master the unique "shorthand" of prescription writing better than general-purpose models.
Visualization of B2SD Backtracking Search

Experimental Setup

The study used a subset of the MIMIC-III database aligned with the n2c2-2018 shared task. The training set consisted of approximately 2,000 medication prescription lines. To validate the utility of the synthetic data, it was used to train a SpacyNER model, which was then evaluated against the gold-standard n2c2-2018 dataset.

Results and Discussion

LT3 demonstrated significant advantages over larger models:

  • Lexical Quality: LT3 achieved a BLEU score of 78.52, outperforming T5-Base (71.98) and T5-Large (69.89).
  • Diversity: Jaccard similarity scores indicated that LT3 produces more diverse prescriptions than T5, which is vital for robust downstream training.
  • Downstream Utility: The NER model trained on LT3-generated data achieved a 96-98% F1 score across categories like Drug, Frequency, Route, Strength, and Form.
  • Efficiency: With only 56 million parameters, LT3 is significantly lighter and more efficient than T5-Large (770M), proving that domain-specific architecture can outperform raw scale.

Conclusion

LT3 provides a viable path for generating high-quality synthetic medical data, preserving patient privacy while enabling robust NLP research. Future work will focus on human validation by clinicians and expanding the model's capabilities to generate longer clinical documents, such as discharge summaries and full-length letters.

Summary updated

BibTeX
@inproceedings{belkadi2023lt,
  author = {Samuel Belkadi and Nicolo Micheletti and Lifeng Han and Warren Del-Pinto and Goran Nenadić},
  title = {{LT3: Generating Medication Prescriptions with Conditional Transformer}},
  booktitle = {SyntheticData4ML @ NeurIPS},
  year = {2023},
  url = {https://openreview.net/forum?id=yYIL3uhQ8i},
}
Figure