Developing Healthcare Language Model Embedding Spaces
Niall Taylor, Dan Schofield, Andrey Kormilitzin, Dan W Joyce, Alejo Nevado-Holgado
TL;DR
This work addresses the challenge of deploying effective language models in healthcare by pre-training smaller LLMs to produce document-level healthcare embeddings. It systematically compares three pre-training objectives—continued MLM, DeCLUTR-style contrastive learning, and a note-category metadata objective—across three UK NHS datasets, evaluating both downstream classification performance and embedding-space structure. Contrastive objectives, particularly when models are frozen, provide the strongest performance with limited labeled data, while note-category pre-training mainly improves clustering separability rather than classification accuracy. The findings underscore the value of domain-adapted, resource-efficient embedding strategies for privacy-conscious healthcare settings and offer practical guidelines for pre-training healthcare LLMs with an emphasis on contrastive objectives and embedding analysis.
Abstract
Pre-trained Large Language Models (LLMs) often struggle on out-of-domain datasets like healthcare focused text. We explore specialized pre-training to adapt smaller LLMs to different healthcare datasets. Three methods are assessed: traditional masked language modeling, Deep Contrastive Learning for Unsupervised Textual Representations (DeCLUTR), and a novel pre-training objective utilizing metadata categories from the healthcare settings. These schemes are evaluated on downstream document classification tasks for each dataset, with additional analysis of the resultant embedding spaces. Contrastively trained models outperform other approaches on the classification tasks, delivering strong performance from limited labeled data and with fewer model parameter updates required. While metadata-based pre-training does not further improve classifications across the datasets, it yields interesting embedding cluster separability. All domain adapted LLMs outperform their publicly available general base LLM, validating the importance of domain-specialization. This research illustrates efficient approaches to instill healthcare competency in compact LLMs even under tight computational budgets, an essential capability for responsible and sustainable deployment in local healthcare settings. We provide pre-training guidelines for specialized healthcare LLMs, motivate continued inquiry into contrastive objectives, and demonstrates adaptation techniques to align small LLMs with privacy-sensitive medical tasks.
