Abstract
Domain adaptation of Pretrained Language Models (PTLMs) is typically achieved by unsupervised pretraining on target-domain text. While successful, this approach is expensive in terms of hardware, runtime and CO2 emissions. Here, we propose a cheaper alternative: We train Word2Vec on target-domain text and align the resulting word vectors with the wordpiece vectors of a general-domain PTLM. We evaluate on eight biomedical Named Entity Recognition (NER) tasks and compare against the recently proposed BioBERT model. We cover over 60% of the BioBERT-BERT F1 delta, at 5% of BioBERT's CO2 footprint and 2% of its cloud compute cost. We also show how to quickly adapt an existing general-domain Question Answering (QA) model to an emerging domain: the Covid-19 pandemic.
Introduction
Pretrained Language Models (PTLMs) like BERT have become the backbone of modern NLP. However, these models are typically generalists trained on broad corpora like Wikipedia. Adapting them to specialized domains such as medicine usually requires extensive unsupervised pretraining on domain-specific text. This process is resource-intensive; for example, BioBERT required ten days of training on eight high-end GPUs. Such requirements create a "compute divide" and prevent rapid model adaptation during emerging crises, such as the Covid-19 pandemic.
Methodology: The "Green" Adaptation Approach
We propose a method to inject domain knowledge into the model's lexical layer without retraining the computationally expensive Transformer layers. The process involves four key steps:
- Word2Vec Training: We train a standard Word2Vec model on target-domain text (e.g., PubMed). This step is highly efficient and can be completed on standard CPUs.
- Vector Space Alignment: Since Word2Vec and BERT operate in different vector spaces, we calculate a linear transformation to map Word2Vec vectors into BERT’s space using the intersection of their vocabularies.
- Embedding Expansion: We update BERT’s embedding layer by adding these aligned domain-specific vectors. Original wordpiece vectors are preserved to maintain the model's general linguistic capabilities.
- Hybrid Tokenization: The tokenizer is updated to recognize new domain words as single units. During finetuning, we utilize a 50/50 mixture of standard and domain-aware tokenization to optimize performance.
Experimental Results
Efficiency and Environmental Impact
The primary advantage of our approach is its efficiency. As shown in the comparison below, GreenBioBERT drastically reduces the financial and environmental costs of domain adaptation.
While BioBERT v1.0 costs between $1,421 and $4,762 to train on Google Cloud, GreenBioBERT costs only $16–$76. Furthermore, the adaptation time is reduced from 240 hours on 8 GPUs to just 12 hours on a CPU, resulting in a 95% reduction in CO2 emissions.
Performance on NER Tasks
We evaluated GreenBioBERT on eight biomedical Named Entity Recognition (NER) tasks. Performance was measured relative to standard BERT and the fully-pretrained BioBERT.
GreenBioBERT consistently outperformed the general-domain BERT baseline, capturing 61% to 70% of the performance gains achieved by the more expensive BioBERT. This suggests that a significant portion of domain-specific performance is derived from the lexicon, which can be adapted inexpensively.
Rapid Adaptation for Covid-19 QA
To demonstrate the method's agility, we adapted a general-domain SQuAD model to the Covid-19 domain using the CORD-19 dataset. The resulting model, GreenCovidSQuADBERT, outperformed the baseline on the Covid-QA dataset in a zero-shot setting, highlighting the method's utility for rapid response to emerging scientific challenges.
Discussion and Conclusion
While the proposed method does not fully close the performance gap with models that undergo full-model pretraining—likely due to the frozen Transformer layers—it offers a highly accessible and environmentally friendly alternative. It effectively bridges the "compute divide," allowing researchers with limited resources to adapt state-of-the-art models to specialized fields. Future work will explore more complex alignment methods to further enhance performance.
Summary updated