MediSwift: Efficient Sparse Pre-trained Biomedical Language Models

Vithursan Thangarasa, Mahmoud Salem, Shreyas Saxena, Chen-Yu Leong, Joel Hestness, Sean Lie

Abstract

Large language models (LLMs) are typically trained on general source data for various domains, but a recent surge in domain-specific LLMs has shown their potential to outperform general-purpose models in domain-specific tasks (e.g., biomedicine). Although domain-specific pre-training enhances efficiency and leads to smaller models, the computational costs of training these LLMs remain high, posing budgeting challenges. We introduce MediSwift, a suite of biomedical LMs that leverage sparse pre-training on domain-specific biomedical text data. By inducing up to 75% weight sparsity during the pre-training phase, MediSwift achieves a 2-2.5x reduction in training FLOPs. Notably, all sparse pre-training was performed on the Cerebras CS-2 system, which is specifically designed to realize the acceleration benefits from unstructured weight sparsity, thereby significantly enhancing the efficiency of the MediSwift models. Through subsequent dense fine-tuning and strategic soft prompting, MediSwift models outperform existing LLMs up to 7B parameters on biomedical tasks, setting new benchmarks w.r.t efficiency-accuracy on tasks such as PubMedQA. Our results show that sparse pre-training, along with dense fine-tuning and soft prompting, offers an effective method for creating high-performing, computationally efficient models in specialized domains.

Introduction: Overcoming the "Budgeting Wall"

Training Large Language Models (LLMs) is notoriously expensive, often requiring massive GPU clusters and weeks of compute. While domain-specific models (e.g., for medicine or law) are more efficient than general-purpose ones, training them from scratch still presents a significant "budgeting wall" for most researchers. Weight sparsity—setting a large percentage of a model's parameters to zero—is a promising way to reduce this computational burden. However, sparse models typically underperform their dense counterparts, and most standard hardware struggles to speed up "unstructured" sparsity. MediSwift addresses these challenges by combining sparse pre-training with specialized hardware and a novel "sparse-to-dense" training strategy.

Methodology: The Sparse-to-Dense Strategy

The researchers employed a three-stage strategy to build MediSwift:

  1. Sparse Pre-training: Starting with a GPT-3 architecture, "static sparsity" was applied at initialization. By randomly pruning 50% or 75% of the weights before training, the required Floating Point Operations (FLOPs) were significantly reduced. This phase utilized the Cerebras CS-2 system, a wafer-scale engine designed for efficient unstructured sparsity.
  2. Dense Fine-tuning: After sparse pre-training, zeroed-out weights were "reactivated" for dense fine-tuning. This allows the model to recover representational capacity at a relatively low cost compared to the pre-training phase.
  3. Soft Prompting: Learnable continuous embeddings (virtual tokens) were integrated during fine-tuning to better steer pre-trained knowledge toward specific tasks like medical question answering.

Data and Evaluation

Models were pre-trained on a curated biomedical corpus of 20.6 million samples (~105 billion tokens) from PubMed Central (PMC) and PubMed Abstracts, using a custom 42,384-token vocabulary. Evaluation focused on PubMedQA (biomedical research question answering) and Hallmarks of Cancers (HoC) classification.

Results and Discussion

MediSwift achieved a 2x to 2.5x reduction in training FLOPs compared to dense baselines, as shown in the efficiency metrics below.

Training efficiency and FLOP reduction of MediSwift models.

The MediSwift-XL (1.21B) model reached a state-of-the-art 76.8% accuracy on the PubMedQA reasoning-required task. Remarkably, it outperformed models nearly six times its size, such as the 7B parameter PMC-LLaMA.

PubMedQA accuracy vs. number of pre-training parameters. MediSwift models achieve higher accuracy than much larger models like PMC-LLaMA.

A key finding was that a 1.21B model with 75% sparsity (effectively 302M active parameters) outperformed a model that was 302M-dense from the start. This suggests that a "wider" underlying architecture provides benefits even when most connections are zeroed out during training. The success of this approach highlights the importance of hardware-algorithm co-design; specialized hardware like the Cerebras CS-2 is necessary to translate theoretical FLOP savings into actual training acceleration.

Conclusion

MediSwift demonstrates that sparse pre-training, followed by dense fine-tuning and soft prompting, is a viable path for creating high-performance, cost-effective domain-specific LLMs. While the current models use static pruning, future work may explore Dynamic Sparse Training (DST) to further improve accuracy and compression. These models serve as powerful research tools, setting new efficiency-accuracy benchmarks in the biomedical domain.

Summary updated

BibTeX
@inproceedings{thangarasa2024mediswift,
  author = {Vithursan Thangarasa and Mahmoud Salem and Shreyas Saxena and Chen-Yu Leong and Joel Hestness and Sean Lie},
  title = {{MediSwift: Efficient Sparse Pre-trained Biomedical Language Models}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=tuDdrhthsR},
}
Figure